1 19 20 package com.hp.hpl.jena.ontology.impl; 23 24 25 import com.hp.hpl.jena.rdf.model.*; 28 import com.hp.hpl.jena.graph.*; 29 import com.hp.hpl.jena.enhanced.*; 30 import com.hp.hpl.jena.util.*; 31 import com.hp.hpl.jena.ontology.*; 32 33 import java.util.*; 34 35 36 37 46 public abstract class AbstractProfile 47 implements Profile 48 { 49 52 55 58 59 protected OneToManyMap m_aliasesMap; 60 61 62 65 68 76 public boolean hasAliasFor( Resource res ) { 77 return aliasMap().containsKey( res ); 78 } 79 80 92 public Resource getAliasFor( Resource res ) { 93 return (Resource) aliasMap().get( res ); 94 } 95 96 105 public Iterator listAliasesFor( Resource res ) { 106 return aliasMap().getAll( res ); 107 } 108 109 118 public static boolean containsSome( EnhGraph g, Node n, Property p ) { 119 return g.asGraph().contains( n, p.asNode(), Node.ANY ); 120 } 121 122 125 129 protected abstract Resource[][] aliasTable(); 130 131 132 137 protected OneToManyMap aliasMap() { 138 if (m_aliasesMap == null) { 139 m_aliasesMap = new OneToManyMap(); 142 Resource[][] aliases = aliasTable(); 143 144 for (int i = 0; i < aliases.length; i++) { 145 m_aliasesMap.put( aliases[i][0], aliases[i][1] ); 147 m_aliasesMap.put( aliases[i][1], aliases[i][0] ); 148 } 149 } 150 151 return m_aliasesMap; 152 } 153 154 155 159 } 160 161 162 191 192 | Popular Tags |