Module org.apache.jena.ontapi
Package org.apache.jena.ontapi.model
Interface OntDataRange.Restriction
- All Superinterfaces:
org.apache.jena.graph.FrontsNode
,OntDataRange
,OntDataRange.Combination<OntFacetRestriction>
,OntObject
,org.apache.jena.rdf.model.RDFNode
,org.apache.jena.rdf.model.Resource
- All Known Implementing Classes:
OntDataRangeImpl.RestrictionImpl
- Enclosing interface:
- OntDataRange
public static interface OntDataRange.Restriction
extends OntDataRange.Combination<OntFacetRestriction>
- See Also:
-
- 7.5 Datatype Restrictions
OntFacetRestriction
OntModel.createFacetRestriction(Class, Literal)
CreateRanges.createDataRestriction(Named, Collection)
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.jena.ontapi.model.OntDataRange
OntDataRange.Combination<N extends org.apache.jena.rdf.model.RDFNode>, OntDataRange.ComplementOf, OntDataRange.IntersectionOf, OntDataRange.Named, OntDataRange.OneOf, OntDataRange.Restriction, OntDataRange.UnionOf
-
Method Summary
Modifier and TypeMethodDescriptiondefault OntDataRange.Restriction
addFacet
(Class<? extends OntFacetRestriction> type, org.apache.jena.rdf.model.Literal literal) Adds a facet restriction to the end of the []-list.default <X extends org.apache.jena.rdf.model.RDFNode>
XSafely converts this RDF resource to the giventype
interface, if it is possible.getList()
Gets a modifiable []-list with items of the typeE
.getModel()
Returns the ontology model associated with this resource.getValue()
Gets an RDF-value (a filler in OWL-API terms) encapsulated by this expression (that can be eitherclass
ordata range
expression).boolean
isLocal()
Determines if this Ontology Resource is locally defined.default OntDataRange.Restriction
setComponents
(Collection<OntFacetRestriction> components) Replaces the existing []-list content with the specified one, that is given in the form ofCollection
.default OntDataRange.Restriction
setComponents
(OntFacetRestriction... values) Replaces the existing []-list content with the specified one, that is given in the form of vararg array.setValue
(OntDataRange.Named value) Sets the specified value (a filler in OWL-API terms) into thisclass
ordata range
expression.spec()
Lists all characteristic statements of the ontology resource, i.e., all those statements which completely determine this object nature according to the OWL2 specification.Methods inherited from interface org.apache.jena.graph.FrontsNode
asNode
Methods inherited from interface org.apache.jena.ontapi.model.OntDataRange
arity, asNamed
Methods inherited from interface org.apache.jena.ontapi.model.OntObject
addAnnotation, addAnnotation, addAnnotation, addComment, addComment, addLabel, addLabel, addStatement, annotate, annotate, annotations, annotationValues, annotationValues, clearAnnotations, content, getComment, getComment, getLabel, getLabel, getMainStatement, getRequiredProperty, hasType, objects, objects, objectType, remove, 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
-
spec
Stream<OntStatement> spec()Lists all characteristic statements of the ontology resource, i.e., all those statements which completely determine this object nature according to the OWL2 specification. For non-composite objects the result might contain only theroot statement
. For composite objects (usually anonymous resources: disjoint sections, class expression, etc.) the result would contain all statements in the graph directly related to the object but without statements that relate to the object components. The return stream is ordered and, in most cases, the expressionthis.spec().findFirst().get()
returns the same statement asthis.getRoot()
. Object annotations are not included in the resultant stream.For OWL Entities the returned stream will contain only a single main statement (i.e.
OntObject.getMainStatement()
), or even will be empty for built-in entities and individuals. The result stream forRestriction Data Range
also includesfacet restrinction
definition triples.- Specified by:
spec
in interfaceOntObject
- Returns:
Stream
ofOntStatement
s.- See Also:
-
addFacet
default OntDataRange.Restriction addFacet(Class<? extends OntFacetRestriction> type, org.apache.jena.rdf.model.Literal literal) Adds a facet restriction to the end of the []-list.- Parameters:
type
- subclass ofOntFacetRestriction
, notnull
literal
- value, notnull
- Returns:
- this instance to allow cascading calls
-
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)
-
setComponents
Replaces the existing []-list content with the specified one, that is given in the form of vararg array.- Parameters:
values
- anArray
of the typeV
- Returns:
- this instance to allow cascading calls
-
setComponents
Replaces the existing []-list content with the specified one, that is given in the form ofCollection
. Nulls and self-references are not allowed.- Parameters:
components
- aCollection
of the typeV
- Returns:
- this instance to allow cascading calls
- Throws:
OntJenaException
- in case of wrong input
-
getList
OntList<OntFacetRestriction> getList()Gets a modifiable []-list with items of the typeE
.- Returns:
Ontology []-list
with items of the typeE
-
setValue
Sets the specified value (a filler in OWL-API terms) into thisclass
ordata range
expression.A
value
can benull
if this is a Cardinality Restriction (the null-filler is considered asowl:Thing
for an object restriction and asRDFS.Literal
for a data restriction).- Parameters:
value
-V
, possiblenull
in case of Cardinality Restriction- Returns:
- this instance to allow cascading calls
- See Also:
-
HasValue.getValue()
-
getValue
OntDataRange.Named getValue()Gets an RDF-value (a filler in OWL-API terms) encapsulated by this expression (that can be eitherclass
ordata range
expression).The result is not
null
even if it is an Unqualified Cardinality Restriction, that has no explicit filler in RDF (the filler is expected to be eitherowl:Thing
for object restriction orRDFS.Literal
for data restriction).- Returns:
V
, notnull
- See Also:
-
SetValue.setValue(RDFNode)
-