Interface OntObject

All Superinterfaces:
org.apache.jena.graph.FrontsNode, org.apache.jena.rdf.model.RDFNode, org.apache.jena.rdf.model.Resource
All Known Subinterfaces:
OntAnnotation, OntAnnotationProperty, OntClass, 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>, OntDataProperty, OntDataRange, OntDataRange.Combination<N>, OntDataRange.ComplementOf, OntDataRange.IntersectionOf, OntDataRange.Named, OntDataRange.OneOf, OntDataRange.Restriction, OntDataRange.UnionOf, OntDisjoint<O>, OntDisjoint.Classes, OntDisjoint.DataProperties, OntDisjoint.Individuals, OntDisjoint.ObjectProperties, OntDisjoint.Properties<P>, OntEntity, OntFacetRestriction, OntFacetRestriction.FractionDigits, OntFacetRestriction.LangRange, OntFacetRestriction.Length, OntFacetRestriction.MaxExclusive, OntFacetRestriction.MaxInclusive, OntFacetRestriction.MaxLength, OntFacetRestriction.MinExclusive, OntFacetRestriction.MinInclusive, OntFacetRestriction.MinLength, OntFacetRestriction.Pattern, OntFacetRestriction.TotalDigits, OntID, OntIndividual, OntIndividual.Anonymous, OntIndividual.Named, OntNamedProperty<P>, OntNegativeAssertion<P,V>, OntNegativeAssertion.WithDataProperty, OntNegativeAssertion.WithObjectProperty, OntObjectProperty, OntObjectProperty.Inverse, OntObjectProperty.Named, OntProperty, OntRelationalProperty, OntSWRL, OntSWRL.Arg, OntSWRL.Atom<P>, OntSWRL.Atom.Binary<P,F,S>, OntSWRL.Atom.Unary<P,A>, OntSWRL.Atom.WithBuiltin, OntSWRL.Atom.WithClass, OntSWRL.Atom.WithDataProperty, OntSWRL.Atom.WithDataRange, OntSWRL.Atom.WithDifferentIndividuals, OntSWRL.Atom.WithObjectProperty, OntSWRL.Atom.WithSameIndividuals, OntSWRL.Builtin, OntSWRL.DArg, OntSWRL.IArg, OntSWRL.Imp, OntSWRL.Variable
All Known Implementing Classes:
OntAnnotationImpl, OntAnnotationPropertyImpl, 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, OntDataPropertyImpl, OntDataRangeImpl, OntDataRangeImpl.ComplementOfImpl, OntDataRangeImpl.IntersectionOfImpl, OntDataRangeImpl.OneOfImpl, OntDataRangeImpl.RestrictionImpl, OntDataRangeImpl.UnionOfImpl, OntDisjointImpl, OntDisjointImpl.ClassesImpl, OntDisjointImpl.DataPropertiesImpl, OntDisjointImpl.IndividualsImpl, OntDisjointImpl.ObjectPropertiesImpl, OntDisjointImpl.PropertiesImpl, OntDisjointImpl.QLRLClassesImpl, OntFacetRestrictionImpl, OntFacetRestrictionImpl.FractionDigitsImpl, OntFacetRestrictionImpl.LangRangeImpl, OntFacetRestrictionImpl.LengthImpl, OntFacetRestrictionImpl.MaxExclusiveImpl, OntFacetRestrictionImpl.MaxInclusiveImpl, OntFacetRestrictionImpl.MaxLengthImpl, OntFacetRestrictionImpl.MinExclusiveImpl, OntFacetRestrictionImpl.MinInclusiveImpl, OntFacetRestrictionImpl.MinLengthImpl, OntFacetRestrictionImpl.PatternImpl, OntFacetRestrictionImpl.TotalDigitsImpl, OntIDImpl, OntIndividualImpl, OntIndividualImpl.AnonymousImpl, OntIndividualImpl.NamedImpl, OntNamedDataRangeImpl, OntNegativePropertyAssertionImpl, OntNegativePropertyAssertionImpl.DataAssertionImpl, OntNegativePropertyAssertionImpl.ObjectAssertionImpl, OntObjectImpl, OntObjectPropertyImpl, OntObjectPropertyImpl.InversePropertyImpl, OntObjectPropertyImpl.NamedImpl, OntPropertyImpl, OntSimpleClassImpl, OntSimpleClassImpl.NamedImpl, OntSimpleClassImpl.RLNamedImpl, OntSimplePropertyImpl, OntSWRLImpl, OntSWRLImpl.AtomImpl, OntSWRLImpl.BinaryImpl, OntSWRLImpl.BuiltInAtomImpl, OntSWRLImpl.BuiltinImpl, OntSWRLImpl.DArgImpl, OntSWRLImpl.DataPropertyAtomImpl, OntSWRLImpl.DataRangeAtomImpl, OntSWRLImpl.DifferentIndividualsAtomImpl, OntSWRLImpl.IArgImpl, OntSWRLImpl.ImpImpl, OntSWRLImpl.IndividualsAtomImpl, OntSWRLImpl.ObjectPropertyAtomImpl, OntSWRLImpl.OntClassAtomImpl, OntSWRLImpl.PropertyAtomImpl, OntSWRLImpl.SameIndividualsAtomImpl, OntSWRLImpl.UnaryImpl, OntSWRLImpl.VariableImpl

