Interface OntClass

All Superinterfaces:
org.apache.jena.graph.FrontsNode, OntObject, org.apache.jena.rdf.model.RDFNode, org.apache.jena.rdf.model.Resource
All Known Subinterfaces:
OntClass.CardinalityRestriction<O,P>, OntClass.CollectionOf<O>, OntClass.ComplementOf, OntClass.ComponentRestriction<O,P>, OntClass.DataAllValuesFrom, OntClass.DataCardinality, OntClass.DataHasValue, OntClass.DataMaxCardinality, OntClass.DataMinCardinality, OntClass.DataSomeValuesFrom, OntClass.HasSelf, OntClass.IntersectionOf, OntClass.LogicalExpression, OntClass.Named, OntClass.NaryDataAllValuesFrom, OntClass.NaryDataSomeValuesFrom, OntClass.NaryRestriction<O,P>, OntClass.ObjectAllValuesFrom, OntClass.ObjectCardinality, OntClass.ObjectHasValue, OntClass.ObjectMaxCardinality, OntClass.ObjectMinCardinality, OntClass.ObjectSomeValuesFrom, OntClass.OneOf, OntClass.Restriction, OntClass.UnaryRestriction<P>, OntClass.UnionOf, OntClass.ValueRestriction<O,P>
All Known Implementing Classes:
OntClassImpl, OntClassImpl.CardinalityRestrictionImpl, OntClassImpl.ComplementOfImpl, OntClassImpl.ComponentRestrictionImpl, OntClassImpl.DataAllValuesFromImpl, OntClassImpl.DataCardinalityImpl, OntClassImpl.DataHasValueImpl, OntClassImpl.DataMaxCardinalityImpl, OntClassImpl.DataMinCardinalityImpl, OntClassImpl.DataSomeValuesFromImpl, OntClassImpl.HasSelfImpl, OntClassImpl.IntersectionOfImpl, OntClassImpl.NaryDataAllValuesFromImpl, OntClassImpl.NaryDataSomeValuesFromImpl, OntClassImpl.NaryRestrictionImpl, OntClassImpl.ObjectAllValuesFromImpl, OntClassImpl.ObjectCardinalityImpl, OntClassImpl.ObjectHasValueImpl, OntClassImpl.ObjectMaxCardinalityImpl, OntClassImpl.ObjectMinCardinalityImpl, OntClassImpl.ObjectSomeValuesFromImpl, OntClassImpl.OneOfImpl, OntClassImpl.OnPropertyRestrictionImpl, OntClassImpl.QLComplementOfImpl, OntClassImpl.QLDataSomeValuesFromImpl, OntClassImpl.QLIntersectionOfImpl, OntClassImpl.QLObjectSomeValuesFromImpl, OntClassImpl.RestrictionImpl, OntClassImpl.RLComplementOfImpl, OntClassImpl.RLDataAllValuesFromImpl, OntClassImpl.RLDataMaxCardinalityImpl, OntClassImpl.RLDataSomeValuesFromImpl, OntClassImpl.RLIntersectionOfImpl, OntClassImpl.RLObjectAllValuesFromImpl, OntClassImpl.RLObjectMaxCardinalityImpl, OntClassImpl.RLObjectSomeValuesFromImpl, OntClassImpl.RLOneOfImpl, OntClassImpl.RLUnionOfImpl, OntClassImpl.UnionOfImpl, OntSimpleClassImpl, OntSimpleClassImpl.NamedImpl, OntSimpleClassImpl.RLNamedImpl

