public class OntResourceImpl extends ResourceImpl implements OntResource
Abstract base class to provide shared implementation for implementations of ontology resources.
| Modifier and Type | Field and Description |
|---|---|
static Implementation |
factory
A factory for generating OntResource facets from nodes in enhanced graphs.
|
static String[] |
KNOWN_LANGUAGES
List of namespaces that are reserved for known ontology languages
|
rdfNodeFactory| Constructor and Description |
|---|
OntResourceImpl(Node n,
EnhGraph g)
Construct an ontology resource represented by the given node in the given graph.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addComment(Literal comment)
Add the given comment to this resource.
|
void |
addComment(String comment,
String lang)
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 |
addLabel(Literal label)
Add the given label to this resource.
|
void |
addLabel(String label,
String lang)
Add the given label to this resource.
|
void |
addRDFType(Resource cls)
Add the given class as one of the
rdf:type's for this resource. |
void |
addSameAs(Resource res)
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 resource
|
void |
addVersionInfo(String info)
Add the given version information to this resource.
|
AllDifferent |
asAllDifferent()
Answer a view of this resource as an 'all different' declaration
|
AnnotationProperty |
asAnnotationProperty()
Answer a view of this resource as an annotation property
|
OntClass |
asClass()
Answer a view of this resource as a class
|
DataRange |
asDataRange()
Answer a view of this resource as a data range
|
DatatypeProperty |
asDatatypeProperty()
Answer a view of this resource as a datatype property
|
Individual |
asIndividual()
Answer a view of this resource as an individual
|
ObjectProperty |
asObjectProperty()
Answer a view of this resource as an object property
|
Ontology |
asOntology()
Answer a view of this resource as an ontology description node
|
OntProperty |
asProperty()
Answer a view of this resource as a property
|
int |
getCardinality(Property p)
Answer the cardinality of the given property on this resource.
|
String |
getComment(String lang)
Answer the comment string for this object.
|
OntResource |
getDifferentFrom()
Answer a resource that is declared to be distinct from this resource.
|
Resource |
getIsDefinedBy()
Answer a resource that is declared to provide a definition of this resource.
|
String |
getLabel(String lang)
Answer the label string for this object.
|
OntModel |
getOntModel()
Answer the model that this resource is attached to, assuming that it
is an
OntModel. |
Profile |
getProfile()
Answer the ontology language profile that governs the ontology model to which
this ontology resource is attached.
|
RDFNode |
getPropertyValue(Property property)
Answer the value of a given RDF property for this ontology resource, or null
if it doesn't have one.
|
Resource |
getRDFType()
Answer the
rdf:type (ie the class) of this resource. |
Resource |
getRDFType(boolean direct)
Answer the
rdf:type (ie the class) of this resource. |
OntResource |
getSameAs()
Answer a resource that is declared to be the same as this resource.
|
Resource |
getSeeAlso()
Answer a resource that provides additional information about this resource.
|
String |
getVersionInfo()
Answer the version information string for this object.
|
boolean |
hasComment(Literal comment)
Answer true if this resource has the given comment.
|
boolean |
hasComment(String comment,
String lang)
Answer true if this resource has the given comment.
|
boolean |
hasLabel(Literal label)
Answer true if this resource has the given label
|
boolean |
hasLabel(String label,
String lang)
Answer true if this resource has the given label
|
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 |
hasRDFType(String uri)
Answer true if this resource is a member of the class denoted by the
given URI.
|
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 information
|
boolean |
isAllDifferent()
Answer true if this resource can be viewed as an 'all different' declaration
|
boolean |
isAnnotationProperty()
Answer true if this resource can be viewed as an annotation property
|
boolean |
isClass()
Answer true if this resource can be viewed as a class
|
boolean |
isDataRange()
Answer true if this resource can be viewed as a data range
|
boolean |
isDatatypeProperty()
Answer true if this resource can be viewed as a datatype property
|
boolean |
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 |
isIndividual()
Answer true if this resource can be viewed as an individual
|
boolean |
isObjectProperty()
Answer true if this resource can be viewed as an object property
|
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.
|
boolean |
isOntology()
Answer true if this resource can be viewed as an ontology description node
|
boolean |
isProperty()
Answer true if this resource can be viewed as a property
|
boolean |
isSameAs(Resource res)
Answer true if this resource is the same as the given resource.
|
ExtendedIterator<RDFNode> |
listComments(String lang)
Answer an iterator over all of the comment literals for this resource.
|
ExtendedIterator<OntResource> |
listDifferentFrom()
Answer an iterator over all of the resources that are declared to be different from
this resource.
|
ExtendedIterator<RDFNode> |
listIsDefinedBy()
Answer an iterator over all of the resources that are declared to define
this resource.
|
ExtendedIterator<RDFNode> |
listLabels(String lang)
Answer an iterator over all of the label literals for this resource.
|
NodeIterator |
listPropertyValues(Property property)
Answer an iterator over the set of all values for a given RDF property.
|
ExtendedIterator<Resource> |
listRDFTypes(boolean direct)
Answer an iterator over the RDF classes to which this resource belongs.
|
ExtendedIterator<OntResource> |
listSameAs()
Answer an iterator over all of the resources that are declared to be the same as
this resource.
|
ExtendedIterator<RDFNode> |
listSeeAlso()
Answer an iterator over all of the resources that are declared to provide addition
information about this resource.
|
ExtendedIterator<String> |
listVersionInfo()
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(Literal comment)
Remove the statement that the given string is a comment on
this resource.
|
void |
removeComment(String comment,
String lang)
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 |
removeDifferentFrom(Resource res)
Remove the statement that this resource is different the given resource.
|
void |
removeLabel(Literal label)
Remove the statement that the given string is a label for
this resource.
|
void |
removeLabel(String label,
String lang)
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 |
setLabel(String label,
String lang)
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 |
setSameAs(Resource res)
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 resource
|
void |
setVersionInfo(String info)
Assert that the given string is the value of the version info for this resource.
|
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, visitWithas, asNode, canAs, equals, getGraph, hashCode, isAnon, isLiteral, isResource, isStmtResource, isURIResource, isValid, viewAsaddView, supportsabort, 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, toStringas, asLiteral, asResource, canAs, getModel, isAnon, isLiteral, isResource, isStmtResource, isURIResource, visitWithasNodepublic static final String[] KNOWN_LANGUAGES
public static Implementation factory
as() instead.public OntModel 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 an OntModel,
answer null.
getOntModel in interface OntResourcepublic Profile getProfile()
Answer the ontology language profile that governs the ontology model to which this ontology resource is attached.
getProfile in interface OntResourceJenaException - if the resource is not bound to an OntModel, since
that's the only way to get the profile for the resourcepublic 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.
isOntLanguageTerm in interface OntResourcepublic void setSameAs(Resource res)
Assert equivalence between the given resource and this resource. Any existing
statements for sameAs will be removed.
setSameAs in interface OntResourceres - The resource that is declared to be the same as this resourceProfileException - If the Profile.SAME_AS() property is not supported in the current language profile.public void addSameAs(Resource res)
Add a resource that is declared to be equivalent to this resource.
addSameAs in interface OntResourceres - A resource that declared to be the same as this resourceProfileException - If the Profile.SAME_AS() property is not supported in the current language profile.public OntResource 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.
getSameAs in interface OntResourceProfileException - If the Profile.SAME_AS() property is not supported in the current language profile.public ExtendedIterator<OntResource> 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.
listSameAs in interface OntResourceProfileException - If the Profile.SAME_AS() property is not supported in the current language profile.public boolean isSameAs(Resource res)
Answer true if this resource is the same as the given resource.
isSameAs in interface OntResourceres - A resource to test againstsameAs statement.public void removeSameAs(Resource res)
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.
removeSameAs in interface OntResourceres - A resource that may be declared to be the sameAs this resourcepublic void setDifferentFrom(Resource res)
Assert that the given resource and this resource are distinct. Any existing
statements for differentFrom will be removed.
setDifferentFrom in interface OntResourceres - The resource that is declared to be distinct from this resourceProfileException - If the Profile.DIFFERENT_FROM() property is not supported in the current language profile.public void addDifferentFrom(Resource res)
Add a statement declaring that this resource is distinct from the given resource.
addDifferentFrom in interface OntResourceres - A resource that declared to be distinct from this resourceProfileException - If the Profile.DIFFERENT_FROM() property is not supported in the current language profile.public OntResource 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.
getDifferentFrom in interface OntResourceProfileException - If the Profile.DIFFERENT_FROM() property is not supported in the current language profile.public ExtendedIterator<OntResource> 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.
listDifferentFrom in interface OntResourceProfileException - If the Profile.DIFFERENT_FROM() property is not supported in the current language profile.public boolean isDifferentFrom(Resource res)
Answer true if this resource is different from the given resource.
isDifferentFrom in interface OntResourceres - A resource to test againstdifferentFrom statement.public void removeDifferentFrom(Resource res)
Remove the statement that this resource is different the given resource. If this statement is not true of the current model, nothing happens.
removeDifferentFrom in interface OntResourceres - A resource that may be declared to be differentFrom this resourcepublic void setSeeAlso(Resource res)
Assert that the given resource provides additional information about the definition of this resource
setSeeAlso in interface OntResourceres - A resource that can provide additional information about this resourceProfileException - If the Profile.SEE_ALSO() property is not supported in the current language profile.public void addSeeAlso(Resource res)
Add a resource that is declared to provided additional information about the definition of this resource
addSeeAlso in interface OntResourceres - A resource that provides extra information on this resourceProfileException - If the Profile.SEE_ALSO() property is not supported in the current language profile.public Resource getSeeAlso()
Answer a resource that provides additional information about this resource. If more than one such resource is defined, make an arbitrary choice.
getSeeAlso in interface OntResourceProfileException - If the Profile.SEE_ALSO() property is not supported in the current language profile.public ExtendedIterator<RDFNode> listSeeAlso()
Answer an iterator over all of the resources that are declared to provide addition information about this resource.
listSeeAlso in interface OntResourceProfileException - If the Profile.SEE_ALSO() property is not supported in the current language profile.public boolean hasSeeAlso(Resource res)
Answer true if this resource has the given resource as a source of additional information.
hasSeeAlso in interface OntResourceres - A resource to test againstres provides more information on this resource.public void removeSeeAlso(Resource res)
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.
removeSeeAlso in interface OntResourceres - A resource that may be declared to provide additional information about this resourcepublic void setIsDefinedBy(Resource res)
Assert that the given resource provides a source of definitions about this resource. Any existing
statements for isDefinedBy will be removed.
setIsDefinedBy in interface OntResourceres - The resource that is declared to be a definition of this resource.ProfileException - If the Profile.IS_DEFINED_BY() property is not supported in the current language profile.public void addIsDefinedBy(Resource res)
Add a resource that is declared to provide a definition of this resource.
addIsDefinedBy in interface OntResourceres - A defining resourceProfileException - If the Profile.IS_DEFINED_BY() property is not supported in the current language profile.public Resource 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.
getIsDefinedBy in interface OntResourceProfileException - If the Profile.IS_DEFINED_BY() property is not supported in the current language profile.public ExtendedIterator<RDFNode> listIsDefinedBy()
Answer an iterator over all of the resources that are declared to define this resource.
listIsDefinedBy in interface OntResourceProfileException - If the Profile.IS_DEFINED_BY() property is not supported in the current language profile.public boolean isDefinedBy(Resource res)
Answer true if this resource is defined by the given resource.
isDefinedBy in interface OntResourceres - A resource to test againstres defines this resource.public void removeDefinedBy(Resource res)
Remove the statement that this resource is defined by the given resource. If this statement is not true of the current model, nothing happens.
removeDefinedBy in interface OntResourceres - A resource that may be declared to define this resourcepublic void setVersionInfo(String info)
Assert that the given string is the value of the version info for this resource. Any existing
statements for versionInfo will be removed.
setVersionInfo in interface OntResourceinfo - The version information for this resourceProfileException - If the Profile.VERSION_INFO() property is not supported in the current language profile.public void addVersionInfo(String info)
Add the given version information to this resource.
addVersionInfo in interface OntResourceinfo - A version information string for this resourceProfileException - If the Profile.VERSION_INFO() property is not supported in the current language profile.public String getVersionInfo()
Answer the version information string for this object. If there is more than one such resource, an arbitrary selection is made.
getVersionInfo in interface OntResourceProfileException - If the Profile.VERSION_INFO() property is not supported in the current language profile.public ExtendedIterator<String> listVersionInfo()
Answer an iterator over all of the version info strings for this resource.
listVersionInfo in interface OntResourceProfileException - If the Profile.VERSION_INFO() property is not supported in the current language profile.public boolean hasVersionInfo(String info)
Answer true if this resource has the given version information
hasVersionInfo in interface OntResourceinfo - Version information to test forinfo as version information.public void removeVersionInfo(String info)
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.
removeVersionInfo in interface OntResourceinfo - A version information string to be removedpublic void setLabel(String label, String lang)
Assert that the given string is the value of the label for this resource. Any existing
statements for label will be removed.
setLabel in interface OntResourcelabel - The label for this resourcelang - The language attribute for this label (EN, FR, etc) or null if not specified.ProfileException - If the Profile.LABEL() property is not supported in the current language profile.public void addLabel(String label, String lang)
Add the given label to this resource.
addLabel in interface OntResourcelabel - A label string for this resourcelang - The language attribute for this label (EN, FR, etc) or null if not specified.ProfileException - If the Profile.LABEL() property is not supported in the current language profile.public void addLabel(Literal label)
Add the given label to this resource.
addLabel in interface OntResourcelabel - The literal labelProfileException - If the Profile.LABEL() property is not supported in the current language profile.public String getLabel(String lang)
Answer the label string for this object. If there is more than one such resource, an arbitrary selection is made.
getLabel in interface OntResourcelang - 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 languageProfileException - If the Profile.LABEL() property is not supported in the current language profile.public ExtendedIterator<RDFNode> listLabels(String lang)
Answer an iterator over all of the label literals for this resource.
listLabels in interface OntResourcelang - The language to restrict any label values to, or null to select all languagesLiteral's.ProfileException - If the Profile.LABEL() property is not supported in the current language profile.public boolean hasLabel(String label, String lang)
Answer true if this resource has the given label
hasLabel in interface OntResourcelabel - The label to test forlang - The optional language tag, or null for don't care.label as a label.public boolean hasLabel(Literal label)
Answer true if this resource has the given label
hasLabel in interface OntResourcelabel - The label to test forlabel as a label.public void removeLabel(String label, String lang)
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.
removeLabel in interface OntResourcelabel - A label string to be removedlang - A lang tagpublic void removeLabel(Literal label)
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.
removeLabel in interface OntResourcelabel - A label literal to be removedpublic void setComment(String comment, String lang)
Assert that the given string is the comment on this resource. Any existing
statements for comment will be removed.
setComment in interface OntResourcecomment - The comment for this resourcelang - The language attribute for this comment (EN, FR, etc) or null if not specified.ProfileException - If the Profile.COMMENT() property is not supported in the current language profile.public void addComment(String comment, String lang)
Add the given comment to this resource.
addComment in interface OntResourcecomment - A comment string for this resourcelang - The language attribute for this comment (EN, FR, etc) or null if not specified.ProfileException - If the Profile.COMMENT() property is not supported in the current language profile.public void addComment(Literal comment)
Add the given comment to this resource.
addComment in interface OntResourcecomment - The literal commentProfileException - If the Profile.COMMENT() property is not supported in the current language profile.public String getComment(String lang)
Answer the comment string for this object. If there is more than one such resource, an arbitrary selection is made.
getComment in interface OntResourcelang - 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 languageProfileException - If the Profile.COMMENT() property is not supported in the current language profile.public ExtendedIterator<RDFNode> listComments(String lang)
Answer an iterator over all of the comment literals for this resource.
listComments in interface OntResourcelang - The language tag to restrict the listed comments to, or null to select all commentsLiteral's.ProfileException - If the Profile.COMMENT() property is not supported in the current language profile.public boolean hasComment(String comment, String lang)
Answer true if this resource has the given comment.
hasComment in interface OntResourcecomment - The comment to test forlang - The optional language tag, or null for don't care.comment as a comment.public boolean hasComment(Literal comment)
Answer true if this resource has the given comment.
hasComment in interface OntResourcecomment - The comment to test forcomment as a comment.public void removeComment(String comment, String lang)
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.
removeComment in interface OntResourcecomment - A comment string to be removedlang - A lang tagpublic void removeComment(Literal comment)
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.
removeComment in interface OntResourcecomment - A comment literal to be removedpublic void setRDFType(Resource cls)
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.
setRDFType in interface OntResourcecls - The RDF resource denoting the new value for the rdf:type property,
which will replace any existing type property.Individual.setOntClass(Resource)public void addRDFType(Resource cls)
Add the given class as one of the rdf:type's for this resource.
addRDFType in interface OntResourcecls - An RDF resource denoting a new value for the rdf:type property.Individual.addOntClass(Resource)public Resource 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 to getRDFType( false ).
getRDFType in interface OntResourceIndividual.getOntClass()public Resource getRDFType(boolean direct)
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).
getRDFType in interface OntResourcedirect - If true, only consider the direct types of this resource, and not
the super-classes of the type(s).Individual.getOntClass(boolean)public ExtendedIterator<Resource> listRDFTypes(boolean direct)
Answer an iterator over the RDF classes to which this resource belongs.
listRDFTypes in interface OntResourcedirect - If true, only answer those resources that are direct types
of this resource, not the super-classes of the class etc.Resource.Individual.listOntClasses(boolean)public boolean hasRDFType(String uri)
Answer true if this resource is a member of the class denoted by the given URI.
hasRDFType in interface OntResourceuri - Denotes the URI of a class to which this value may belongrdf:type's.Individual.hasOntClass(String)public boolean hasRDFType(Resource ontClass)
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 );
hasRDFType in interface OntResourceontClass - Denotes a class to which this value may belongrdf:type's.Individual.hasOntClass(Resource)public boolean hasRDFType(Resource ontClass, boolean direct)
Answer true if this resource is a member of the class denoted by the given class resource.
hasRDFType in interface OntResourceontClass - 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.rdf:type's.Individual.hasOntClass(Resource, boolean)public void removeRDFType(Resource cls)
Remove the statement that this resource is of the given RDF type. If this statement is not true of the current model, nothing happens.
removeRDFType in interface OntResourcecls - A resource denoting a class that that is to be removed from the classes of this resourceIndividual.removeOntClass(Resource)public int getCardinality(Property p)
Answer the cardinality of the given property on this resource. The cardinality is the number of distinct values there are for the property.
getCardinality in interface OntResourcep - A propertyp on this resource, as an
integer greater than or equal to zero.public 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. 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.
setPropertyValue in interface OntResourceproperty - The property to updatevalue - The new value of the property as an RDFNode, or null to
effectively remove this property.public RDFNode getPropertyValue(Property property)
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.
getPropertyValue in interface OntResourceproperty - An RDF propertypublic NodeIterator listPropertyValues(Property property)
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.
listPropertyValues in interface OntResourceproperty - The property whose values are soughtpublic 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 arbitrary rdf: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.
remove in interface OntResourcepublic void removeProperty(Property property, RDFNode value)
Remove the specific RDF property-value pair from this DAML resource.
removeProperty in interface OntResourceproperty - The property to be removedvalue - The specific value of the property to be removedpublic AnnotationProperty asAnnotationProperty()
Answer a view of this resource as an annotation property
asAnnotationProperty in interface OntResourceConversionException - if the resource cannot be converted to an annotation propertypublic OntProperty asProperty()
Answer a view of this resource as a property
asProperty in interface OntResourceConversionException - if the resource cannot be converted to a propertypublic ObjectProperty asObjectProperty()
Answer a view of this resource as an object property
asObjectProperty in interface OntResourceConversionException - if the resource cannot be converted to an object propertypublic DatatypeProperty asDatatypeProperty()
Answer a view of this resource as a datatype property
asDatatypeProperty in interface OntResourceConversionException - if the resource cannot be converted to a datatype propertypublic Individual asIndividual()
Answer a view of this resource as an individual
asIndividual in interface OntResourceConversionException - if the resource cannot be converted to an individualpublic OntClass asClass()
Answer a view of this resource as a class
asClass in interface OntResourceConversionException - if the resource cannot be converted to a classpublic Ontology asOntology()
Answer a view of this resource as an ontology description node
asOntology in interface OntResourceConversionException - if the resource cannot be converted to an ontology description nodepublic AllDifferent asAllDifferent()
Answer a view of this resource as an 'all different' declaration
asAllDifferent in interface OntResourceConversionException - if the resource cannot be converted to an all different declarationpublic DataRange asDataRange()
Answer a view of this resource as a data range
asDataRange in interface OntResourceConversionException - if the resource cannot be converted to a data rangepublic boolean isAnnotationProperty()
Answer true if this resource can be viewed as an annotation property
isAnnotationProperty in interface OntResourcepublic boolean isProperty()
Answer true if this resource can be viewed as a property
isProperty in interface OntResourcepublic boolean isObjectProperty()
Answer true if this resource can be viewed as an object property
isObjectProperty in interface OntResourcepublic boolean isDatatypeProperty()
Answer true if this resource can be viewed as a datatype property
isDatatypeProperty in interface OntResourcepublic boolean isIndividual()
Answer true if this resource can be viewed as an individual
isIndividual in interface OntResourcepublic boolean isClass()
Answer true if this resource can be viewed as a class
isClass in interface OntResourcepublic boolean isOntology()
Answer true if this resource can be viewed as an ontology description node
isOntology in interface OntResourcepublic boolean isDataRange()
Answer true if this resource can be viewed as a data range
isDataRange in interface OntResourcepublic boolean isAllDifferent()
Answer true if this resource can be viewed as an 'all different' declaration
isAllDifferent in interface OntResourceLicenced under the Apache License, Version 2.0