1 19 20 package com.hp.hpl.jena.ontology.impl; 23 24 25 import com.hp.hpl.jena.enhanced.*; 28 import com.hp.hpl.jena.graph.Node; 29 import com.hp.hpl.jena.ontology.*; 30 import com.hp.hpl.jena.rdf.model.*; 31 import com.hp.hpl.jena.util.iterator.ExtendedIterator; 32 33 34 44 public class OntologyImpl 45 extends OntResourceImpl 46 implements Ontology 47 { 48 51 52 55 58 public static Implementation factory = new Implementation() { 59 public EnhNode wrap( Node n, EnhGraph eg ) { 60 if (canWrap( n, eg )) { 61 return new OntologyImpl( n, eg ); 62 } 63 else { 64 throw new ConversionException( "Cannot convert node " + n + " to Ontology"); 65 } 66 } 67 68 public boolean canWrap( Node node, EnhGraph eg ) { 69 Profile profile = (eg instanceof OntModel) ? ((OntModel) eg).getProfile() : null; 71 return (profile != null) && profile.isSupported( node, eg, Ontology.class ); 72 } 73 }; 74 75 76 77 80 83 91 public OntologyImpl( Node n, EnhGraph g ) { 92 super( n, g ); 93 } 94 95 96 99 101 107 public void setImport( Resource res ) { 108 setPropertyValue( getProfile().IMPORTS(), "IMPORTS", res ); 109 } 110 111 117 public void addImport( Resource res ) { 118 addPropertyValue( getProfile().IMPORTS(), "IMPORTS", res ); 119 } 120 121 127 public OntResource getImport() { 128 return objectAsResource( getProfile().IMPORTS(), "IMPORTS" ); 129 } 130 131 137 public ExtendedIterator listImports() { 138 return listAs( getProfile().IMPORTS(), "IMPORTS", OntResource.class ); 139 } 140 141 147 public boolean imports( Resource res ) { 148 return hasPropertyValue( getProfile().IMPORTS(), "IMPORTS", res ); 149 } 150 151 156 public void removeImport( Resource res ) { 157 removePropertyValue( getProfile().IMPORTS(), "IMPORTS", res ); 158 } 159 160 161 163 169 public void setBackwardCompatibleWith( Resource res ) { 170 setPropertyValue( getProfile().BACKWARD_COMPATIBLE_WITH(), "BACKWARD_COMPATIBLE_WITH", res ); 171 } 172 173 179 public void addBackwardCompatibleWith( Resource res ) { 180 addPropertyValue( getProfile().BACKWARD_COMPATIBLE_WITH(), "BACKWARD_COMPATIBLE_WITH", res ); 181 } 182 183 189 public OntResource getBackwardCompatibleWith() { 190 return objectAsResource( getProfile().BACKWARD_COMPATIBLE_WITH(), "BACKWARD_COMPATIBLE_WITH" ); 191 } 192 193 200 public ExtendedIterator listBackwardCompatibleWith() { 201 return listAs( getProfile().BACKWARD_COMPATIBLE_WITH(), "BACKWARD_COMPATIBLE_WITH", OntResource.class ); 202 } 203 204 210 public boolean isBackwardCompatibleWith( Resource res ) { 211 return hasPropertyValue( getProfile().BACKWARD_COMPATIBLE_WITH(), "BACKWARD_COMPATIBLE_WITH", res ); 212 } 213 214 220 public void removeBackwardCompatibleWith( Resource res ) { 221 removePropertyValue( getProfile().BACKWARD_COMPATIBLE_WITH(), "BACKWARD_COMPATIBLE_WITH", res ); 222 } 223 224 225 227 233 public void setPriorVersion( Resource res ) { 234 setPropertyValue( getProfile().PRIOR_VERSION(), "PRIOR_VERSION", res ); 235 } 236 237 243 public void addPriorVersion( Resource res ) { 244 addPropertyValue( getProfile().PRIOR_VERSION(), "PRIOR_VERSION", res ); 245 } 246 247 253 public OntResource getPriorVersion() { 254 return objectAsResource( getProfile().PRIOR_VERSION(), "PRIOR_VERSION" ); 255 } 256 257 264 public ExtendedIterator listPriorVersion() { 265 return listAs( getProfile().PRIOR_VERSION(), "PRIOR_VERSION", OntResource.class ); 266 } 267 268 274 public boolean hasPriorVersion( Resource res ) { 275 return hasPropertyValue( getProfile().PRIOR_VERSION(), "PRIOR_VERSION", res ); 276 } 277 278 283 public void removePriorVersion( Resource res ) { 284 removePropertyValue( getProfile().PRIOR_VERSION(), "PRIOR_VERSION", res ); 285 } 286 287 288 290 296 public void setIncompatibleWith( Resource res ) { 297 setPropertyValue( getProfile().INCOMPATIBLE_WITH(), "INCOMPATIBLE_WITH", res ); 298 } 299 300 306 public void addIncompatibleWith( Resource res ) { 307 addPropertyValue( getProfile().INCOMPATIBLE_WITH(), "INCOMPATIBLE_WITH", res ); 308 } 309 310 316 public OntResource getIncompatibleWith() { 317 return objectAsResource( getProfile().INCOMPATIBLE_WITH(), "INCOMPATIBLE_WITH" ); 318 } 319 320 327 public ExtendedIterator listIncompatibleWith() { 328 return listAs( getProfile().INCOMPATIBLE_WITH(), "INCOMPATIBLE_WITH", OntResource.class ); 329 } 330 331 337 public boolean isIncompatibleWith( Resource res ) { 338 return hasPropertyValue( getProfile().INCOMPATIBLE_WITH(), "INCOMPATIBLE_WITH", res ); 339 } 340 341 346 public void removeIncompatibleWith( Resource res ) { 347 removePropertyValue( getProfile().INCOMPATIBLE_WITH(), "INCOMPATIBLE_WITH", res ); 348 } 349 350 351 354 358 } 359 360 361 390 | Popular Tags |