📄 ontmodelimpl.java
字号:
* <p>
* <strong>Note:</strong> the number of nodes returned by this iterator will vary according to
* the completeness of the deductive extension of the underlying graph. See class
* overview for more details.
* </p>
*
* @return An iterator over restriction class resources.
* @see Profile#RESTRICTION
*/
public ExtendedIterator listRestrictions() {
checkProfileEntry( getProfile().RESTRICTION(), "RESTRICTION" );
return UniqueExtendedIterator.create(
findByTypeAs( getProfile().RESTRICTION(), Restriction.class ) );
}
/**
* <p>
* Answer an iterator that ranges over the nodes that denote pair-wise disjointness between
* sets of classes.
* </p>
* <p>
* <strong>Note:</strong> the number of nodes returned by this iterator will vary according to
* the completeness of the deductive extension of the underlying graph. See class
* overview for more details.
* </p>
*
* @return An iterator over AllDifferent nodes.
*/
public ExtendedIterator listAllDifferent() {
checkProfileEntry( getProfile().ALL_DIFFERENT(), "ALL_DIFFERENT" );
return UniqueExtendedIterator.create(
findByTypeAs( getProfile().ALL_DIFFERENT(), AllDifferent.class ) );
}
/**
* <p>Answer an iterator over the DataRange objects in this ontology, if there
* are any.</p>
* @return An iterator, whose values are {@link DataRange} objects.
*/
public ExtendedIterator listDataRanges() {
checkProfileEntry( getProfile().DATARANGE(), "DATARANGE" );
return UniqueExtendedIterator.create(
findByTypeAs( getProfile().DATARANGE(), DataRange.class ) );
}
/**
* <p>
* Answer an iterator that ranges over the properties in this model that are declared
* to be annotation properties. Not all supported languages define annotation properties
* (the category of annotation properties is chiefly an OWL innovation).
* </p>
* <p>
* <strong>Note:</strong> the number of nodes returned by this iterator will vary according to
* the completeness of the deductive extension of the underlying graph. See class
* overview for more details.
* </p>
*
* @return An iterator over annotation properties.
* @see Profile#getAnnotationProperties()
*/
public ExtendedIterator listAnnotationProperties() {
checkProfileEntry( getProfile().ANNOTATION_PROPERTY(), "ANNOTATION_PROPERTY" );
Resource r = getProfile().ANNOTATION_PROPERTY();
if (r == null) {
return NullIterator.instance;
}
else {
return UniqueExtendedIterator.create(
findByType( r )
.andThen( WrappedIterator.create( getProfile().getAnnotationProperties() ) )
.mapWith( new SubjectNodeAs( AnnotationProperty.class ) ) );
}
}
/**
* <p>
* Answer a resource that represents an ontology description node in this model. If a resource
* with the given uri exists in the model, and can be viewed as an Ontology, return the
* Ontology facet, otherwise return null.
* </p>
*
* @param uri The uri for the ontology node. Conventionally, this corresponds to the base URI
* of the document itself.
* @return An Ontology resource or null.
*/
public Ontology getOntology( String uri ) {
return (Ontology) findByURIAs( uri, Ontology.class );
}
/**
* <p>
* Answer a resource that represents an Individual node in this model. If a resource
* with the given uri exists in the model, and can be viewed as an Individual, return the
* Individual facet, otherwise return null.
* </p>
*
* @param uri The URI for the requried individual
* @return An Individual resource or null.
*/
public Individual getIndividual( String uri ) {
return (Individual) findByURIAs( uri, Individual.class );
}
/**
* <p>
* Answer a resource representing an generic property in this model. If a property
* with the given uri exists in the model, return the
* OntProperty facet, otherwise return null.
* </p>
*
* @param uri The uri for the property.
* @return An OntProperty resource or null.
*/
public OntProperty getOntProperty( String uri ) {
return (OntProperty) findByURIAs( uri, OntProperty.class );
}
/**
* <p>
* Answer a resource representing an object property in this model. If a resource
* with the given uri exists in the model, and can be viewed as an ObjectProperty, return the
* ObjectProperty facet, otherwise return null.
* </p>
*
* @param uri The uri for the object property. May not be null.
* @return An ObjectProperty resource or null.
*/
public ObjectProperty getObjectProperty( String uri ) {
return (ObjectProperty) findByURIAs( uri, ObjectProperty.class );
}
/**
* <p>Answer a resource representing a transitive property. If a resource
* with the given uri exists in the model, and can be viewed as a TransitiveProperty, return the
* TransitiveProperty facet, otherwise return null. </p>
* @param uri The uri for the property. May not be null.
* @return A TransitiveProperty resource or null
*/
public TransitiveProperty getTransitiveProperty( String uri ) {
return (TransitiveProperty) findByURIAs( uri, TransitiveProperty.class );
}
/**
* <p>Answer a resource representing a symmetric property. If a resource
* with the given uri exists in the model, and can be viewed as a SymmetricProperty, return the
* SymmetricProperty facet, otherwise return null. </p>
* @param uri The uri for the property. May not be null.
* @return A SymmetricProperty resource or null
*/
public SymmetricProperty getSymmetricProperty( String uri ) {
return (SymmetricProperty) findByURIAs( uri, SymmetricProperty.class );
}
/**
* <p>Answer a resource representing an inverse functional property. If a resource
* with the given uri exists in the model, and can be viewed as a InverseFunctionalProperty, return the
* InverseFunctionalProperty facet, otherwise return null. </p>
* @param uri The uri for the property. May not be null.
* @return An InverseFunctionalProperty resource or null
*/
public InverseFunctionalProperty getInverseFunctionalProperty( String uri ) {
return (InverseFunctionalProperty) findByURIAs( uri, InverseFunctionalProperty.class );
}
/**
* <p>
* Answer a resource that represents datatype property in this model. . If a resource
* with the given uri exists in the model, and can be viewed as a DatatypeProperty, return the
* DatatypeProperty facet, otherwise return null.
* </p>
*
* @param uri The uri for the datatype property. May not be null.
* @return A DatatypeProperty resource or null
*/
public DatatypeProperty getDatatypeProperty( String uri ) {
return (DatatypeProperty) findByURIAs( uri, DatatypeProperty.class );
}
/**
* <p>
* Answer a resource that represents an annotation property in this model. If a resource
* with the given uri exists in the model, and can be viewed as an AnnotationProperty, return the
* AnnotationProperty facet, otherwise return null.
* </p>
*
* @param uri The uri for the annotation property. May not be null.
* @return An AnnotationProperty resource or null
*/
public AnnotationProperty getAnnotationProperty( String uri ) {
return (AnnotationProperty) findByURIAs( uri, AnnotationProperty.class );
}
/**
* <p>
* Answer a resource that represents a class description node in this model. If a resource
* with the given uri exists in the model, and can be viewed as an OntClass, return the
* OntClass facet, otherwise return null.
* </p>
*
* @param uri The uri for the class node, or null for an anonymous class.
* @return An OntClass resource or null.
*/
public OntClass getOntClass( String uri ) {
OntClass c = (OntClass) findByURIAs( uri, OntClass.class );
// special case for nothing and thing
if (c == null) {
Resource thing = getProfile().THING();
if (thing != null && thing.getURI().equals( uri )) {
c = (OntClass) thing.inModel( this ).as( OntClass.class );
}
Resource nothing = getProfile().NOTHING();
if (nothing != null && nothing.getURI().equals( uri )) {
c = (OntClass) nothing.inModel( this ).as( OntClass.class );
}
}
return c;
}
/**
* <p>Answer a resource representing the class that is the complement of another class. If a resource
* with the given uri exists in the model, and can be viewed as a ComplementClass, return the
* ComplementClass facet, otherwise return null. </p>
* @param uri The URI of the new complement class.
* @return A complement class or null
*/
public ComplementClass getComplementClass( String uri ) {
return (ComplementClass) findByURIAs( uri, ComplementClass.class );
}
/**
* <p>Answer a resource representing the class that is the enumeration of a list of individuals. If a resource
* with the given uri exists in the model, and can be viewed as an EnumeratedClass, return the
* EnumeratedClass facet, otherwise return null. </p>
* @param uri The URI of the new enumeration class.
* @return An enumeration class or null
*/
public EnumeratedClass getEnumeratedClass( String uri ) {
return (EnumeratedClass) findByURIAs( uri, EnumeratedClass.class );
}
/**
* <p>Answer a resource representing the class that is the union of a list of class desctiptions. If a resource
* with the given uri exists in the model, and can be viewed as a UnionClass, return the
* UnionClass facet, otherwise return null. </p>
* @param uri The URI of the new union class.
* @return A union class description or null
*/
public UnionClass getUnionClass( String uri ) {
return (UnionClass) findByURIAs( uri, UnionClass.class );
}
/**
* <p>Answer a resource representing the class that is the intersection of a list of class descriptions. If a resource
* with the given uri exists in the model, and can be viewed as a IntersectionClass, return the
* IntersectionClass facet, otherwise return null. </p>
* @param uri The URI of the new intersection class.
* @return An intersection class description or null
*/
public IntersectionClass getIntersectionClass( String uri ) {
return (IntersectionClass) findByURIAs( uri, IntersectionClass.class );
}
/**
* <p>
* Answer a resource that represents a property restriction in this model. If a resource
* with the given uri exists in the model, and can be viewed as a Restriction, return the
* Restriction facet, otherwise return null.
* </p>
*
* @param uri The uri for the restriction node.
* @return A Restriction resource or null
*/
public Restriction getRestriction( String uri ) {
return (Restriction) findByURIAs( uri, Restriction.class );
}
/**
* <p>Answer a class description defined as the class of those individuals that have the given
* resource as the value of the given property. If a resource
* with the given uri exists in the model, and can be viewed as a HasValueRestriction, return the
* HasValueRestriction facet, otherwise return null. </p>
*
* @param uri The URI for the restriction
* @return A resource representing a has-value restriction or null
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -