- All Superinterfaces:
org.apache.jena.graph.FrontsNode
,OntObject
,org.apache.jena.rdf.model.RDFNode
,org.apache.jena.rdf.model.Resource
- All Known Implementing Classes:
OntIDImpl
Interface encapsulating an Ontology Identifier.
Each
OWL2 Obtology
must have one and only one Ontology ID
inside.
Please note: the methods of this interface do not affect the hierarchical structure of the graph
to which this resource is attached, they only affect the structure of the graph itself.
In other words, calling the methods removeImport(String)
does not remove the sub-graph
from the main Union Graph
.
Similar, calling the method addImport(String)
simply adds the corresponding triple to the base graph.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault OntID
addComment
(String txt) Creates_:this rdfs:comment "txt"^^xsd:string
statement.default OntID
addComment
(String txt, String lang) Adds the given localized text annotation with builtinrdfs:comment
predicate.Adds the triplethis owl:import uri
to this resource.default OntID
addVersionInfo
(String txt) Adds aowl:versionInfo
description.default OntID
addVersionInfo
(String txt, String lang) Annotates this object withowl:versionInfo
predicate and the specified language-tagged literal.default OntID
annotate
(OntAnnotationProperty predicate, String txt, String lang) Adds a language-tagged text for this object and the givenpredicate
default OntID
annotate
(OntAnnotationProperty predicate, org.apache.jena.rdf.model.RDFNode value) Annotates the object with the givenpredicate
andvalue
.default <X extends org.apache.jena.rdf.model.RDFNode>
XSafely converts this RDF resource to the giventype
interface, if it is possible.default String
Returns an IRI that can be used to createowl:imports
statement in another model to make a reference between a model to which this id belongs and another model.getModel()
Returns the ontology model associated with this resource.default String
Answers the version info string for this ontology id.default String
getVersionInfo
(String lang) Answers the version info string for this ontology id.Returns an IRI from the right side ofthis owl:versionIRI IRI
statement if it is uniquely determined.imports()
Lists allowl:import
s.boolean
isLocal()
Determines if this Ontology Resource is locally defined.removeImport
(String uri) Removes the triplethis owl:import uri
from this resource.default boolean
Indicates whether the givenOntology ID
is equal to this one in OWL2 terms.setVersionIRI
(String uri) Assigns a new version IRI to this Ontology ID object.Methods inherited from interface org.apache.jena.graph.FrontsNode
asNode
Methods inherited from interface org.apache.jena.ontapi.model.OntObject
addAnnotation, addAnnotation, addAnnotation, addLabel, addLabel, addStatement, annotations, 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
-
getVersionIRI
String getVersionIRI()Returns an IRI from the right side ofthis owl:versionIRI IRI
statement if it is uniquely determined.- Returns:
- String IRI or
null
-
setVersionIRI
Assigns a new version IRI to this Ontology ID object. Anull
argument means that current version IRI should be deleted.- Parameters:
uri
- String, can benull
to remove versionIRI- Returns:
- this ID-object to allow cascading calls
- Throws:
OntJenaException
- if input is wrong
-
addImport
Adds the triplethis owl:import uri
to this resource.- Parameters:
uri
- String, notnull
- Returns:
- this ID-object to allow cascading calls
- Throws:
OntJenaException
- if input is wrong
-
removeImport
Removes the triplethis owl:import uri
from this resource.- Parameters:
uri
- String, notnull
- Returns:
- this ID-object to allow cascading calls
-
imports
Lists allowl:import
s.- Returns:
Stream
of Strings (IRIs)
-
sameAs
Indicates whether the givenOntology ID
is equal to this one in OWL2 terms. This means that the IDs must have the same IRI + version IRI pairs. If the method returnstrue
, then two ontologies can not be coexisting in the same scope.- Parameters:
other
-OntID
- Returns:
true
in case the IDs are the same, otherwisefalse
-
getImportsIRI
Returns an IRI that can be used to createowl:imports
statement in another model to make a reference between a model to which this id belongs and another model. According to the specification, a version IRI is primary.- Returns:
- String or
null
- See Also:
-
addComment
Creates_:this rdfs:comment "txt"^^xsd:string
statement.- Specified by:
addComment
in interfaceOntObject
- Parameters:
txt
- String, notnull
- Returns:
- this object to allow cascading calls
- See Also:
-
addComment
Adds the given localized text annotation with builtinrdfs:comment
predicate.- Specified by:
addComment
in interfaceOntObject
- Parameters:
txt
- String, the literal lexical form, notnull
lang
- String, the language tag, nullable- Returns:
- this object to allow cascading calls
- See Also:
-
addVersionInfo
Adds aowl:versionInfo
description.- Parameters:
txt
- String, the literal lexical form, notnull
- Returns:
- this ID-object to allow cascading calls
-
addVersionInfo
Annotates this object withowl:versionInfo
predicate and the specified language-tagged literal.- Parameters:
txt
- String, the literal lexical form, notnull
lang
- String, the language tag, nullable- Returns:
- this ID-object to allow cascading calls
-
getVersionInfo
Answers the version info string for this ontology id. If there is more than one such resource, an arbitrary selection is made.- Returns:
- a
owl:versionInfo
string ornull
if nothing is found
-
getVersionInfo
Answers the version info string for this ontology id. If there is more than one such resource, an arbitrary selection is made.- Parameters:
lang
- String, the language attribute for the desired comment (EN, FR, etc.) ornull
for don't care; will attempt to retrieve the most specific comment matching the given language; to get no-lang literal string an empty string can be used- Returns:
- a
owl:versionInfo
string matching the given language, ornull
if there is no version info
-
annotate
Adds a language-tagged text for this object and the givenpredicate
- Specified by:
annotate
in interfaceOntObject
- Parameters:
predicate
-OntAnnotationProperty
- named annotation property, notnull
txt
- String, the literal lexical form, cannot benull
lang
- String, the language tag, can benull
- Returns:
- this object to allow cascading calls
-
annotate
Annotates the object with the givenpredicate
andvalue
.- Specified by:
annotate
in interfaceOntObject
- Parameters:
predicate
-OntAnnotationProperty
- named annotation property, notnull
value
-RDFNode
- the value: uri-resource, literal or anonymous individual, notnull
- Returns:
- this object 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 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)
-