public interface OntClass extends OntObject
A base abstraction for any Class Expressions (both named and anonymous).
See Also:
  • Method Details

    • subClasses

      Stream<OntClass> subClasses(boolean direct)
      Answers a Stream over all the class expressions that are declared to be subclasses of this class expression. The return Stream is distinct and this instance is not included in it. The flag direct allows some selectivity over the classes that appear in the Stream. Consider the following scenario:
      
         :B rdfs:subClassOf :A.
         :C rdfs:subClassOf :A.
         :D rdfs:subClassOf :C.
       
      (so A has two subclasses, B and C, and C has subclass D) In a raw model, with no inference support, listing the subclasses of A will answer B and C. In an inferencing model, rdfs:subClassOf is known to be transitive, so the subclasses iterator will include D. The direct subclasses are those members of the closure of the subClassOf relation, restricted to classes that cannot be reached by a longer route, i.e., the ones that are directly adjacent to the given root. Thus, the direct subclasses of A are B and C only, and not D - even in an inferencing graph. Note that this is not the same as the entailments from the raw graph. Suppose we add to this example:
      
         :D rdfs:subClassOf :A.
       
      Now, in the raw graph, A has subclass C. But the direct subclasses of A remain B and C, since there is a longer path A-C-D that means that D is not a direct subclass of A. The assertion in the raw graph that A has subclass D is essentially redundant, since this can be inferred from the closure of the graph.
      Parameters:
      direct - boolean - if true answers the directly adjacent classes in the subclass relation: i.e., eliminate any class for which there is a longer route to reach that parent under the subclass relation; if false answers all subclasses found by inferencer, which usually means entire hierarchy down the tree; this class is not included
      Returns:
      distinct Stream of sub class expressions
      See Also:
    • superClasses

      Stream<OntClass> superClasses(boolean direct)
      Answers a Stream over the class-expressions for which this class expression is declared a subclass. The return Stream is distinct and this instance is not included in it.

      The flag direct allows some selectivity over the classes that appear in the Stream. Consider the following scenario:

      
         :A rdfs:subClassOf :B .
         :A rdfs:subClassOf :C .
         :C rdfs:subClassOf :D .
       
      (so A has superclasses B and C, and C has superclass D) In a raw model, with no inference support, listing the superclasses of A will answer B and C. In an inferencing model, rdfs:subClassOf is known to be transitive, so the superclasses iterator will include D. The direct superclasses are those members of the closure of the inverse-subClassOf relation, restricted to classes that cannot be reached by a longer route, i.e., the ones that are directly adjacent to the given root. Thus, the direct superclasses of A are B and C only, and not D - even in an inferencing graph. Note that this is not the same as the entailments from the raw graph. Suppose we add to this example:
      
         :A rdfs:subClassOf :D .
       
      Now, in the raw graph, A has superclasses B, C, D. But the direct superclasses of A remain only B and C, since there is a longer path A-C-D that means that D is not a direct superclass of A. The assertion in the raw graph that A has superclass D is essentially redundant, since this can be inferred from the closure of the graph.
      Parameters:
      direct - boolean: if true answers the directly adjacent classes in the superclass relation, i.e., eliminate any class for which there is a longer route to reach that parent under the superclass relation; if false answers all superclasses found by inferencer, which usually means entire hierarchy up the tree; this class is not included
      Returns:
      distinct Stream of super class expressions
      See Also:
    • individuals

      Stream<OntIndividual> individuals(boolean direct)
      Lists all individuals, directly or indirectly connected to this class. The search pattern is a rdf:type C, where C is class expression and a individual.
      Parameters:
      direct - boolean if true, only direct instances are counted (i.e., not instances of subclasses of this class)
      Returns:
      a Stream of OntIndividuals
    • hasDeclaredProperty

      boolean hasDeclaredProperty(OntProperty property, boolean direct)
      Returns true if the given property is associated with a frame-like view of this class. This captures an informal notion of the properties of a class, by looking at the domains of the property in this class's model, and matching them to this class. A full description of the frame-like view of a class may be found in: Apache Jena: RDF frames how-to for full details.

      Note that many cases of determining whether a property is associated with a class depend on RDFS or OWL reasoning. This method may therefore return complete results only in models that have an attached reasoner. For built-in properties the method returns always false. If there are no domains for the property, then it is considered as global and is attached to root classes.

      Parameters:
      property - OntProperty, not null
      direct - boolean: if true analyses only the directly adjacent domains in the subclass relation, otherwise takes into account the class hierarchy
      Returns:
      boolean, true if the property is associated with this class by its domain, otherwise false
    • declaredProperties

      Stream<OntProperty> declaredProperties(boolean direct)
      Returns a Stream over the properties associated with a frame-like view of this class. This captures an intuitive notion of the properties of a class. This can be useful in presenting an ontology class in a user interface, for example, by automatically constructing a form to instantiate instances of the class. The properties in the frame-like view of the class are determined by comparing the domain of properties in this class's OntModel with the class itself. See: Apache Jena: Presenting RDF as frames for more details.
      Parameters:
      direct - boolean: if true analyses only the directly adjacent domains in the subclass relation, otherwise takes into account the class hierarchy
      Returns:
      a distinct Stream of object, datatype and annotation properties, attached to this class
      See Also:
    • isHierarchyRoot

      boolean isHierarchyRoot()
      Answers true if this class is one of the roots of the local class hierarchy. This will be true if either (i) this class has either owl:Thing or rdfs:Resource as a direct superclass, or (ii) it has no declared superclasses.

      owl:Nothing cannot be root.

      Returns:
      true if this class is the root of the class hierarchy in the model it is attached to
    • hasKeys

      Lists all HasKey ontology []-lists that are attached to this class expression on predicate owl:hasKey.
      Returns:
      Stream of OntLists with parameter-type OntDOP
    • createIndividual

      OntIndividual.Anonymous createIndividual()
      Creates an anonymous individual which is of this class-expression type.
      Returns:
      OntIndividual.Anonymous
      See Also:
    • createIndividual

      OntIndividual.Named createIndividual(String uri)
      Creates a named individual which is of this class type.
      Parameters:
      uri - String, not null
      Returns:
      OntIndividual.Named
      See Also:
    • createHasKey

      OntList<OntRelationalProperty> createHasKey(Collection<OntObjectProperty> objectProperties, Collection<OntDataProperty> dataProperties)
      Creates a HasKey logical construction as ontology []-list of Object or Data Property Expressions that is attached to this Class Expression using the predicate owl:hasKey. The resulting rdf-list will consist of all the elements of the specified collection in the same order but with exclusion of duplicates. Note: nulls in the collection will cause exception. For additional information about HasKey logical construction see 9.5 Keys specification.
      Parameters:
      objectProperties - Collection (preferably Set) of object property expressions
      dataProperties - Collection (preferably Set) of data property expressions
      Returns:
      OntList of OntRelationalPropertys
      See Also:
    • addHasKeyStatement

      OntStatement addHasKeyStatement(OntRelationalProperty... properties)
      Creates a HasKey logical construction as ontology list and returns the statement C owl:hasKey ( P1 ... Pm R1 ... Rn ) to allow the subsequent addition of annotations. About RDF Graph annotation specification sees, for example, 2.3.1 Axioms that Generate a Main Triple.
      Parameters:
      properties - Array of OntRelationalPropertys without nulls
      Returns:
      OntStatement with a possibility to annotate
      See Also:
    • removeHasKey

      OntClass removeHasKey(org.apache.jena.rdf.model.Resource list)
      Deletes the given HasKey list including its annotations.
      Parameters:
      list - Resource can be OntList or RDFList; if null the method will remove all hasKey's
      Returns:
      this instance to allow cascading calls
    • isDisjoint

      boolean isDisjoint(org.apache.jena.rdf.model.Resource candidate)
      Answers true if this class is disjoint with the given class.
      Parameters:
      candidate - Resource a class to test
      Returns:
      true if this class is disjoint with the given class
    • disjointClasses

      Stream<OntClass> disjointClasses()
      Returns disjoint class-objects. This includes thisClass owl:disjointWith otherClass, otherClass owl:disjointWith thisClass statements and owl:AllDisjointClasses construct.
      Returns:
      a Stream of OntClasss
      See Also:
    • equivalentClasses

      Stream<OntClass> equivalentClasses()
      Lists all equivalent classes. The statement patter to search for is C1 owl:equivalentClass C2.
      Returns:
      Stream of OntClasss
      See Also:
    • asNamed

      default OntClass.Named asNamed()
      Represents this OWL class expression as a named OWL class if it is possible, otherwise throws an exception. Effectively equivalent to the expression this.as(Named.class).
      Throws:
      org.apache.jena.enhanced.UnsupportedPolymorphismException - if the expression is not named OWL entity
    • individuals

      default Stream<OntIndividual> individuals()
      Lists all individuals taking into account class hierarchy. Equivalent to this.individuals(false)
      Returns:
      a Stream of OntIndividuals
      See Also:
    • properties

      default Stream<OntProperty> properties()
      Lists all properties attached to this class in a rdfs:domain statement. The property is considered as attached if the property and the class expression are both included in the property domain axiom statement:
      • R rdfs:domain C - R is a data property, C - this class expression
      • P rdfs:domain C - P is an object property expression, C - this class expression
      • A rdfs:domain U - A is annotation property, U is IRI (this class expression)
      Returns:
      Stream of OntPropertys
      See Also:
    • declaredProperties

      default Stream<OntProperty> declaredProperties()
      Equivalent to this.declaredProperties(false)
      Returns:
      a distinct Stream of (object, datatype & annotation properties), attached to this class
      See Also:
    • subClasses

      default Stream<OntClass> subClasses()
      Lists all direct or indirect subclasses for this class expression, i.e., all subclasses found by inferencer, which usually means entire hierarchy down the tree; this class is not included. The search pattern is Ci rdfs:subClassOf C.

      Equivalent to this.subClasses(false).

      Returns:
      Stream of OntClasss
      See Also:
    • subClass

      default Optional<OntClass> subClass()
      Answers a class that is the subclass of this class. If there is more than one such class, an arbitrary selection is made. Unlike the method subClasses(), this method can return this class itself.
      Returns:
      Optional wrapping OntClass
    • superClasses

      default Stream<OntClass> superClasses()
      Lists all direct and indirect superclasses for this class expression, i.e., all superclasses found by inferencer, which usually means entire hierarchy up the tree; this class is not included. The search pattern is C rdfs:subClassOf Ci.

      Equivalent to this.superClasses(false).

      Returns:
      Stream of OntClasss
      See Also:
    • superClass

      default Optional<OntClass> superClass()
      Answers a class that is the superclass of this class. If there is more than one such class, an arbitrary selection is made. Unlike the method superClasses(), this method can return this class itself.
      Returns:
      Optional wrapping OntClass
    • hasSubClass

      default boolean hasSubClass(OntClass clazz, boolean direct)
      Answers true if the given class is a subclass of this class. See subClasses(boolean) for a full explanation of the direct parameter.
      Parameters:
      clazz - a OntClass to test
      direct - boolean; If true, only search the classes that are directly adjacent to this class in the class hierarchy
      Returns:
      boolean
    • hasSuperClass

      default boolean hasSuperClass(OntClass clazz, boolean direct)
      Answers true if the given class is a superclass of this class. See superClasses(boolean) for a full explanation of the direct parameter
      Parameters:
      clazz - a OntClass to test
      direct - boolean; If true, only search the classes that are directly adjacent to this class in the class hierarchy.
      Returns:
      boolean
    • disjoints

      default Stream<OntDisjoint.Classes> disjoints()
      Lists all OntDisjoint sections where this class is a member.
      Returns:
      a Stream of OntDisjoint.Classes
    • addSubClassOfStatement

      default OntStatement addSubClassOfStatement(OntClass other)
      Adds the given class as a superclass and returns the corresponding statement to provide the ability to add annotations.
      Parameters:
      other - OntClass, not null
      Returns:
      OntStatement to allow the subsequent annotations addition
      See Also:
    • addDisjointWithStatement

      default OntStatement addDisjointWithStatement(OntClass other)
      Adds the given class as a disjoint class and returns the corresponding statement to provide the ability to add annotations.
      Parameters:
      other - OntClass, not null
      Returns:
      OntStatement to allow the subsequent annotations addition
      See Also:
    • addEquivalentClassStatement

      default OntStatement addEquivalentClassStatement(OntClass other)
      Adds the given class as an equivalent class and returns the corresponding statement to provide the ability to add annotations.
      Parameters:
      other - OntClass, not null
      Returns:
      OntStatement to allow the subsequent annotations addition
      See Also:
    • addHasKeyStatement

      default OntStatement addHasKeyStatement(Collection<OntObjectProperty> objectProperties, Collection<OntDataProperty> dataProperties)
      Creates an owl:hasKey statement returning the root statement to allow the subsequent annotations adding.
      Parameters:
      objectProperties - the collection of OntObjectPropertys, not null and cannot contain nulls
      dataProperties - the collection of OntDataPropertys, not null and cannot contain nulls
      Returns:
      OntStatement to allow the subsequent annotations addition
      See Also:
    • addSuperClass

      default OntClass addSuperClass(OntClass other)
      Adds the given class as a superclass and returns this class expression instance to allow cascading calls.
      Parameters:
      other - OntClass, not null
      Returns:
      this instance to allow cascading calls
      See Also:
    • addSubClass

      default OntClass addSubClass(OntClass other)
      Adds the given class as a subclass and returns this class expression instance to allow cascading calls.
      Parameters:
      other - OntClass, not null
      Returns:
      this instance to allow cascading calls
      See Also:
    • addDisjointClass

      default OntClass addDisjointClass(OntClass other)
      Adds the given class as a disjoint class and returns this class expression instance to allow cascading calls.
      Parameters:
      other - OntClass, not null
      Returns:
      this instance to allow cascading calls
      See Also:
    • addEquivalentClass

      default OntClass addEquivalentClass(OntClass other)
      Adds a new equivalent class.
      Parameters:
      other - OntClass, not null
      Returns:
      this instance to allow cascading calls
      See Also:
    • addHasKey

      default OntClass addHasKey(Collection<OntObjectProperty> objectProperties, Collection<OntDataProperty> dataProperties)
      Creates an owl:hasKey statement returning this class to allow cascading calls.
      Parameters:
      objectProperties - the collection of OntObjectPropertys
      dataProperties - the collection of OntDataPropertys
      Returns:
      this instance to allow cascading calls
      See Also:
    • addHasKey

      default OntClass addHasKey(OntRelationalProperty... properties)
      Creates an owl:hasKey statement returning this class to allow cascading calls.
      Parameters:
      properties - Array of OntRelationalPropertys without nulls
      Returns:
      this instance to allow cascading calls
      See Also:
    • removeIndividual

      default OntClass removeIndividual(org.apache.jena.rdf.model.Resource individual)
      Removes the given individual from the set of instances that are members of this class. This is effectively equivalent to the OntIndividual.detachClass(Resource) method if the specified resource is OntIndividual.
      Parameters:
      individual - Resource a resource denoting an individual that is no longer to be a member of this class
      Returns:
      this instance to allow cascading calls
    • removeSuperClass

      default OntClass removeSuperClass(org.apache.jena.rdf.model.Resource other)
      Removes a superclass relationship for the given resource including all possible annotations. No-op in case no match found. Removes all rdfs:subClassOf statements with all their annotations in case null is specified.
      Parameters:
      other - Resource or null to remove all rdfs:subClassOf statements
      Returns:
      this instance to allow cascading calls
      See Also:
    • removeSubClass

      default OntClass removeSubClass(org.apache.jena.rdf.model.Resource other)
      Removes a subclass relationship for the given resource including all possible annotations. No-op in case no match found. Removes all rdfs:subClassOf statements with all their annotations in case null is specified.
      Parameters:
      other - Resource or null to remove all rdfs:subClassOf statements
      Returns:
      this instance to allow cascading calls
      See Also:
    • removeDisjointClass

      default OntClass removeDisjointClass(org.apache.jena.rdf.model.Resource other)
      Removes the specified disjoint class resource. No-op in case no match found. Removes all owl:disjointWith statements with all their annotations in case null is specified.
      Parameters:
      other - Resource, or null to remove all disjoint classes
      Returns:
      this instance to allow cascading calls
      See Also:
    • removeEquivalentClass

      default OntClass removeEquivalentClass(org.apache.jena.rdf.model.Resource other)
      Removes the given equivalent class resource including the statement's annotations. No-op in case no match found. Removes all owl:equivalentClass statements with all their annotations in case null is specified.
      Parameters:
      other - Resource, or null to remove all equivalent classes
      Returns:
      this instance to allow cascading calls
      See Also:
    • clearHasKeys

      default OntClass clearHasKeys()
      Deletes all HasKey []-list including its annotations, i.e., all those statements with the predicate owl:hasKey for which this resource is a subject.
      Returns:
      this instance to allow cascading calls
      Throws:
      OntJenaException - if the list is not found
    • findHasKey

      default Optional<OntList<OntRelationalProperty>> findHasKey(org.apache.jena.rdf.model.RDFNode list)
      Finds a HasKey logical construction attached to this class expression by the specified rdf-node in the form of OntList.
      Parameters:
      list - RDFNode
      Returns:
      Optional around OntList of data and object property expressions
    • fromHasKey

      default Stream<OntRelationalProperty> fromHasKey()
      Lists all key properties. I.e., returns all object- and datatype-properties that belong to the C owl:hasKey ( P1 ... Pm R1 ... Rn ) statements, where C is this class expression, Pi is a property expression, and Ri is a data(-type) property. If there are several []-lists in the model that satisfy these conditions, all their content will be merged into the one distinct stream.
      Returns:
      distinct Stream of object and data properties
      See Also:
    • asSubClass

      default OntClass asSubClass()
      Returns the subclass-view of this class if the specification allows this class to be in subclass position, otherwise throws exception. Some profiles (e.g., OWL2 QL, OWL2 RL) distinguish constructions with respect to their position in the axiom statements. Note that the returned class may differ in behavior from this class.
      Returns:
      OntClass, not null
      Throws:
      OntJenaException.Unsupported - if this feature is not supported
      See Also:
    • canAsSubClass

      default boolean canAsSubClass()
      Answers if this class can be a subclass of another class. Some profiles (e.g., OWL2 QL, OWL2 RL) distinguish constructions with respect to their position in the axiom statements.
      Returns:
      true if this class can be a subclass
      See Also:
    • asSuperClass

      default OntClass asSuperClass()
      Returns the superclass-view of this class if the specification allows this class to be in superclass position, otherwise throws exception. Some profiles (e.g., OWL2 QL, OWL2 RL) distinguish constructions with respect to their position in the axiom statements. Note that the returned class may differ in behavior from this class.
      Returns:
      OntClass or null
      Throws:
      OntJenaException.Unsupported - if this feature is not supported
      See Also:
    • canAsSuperClass

      default boolean canAsSuperClass()
      Answers if this class can be a superclass of another class. Some profiles (e.g., OWL2 QL, OWL2 RL) distinguish constructions with respect to their position in the axiom statements.
      Returns:
      true if this class can be a superclass
      See Also:
    • asAssertionClass

      default OntClass asAssertionClass()
      Returns the assertion-view of this class if the specification allows this class to make class assertions, otherwise throws exception. Some profiles (e.g., OWL2 QL, OWL2 RL) distinguish constructions with respect to their position in the axiom statements. Note that the returned class may differ in behavior from this class.
      Returns:
      OntClass or null
      Throws:
      OntJenaException.Unsupported - if this feature is not supported
      See Also:
    • canAsAssertionClass

      default boolean canAsAssertionClass()
      Answers if this class can be an object in class-assertion statement (a type of individual). Some profiles (e.g., OWL2 QL, OWL2 RL) distinguish constructions with respect to their position in the axiom statements.
      Returns:
      true if this class can be a class-type of an individual
      See Also:
    • asEquivalentClass

      default OntClass asEquivalentClass()
      Returns the equivalent-class-view of this class if the specification allows this class to be in equivalent position (owl:equivalentClass), otherwise throws exception. Some profiles (e.g., OWL2 QL, OWL2 RL) distinguish constructions with respect to their position in the axiom statements. Note that the returned class may differ in behavior from this class.
      Returns:
      OntClass or null
      Throws:
      OntJenaException.Unsupported - if this feature is not supported
      See Also:
    • canAsEquivalentClass

      default boolean canAsEquivalentClass()
      Answers if this class can be an equivalent of another class. Some profiles (e.g., OWL2 QL, OWL2 RL) distinguish constructions with respect to their position in the axiom statements.
      Returns:
      true if this class can be equivalent of another class
      See Also:
    • asDisjointClass

      default OntClass asDisjointClass()
      Returns the disjoint-class-view of this class if the specification allows this to be in disjoint position (owl:disjointWith, owl:AllDisjointClasses), otherwise throws exception. Some profiles (e.g., OWL2 QL, OWL2 RL) distinguish constructions with respect to their position in the axiom statements.
      Returns:
      OntClass or null
      Throws:
      OntJenaException.Unsupported - if this feature is not supported
      See Also:
    • canAsDisjointClass

      default boolean canAsDisjointClass()
      Answers if this class can be disjoint with another class. Some profiles (e.g., OWL2 QL, OWL2 RL) distinguish constructions with respect to their position in the axiom statements.
      Returns:
      true if this class can be disjoint with another class
      See Also:
    • 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)