Class OntAnnotationPropertyImpl

java.lang.Object
org.apache.jena.enhanced.Polymorphic<org.apache.jena.rdf.model.RDFNode>
org.apache.jena.enhanced.EnhNode
org.apache.jena.rdf.model.impl.ResourceImpl
All Implemented Interfaces:
org.apache.jena.graph.FrontsNode, OntAnnotationProperty, OntEntity, OntNamedProperty<OntAnnotationProperty>, OntObject, OntProperty, org.apache.jena.rdf.model.Property, org.apache.jena.rdf.model.RDFNode, org.apache.jena.rdf.model.Resource

public class OntAnnotationPropertyImpl extends OntPropertyImpl implements OntAnnotationProperty
Implementation of Annotation Property abstraction (a URI-Resource with owl:AnnotationProperty type).
  • Constructor Details

    • OntAnnotationPropertyImpl

      public OntAnnotationPropertyImpl(org.apache.jena.graph.Node n, org.apache.jena.enhanced.EnhGraph g)
  • Method Details

    • objectType

      public Class<OntAnnotationProperty> objectType()
      Description copied from class: OntObjectImpl
      Gets a public ont-object type identifier.
      Specified by:
      objectType in interface OntObject
      Overrides:
      objectType in class OntObjectImpl
      Returns:
      Class, the actual type of this object
    • superProperties

      public Stream<OntAnnotationProperty> superProperties(boolean direct)
      Description copied from interface: OntAnnotationProperty
      Answers a Stream over all the properties that are declared to be super-properties of this property. Each element of the Stream will have the same type as this property instance: if it is datatype property the method will return only data properties, etc. The parameter direct controls selectivity over the properties that appear in the Stream. Consider the following scenario:
      
        :A rdfs:subPropertyOf :B .
        :A rdfs:subPropertyOf :C .
        :C rdfs:subPropertyOf :D .
        
      (so A has super-property B and C, and C has super-property D) In a raw model, with no inference support, listing the super-property of A will answer B and C. In an inferencing model, rdfs:subPropertyOf is known to be transitive, so the super-property iterator will include D. The direct super-properties are those members of the closure of the inverse-subPropertyOf relation, restricted to properties that cannot be reached by a longer route, i.e., the ones that are directly adjacent to the given root. Thus, the direct super-property of A are B and C only, and not D - even in an inferencing graph. Note that this is different from the entailments from the raw graph. Suppose we add to this example:
      
         :A rdfs:subPropertyOf :D .
       
      Now, in the raw graph, A has super-property B, C, D. But the direct super-property of A remain only B and C, since there is a longer path A-C-D that means that D is not a direct super-property of A. The assertion in the raw graph that A has super-property D is essentially redundant, since this can be inferred from the closure of the graph.
      Specified by:
      superProperties in interface OntAnnotationProperty
      Specified by:
      superProperties in interface OntProperty
      Parameters:
      direct - boolean: if true answers the directly adjacent properties in the super-property relation, i.e. eliminate any property for which there is a longer route to reach that parent under the super-property relation; if false answers all super-properties found by inferencer, which usually means entire hierarchy up the tree; this instance is not included
      Returns:
      distinct Stream of annotation properties
      See Also:
    • subProperties

      public Stream<OntAnnotationProperty> subProperties(boolean direct)
      Description copied from interface: OntAnnotationProperty
      Answers a Stream over all the properties that are declared to be sub-properties of this property. Each element of the Stream will have the same type as this property instance: if it is datatype property the method will return only data properties, etc. The parameter direct controls selectivity over the properties that appear in the Stream. Consider the following scenario:
      
        :D rdfs:subPropertyOf :C .
        :C rdfs:subPropertyOf :A .
        :B rdfs:subPropertyOf :A .
       
      (so A has two sub-properties, B and C, and C has sub-property D) In a raw model, with no inference support, listing the sub-property of A will answer B and C. In an inferencing model, rdfs:subPropertyOf is known to be transitive, so the sub-properties iterator will include D. The direct sub-properties are those members of the closure of the subPropertyOf relation, restricted to properties that cannot be reached by a longer route, i.e., the ones that are directly adjacent to the given root. Thus, the direct sub-properties of A are B and C only, and not D - even in an inferencing graph. Note that this is different from the entailments from the raw graph. Suppose we add to this example:
      
         :D rdfs:subPropertyOf :A.
       
      Now, in the raw graph, A has sub-property C. But the direct sub-properties of A remain B and C, since there is a longer path A-C-D that means that D is not a direct sub-property of A. The assertion in the raw graph that A has sub-property D is essentially redundant, since this can be inferred from the closure of the graph.
      Specified by:
      subProperties in interface OntAnnotationProperty
      Specified by:
      subProperties in interface OntProperty
      Parameters:
      direct - boolean if true answers the directly adjacent properties in the sub-property relation: i.e. eliminate any properties for which there is a longer route to reach that parent under the super-property relation
      Returns:
      distinct Stream of annotation properties
      See Also:
    • addDomainStatement

      public OntStatement addDomainStatement(org.apache.jena.rdf.model.Resource domain)
      Description copied from interface: OntProperty
      Adds a statement $this rdfs:domain $domain.
      Specified by:
      addDomainStatement in interface OntProperty
      Parameters:
      domain - Resource, not null
      Returns:
      OntStatement to allow the subsequent addition of annotations
    • addRangeStatement

      public OntStatement addRangeStatement(org.apache.jena.rdf.model.Resource range)
      Description copied from interface: OntProperty
      Adds range statement $this rdfs:range $range.
      Specified by:
      addRangeStatement in interface OntProperty
      Parameters:
      range - Resource, not null
      Returns:
      OntStatement to allow subsequent annotations adding
    • domains

      public Stream<org.apache.jena.rdf.model.Resource> domains()
      Description copied from interface: OntAnnotationProperty
      Lists all valid annotation property domains in the form of java Stream.
      Specified by:
      domains in interface OntAnnotationProperty
      Specified by:
      domains in interface OntProperty
      Returns:
      Stream of uri-Resources
      See Also:
    • ranges

      public Stream<org.apache.jena.rdf.model.Resource> ranges()
      Description copied from interface: OntAnnotationProperty
      Lists all valid annotation property ranges.
      Specified by:
      ranges in interface OntAnnotationProperty
      Specified by:
      ranges in interface OntProperty
      Returns:
      Stream of uri-Resources
      See Also:
    • declaringClasses

      public Stream<OntClass> declaringClasses(boolean direct)
      Description copied from interface: OntProperty
      Answers a Stream of all the classes in this ontology, such that each returned class has this property as one of its properties in OntClass.declaredProperties(boolean). This simulates a frame-like view of properties and classes; for more details see the Apache Jena: Presenting RDF as frames
      Specified by:
      declaringClasses in interface OntProperty
      Parameters:
      direct - boolean if true, use only direct associations between classes and properties
      Returns:
      a Stream of the classes having this property as one of their declared properties
    • hasSuperProperty

      public boolean hasSuperProperty(OntProperty property, boolean direct)
      Description copied from interface: OntProperty
      Answers true if the given property is a super-property of this property. See OntProperty.superProperties(boolean) for a full explanation of the direct parameter.
      Specified by:
      hasSuperProperty in interface OntProperty
      Parameters:
      property - a OntProperty to test
      direct - boolean; If true, only search the properties that are directly adjacent to this property in the class hierarchy
      Returns:
      boolean
    • isBuiltIn

      public boolean isBuiltIn()
      Description copied from interface: OntEntity
      Determines if this is a builtin entity. In a standard (default) OWL2 vocabulary an entity is builtin if it is:
      • a class and its IRI is either owl:Thing or owl:Nothing
      • an object property and its IRI is either owl:topObjectProperty or owl:bottomObjectProperty
      • a data property and its IRI is either owl:topDataProperty or owl:bottomDataProperty
      • a datatype and its IRI is either rdfs:Literal, or rdf:PlainLiteral, or it is from the OWL 2 datatype map
      • an annotation property and its IRI is one of the following:
        • rdfs:label
        • rdfs:comment
        • rdfs:seeAlso
        • rdfs:isDefinedBy
        • owl:deprecated
        • owl:versionInfo
        • owl:priorVersion
        • owl:backwardCompatibleWith
        • owl:incompatibleWith
      Note: all the listed above IRIs refer to the default Builtins Vocabulary. A model with different Builtins vocabulary will naturally have a different Set of builtin IRIs, and this method will return a different result.
      Specified by:
      isBuiltIn in interface OntEntity
      Returns:
      true if it is a built-in entity
      See Also:
    • inModel

      public org.apache.jena.rdf.model.Property inModel(org.apache.jena.rdf.model.Model m)
      Specified by:
      inModel in interface org.apache.jena.rdf.model.Property
      Specified by:
      inModel in interface org.apache.jena.rdf.model.RDFNode
      Specified by:
      inModel in interface org.apache.jena.rdf.model.Resource
      Overrides:
      inModel in class org.apache.jena.rdf.model.impl.ResourceImpl
    • findRootStatement

      public Optional<OntStatement> findRootStatement()
      Description copied from class: OntObjectImpl
      Finds the first declaration root statement. The graph may contain several triples with predicate rdf:type and this ontology object as a subject. In this case, the result is unpredictable.
      Overrides:
      findRootStatement in class OntObjectImpl
      Returns:
      Optional around OntStatement that supports plain annotation assertions
    • getOrdinal

      public int getOrdinal()
      Specified by:
      getOrdinal in interface org.apache.jena.rdf.model.Property
    • getModel

      OntModel getModel()
      Returns the ontology model associated with this resource. If the Resource was not created by a Model, the result may be null.
      Specified by:
      getModel in interface org.apache.jena.rdf.model.RDFNode
      Returns:
      OntModel
    • isLocal

      boolean isLocal()
      Determines if this Ontology Resource is locally defined. This means that the resource definition (i.e., a the root statement) belongs to the base ontology graph. If the ontology contains subgraphs (which should match owl:imports in OWL) and the resource is defined in one of them, than this method called from top-level interface will return false.
      Returns:
      true if this resource is local to the base model graph.
    • getAs

      default <X extends org.apache.jena.rdf.model.RDFNode> X getAs(Class<X> type)
      Safely converts this RDF resource to the given type interface, if it is possible. Otherwise, returns null. A calling of this method is effectively equivalent to the expression this.canAs(type) ? this.as(type) : null.
      Type Parameters:
      X - any subtype of RDFNode
      Parameters:
      type - a Class-type of the desired RDF view (interface)
      Returns:
      an instance of the type X or null
      See Also:
      • RDFNode.as(Class)
      • RDFNode.canAs(Class)