- 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:
-
OntAnnotationStatement- 2.2 Translation of Annotations
-
Method Summary
Modifier and TypeMethodDescriptiondefault OntStatementaddAnnotation(OntAnnotationProperty predicate, String text) Creates and returns a textual no-lang sub-annotation-assertion.default OntStatementaddAnnotation(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 propertyandRDF Nodevalue and returns a newly added annotation assertion statement.default OntStatementannotate(OntAnnotationProperty property, String text) Annotates the statement with the given predicate and textual message.default OntStatementannotate(OntAnnotationProperty property, String text, String lang) Annotates the statement with the given predicate and language-tagged textual message.default OntStatementannotate(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 booleanAnswerstrueiff this statement is a part ofBulk Annotation Ontology Object.default OntStatementRemoves all sub-annotations including their children.default OntStatementdeleteAnnotation(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 ofListwith a fixed order.getModel()Gets theOntology RDF ModelthisStatementwas 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 booleanAnswerstrueiff this statement has any annotations attached (either plain or bulk).default booleanAnswerstrueiff this is an annotation assertion.default booleanAnswerstrueiff this statement is a declaration:@any rdf:type @any.default booleanisLocal()Answerstrueiff this statement is in the base graph.Methods inherited from interface org.apache.jena.graph.FrontsTriple
asTripleMethods 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 ModelthisStatementwas created in.- Specified by:
getModelin interfaceorg.apache.jena.rdf.model.Statement- Returns:
OntModel
-
addAnnotation
Annotates the statement with the givenannotation propertyandRDF Nodevalue 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 returnedOntStatementhas 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 resourceand its subject is a blank node.- Parameters:
property-OntAnnotationPropertynamed annotation property, notnullvalue-RDFNodeuri-resource, literal or anonymous individual, notnull- Returns:
- a new
Ont-Statementfor 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 statements withannotation propertyas 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 correspondingOntAnnotationresource has no assertions anymore, it deletes the whole OntAnnotation resource also.- Parameters:
property-OntAnnotationPropertynamed annotation property, notnullvalue-RDFNodeuri-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 tthe 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
OntAnnotationresources - See Also:
-
getSubject
OntObject getSubject()An accessor method to return the subject of the statements in form ofOntology Object.- Specified by:
getSubjectin interfaceorg.apache.jena.rdf.model.Statement- Returns:
OntObject- See Also:
-
Statement.getSubject()
-
isLocal
default boolean isLocal()Answerstrueiff this statement is in the base graph. The method is equivalent to the expressionthis.getModel().getBaseGraph().contains(this.asTriple()).- Returns:
trueif it is a local statement- See Also:
-
OntResource.isLocal()
-
getAnnotationList
Returns the annotation objects attached to this statement in the form ofListwith a fixed order.- Returns:
ListofOntology Annotations- 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:
Optionalaround ofOntAnnotation, can be empty- See Also:
-
annotations
Lists all annotations by the property.- Parameters:
property-OntAnnotationPropertythe property- Returns:
- Stream of
OntStatements
-
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()Answerstrueiff this statement is a declaration:@any rdf:type @any.- Returns:
trueif the predicate isrdf:type
-
belongsToAnnotation
default boolean belongsToAnnotation()Answerstrueiff 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:
trueif it is a part of bulk annotation object- See Also:
-
isAnnotationAssertion
default boolean isAnnotationAssertion()Answerstrueiff this is an annotation assertion. Annotation assertion is a statements A t, wheresis an IRI or anonymous individual,tis an IRI, anonymous individual, or literal, andAis an annotation property.- Returns:
trueif the predicate isOntAnnotationProperty
-
clearAnnotations
Removes all sub-annotations including their children.- Returns:
- this statement to allow cascading calls
- See Also:
-
hasAnnotations
default boolean hasAnnotations()Answerstrueiff this statement has any annotations attached (either plain or bulk).- Returns:
trueif it is annotated
-
addAnnotation
Creates and returns a textual no-lang sub-annotation-assertion.- Parameters:
predicate-OntAnnotationProperty, notnulltext- 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, notnulltext- String, the text message, notnulllang- String, language, optional- Returns:
OntStatement, new instance- See Also:
-
annotate
Annotates the statement with the given predicate and textual message.- Parameters:
property-OntAnnotationPropertynamed annotation property, notnulltext- String, the text message, notnull- Returns:
- this
OntStatementto allow cascading calls - See Also:
-
annotate
Annotates the statement with the given predicate and language-tagged textual message.- Parameters:
property-OntAnnotationPropertynamed annotation property, notnulltext- String, the text message, notnulllang- String, language, optional- Returns:
- this
OntStatementto 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-OntAnnotationPropertynamed annotation property, notnullvalue-RDFNodeuri-resource, literal or anonymous individual, notnull- Returns:
- this
OntStatementto allow cascading calls - See Also:
-
getSubject
Answers a typed subject of the statement.- Type Parameters:
S- subtype ofResource- Parameters:
type- Class type- Returns:
Resourceinstance- 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:
RDFNodeinstance- Throws:
org.apache.jena.enhanced.UnsupportedPolymorphismException- if the object node and the given type are incompatible- See Also:
-
Statement.getObject()
-