- All Superinterfaces:
org.apache.jena.graph.FrontsNode,OntObject,org.apache.jena.rdf.model.RDFNode,org.apache.jena.rdf.model.Resource
- All Known Implementing Classes:
OntAnnotationImpl
A Bulk Annotation
Ontology Object.
It's an anonymous jena-resource with one of the two types:
owl:Axiomfor root annotations, it is usually owned by axiomatic statements.owl:Annotationfor sub-annotations, and also for annotation of several specific axioms with main-statement_:x rdf:type @typewhere@typeisowl:AllDisjointClasses,owl:AllDisjointProperties,owl:AllDifferentorowl:NegativePropertyAssertion.
[ a owl:Axiom ;
rdfs:comment "some comment 1", "some comment 2"@fr ;
owl:annotatedProperty rdf:type ;
owl:annotatedSource <Class> ;
owl:annotatedTarget owl:Class
] .
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddAnnotation(OntAnnotationProperty property, org.apache.jena.rdf.model.RDFNode value) Adds a new annotation assertion to this annotation resource.Just a synonym forassertions().Returns the annotations assertions attached to this annotation resource.Lists all descendants of this ont-annotation resource.default <X extends org.apache.jena.rdf.model.RDFNode>
XSafely converts this RDF resource to the giventypeinterface, if it is possible.getBase()Returns the base statement, i.e. statement to which this bulk-annotation is attached.getModel()Returns the ontology model associated with this resource.booleanisLocal()Determines if this Ontology Resource is locally defined.default Optional<OntAnnotation>parent()Answers a parentOntAnnotation.Methods inherited from interface org.apache.jena.graph.FrontsNode
asNodeMethods inherited from interface org.apache.jena.ontapi.model.OntObject
addAnnotation, addAnnotation, addComment, addComment, addLabel, addLabel, addStatement, annotate, annotate, annotationValues, annotationValues, clearAnnotations, content, getComment, getComment, getLabel, getLabel, getMainStatement, getRequiredProperty, hasType, objects, objects, objectType, remove, spec, statement, statement, statements, statements, typesMethods inherited from interface org.apache.jena.rdf.model.RDFNode
as, asLiteral, asResource, asStatementTerm, canAs, isAnon, isLiteral, isResource, isStatementTerm, isURIResource, visitWithMethods 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, getURI, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasProperty, hasProperty, hasProperty, hasProperty, hasURI, inModel, listProperties, listProperties, listProperties, removeAll, removeProperties, toString
-
Method Details
-
getBase
OntStatement getBase()Returns the base statement, i.e. statement to which this bulk-annotation is attached. In the example above it is the statement<Class> rdf:type owl:Class. Notes: Starting v.2.0.0the presence of this statement in the Graph does not require anymore. The result could benullin the special case of anonymous resource, e.g. whenrdf:typeisowl:AllDisjointClasses, see class description.- Returns:
OntStatement, possiblynull
-
assertions
Stream<OntStatement> assertions()Returns the annotations assertions attached to this annotation resource. The annotation assertion is a statements with anannotation propertyas predicate. The example above contains two such statements:_:x rdfs:comment "some comment 1"and_:x rdfs:comment "some comment 2"@fr.- Returns:
Streamof annotation statementsOntStatements- See Also:
-
descendants
Stream<OntAnnotation> descendants()Lists all descendants of this ont-annotation resource. The resulting resources must haveowl:Annotationtype and this object on predicateowl:annotatedSource. The methodparent()called on descendants must return the annotation equals to this.- Returns:
StreamofOntAnnotations
-
annotations
Stream<OntStatement> annotations()Just a synonym forassertions().- Specified by:
annotationsin interfaceOntObject- Returns:
Streamof annotation statementsOntStatements- See Also:
-
addAnnotation
Adds a new annotation assertion to this annotation resource. If thisOntAnnotationcontains annotation property assertionthis x yand it does not have sub-annotations yet, the given annotation propertypand valuevwill produce followingOntAnnotationobject:
and this method will return_:x rdf:type owl:Annotation . _:x p v . _:x owl:annotatedSource this . _:x owl:annotatedProperty x . _:x owl:annotatedTarget y ._:x p vtriple wrapped asOntStatementto allow adding subsequent sub-annotations. If this annotation object already has a sub-annotation for the statementthis x y, the new triple will be added to the existing anonymous resource.- Specified by:
addAnnotationin interfaceOntObject- Parameters:
property-OntAnnotationPropertyvalue-RDFNode- Returns:
OntStatement- an annotation assertion belonging to this object- See Also:
-
parent
Answers a parentOntAnnotation. For non-empty result therdf:typemust beowl:Annotation. For a root annotation an empty result is expected.- Returns:
Optionalaround ofOntAnnotation
-
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:
getModelin interfaceorg.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 theroot statement) belongs to the base ontology graph. If the ontology contains subgraphs (which should matchowl:importsin OWL) and the resource is defined in one of them, than this method called from top-level interface will returnfalse.- Returns:
trueif this resource is local to the base model graph.
-
getAs
Safely converts this RDF resource to the giventypeinterface, if it is possible. Otherwise, returnsnull. A calling of this method is effectively equivalent to the expressionthis.canAs(type) ? this.as(type) : null.- Type Parameters:
X- any subtype ofRDFNode- Parameters:
type- aClass-type of the desired RDF view (interface)- Returns:
- an instance of the type
Xornull - See Also:
-
RDFNode.as(Class)RDFNode.canAs(Class)
-