- All Implemented Interfaces:
FrontsNode
,OntResource
,RDFNode
,Resource
- Direct Known Subclasses:
AllDifferentImpl
,DataRangeImpl
,IndividualImpl
,OntClassImpl
,OntologyImpl
,OntPropertyImpl
Abstract base class to provide shared implementation for implementations of ontology resources.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Implementation
A factory for generating OntResource facets from nodes in enhanced graphs.static final String[]
List of namespaces that are reserved for known ontology languagesFields inherited from class org.apache.jena.rdf.model.impl.ResourceImpl
rdfNodeFactory
-
Constructor Summary
ConstructorsConstructorDescriptionOntResourceImpl
(Node n, EnhGraph g) Construct an ontology resource represented by the given node in the given graph. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComment
(String comment, String lang) Add the given comment to this resource.void
addComment
(Literal comment) Add the given comment to this resource.void
addDifferentFrom
(Resource res) Add a statement declaring that this resource is distinct from the given resource.void
addIsDefinedBy
(Resource res) Add a resource that is declared to provide a definition of this resource.void
Add the given label to this resource.void
Add the given label to this resource.void
addRDFType
(Resource cls) Add the given class as one of therdf:type
's for this resource.void
Add a resource that is declared to be equivalent to this resource.void
addSeeAlso
(Resource res) Add a resource that is declared to provided additional information about the definition of this resourcevoid
addVersionInfo
(String info) Add the given version information to this resource.Answer a view of this resource as an 'all different' declarationAnswer a view of this resource as an annotation propertyasClass()
Answer a view of this resource as a classAnswer a view of this resource as a data rangeAnswer a view of this resource as a datatype propertyAnswer a view of this resource as an individualAnswer a view of this resource as an object propertyAnswer a view of this resource as an ontology description nodeAnswer a view of this resource as a propertyint
Answer the cardinality of the given property on this resource.getComment
(String lang) Answer the comment string for this object.Answer a resource that is declared to be distinct from this resource.Answer a resource that is declared to provide a definition of this resource.Answer the label string for this object.Answer the model that this resource is attached to, assuming that it is anOntModel
.Answer the ontology language profile that governs the ontology model to which this ontology resource is attached.getPropertyValue
(Property property) Answer the value of a given RDF property for this ontology resource, or null if it doesn't have one.Answer therdf:type
(ie the class) of this resource.getRDFType
(boolean direct) Answer therdf:type
(ie the class) of this resource.Answer a resource that is declared to be the same as this resource.Answer a resource that provides additional information about this resource.Answer the version information string for this object.boolean
hasComment
(String comment, String lang) Answer true if this resource has the given comment.boolean
hasComment
(Literal comment) Answer true if this resource has the given comment.boolean
Answer true if this resource has the given labelboolean
Answer true if this resource has the given labelboolean
hasRDFType
(String uri) Answer true if this resource is a member of the class denoted by the given URI.boolean
hasRDFType
(Resource ontClass) Answer true if this resource is a member of the class denoted by the given class resource.boolean
hasRDFType
(Resource ontClass, boolean direct) Answer true if this resource is a member of the class denoted by the given class resource.boolean
hasSeeAlso
(Resource res) Answer true if this resource has the given resource as a source of additional information.boolean
hasVersionInfo
(String info) Answer true if this resource has the given version informationboolean
Answer true if this resource can be viewed as an 'all different' declarationboolean
Answer true if this resource can be viewed as an annotation propertyboolean
isClass()
Answer true if this resource can be viewed as a classboolean
Answer true if this resource can be viewed as a data rangeboolean
Answer true if this resource can be viewed as a datatype propertyboolean
isDefinedBy
(Resource res) Answer true if this resource is defined by the given resource.boolean
isDifferentFrom
(Resource res) Answer true if this resource is different from the given resource.boolean
Answer true if this resource can be viewed as an individualboolean
Answer true if this resource can be viewed as an object propertyboolean
Answer true if this resource is a symbol in one of the standard ontology languages supported by Jena: RDF, RDFS, OWL or DAML+OIL.boolean
Answer true if this resource can be viewed as an ontology description nodeboolean
Answer true if this resource can be viewed as a propertyboolean
Answer true if this resource is the same as the given resource.listComments
(String lang) Answer an iterator over all of the comment literals for this resource.Answer an iterator over all of the resources that are declared to be different from this resource.Answer an iterator over all of the resources that are declared to define this resource.listLabels
(String lang) Answer an iterator over all of the label literals for this resource.listPropertyValues
(Property property) Answer an iterator over the set of all values for a given RDF property.listRDFTypes
(boolean direct) Answer an iterator over the RDF classes to which this resource belongs.Answer an iterator over all of the resources that are declared to be the same as this resource.Answer an iterator over all of the resources that are declared to provide addition information about this resource.Answer an iterator over all of the version info strings for this resource.void
remove()
Removes this resource from the ontology by deleting any statements that refer to it, as either statement-subject or statement-object.void
removeComment
(String comment, String lang) Remove the statement that the given string is a comment on this resource.void
removeComment
(Literal comment) Remove the statement that the given string is a comment on this resource.void
removeDefinedBy
(Resource res) Remove the statement that this resource is defined by the given resource.void
Remove the statement that this resource is different the given resource.void
removeLabel
(String label, String lang) Remove the statement that the given string is a label for this resource.void
removeLabel
(Literal label) Remove the statement that the given string is a label for this resource.void
removeProperty
(Property property, RDFNode value) Remove the specific RDF property-value pair from this DAML resource.void
removeRDFType
(Resource cls) Remove the statement that this resource is of the given RDF type.void
removeSameAs
(Resource res) Remove the statement that this resource is the same as the given resource.void
removeSeeAlso
(Resource res) Remove the statement indicating the given resource as a source of additional information about this resource.void
removeVersionInfo
(String info) Remove the statement that the given string provides version information about this resource.void
setComment
(String comment, String lang) Assert that the given string is the comment on this resource.void
setDifferentFrom
(Resource res) Assert that the given resource and this resource are distinct.void
setIsDefinedBy
(Resource res) Assert that the given resource provides a source of definitions about this resource.void
Assert that the given string is the value of the label for this resource.void
setPropertyValue
(Property property, RDFNode value) Set the value of the given property of this ontology resource to the given value, encoded as an RDFNode.void
setRDFType
(Resource cls) Set the RDF type (i.e.void
Assert equivalence between the given resource and this resource.void
setSeeAlso
(Resource res) Assert that the given resource provides additional information about the definition of this resourcevoid
setVersionInfo
(String info) Assert that the given string is the value of the version info for this resource.Methods inherited from class org.apache.jena.rdf.model.impl.ResourceImpl
abort, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, asLiteral, asResource, begin, commit, getId, getLocalName, getModel, getNameSpace, getProperty, getProperty, getPropertyResourceValue, getRequiredProperty, getRequiredProperty, getStmtTerm, getURI, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasProperty, hasProperty, hasProperty, hasProperty, hasURI, inModel, listProperties, listProperties, listProperties, removeAll, removeProperties, toString, visitWith
Methods inherited from class org.apache.jena.enhanced.EnhNode
as, asNode, canAs, equals, getGraph, hashCode, isAnon, isLiteral, isResource, isStmtResource, isURIResource, isValid, viewAs
Methods inherited from class org.apache.jena.enhanced.Polymorphic
addView, supports
Methods inherited from interface org.apache.jena.graph.FrontsNode
asNode
Methods inherited from interface org.apache.jena.rdf.model.RDFNode
as, asLiteral, asResource, canAs, getModel, 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, getRequiredProperty, getStmtTerm, getURI, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasLiteral, hasProperty, hasProperty, hasProperty, hasProperty, hasURI, inModel, listProperties, listProperties, listProperties, removeAll, removeProperties, toString
-
Field Details
-
KNOWN_LANGUAGES
List of namespaces that are reserved for known ontology languages -
factory
A factory for generating OntResource facets from nodes in enhanced graphs. Note: should not be invoked directly by user code: useas()
instead.
-
-
Constructor Details
-
OntResourceImpl
Construct an ontology resource represented by the given node in the given graph.
- Parameters:
n
- The node that represents the resourceg
- The enh graph that contains n
-
-
Method Details
-
getOntModel
Answer the model that this resource is attached to, assuming that it is an
OntModel
. If this resource is not attached to any model, or is (unusually) attached to a model that is not anOntModel
, answer null.- Specified by:
getOntModel
in interfaceOntResource
- Returns:
- The ont model that this resource is attached to, or null.
-
getProfile
Answer the ontology language profile that governs the ontology model to which this ontology resource is attached.
- Specified by:
getProfile
in interfaceOntResource
- Returns:
- The language profile for this ontology resource
- Throws:
JenaException
- if the resource is not bound to an OntModel, since that's the only way to get the profile for the resource
-
isOntLanguageTerm
public boolean isOntLanguageTerm()Answer true if this resource is a symbol in one of the standard ontology languages supported by Jena: RDF, RDFS, OWL or DAML+OIL. Since these languages have restricted namespaces, this check is simply a convenient way of testing whether this resource is in one of those pre-declared namespaces.
- Specified by:
isOntLanguageTerm
in interfaceOntResource
- Returns:
- True if this is a term in the language namespace for OWL, RDF, RDFS or DAML+OIL.
-
setSameAs
Assert equivalence between the given resource and this resource. Any existing statements for
sameAs
will be removed.- Specified by:
setSameAs
in interfaceOntResource
- Parameters:
res
- The resource that is declared to be the same as this resource- Throws:
ProfileException
- If theProfile.SAME_AS()
property is not supported in the current language profile.
-
addSameAs
Add a resource that is declared to be equivalent to this resource.
- Specified by:
addSameAs
in interfaceOntResource
- Parameters:
res
- A resource that declared to be the same as this resource- Throws:
ProfileException
- If theProfile.SAME_AS()
property is not supported in the current language profile.
-
getSameAs
Answer a resource that is declared to be the same as this resource. If there is more than one such resource, an arbitrary selection is made.
- Specified by:
getSameAs
in interfaceOntResource
- Returns:
- res An ont resource that declared to be the same as this resource
- Throws:
ProfileException
- If theProfile.SAME_AS()
property is not supported in the current language profile.
-
listSameAs
Answer an iterator over all of the resources that are declared to be the same as this resource. Each element of the iterator will be an
OntResource
.- Specified by:
listSameAs
in interfaceOntResource
- Returns:
- An iterator over the resources equivalent to this resource.
- Throws:
ProfileException
- If theProfile.SAME_AS()
property is not supported in the current language profile.
-
isSameAs
Answer true if this resource is the same as the given resource.
- Specified by:
isSameAs
in interfaceOntResource
- Parameters:
res
- A resource to test against- Returns:
- True if the resources are declared the same via a
sameAs
statement.
-
removeSameAs
Remove the statement that this resource is the same as the given resource. If this statement is not true of the current model, nothing happens.
- Specified by:
removeSameAs
in interfaceOntResource
- Parameters:
res
- A resource that may be declared to be the sameAs this resource
-
setDifferentFrom
Assert that the given resource and this resource are distinct. Any existing statements for
differentFrom
will be removed.- Specified by:
setDifferentFrom
in interfaceOntResource
- Parameters:
res
- The resource that is declared to be distinct from this resource- Throws:
ProfileException
- If theProfile.DIFFERENT_FROM()
property is not supported in the current language profile.
-
addDifferentFrom
Add a statement declaring that this resource is distinct from the given resource.
- Specified by:
addDifferentFrom
in interfaceOntResource
- Parameters:
res
- A resource that declared to be distinct from this resource- Throws:
ProfileException
- If theProfile.DIFFERENT_FROM()
property is not supported in the current language profile.
-
getDifferentFrom
Answer a resource that is declared to be distinct from this resource. If there is more than one such resource, an arbitrary selection is made.
- Specified by:
getDifferentFrom
in interfaceOntResource
- Returns:
- res An ont resource that declared to be different from this resource
- Throws:
ProfileException
- If theProfile.DIFFERENT_FROM()
property is not supported in the current language profile.
-
listDifferentFrom
Answer an iterator over all of the resources that are declared to be different from this resource. Each element of the iterator will be an
OntResource
.- Specified by:
listDifferentFrom
in interfaceOntResource
- Returns:
- An iterator over the resources different from this resource.
- Throws:
ProfileException
- If theProfile.DIFFERENT_FROM()
property is not supported in the current language profile.
-
isDifferentFrom
Answer true if this resource is different from the given resource.
- Specified by:
isDifferentFrom
in interfaceOntResource
- Parameters:
res
- A resource to test against- Returns:
- True if the resources are declared to be distinct via a
differentFrom
statement.
-
removeDifferentFrom
Remove the statement that this resource is different the given resource. If this statement is not true of the current model, nothing happens.
- Specified by:
removeDifferentFrom
in interfaceOntResource
- Parameters:
res
- A resource that may be declared to be differentFrom this resource
-
setSeeAlso
Assert that the given resource provides additional information about the definition of this resource
- Specified by:
setSeeAlso
in interfaceOntResource
- Parameters:
res
- A resource that can provide additional information about this resource- Throws:
ProfileException
- If theProfile.SEE_ALSO()
property is not supported in the current language profile.
-
addSeeAlso
Add a resource that is declared to provided additional information about the definition of this resource
- Specified by:
addSeeAlso
in interfaceOntResource
- Parameters:
res
- A resource that provides extra information on this resource- Throws:
ProfileException
- If theProfile.SEE_ALSO()
property is not supported in the current language profile.
-
getSeeAlso
Answer a resource that provides additional information about this resource. If more than one such resource is defined, make an arbitrary choice.
- Specified by:
getSeeAlso
in interfaceOntResource
- Returns:
- res A resource that provides additional information about this resource
- Throws:
ProfileException
- If theProfile.SEE_ALSO()
property is not supported in the current language profile.
-
listSeeAlso
Answer an iterator over all of the resources that are declared to provide addition information about this resource.
- Specified by:
listSeeAlso
in interfaceOntResource
- Returns:
- An iterator over the resources providing additional definition on this resource.
- Throws:
ProfileException
- If theProfile.SEE_ALSO()
property is not supported in the current language profile.
-
hasSeeAlso
Answer true if this resource has the given resource as a source of additional information.
- Specified by:
hasSeeAlso
in interfaceOntResource
- Parameters:
res
- A resource to test against- Returns:
- True if the
res
provides more information on this resource.
-
removeSeeAlso
Remove the statement indicating the given resource as a source of additional information about this resource. If this statement is not true of the current model, nothing happens.
- Specified by:
removeSeeAlso
in interfaceOntResource
- Parameters:
res
- A resource that may be declared to provide additional information about this resource
-
setIsDefinedBy
Assert that the given resource provides a source of definitions about this resource. Any existing statements for
isDefinedBy
will be removed.- Specified by:
setIsDefinedBy
in interfaceOntResource
- Parameters:
res
- The resource that is declared to be a definition of this resource.- Throws:
ProfileException
- If theProfile.IS_DEFINED_BY()
property is not supported in the current language profile.
-
addIsDefinedBy
Add a resource that is declared to provide a definition of this resource.
- Specified by:
addIsDefinedBy
in interfaceOntResource
- Parameters:
res
- A defining resource- Throws:
ProfileException
- If theProfile.IS_DEFINED_BY()
property is not supported in the current language profile.
-
getIsDefinedBy
Answer a resource that is declared to provide a definition of this resource. If there is more than one such resource, an arbitrary selection is made.
- Specified by:
getIsDefinedBy
in interfaceOntResource
- Returns:
- res An ont resource that is declared to provide a definition of this resource
- Throws:
ProfileException
- If theProfile.IS_DEFINED_BY()
property is not supported in the current language profile.
-
listIsDefinedBy
Answer an iterator over all of the resources that are declared to define this resource.
- Specified by:
listIsDefinedBy
in interfaceOntResource
- Returns:
- An iterator over the resources defining this resource.
- Throws:
ProfileException
- If theProfile.IS_DEFINED_BY()
property is not supported in the current language profile.
-
isDefinedBy
Answer true if this resource is defined by the given resource.
- Specified by:
isDefinedBy
in interfaceOntResource
- Parameters:
res
- A resource to test against- Returns:
- True if
res
defines this resource.
-
removeDefinedBy
Remove the statement that this resource is defined by the given resource. If this statement is not true of the current model, nothing happens.
- Specified by:
removeDefinedBy
in interfaceOntResource
- Parameters:
res
- A resource that may be declared to define this resource
-
setVersionInfo
Assert that the given string is the value of the version info for this resource. Any existing statements for
versionInfo
will be removed.- Specified by:
setVersionInfo
in interfaceOntResource
- Parameters:
info
- The version information for this resource- Throws:
ProfileException
- If theProfile.VERSION_INFO()
property is not supported in the current language profile.
-
addVersionInfo
Add the given version information to this resource.
- Specified by:
addVersionInfo
in interfaceOntResource
- Parameters:
info
- A version information string for this resource- Throws:
ProfileException
- If theProfile.VERSION_INFO()
property is not supported in the current language profile.
-
getVersionInfo
Answer the version information string for this object. If there is more than one such resource, an arbitrary selection is made.
- Specified by:
getVersionInfo
in interfaceOntResource
- Returns:
- A version info string
- Throws:
ProfileException
- If theProfile.VERSION_INFO()
property is not supported in the current language profile.
-
listVersionInfo
Answer an iterator over all of the version info strings for this resource.
- Specified by:
listVersionInfo
in interfaceOntResource
- Returns:
- An iterator over the version info strings for this resource.
- Throws:
ProfileException
- If theProfile.VERSION_INFO()
property is not supported in the current language profile.
-
hasVersionInfo
Answer true if this resource has the given version information
- Specified by:
hasVersionInfo
in interfaceOntResource
- Parameters:
info
- Version information to test for- Returns:
- True if this resource has
info
as version information.
-
removeVersionInfo
Remove the statement that the given string provides version information about this resource. If this statement is not true of the current model, nothing happens.
- Specified by:
removeVersionInfo
in interfaceOntResource
- Parameters:
info
- A version information string to be removed
-
setLabel
Assert that the given string is the value of the label for this resource. Any existing statements for
label
will be removed.- Specified by:
setLabel
in interfaceOntResource
- Parameters:
label
- The label for this resourcelang
- The language attribute for this label (EN, FR, etc) or null if not specified.- Throws:
ProfileException
- If theProfile.LABEL()
property is not supported in the current language profile.
-
addLabel
Add the given label to this resource.
- Specified by:
addLabel
in interfaceOntResource
- Parameters:
label
- A label string for this resourcelang
- The language attribute for this label (EN, FR, etc) or null if not specified.- Throws:
ProfileException
- If theProfile.LABEL()
property is not supported in the current language profile.
-
addLabel
Add the given label to this resource.
- Specified by:
addLabel
in interfaceOntResource
- Parameters:
label
- The literal label- Throws:
ProfileException
- If theProfile.LABEL()
property is not supported in the current language profile.
-
getLabel
Answer the label string for this object. If there is more than one such resource, an arbitrary selection is made.
- Specified by:
getLabel
in interfaceOntResource
- Parameters:
lang
- The language attribute for the desired label (EN, FR, etc) or null for don't care. Will attempt to retreive the most specific label matching the given language- Returns:
- A label string matching the given language, or null if there is no matching label.
- Throws:
ProfileException
- If theProfile.LABEL()
property is not supported in the current language profile.
-
listLabels
Answer an iterator over all of the label literals for this resource.
- Specified by:
listLabels
in interfaceOntResource
- Parameters:
lang
- The language to restrict any label values to, or null to select all languages- Returns:
- An iterator over RDF
Literal
's. - Throws:
ProfileException
- If theProfile.LABEL()
property is not supported in the current language profile.
-
hasLabel
Answer true if this resource has the given label
- Specified by:
hasLabel
in interfaceOntResource
- Parameters:
label
- The label to test forlang
- The optional language tag, or null for don't care.- Returns:
- True if this resource has
label
as a label.
-
hasLabel
Answer true if this resource has the given label
- Specified by:
hasLabel
in interfaceOntResource
- Parameters:
label
- The label to test for- Returns:
- True if this resource has
label
as a label.
-
removeLabel
Remove the statement that the given string is a label for this resource. If this statement is not true of the current model, nothing happens.
- Specified by:
removeLabel
in interfaceOntResource
- Parameters:
label
- A label string to be removedlang
- A lang tag
-
removeLabel
Remove the statement that the given string is a label for this resource. If this statement is not true of the current model, nothing happens.
- Specified by:
removeLabel
in interfaceOntResource
- Parameters:
label
- A label literal to be removed
-
setComment
Assert that the given string is the comment on this resource. Any existing statements for
comment
will be removed.- Specified by:
setComment
in interfaceOntResource
- Parameters:
comment
- The comment for this resourcelang
- The language attribute for this comment (EN, FR, etc) or null if not specified.- Throws:
ProfileException
- If theProfile.COMMENT()
property is not supported in the current language profile.
-
addComment
Add the given comment to this resource.
- Specified by:
addComment
in interfaceOntResource
- Parameters:
comment
- A comment string for this resourcelang
- The language attribute for this comment (EN, FR, etc) or null if not specified.- Throws:
ProfileException
- If theProfile.COMMENT()
property is not supported in the current language profile.
-
addComment
Add the given comment to this resource.
- Specified by:
addComment
in interfaceOntResource
- Parameters:
comment
- The literal comment- Throws:
ProfileException
- If theProfile.COMMENT()
property is not supported in the current language profile.
-
getComment
Answer the comment string for this object. If there is more than one such resource, an arbitrary selection is made.
- Specified by:
getComment
in interfaceOntResource
- Parameters:
lang
- The language attribute for the desired comment (EN, FR, etc) or null for don't care. Will attempt to retreive the most specific comment matching the given language- Returns:
- A comment string matching the given language, or null if there is no matching comment.
- Throws:
ProfileException
- If theProfile.COMMENT()
property is not supported in the current language profile.
-
listComments
Answer an iterator over all of the comment literals for this resource.
- Specified by:
listComments
in interfaceOntResource
- Parameters:
lang
- The language tag to restrict the listed comments to, or null to select all comments- Returns:
- An iterator over RDF
Literal
's. - Throws:
ProfileException
- If theProfile.COMMENT()
property is not supported in the current language profile.
-
hasComment
Answer true if this resource has the given comment.
- Specified by:
hasComment
in interfaceOntResource
- Parameters:
comment
- The comment to test forlang
- The optional language tag, or null for don't care.- Returns:
- True if this resource has
comment
as a comment.
-
hasComment
Answer true if this resource has the given comment.
- Specified by:
hasComment
in interfaceOntResource
- Parameters:
comment
- The comment to test for- Returns:
- True if this resource has
comment
as a comment.
-
removeComment
Remove the statement that the given string is a comment on this resource. If this statement is not true of the current model, nothing happens.
- Specified by:
removeComment
in interfaceOntResource
- Parameters:
comment
- A comment string to be removedlang
- A lang tag
-
removeComment
Remove the statement that the given string is a comment on this resource. If this statement is not true of the current model, nothing happens.
- Specified by:
removeComment
in interfaceOntResource
- Parameters:
comment
- A comment literal to be removed
-
setRDFType
Set the RDF type (i.e. the class) for this resource, replacing any existing
rdf:type
property. Any existing statements for the RDF type will first be removed.- Specified by:
setRDFType
in interfaceOntResource
- Parameters:
cls
- The RDF resource denoting the new value for therdf:type
property, which will replace any existing type property.- See Also:
-
addRDFType
Add the given class as one of the
rdf:type
's for this resource.- Specified by:
addRDFType
in interfaceOntResource
- Parameters:
cls
- An RDF resource denoting a new value for therdf:type
property.- See Also:
-
getRDFType
Answer the
rdf:type
(ie the class) of this resource. If there is more than one type for this resource, the return value will be one of the values, but it is not specified which one (nor that it will consistently be the same one each time). Equivalent togetRDFType( false )
.- Specified by:
getRDFType
in interfaceOntResource
- Returns:
- A resource that is the rdf:type for this resource, or one of them if more than one is defined.
- See Also:
-
getRDFType
Answer the
rdf:type
(ie the class) of this resource. If there is more than one type for this resource, the return value will be one of the values, but it is not specified which one (nor that it will consistently be the same one each time).- Specified by:
getRDFType
in interfaceOntResource
- Parameters:
direct
- If true, only consider the direct types of this resource, and not the super-classes of the type(s).- Returns:
- A resource that is the rdf:type for this resource, or one of them if more than one is defined.
- See Also:
-
listRDFTypes
Answer an iterator over the RDF classes to which this resource belongs.
- Specified by:
listRDFTypes
in interfaceOntResource
- Parameters:
direct
- If true, only answer those resources that are direct types of this resource, not the super-classes of the class etc.- Returns:
- An iterator over the set of this resource's classes, each of which
will be a
Resource
. - See Also:
-
hasRDFType
Answer true if this resource is a member of the class denoted by the given URI.
- Specified by:
hasRDFType
in interfaceOntResource
- Parameters:
uri
- Denotes the URI of a class to which this value may belong- Returns:
- True if this resource has the given class as one of its
rdf:type
's. - See Also:
-
hasRDFType
Answer true if this resource is a member of the class denoted by the given class resource. Includes all available types, so is equivalent to
hasRDF( ontClass, false );
- Specified by:
hasRDFType
in interfaceOntResource
- Parameters:
ontClass
- Denotes a class to which this value may belong- Returns:
- True if this resource has the given class as one of its
rdf:type
's. - See Also:
-
hasRDFType
Answer true if this resource is a member of the class denoted by the given class resource.
- Specified by:
hasRDFType
in interfaceOntResource
- Parameters:
ontClass
- Denotes a class to which this value may belongdirect
- If true, only consider the direct types of this resource, ignoring the super-classes of the stated types.- Returns:
- True if this resource has the given class as one of its
rdf:type
's. - See Also:
-
removeRDFType
Remove the statement that this resource is of the given RDF type. If this statement is not true of the current model, nothing happens.
- Specified by:
removeRDFType
in interfaceOntResource
- Parameters:
cls
- A resource denoting a class that that is to be removed from the classes of this resource- See Also:
-
getCardinality
Answer the cardinality of the given property on this resource. The cardinality is the number of distinct values there are for the property.
- Specified by:
getCardinality
in interfaceOntResource
- Parameters:
p
- A property- Returns:
- The cardinality for the property
p
on this resource, as an integer greater than or equal to zero.
-
setPropertyValue
Set the value of the given property of this ontology resource to the given value, encoded as an RDFNode. Maintains the invariant that there is at most one value of the property for a given resource, so existing property values are first removed. To add multiple properties, use
addProperty
.- Specified by:
setPropertyValue
in interfaceOntResource
- Parameters:
property
- The property to updatevalue
- The new value of the property as an RDFNode, or null to effectively remove this property.
-
getPropertyValue
Answer the value of a given RDF property for this ontology resource, or null if it doesn't have one. The value is returned as an RDFNode, from which the concrete data value can be extracted for literals. If the value is a resource, it will present the
OntResource
facet. If there is more than one RDF statement with the given property for the current value, it is not defined which of the values will be returned.- Specified by:
getPropertyValue
in interfaceOntResource
- Parameters:
property
- An RDF property- Returns:
- An RDFNode whose value is the value, or one of the values, of the given property. If the property is not defined the method returns null.
-
listPropertyValues
Answer an iterator over the set of all values for a given RDF property. Each value in the iterator will be an RDFNode, representing the value (object) of each statement in the underlying model.
- Specified by:
listPropertyValues
in interfaceOntResource
- Parameters:
property
- The property whose values are sought- Returns:
- An Iterator over the values of the property
-
remove
public void remove()Removes this resource from the ontology by deleting any statements that refer to it, as either statement-subject or statement-object. If this resource is a property, this method will not remove statements whose predicate is this property.
Caveat: Jena RDF models contain statements, not resources per se, so this method simulates removal of an object by removing all of the statements that have this resource as subject or object, with one exception. If the resource is referenced in an RDF List, i.e. as the object of an
rdf:first
statement in a list cell, this reference is not removed. Removing an arbitraryrdf:first
statement from the midst of a list, without doing other work to repair the list, would leave an ill-formed list in the model. Therefore, if this resource is known to appear in a list somewhere in the model, it should be separately deleted from that list before calling this remove method.- Specified by:
remove
in interfaceOntResource
-
removeProperty
Remove the specific RDF property-value pair from this DAML resource.
- Specified by:
removeProperty
in interfaceOntResource
- Parameters:
property
- The property to be removedvalue
- The specific value of the property to be removed
-
asAnnotationProperty
Answer a view of this resource as an annotation property
- Specified by:
asAnnotationProperty
in interfaceOntResource
- Returns:
- This resource, but viewed as an AnnotationProperty
- Throws:
ConversionException
- if the resource cannot be converted to an annotation property
-
asProperty
Answer a view of this resource as a property
- Specified by:
asProperty
in interfaceOntResource
- Returns:
- This resource, but viewed as an OntProperty
- Throws:
ConversionException
- if the resource cannot be converted to a property
-
asObjectProperty
Answer a view of this resource as an object property
- Specified by:
asObjectProperty
in interfaceOntResource
- Returns:
- This resource, but viewed as an ObjectProperty
- Throws:
ConversionException
- if the resource cannot be converted to an object property
-
asDatatypeProperty
Answer a view of this resource as a datatype property
- Specified by:
asDatatypeProperty
in interfaceOntResource
- Returns:
- This resource, but viewed as a DatatypeProperty
- Throws:
ConversionException
- if the resource cannot be converted to a datatype property
-
asIndividual
Answer a view of this resource as an individual
- Specified by:
asIndividual
in interfaceOntResource
- Returns:
- This resource, but viewed as an Individual
- Throws:
ConversionException
- if the resource cannot be converted to an individual
-
asClass
Answer a view of this resource as a class
- Specified by:
asClass
in interfaceOntResource
- Returns:
- This resource, but viewed as an OntClass
- Throws:
ConversionException
- if the resource cannot be converted to a class
-
asOntology
Answer a view of this resource as an ontology description node
- Specified by:
asOntology
in interfaceOntResource
- Returns:
- This resource, but viewed as an Ontology
- Throws:
ConversionException
- if the resource cannot be converted to an ontology description node
-
asAllDifferent
Answer a view of this resource as an 'all different' declaration
- Specified by:
asAllDifferent
in interfaceOntResource
- Returns:
- This resource, but viewed as an AllDifferent node
- Throws:
ConversionException
- if the resource cannot be converted to an all different declaration
-
asDataRange
Answer a view of this resource as a data range
- Specified by:
asDataRange
in interfaceOntResource
- Returns:
- This resource, but viewed as a DataRange
- Throws:
ConversionException
- if the resource cannot be converted to a data range
-
isAnnotationProperty
public boolean isAnnotationProperty()Answer true if this resource can be viewed as an annotation property
- Specified by:
isAnnotationProperty
in interfaceOntResource
- Returns:
- True if this resource can be viewed as an AnnotationProperty
-
isProperty
public boolean isProperty()Answer true if this resource can be viewed as a property
- Specified by:
isProperty
in interfaceOntResource
- Returns:
- True if this resource can be viewed as an OntProperty
-
isObjectProperty
public boolean isObjectProperty()Answer true if this resource can be viewed as an object property
- Specified by:
isObjectProperty
in interfaceOntResource
- Returns:
- True if this resource can be viewed as an ObjectProperty
-
isDatatypeProperty
public boolean isDatatypeProperty()Answer true if this resource can be viewed as a datatype property
- Specified by:
isDatatypeProperty
in interfaceOntResource
- Returns:
- True if this resource can be viewed as a DatatypeProperty
-
isIndividual
public boolean isIndividual()Answer true if this resource can be viewed as an individual
- Specified by:
isIndividual
in interfaceOntResource
- Returns:
- True if this resource can be viewed as an Individual
-
isClass
public boolean isClass()Answer true if this resource can be viewed as a class
- Specified by:
isClass
in interfaceOntResource
- Returns:
- True if this resource can be viewed as an OntClass
-
isOntology
public boolean isOntology()Answer true if this resource can be viewed as an ontology description node
- Specified by:
isOntology
in interfaceOntResource
- Returns:
- True if this resource can be viewed as an Ontology
-
isDataRange
public boolean isDataRange()Answer true if this resource can be viewed as a data range
- Specified by:
isDataRange
in interfaceOntResource
- Returns:
- True if this resource can be viewed as a DataRange
-
isAllDifferent
public boolean isAllDifferent()Answer true if this resource can be viewed as an 'all different' declaration
- Specified by:
isAllDifferent
in interfaceOntResource
- Returns:
- True if this resource can be viewed as an AllDifferent node
-