Class OntIndividualImpl.AnonymousImpl

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
org.apache.jena.ontapi.impl.objects.OntObjectImpl
org.apache.jena.ontapi.impl.objects.OntIndividualImpl
org.apache.jena.ontapi.impl.objects.OntIndividualImpl.AnonymousImpl
All Implemented Interfaces:
org.apache.jena.graph.FrontsNode, OntIndividual, OntIndividual.Anonymous, OntObject, org.apache.jena.rdf.model.RDFNode, org.apache.jena.rdf.model.Resource
Enclosing class:
OntIndividualImpl

public static class OntIndividualImpl.AnonymousImpl extends OntIndividualImpl implements OntIndividual.Anonymous
See description to the interface OntIndividual.Anonymous. The current implementation allows treating b-node as anonymous individual in any case except the following cases:
  • it is a subject in statement "_:x rdf:type s", where "s" is not a class expression ("C").
  • it is a subject in statement "_:x @predicate @any", where @predicate is from reserved vocabulary but not object, data or annotation built-in property and not owl:sameAs and owl:differentFrom.
  • it is an object in statement "@any @predicate _:x", where @predicate is from reserved vocabulary but not object, data or annotation built-in property and not owl:sameAs, owl:differentFrom, owl:hasValue, owl:sourceIndividual and rdf:first.

for notations see OWL2 Quick Refs

  • Constructor Details

    • AnonymousImpl

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

    • isLocal

      public boolean isLocal()
      Overrides:
      isLocal in class OntIndividualImpl
      Returns:
      true if the root statement belongs to the base graph
    • 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
    • objectType

      public Class<? extends OntObject> 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
    • detachClass

      public OntIndividualImpl.AnonymousImpl detachClass(org.apache.jena.rdf.model.Resource clazz)
      Description copied from interface: OntIndividual.Anonymous
      Removes a class assertion statement for the given class. Like others methods #remove..(..) (see OntObject.remove(Property, RDFNode)), this operation does nothing in case no match found and in case null is specified it removes all class assertion statements including all their annotations. To delete the individual with its content the method OntModel.removeOntObject(OntObject) can be used. For an anonymous individual, a primary class assertion is also a definition, so its deletion is prohibited.
      Specified by:
      detachClass in interface OntIndividual
      Specified by:
      detachClass in interface OntIndividual.Anonymous
      Parameters:
      clazz - OntClass, not null
      Returns:
      this instance to allow cascading calls
      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
    • 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)