- All Superinterfaces:
org.apache.jena.graph.FrontsNode
,OntObject
,org.apache.jena.rdf.model.RDFNode
,org.apache.jena.rdf.model.Resource
- All Known Subinterfaces:
OntIndividual.Anonymous
,OntIndividual.Named
- All Known Implementing Classes:
OntIndividualImpl
,OntIndividualImpl.AnonymousImpl
,OntIndividualImpl.NamedImpl
Interface for named and anonymous individuals.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
An interface for Anonymous Individuals.static interface
An interface for Named Individual which is anEntity OntEntity
. -
Method Summary
Modifier and TypeMethodDescriptiondefault OntIndividual
addAssertion
(OntAnnotationProperty property, org.apache.jena.rdf.model.RDFNode value) Adds annotation assertionAnnotationAssertion(A s t)
.default OntIndividual
addAssertion
(OntDataProperty property, org.apache.jena.rdf.model.Literal value) Adds a positive data property assertiona R v
.default OntIndividual
addAssertion
(OntObjectProperty.Named property, OntIndividual value) Adds a positive object property assertiona1 PN a2
.default OntStatement
addClassAssertion
(OntClass clazz) Creates and returns a class-assertion statementa rdf:type C
, wherea
is this individual.default OntIndividual
addComment
(String txt) Creates_:this rdfs:comment "txt"^^xsd:string
statement.default OntIndividual
addComment
(String txt, String lang) Adds the given localized text annotation with builtinrdfs:comment
predicate.default OntStatement
Adds aowl:differentFrom
individual statement.default OntIndividual
Adds aowl:differentFrom
individual statement and returns this object itself to allow cascading calls.default OntIndividual
Creates_:this rdfs:label "txt"^^xsd:string
statement.default OntIndividual
Adds the given localized text annotation with builtinrdfs:label
predicate.default OntIndividual
addNegativeAssertion
(OntDataProperty property, org.apache.jena.rdf.model.Literal value) Adds a negative data property assertion.default OntIndividual
addNegativeAssertion
(OntObjectProperty property, OntIndividual value) Adds a negative object property assertion.default OntIndividual
addProperty
(OntNamedProperty property, org.apache.jena.rdf.model.RDFNode value) Adds a property assertion statement.default OntStatement
addSameAsStatement
(OntIndividual other) Adds a same individual reference.default OntIndividual
addSameIndividual
(OntIndividual other) Adds aowl:sameAs
individual statement and returns this object itself to allow cascading calls.default OntIndividual
annotate
(OntAnnotationProperty predicate, String txt, String lang) Adds a language-tagged text for this object and the givenpredicate
default OntIndividual
annotate
(OntAnnotationProperty predicate, org.apache.jena.rdf.model.RDFNode value) Annotates the object with the givenpredicate
andvalue
.default OntIndividual.Named
asNamed()
default OntIndividual
attachClass
(OntClass clazz) Adds a type (class expression) to this individual.classes()
Returns all class types (direct and indirect).classes
(boolean direct) Answers aStream
over the class expressions to which this individual belongs, including super-classes if the flagdirect
isfalse
.content()
Lists the content of the object, i.e., all characteristic statements (seeOntObject.spec()
), plus all additional statements in which this object is the subject, minus those of them whose predicate is an annotation property (annotations are not included).detachClass
(org.apache.jena.rdf.model.Resource clazz) Removes a class assertion statement for the given class.default Stream<OntIndividual>
Lists all different individuals.default Stream<OntDisjoint.Individuals>
Lists allOntDisjoint
sections where this individual is a member.default <X extends org.apache.jena.rdf.model.RDFNode>
XSafely converts this RDF resource to the giventype
interface, if it is possible.getModel()
Returns the ontology model associated with this resource.default boolean
hasOntClass
(OntClass clazz, boolean direct) Answerstrue
if the given class is in the class-type closure.boolean
isLocal()
Determines if this Ontology Resource is locally defined.default Stream<OntNegativeAssertion>
Lists all negative property assertions for this individual.default Stream<OntNegativeAssertion>
negativeAssertions
(OntRelationalProperty property) Lists all negative property assertions for this individual and the given property.ontClass()
Answers a class to which this individual belongs, If there is more than one such class, an arbitrary selection is made.default Stream<OntStatement>
Lists all positive assertions for this individual.default Stream<OntStatement>
positiveAssertions
(OntNamedProperty predicate) Lists all positive property assertions for this individual and the given predicate.default OntIndividual
removeAssertion
(OntNamedProperty property, org.apache.jena.rdf.model.RDFNode value) Removes a positive property assertion including its annotation.default OntIndividual
removeDifferentIndividual
(org.apache.jena.rdf.model.Resource other) Removes a different individual statement for this and specified individuals, including the statement's annotation.default OntIndividual
removeNegativeAssertion
(OntRelationalProperty property, org.apache.jena.rdf.model.RDFNode value) Removes a negative property assertion including its annotation.default OntIndividual
removeSameIndividual
(org.apache.jena.rdf.model.Resource other) Removes a same individual statement for this and specified individuals, including the statement's annotation.default Stream<OntIndividual>
Lists all same individuals.Methods inherited from interface org.apache.jena.graph.FrontsNode
asNode
Methods inherited from interface org.apache.jena.ontapi.model.OntObject
addAnnotation, addAnnotation, addAnnotation, addStatement, annotations, annotationValues, annotationValues, clearAnnotations, 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
-
detachClass
Removes a class assertion statement for the given class. Like others methods#remove..(..)
(seeOntObject.remove(Property, RDFNode)
), this operation does nothing in case no match found and in casenull
is specified it removes all class assertion statements including all their annotations. To delete the individual with its content the methodOntModel.removeOntObject(OntObject)
can be used.- Parameters:
clazz
-OntClass
ornull
to remove all class assertions- Returns:
- this instance to allow cascading calls
- See Also:
-
classes
Answers aStream
over the class expressions to which this individual belongs, including super-classes if the flagdirect
isfalse
. If the flagdirect
istrue
, then only direct types are returned, and the method is effectively equivalent to the methodclasses()
. See alsoOntClass.superClasses(boolean)
.- Parameters:
direct
- iftrue
, only answers thoseOntClass
s that are direct types of this individual, not the superclasses of the class etc- Returns:
- distinct
Stream
ofclass expressions
- See Also:
-
content
Stream<OntStatement> content()Lists the content of the object, i.e., all characteristic statements (seeOntObject.spec()
), plus all additional statements in which this object is the subject, minus those of them whose predicate is an annotation property (annotations are not included). For individuals, content also includes negative property assertion statements.- Specified by:
content
in interfaceOntObject
- Returns:
Stream
of contentOntStatement
s- See Also:
-
asNamed
-
classes
Returns all class types (direct and indirect).- Returns:
Stream
ofOntClass
s
-
hasOntClass
Answerstrue
if the given class is in the class-type closure.- Parameters:
clazz
-OntClass
to testdirect
- seeclasses(boolean)
- Returns:
- true if the specified class found
-
ontClass
Answers a class to which this individual belongs, If there is more than one such class, an arbitrary selection is made.- Returns:
Optional
wrappingOntClass
-
sameIndividuals
Lists all same individuals. The pattern to search for isai owl:sameAs aj
, whereai
is this individual.- Returns:
Stream
ofOntIndividual
s
-
disjoints
Lists allOntDisjoint
sections where this individual is a member.- Returns:
- a
Stream
ofOntDisjoint.Individuals
-
differentIndividuals
Lists all different individuals. The pattern to search for isthisIndividual owl:differentFrom otherIndividual
, whereotherIndividual
is one of the returned.- Returns:
Stream
ofOntIndividual
s- See Also:
-
positiveAssertions
Lists all positive assertions for this individual.- Returns:
Stream
ofOntStatement
s
-
positiveAssertions
Lists all positive property assertions for this individual and the given predicate.- Parameters:
predicate
-OntNamedProperty
ornull
- Returns:
Stream
ofOntStatement
s
-
negativeAssertions
Lists all negative property assertions for this individual.- Returns:
Stream
ofnegative property assertion
s
-
negativeAssertions
Lists all negative property assertions for this individual and the given property.- Parameters:
property
-OntRelationalProperty
ornull
- Returns:
Stream
ofnegative property assertion
s
-
addClassAssertion
Creates and returns a class-assertion statementa rdf:type C
, wherea
is this individual.- Parameters:
clazz
-OntClass
, notnull
- Returns:
OntStatement
to allow subsequent annotations adding- See Also:
-
addDifferentFromStatement
Adds aowl:differentFrom
individual statement.- Parameters:
other
-OntIndividual
, notnull
- Returns:
OntStatement
to provide the ability to add annotations subsequently- See Also:
-
addSameAsStatement
Adds a same individual reference.- Parameters:
other
-OntIndividual
, notnull
- Returns:
OntStatement
to allow subsequent annotations adding- See Also:
-
attachClass
Adds a type (class expression) to this individual.- Parameters:
clazz
-OntClass
- Returns:
- this instance to allow cascading calls
- See Also:
-
addDifferentIndividual
Adds aowl:differentFrom
individual statement and returns this object itself to allow cascading calls.- Parameters:
other
-OntIndividual
, notnull
- Returns:
- this instance to allow cascading calls
- See Also:
-
addSameIndividual
Adds aowl:sameAs
individual statement and returns this object itself to allow cascading calls.- Parameters:
other
- otherOntIndividual
, notnull
- Returns:
- this instance to allow cascading calls
- See Also:
-
addAssertion
default OntIndividual addAssertion(OntAnnotationProperty property, org.apache.jena.rdf.model.RDFNode value) Adds annotation assertionAnnotationAssertion(A s t)
. In general case it iss A t
, wheres
is IRI or anonymous individual,A
- annotation property, andt
- IRI, anonymous individual, or literal.- Parameters:
property
-OntAnnotationProperty
value
-RDFNode
(IRI, anonymous individual, or literal)- Returns:
- this individual to allow cascading calls
- See Also:
-
addAssertion
default OntIndividual addAssertion(OntDataProperty property, org.apache.jena.rdf.model.Literal value) Adds a positive data property assertiona R v
.- Parameters:
property
-OntDataProperty
value
-Literal
- Returns:
- this individual to allow cascading calls
- See Also:
-
addAssertion
Adds a positive object property assertiona1 PN a2
.- Parameters:
property
-OntObjectProperty.Named
named object propertyvalue
-OntIndividual
other individual- Returns:
- this individual to allow cascading calls
- See Also:
-
addProperty
default OntIndividual addProperty(OntNamedProperty property, org.apache.jena.rdf.model.RDFNode value) Adds a property assertion statement. Caution: this method offers a way to add a statement that is contrary to the OWL2 specification. For example, it is possible to addobject property
-literal
pair, that is not object property assertion.- Parameters:
property
-OntNamedProperty
, notnull
value
-RDFNode
, notnull
- Returns:
- this instance to allow cascading calls
- See Also:
-
Resource.addProperty(Property, RDFNode)
removeAssertion(OntNamedProperty, RDFNode)
-
addNegativeAssertion
Adds a negative object property assertion.Functional syntax:
NegativeObjectPropertyAssertion(P a1 a2)
RDF Syntax:_:x rdf:type owl:NegativePropertyAssertion . _:x owl:sourceIndividual a1 . _:x owl:assertionProperty P . _:x owl:targetIndividual a2 .
- Parameters:
property
-OntObjectProperty
value
-OntIndividual
other individual- Returns:
- this individual to allow cascading calls
-
addNegativeAssertion
default OntIndividual addNegativeAssertion(OntDataProperty property, org.apache.jena.rdf.model.Literal value) Adds a negative data property assertion.Functional syntax:
NegativeDataPropertyAssertion(R a v)
RDF Syntax:_:x rdf:type owl:NegativePropertyAssertion. _:x owl:sourceIndividual a . _:x owl:assertionProperty R . _:x owl:targetValue v .
- Parameters:
property
-OntDataProperty
value
-Literal
- Returns:
- this individual to allow cascading calls
-
removeAssertion
default OntIndividual removeAssertion(OntNamedProperty property, org.apache.jena.rdf.model.RDFNode value) Removes a positive property assertion including its annotation.- Parameters:
property
-OntNamedProperty
, can benull
to remove all positive property assertionsvalue
-RDFNode
(eitherOntIndividual
orLiteral
), can benull
to remove all assertions for the predicateproperty
- Returns:
- this instance to allow cascading calls
- See Also:
-
removeNegativeAssertion
default OntIndividual removeNegativeAssertion(OntRelationalProperty property, org.apache.jena.rdf.model.RDFNode value) Removes a negative property assertion including its annotation.- Parameters:
property
-OntNamedProperty
, can benull
to remove all negative property assertionsvalue
-RDFNode
(eitherOntIndividual
orLiteral
), can benull
to remove all assertions for the predicateproperty
- Returns:
- this instance to allow cascading calls
-
removeDifferentIndividual
Removes a different individual statement for this and specified individuals, including the statement's annotation. No-op in case no different individuals are found. Removes all triples with the predicateowl:differentFrom
ifnull
is specified.- Parameters:
other
-Resource
ornull
to remove all different individuals- Returns:
- this instance to allow cascading calls
- See Also:
-
removeSameIndividual
Removes a same individual statement for this and specified individuals, including the statement's annotation. No-op in case no same individuals are found. Removes all triples with the predicateowl:sameAs
ifnull
is specified.- Parameters:
other
-Resource
ornull
to remove all same individuals- Returns:
- this instance to allow cascading calls
- 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:
-
addLabel
Creates_:this rdfs:label "txt"^^xsd:string
statement. -
addLabel
Adds the given localized text annotation with builtinrdfs:label
predicate. -
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
default OntIndividual annotate(OntAnnotationProperty predicate, org.apache.jena.rdf.model.RDFNode value) 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)
-