- 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:Axiom
for root annotations, it is usually owned by axiomatic statements.owl:Annotation
for sub-annotations, and also for annotation of several specific axioms with main-statement_:x rdf:type @type
where@type
isowl:AllDisjointClasses
,owl:AllDisjointProperties
,owl:AllDifferent
orowl: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 giventype
interface, 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.boolean
isLocal()
Determines if this Ontology Resource is locally defined.default Optional<OntAnnotation>
parent()
Answers a parentOntAnnotation
.Methods inherited from interface org.apache.jena.graph.FrontsNode
asNode
Methods 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, types
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
-
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.0
the presence of this statement in the Graph does not require anymore. The result could benull
in the special case of anonymous resource, e.g. whenrdf:type
isowl: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 property
as predicate. The example above contains two such statements:_:x rdfs:comment "some comment 1"
and_:x rdfs:comment "some comment 2"@fr
.- Returns:
Stream
of annotation statementsOntStatement
s- See Also:
-
descendants
Stream<OntAnnotation> descendants()Lists all descendants of this ont-annotation resource. The resulting resources must haveowl:Annotation
type and this object on predicateowl:annotatedSource
. The methodparent()
called on descendants must return the annotation equals to this.- Returns:
Stream
ofOntAnnotation
s
-
annotations
Stream<OntStatement> annotations()Just a synonym forassertions()
.- Specified by:
annotations
in interfaceOntObject
- Returns:
Stream
of annotation statementsOntStatement
s- See Also:
-
addAnnotation
Adds a new annotation assertion to this annotation resource. If thisOntAnnotation
contains annotation property assertionthis x y
and it does not have sub-annotations yet, the given annotation propertyp
and valuev
will produce followingOntAnnotation
object:
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 v
triple wrapped asOntStatement
to 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:
addAnnotation
in interfaceOntObject
- Parameters:
property
-OntAnnotationProperty
value
-RDFNode
- Returns:
OntStatement
- an annotation assertion belonging to this object- See Also:
-
parent
Answers a parentOntAnnotation
. For non-empty result therdf:type
must beowl:Annotation
. For a root annotation an empty result is expected.- Returns:
Optional
around 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:
getModel
in 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:imports
in OWL) and the resource is defined in one of them, than this method called from top-level interface will returnfalse
.- Returns:
true
if this resource is local to the base model graph.
-
getAs
Safely converts this RDF resource to the giventype
interface, 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
X
ornull
- See Also:
-
RDFNode.as(Class)
RDFNode.canAs(Class)
-