public interface OntObject
A base Ontology Object RDF Resource. A common super-type for all the abstractions in the Ontology RDF Model, which support Jena Polymorphism, can be annotated and have a structure strictly defined according to the OWL2 specification.
  • Method Summary

    Modifier and Type
    Method
    Description
    default OntStatement
    addAnnotation(OntAnnotationProperty predicate, String lexicalForm)
    Adds no-lang annotation assertion.
    default OntStatement
    Adds lang annotation assertion.
    addAnnotation(OntAnnotationProperty property, org.apache.jena.rdf.model.RDFNode value)
    Adds an annotation assertion with the given annotation property as predicate and RDF Node as value.
    default OntObject
    Creates _:this rdfs:comment "txt"^^xsd:string statement.
    default OntObject
    addComment(String txt, String lang)
    Adds the given localized text annotation with builtin rdfs:comment predicate.
    default OntObject
    Creates _:this rdfs:label "txt"^^xsd:string statement.
    default OntObject
    addLabel(String txt, String lang)
    Adds the given localized text annotation with builtin rdfs:label predicate.
    addStatement(org.apache.jena.rdf.model.Property property, org.apache.jena.rdf.model.RDFNode value)
    Adds an ont-statement by attaching predicate and object (value) to this resource.
    default OntObject
    annotate(OntAnnotationProperty predicate, String txt, String lang)
    Adds a language-tagged text for this object and the given predicate
    default OntObject
    annotate(OntAnnotationProperty predicate, org.apache.jena.rdf.model.RDFNode value)
    Annotates the object with the given predicate and value.
    Lists all top-level annotations attached to the root statement of this object.
    default Stream<org.apache.jena.rdf.model.RDFNode>
    Lists all annotation values for the given predicate.
    Lists all annotation literals for the given predicate and the language tag.
    Removes all root annotations including their sub-annotations hierarchy.
    Lists the content of the object, i.e., all characteristic statements (see spec()), plus all additional statements in which this object is the subject, minus those of them whose predicate is an annotation property (annotations are not included).
    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.
    default String
    Answers the comment string for this object.
    default String
    Answers the comment string for this object.
    default String
    Answers the label string for this object.
    default String
    Answers the label string for this object.
    Returns the main OntStatement which determines the nature of this ontological resource.
    Returns the ontology model associated with this resource.
    getRequiredProperty(org.apache.jena.rdf.model.Property property)
    Returns the first statement for the specified property.
    default boolean
    hasType(org.apache.jena.rdf.model.Resource type)
    Answers true iff this object has the declaration triple this rdf:type type, where type is what specified as parameter.
    boolean
    Determines if this Ontology Resource is locally defined.
    Stream<org.apache.jena.rdf.model.RDFNode>
    objects(org.apache.jena.rdf.model.Property predicate)
    Lists all objects attached on the property to this object.
    <O extends org.apache.jena.rdf.model.RDFNode>
    Stream<O>
    objects(org.apache.jena.rdf.model.Property predicate, Class<O> type)
    Lists all objects attached on the property to this object with the given type.
    Class<? extends OntObject>
    Gets a public ont-object type identifier.
    remove(org.apache.jena.rdf.model.Property property, org.apache.jena.rdf.model.RDFNode object)
    Deletes the specific property-value pair from this object.
    Lists all characteristic statements of the ontology resource, i.e., all those statements which completely determine this object nature according to the OWL2 specification.
    statement(org.apache.jena.rdf.model.Property property)
    Returns the first statement for the specified property.
    statement(org.apache.jena.rdf.model.Property property, org.apache.jena.rdf.model.RDFNode value)
    Returns the first statement for the specified property and object.
    Lists all top-level statements related to this object (i.e., with subject=this).
    statements(org.apache.jena.rdf.model.Property property)
    Lists ont-statements by the predicate.
    default Stream<org.apache.jena.rdf.model.Resource>
    Lists all declarations (statements with rdf:type predicate).

    Methods inherited from interface org.apache.jena.graph.FrontsNode

    asNode

    Methods inherited from interface org.apache.jena.rdf.model.RDFNode

    as, asLiteral, asResource, canAs, isAnon, isLiteral, isResource, isStmtResource, isURIResource, visitWith

    Methods inherited from interface org.apache.jena.rdf.model.Resource

    abort, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addProperty, addProperty, addProperty, addProperty, begin, commit, equals, getId, getLocalName, getNameSpace, getProperty, getProperty, getPropertyResourceValue, getRequiredProperty, getStmtTerm, getURI, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasProperty, hasProperty, hasProperty, hasProperty, hasURI, inModel, listProperties, listProperties, listProperties, removeAll, removeProperties, toString
  • Method Details

    • objectType

      Class<? extends OntObject> objectType()
      Gets a public ont-object type identifier.
      Returns:
      Class, the actual type of this object
    • getMainStatement

      OntStatement getMainStatement()
      Returns the main OntStatement which determines the nature of this ontological resource. In most cases it is a declaration and wraps a triple with predicate rdf:type.

      The returned OntStatement differs from that which could be obtained directly from the model using one of model's statement(..) methods: the main statement annotations are added in the form of annotation property assertions (so-called 'plain annotations'), not as typed anonymous resources (so-called 'bulk annotations', OntAnnotation). In ONT-API it is legal for a main statement to have both plain and bulk annotations. Note: for anonymous ontology objects (i.e., not for OWL Entities) this behavior may not fully meet OWL2 specification: the specification describes only bulk annotations for all anonymous OWL2 components with except of an individual. To get a common ontology statement that supports bulk annotations only, the expression getModel().asStatement(this.getMainStatement().asTriple()) can be used.

      Returns:
      OntStatement or null in some boundary cases (e.g., for builtins)
      See Also:
    • spec

      Lists all characteristic statements of the ontology resource, i.e., all those statements which completely determine this object nature according to the OWL2 specification. For non-composite objects the result might contain only the root statement. For composite objects (usually anonymous resources: disjoint sections, class expression, etc.) the result would contain all statements in the graph directly related to the object but without statements that relate to the object components. The return stream is ordered and, in most cases, the expression this.spec().findFirst().get() returns the same statement as this.getRoot(). Object annotations are not included in the resultant stream.

      For OWL Entities the returned stream will contain only a single main statement (i.e. getMainStatement()), or even will be empty for built-in entities and individuals.

      Returns:
      Stream of Ontology Statements
      See Also:
    • content

      Stream<OntStatement> content()
      Lists the content of the object, i.e., all characteristic statements (see spec()), plus all additional statements in which this object is the subject, minus those of them whose predicate is an annotation property (annotations are not included).
      Returns:
      Stream of Ontology Statements
      See Also:
    • addStatement

      OntStatement addStatement(org.apache.jena.rdf.model.Property property, org.apache.jena.rdf.model.RDFNode value)
      Adds an ont-statement by attaching predicate and object (value) to this resource.
      Parameters:
      property - Property predicate, not null
      value - RDFNode object, not null
      Returns:
      OntStatement
      See Also:
      • Resource.addProperty(Property, RDFNode)
    • remove

      OntObject remove(org.apache.jena.rdf.model.Property property, org.apache.jena.rdf.model.RDFNode object)
      Deletes the specific property-value pair from this object. All the corresponding statement's annotations are also deleted. In case the given object is null, all statements with the property-predicate will be deleted. No-op if no match found.
      Parameters:
      property - Property predicate, not null
      object - RDFNode object, can be null
      Returns:
      this object to allow cascading calls
      See Also:
    • statements

      Stream<OntStatement> statements(org.apache.jena.rdf.model.Property property)
      Lists ont-statements by the predicate.
      Parameters:
      property - Property, predicate, can be null
      Returns:
      Stream of OntStatements
    • statements

      Stream<OntStatement> statements()
      Lists all top-level statements related to this object (i.e., with subject=this).
      Returns:
      Stream of all statements
      See Also:
      • Resource.listProperties()
    • statement

      Optional<OntStatement> statement(org.apache.jena.rdf.model.Property property, org.apache.jena.rdf.model.RDFNode value)
      Returns the first statement for the specified property and object. What exactly is the first triple is defined at the level of graph; in general, it is unpredictable. Also note, the common jena implementation of in-memory graph does not allow duplicated triples, and hence there can be at most one operator for a given property and value.
      Parameters:
      property - Property, the predicate
      value - RDFNode, the object
      Returns:
      Optional around OntStatement
    • statement

      Optional<OntStatement> statement(org.apache.jena.rdf.model.Property property)
      Returns the first statement for the specified property. What is the first triple is defined at the level of graph; in general, it is unpredictable.
      Parameters:
      property - Property, can be null
      Returns:
      Optional around OntStatement
      See Also:
      • Resource.getProperty(Property)
    • objects

      <O extends org.apache.jena.rdf.model.RDFNode> Stream<O> objects(org.apache.jena.rdf.model.Property predicate, Class<O> type)
      Lists all objects attached on the property to this object with the given type.
      Type Parameters:
      O - a class-type of rdf-node
      Parameters:
      predicate - Property predicate, can be null for wildcard searching
      type - Interface to find and cast
      Returns:
      Stream of RDF Nodes of the type O
    • objects

      Stream<org.apache.jena.rdf.model.RDFNode> objects(org.apache.jena.rdf.model.Property predicate)
      Lists all objects attached on the property to this object.
      Parameters:
      predicate - Property predicate, can be null for wildcard searching
      Returns:
      Stream of RDF Nodes
    • addAnnotation

      OntStatement addAnnotation(OntAnnotationProperty property, org.apache.jena.rdf.model.RDFNode value)
      Adds an annotation assertion with the given annotation property as predicate and RDF Node as value. The method is equivalent to the expression getRoot().addAnnotation(property, value).
      Parameters:
      property - OntAnnotationProperty - named annotation property
      value - RDFNode - the value: uri-resource, literal or anonymous individual
      Returns:
      OntStatement for newly added annotation to provide the possibility of adding subsequent sub-annotations
      Throws:
      OntJenaException - in case input is wrong
      See Also:
    • annotations

      Stream<OntStatement> annotations()
      Lists all top-level annotations attached to the root statement of this object. Each annotation can be plain (annotation property assertion) or bulk (anonymous resource with the type owl:Axiom or owl:Annotation, possibly with sub-annotations). Sub-annotations are not included in the returned stream. For non-built-in ontology objects this is equivalent to the expression getRoot().annotations().
      Returns:
      Stream of OntStatements that have an annotation property as predicate
      See Also:
    • annotationValues

      Stream<String> annotationValues(OntAnnotationProperty predicate, String lang)
      Lists all annotation literals for the given predicate and the language tag. Literal tag comparison is case-insensitive. Partial search is also allowed, for example, a literal with the tag en-GB will list also if the input language tag is en. An empty string as language tag means searching for plain no-language literals.
      Parameters:
      predicate - OntAnnotationProperty, not null
      lang - String, the language tag to restrict the listed literals to, or null to select all literals
      Returns:
      Stream of String's, i.e., literal lexical forms
      See Also:
    • clearAnnotations

      OntObject clearAnnotations()
      Removes all root annotations including their sub-annotations hierarchy. Any non-root annotations are untouched. For example, in case of deleting an OWL class, if it is present on the left side of the rdfs:subClassOf statement, all the annotations of that statement will remain in the graph, but all main annotations (which belongs to the statement with the predicate rdf:type) will be deleted from the graph. For non-built-in ontology objects this is equivalent to the expression getRoot().clearAnnotations().
      Returns:
      this object to allow cascading calls
      See Also:
    • getRequiredProperty

      OntStatement getRequiredProperty(org.apache.jena.rdf.model.Property property)
      Returns the first statement for the specified property. What exactly is the first triple is defined at the level of graph and, in general, it is unpredictable.
      Specified by:
      getRequiredProperty in interface org.apache.jena.rdf.model.Resource
      Parameters:
      property - Property, the predicate
      Returns:
      OntStatement
      Throws:
      org.apache.jena.shared.PropertyNotFoundException - if no such statement found
      See Also:
      • Resource.getRequiredProperty(Property)
    • hasType

      default boolean hasType(org.apache.jena.rdf.model.Resource type)
      Answers true iff this object has the declaration triple this rdf:type type, where type is what specified as parameter.
      Parameters:
      type - Resource to test
      Returns:
      true if the given type is present
    • types

      default Stream<org.apache.jena.rdf.model.Resource> types()
      Lists all declarations (statements with rdf:type predicate).
      Returns:
      Stream of Resources
    • annotationValues

      default Stream<org.apache.jena.rdf.model.RDFNode> annotationValues(OntAnnotationProperty predicate)
      Lists all annotation values for the given predicate.
      Parameters:
      predicate - OntAnnotationProperty, not null
      Returns:
      Stream of RDFNodes
      See Also:
    • addAnnotation

      default OntStatement addAnnotation(OntAnnotationProperty predicate, String lexicalForm)
      Adds no-lang annotation assertion.
      Parameters:
      predicate - OntAnnotationProperty predicate
      lexicalForm - String, the literal lexical form, not null
      Returns:
      OntStatement
    • addAnnotation

      default OntStatement addAnnotation(OntAnnotationProperty predicate, String txt, String lang)
      Adds lang annotation assertion.
      Parameters:
      predicate - OntAnnotationProperty predicate
      txt - String, the literal lexical form, not null
      lang - String, the language tag, nullable
      Returns:
      OntStatement - new statement: @subject @predicate "txt"@lang
    • annotate

      default OntObject annotate(OntAnnotationProperty predicate, org.apache.jena.rdf.model.RDFNode value)
      Annotates the object with the given predicate and value.
      Parameters:
      predicate - OntAnnotationProperty - named annotation property, not null
      value - RDFNode - the value: uri-resource, literal or anonymous individual, not null
      Returns:
      this object to allow cascading calls
      See Also:
    • annotate

      default OntObject annotate(OntAnnotationProperty predicate, String txt, String lang)
      Adds a language-tagged text for this object and the given predicate
      Parameters:
      predicate - OntAnnotationProperty - named annotation property, not null
      txt - String, the literal lexical form, cannot be null
      lang - String, the language tag, can be null
      Returns:
      this object to allow cascading calls
    • addComment

      default OntObject addComment(String txt)
      Creates _:this rdfs:comment "txt"^^xsd:string statement.
      Parameters:
      txt - String, not null
      Returns:
      this object to allow cascading calls
      See Also:
    • addComment

      default OntObject addComment(String txt, String lang)
      Adds the given localized text annotation with builtin rdfs:comment predicate.
      Parameters:
      txt - String, the literal lexical form, not null
      lang - String, the language tag, nullable
      Returns:
      this object to allow cascading calls
      See Also:
    • addLabel

      default OntObject addLabel(String txt)
      Creates _:this rdfs:label "txt"^^xsd:string statement.
      Parameters:
      txt - String, the literal lexical form, not null
      Returns:
      this object to allow cascading calls
      See Also:
    • addLabel

      default OntObject addLabel(String txt, String lang)
      Adds the given localized text annotation with builtin rdfs:label predicate.
      Parameters:
      txt - String, the literal lexical form, not null
      lang - String, the language tag, nullable
      Returns:
      this object to allow cascading calls
      See Also:
    • getComment

      default String getComment()
      Answers the comment string for this object. If there is more than one such resource, an arbitrary selection is made.
      Returns:
      a rdfs:comment string or null if there is no comments
      See Also:
    • getComment

      default String getComment(String lang)
      Answers the comment string for this object. If there is more than one such resource, an arbitrary selection is made.
      Parameters:
      lang - String, the language attribute for the desired comment (EN, FR, etc.) or null for don't care; will attempt to retrieve the most specific comment matching the given language; to get no-lang literal string an empty string can be used
      Returns:
      a rdfs:comment string matching the given language, or null if there is no matching comment
      See Also:
    • getLabel

      default String getLabel()
      Answers the label string for this object. If there is more than one such resource, an arbitrary selection is made.
      Returns:
      a rdfs:label string or null if there is no comments
      See Also:
    • getLabel

      default String getLabel(String lang)
      Answers the label string for this object. If there is more than one such resource, an arbitrary selection is made.
      Parameters:
      lang - String, the language attribute for the desired comment (EN, FR, etc.) or null for don't care; will attempt to retrieve the most specific comment matching the given language; to get no-lang literal string an empty string can be used
      Returns:
      a rdfs:label string matching the given language, or null if there is no matching label
      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)