- All Superinterfaces:
org.apache.jena.graph.FrontsTriple
,org.apache.jena.rdf.model.Statement
- All Known Implementing Classes:
OntStatementImpl
public interface OntStatement
extends org.apache.jena.rdf.model.Statement
An Ontology RDF
Statement
.
This is not a Resource
.
This is an extended Jena Model Statement
with possibility to add, delete and find annotations
in the same form of OntStatement
or Ontology Annotation
resources.
- See Also:
-
OntAnnotation
Statement
- 2.2 Translation of Annotations
-
Method Summary
Modifier and TypeMethodDescriptiondefault OntStatement
addAnnotation
(OntAnnotationProperty predicate, String text) Creates and returns a textual no-lang sub-annotation-assertion.default OntStatement
addAnnotation
(OntAnnotationProperty predicate, String text, String lang) Creates and returns a textual language-tagged sub-annotation-assertion.addAnnotation
(OntAnnotationProperty property, org.apache.jena.rdf.model.RDFNode value) Annotates the statement with the givenannotation property
andRDF Node
value and returns a newly added annotation assertion statement.default OntStatement
annotate
(OntAnnotationProperty property, String text) Annotates the statement with the given predicate and textual message.default OntStatement
annotate
(OntAnnotationProperty property, String text, String lang) Annotates the statement with the given predicate and language-tagged textual message.default OntStatement
annotate
(OntAnnotationProperty property, org.apache.jena.rdf.model.RDFNode value) Annotates the statement with the given predicate and value.Returns the stream of the annotation objects attached to this statement.Lists all annotations related to this statement.default Stream<OntStatement>
annotations
(OntAnnotationProperty property) Lists all annotations by the property.default Optional<OntAnnotation>
Returns the primary annotation object (resource) which is related to this statement.default boolean
Answerstrue
iff this statement is a part ofBulk Annotation Ontology Object
.default OntStatement
Removes all sub-annotations including their children.default OntStatement
deleteAnnotation
(OntAnnotationProperty property) Deletes all (sub-)annotations with the given predicate-property.deleteAnnotation
(OntAnnotationProperty property, org.apache.jena.rdf.model.RDFNode value) Deletes the child annotation if present.default List<OntAnnotation>
Returns the annotation objects attached to this statement in the form ofList
with a fixed order.getModel()
Gets theOntology RDF Model
thisStatement
was created in.default <O extends org.apache.jena.rdf.model.RDFNode>
OAnswers a typed object of the statement.An accessor method to return the subject of the statements in form ofOntology Object
.default <S extends org.apache.jena.rdf.model.Resource>
SgetSubject
(Class<S> type) Answers a typed subject of the statement.default boolean
Answerstrue
iff this statement has any annotations attached (either plain or bulk).default boolean
Answerstrue
iff this is an annotation assertion.default boolean
Answerstrue
iff this statement is a declaration:@any rdf:type @any
.default boolean
isLocal()
Answerstrue
iff this statement is in the base graph.Methods inherited from interface org.apache.jena.graph.FrontsTriple
asTriple
Methods inherited from interface org.apache.jena.rdf.model.Statement
changeLiteralObject, changeLiteralObject, changeLiteralObject, changeLiteralObject, changeLiteralObject, changeLiteralObject, changeObject, changeObject, changeObject, equals, getAlt, getBag, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLanguage, getList, getLiteral, getLong, getObject, getPredicate, getProperty, getResource, getSeq, getShort, getStatementProperty, getString, hashCode, remove
-
Method Details
-
getModel
OntModel getModel()Gets theOntology RDF Model
thisStatement
was created in.- Specified by:
getModel
in interfaceorg.apache.jena.rdf.model.Statement
- Returns:
OntModel
-
addAnnotation
Annotates the statement with the givenannotation property
andRDF Node
value and returns a newly added annotation assertion statement.In the special case of a main statement (i.e., if this statement is a result of
OntObject.getMainStatement()
) the returnedOntStatement
has the same subject as this statement, and it is called a plain annotation assertion (in this case the method is equivalent to theOntObject.addAnnotation(OntAnnotationProperty, RDFNode)
method). Otherwise, the returned statement is a part of a fresh or existingbulk annotation resource
and its subject is a blank node.- Parameters:
property
-OntAnnotationProperty
named annotation property, notnull
value
-RDFNode
uri-resource, literal or anonymous individual, notnull
- Returns:
- a new
Ont-Statement
for newly added annotation - Throws:
OntJenaException
- in case input is incorrect- See Also:
-
annotations
Stream<OntStatement> annotations()Lists all annotations related to this statement. The returned stream consists of annotation assertions listed from the top-level bulk annotations plus plain annotation assertions in the special case of the main statement.- Returns:
- Stream (unordered) of
annotation assertion statement
s withannotation property
as predicates, can be empty - See Also:
-
deleteAnnotation
OntStatement deleteAnnotation(OntAnnotationProperty property, org.apache.jena.rdf.model.RDFNode value) throws OntJenaException Deletes the child annotation if present. Does nothing if no assertion found. Throws an exception if specified annotation has it its own annotations. If this statement is not root and the correspondingOntAnnotation
resource has no assertions anymore, it deletes the whole OntAnnotation resource also.- Parameters:
property
-OntAnnotationProperty
named annotation property, notnull
value
-RDFNode
uri-resource, literal or anonymous individual, notnull
- Returns:
- this statement instance to allow cascading calls
- Throws:
OntJenaException
- in case input is incorrect or deleted annotation has it its own annotations- See Also:
-
annotationResources
Stream<OntAnnotation> annotationResources()Returns the stream of the annotation objects attached to this statement. E.g., for the statements A t
the annotation object looks like
Technically, although it usually does not make sense, it is allowed that a statement may have several such b-nodes._:b0 a owl:Axiom . _:b0 Aj tj . _:b0 owl:annotatedSource s . _:b0 owl:annotatedProperty A . _:b0 owl:annotatedTarget t .
- Returns:
- Stream (unordered) of
OntAnnotation
resources - See Also:
-
getSubject
OntObject getSubject()An accessor method to return the subject of the statements in form ofOntology Object
.- Specified by:
getSubject
in interfaceorg.apache.jena.rdf.model.Statement
- Returns:
OntObject
- See Also:
-
Statement.getSubject()
-
isLocal
default boolean isLocal()Answerstrue
iff this statement is in the base graph. The method is equivalent to the expressionthis.getModel().getBaseGraph().contains(this.asTriple())
.- Returns:
true
if it is a local statement- See Also:
-
OntResource.isLocal()
-
getAnnotationList
Returns the annotation objects attached to this statement in the form ofList
with a fixed order.- Returns:
List
ofOntology Annotation
s- See Also:
-
asAnnotationResource
Returns the primary annotation object (resource) which is related to this statement. It is assumed that this method always returns the same result if no changes in graph are made, even after graph reloading.- Returns:
Optional
around ofOntAnnotation
, can be empty- See Also:
-
annotations
Lists all annotations by the property.- Parameters:
property
-OntAnnotationProperty
the property- Returns:
- Stream of
OntStatement
s
-
deleteAnnotation
Deletes all (sub-)annotations with the given predicate-property.- Parameters:
property
-OntAnnotationProperty
- Returns:
- this statement to allow cascading calls
- See Also:
-
isDeclaration
default boolean isDeclaration()Answerstrue
iff this statement is a declaration:@any rdf:type @any
.- Returns:
true
if the predicate isrdf:type
-
belongsToAnnotation
default boolean belongsToAnnotation()Answerstrue
iff this statement is a part ofBulk Annotation Ontology Object
. This means that it is one of the following:_:x rdf:type owl:Annotation . _:x p v . _:x owl:annotatedSource this . _:x owl:annotatedProperty x . _:x owl:annotatedTarget y .
- Returns:
true
if it is a part of bulk annotation object- See Also:
-
isAnnotationAssertion
default boolean isAnnotationAssertion()Answerstrue
iff this is an annotation assertion. Annotation assertion is a statements A t
, wheres
is an IRI or anonymous individual,t
is an IRI, anonymous individual, or literal, andA
is an annotation property.- Returns:
true
if the predicate isOntAnnotationProperty
-
clearAnnotations
Removes all sub-annotations including their children.- Returns:
- this statement to allow cascading calls
- See Also:
-
hasAnnotations
default boolean hasAnnotations()Answerstrue
iff this statement has any annotations attached (either plain or bulk).- Returns:
true
if it is annotated
-
addAnnotation
Creates and returns a textual no-lang sub-annotation-assertion.- Parameters:
predicate
-OntAnnotationProperty
, notnull
text
- String, the text message, notnull
- Returns:
OntStatement
, new instance- See Also:
-
addAnnotation
Creates and returns a textual language-tagged sub-annotation-assertion.- Parameters:
predicate
-OntAnnotationProperty
, notnull
text
- String, the text message, notnull
lang
- String, language, optional- Returns:
OntStatement
, new instance- See Also:
-
annotate
Annotates the statement with the given predicate and textual message.- Parameters:
property
-OntAnnotationProperty
named annotation property, notnull
text
- String, the text message, notnull
- Returns:
- this
OntStatement
to allow cascading calls - See Also:
-
annotate
Annotates the statement with the given predicate and language-tagged textual message.- Parameters:
property
-OntAnnotationProperty
named annotation property, notnull
text
- String, the text message, notnull
lang
- String, language, optional- Returns:
- this
OntStatement
to allow cascading calls - See Also:
-
annotate
default OntStatement annotate(OntAnnotationProperty property, org.apache.jena.rdf.model.RDFNode value) Annotates the statement with the given predicate and value. The method differs fromaddAnnotation(OntAnnotationProperty, RDFNode)
only in a return object.- Parameters:
property
-OntAnnotationProperty
named annotation property, notnull
value
-RDFNode
uri-resource, literal or anonymous individual, notnull
- Returns:
- this
OntStatement
to allow cascading calls - See Also:
-
getSubject
Answers a typed subject of the statement.- Type Parameters:
S
- subtype ofResource
- Parameters:
type
- Class type- Returns:
Resource
instance- Throws:
org.apache.jena.enhanced.UnsupportedPolymorphismException
- if the subject node and the given type are incompatible- See Also:
-
getObject
Answers a typed object of the statement.- Type Parameters:
O
- subtype ofRDFNode
- Parameters:
type
- Class type- Returns:
RDFNode
instance- Throws:
org.apache.jena.enhanced.UnsupportedPolymorphismException
- if the object node and the given type are incompatible- See Also:
-
Statement.getObject()
-