Protégé-OWL 3.4 beta

edu.stanford.smi.protegex.owl.model.impl
Class DefaultRDFIndividual

java.lang.Object
  extended by edu.stanford.smi.protege.model.DefaultFrame
      extended by edu.stanford.smi.protege.model.DefaultInstance
          extended by edu.stanford.smi.protege.model.DefaultSimpleInstance
              extended by edu.stanford.smi.protegex.owl.model.impl.DefaultRDFIndividual
All Implemented Interfaces:
edu.stanford.smi.protege.model.Frame, edu.stanford.smi.protege.model.Instance, edu.stanford.smi.protege.model.Localizable, edu.stanford.smi.protege.model.SimpleInstance, ProtegeInstance, RDFIndividual, RDFObject, RDFResource, Visitable, Serializable, Comparable<edu.stanford.smi.protege.model.Frame>
Direct Known Subclasses:
AbstractCodeGeneratorIndividual, DefaultCustomer_, DefaultOWLDataRange, DefaultOWLIndividual, DefaultOWLOntology, DefaultProduct, DefaultPurchase, DefaultRDFList, DefaultRDFSDatatype, DefaultRDFUntypedResource, DefaultTestPerson

public class DefaultRDFIndividual
extends edu.stanford.smi.protege.model.DefaultSimpleInstance
implements RDFIndividual

See Also:
Serialized Form

Constructor Summary
DefaultRDFIndividual()
           
DefaultRDFIndividual(edu.stanford.smi.protege.model.KnowledgeBase kb, edu.stanford.smi.protege.model.FrameID id)
           
 
Method Summary
 void accept(OWLModelVisitor visitor)
          This method is provided to be used with the OWLModelVisitor, which is part of the visitor design pattern.
 void addComment(String comment)
          Adds an rdfs:comment to this resource.
 void addDifferentFrom(RDFResource resource)
          Adds an owl:differentFrom to this resource.
 void addIsDefinedBy(RDFResource instance)
          Adds an rdfs:isDefinedBy to this resource.
 void addLabel(String label, String language)
          Adds a label to this.
 void addPropertyValue(RDFProperty property, Object value)
          Adds a value for a given property to this resource.
 void addPropertyValueListener(PropertyValueListener listener)
          Adds a PropertyValueListener to receive events when property values have changed.
 void addProtegeType(RDFSClass type)
          Adds an type to this resource.
 void addRDFType(RDFSClass type)
          Adds an rdf:type to this resource.
 void addResourceListener(ResourceListener listener)
          Adds a ResourceListener to receive events when the type of this has changed.
 void addSameAs(RDFResource resource)
          Adds an owl:sameAs to this resource.
 void addVersionInfo(String versionInfo)
          Adds an owl:versionInfo to this resource.
 RDFResource as(Class javaInterface)
          Converts this dynamically into an instance of a given Java interface.
 boolean canAs(Class javaInterface)
          Checks whether this can be dynamically morphed into an instance of a given Java interface.
 boolean equalsStructurally(RDFObject object)
          Determines whether or not the specified class is structurally equal to this class.
 RDFResource getAllValuesFromOnTypes(RDFProperty property)
          Checks for rdfs:range or owl:allValuesFrom restrictions on the types of this resource.
 Collection getComments()
          Gets all rdfs:comments for this resource.
 Collection getDifferentFrom()
          Gets all owl:differentFroms for this resource.
 Collection getDocumentation()
           
 Collection getHasValuesOnTypes(RDFProperty property)
          Checks if there are any owl:hasValue restrictions defined on any rdf:type of this and returns the fillers of the restrictions (if found).
 Icon getIcon()
           
 Class getIconLocation()
          Gets a class that serves as a location of the icon resource.
 String getIconName()
          Gets the local name of an icon for this type of resource.
 Collection getInferredTypes()
          Gets the direct types that were inferred during the most recent execution of a reasoner.
 Collection getIsDefinedBy()
          Gets all rdfs:isDefinedBy for this resource.
 Collection getLabels()
          Gets the rdfs:labels that are currenly defined for this.
 String getLocalName()
          Gets the local part of the full URI (name) of this resource.
 String getNamespace()
          Gets the namespace of this resource.
 String getNamespacePrefix()
          Gets the prefix of the namespace, i.e.
 OWLModel getOWLModel()
          Gets the OWLModel this resource is defined in.
 Collection getPossibleRDFProperties()
          Gets a Collection of all RDFProperties that this resource could take values for.
 String getPrefixedName()
          Gets the qualified name as a namespace, local name pair (e.g.
 Object getPropertyValue(RDFProperty property)
          Gets all (direct) values of a given property.
 Object getPropertyValue(RDFProperty property, boolean includingSubproperties)
          Gets all values of a given property, and optionally its subproperties.
 RDFResource getPropertyValueAs(RDFProperty property, Class javaInterface)
           
 int getPropertyValueCount(RDFProperty property)
          Gets the number of all (direct) values of a given property.
 RDFSLiteral getPropertyValueLiteral(RDFProperty property)
          Gets the first value of a given property as an RDFSLiteral.
 Collection getPropertyValueLiterals(RDFProperty property)
          Gets all (direct) values of a given property at this as RDFSLiterals.
 Collection getPropertyValues(RDFProperty property)
          Gets all (direct) values of a given property at this resource.
 Collection getPropertyValues(RDFProperty property, boolean includingSubproperties)
          Gets all values of a given property, optionally including the values of the subproperties of the property.
 Collection getPropertyValuesAs(RDFProperty property, Class javaInterface)
           
 RDFSClass getProtegeType()
          Gets the first asserted type of this resource.
 Collection getProtegeTypes()
          Gets the asserted types of this resource.
 Collection getRDFProperties()
          Gets all RDFProperties that have at least one value at this.
 RDFSClass getRDFType()
          Gets the first asserted rdf:type of this resource.
 Collection getRDFTypes()
          Gets the asserted rdf:types of this resource.
 Set getReferringAnonymousClasses()
          Gets a Collection of all OWLAnonymousClasses that have a reference to this.
 Collection getSameAs()
          Gets the values of the owl:sameAs property.
 String getURI()
          Gets the full URI of this resource.
 Collection getVersionInfo()
          Gets the values of the owl:versionInfo property.
 boolean hasPropertyValue(RDFProperty property)
          Checks whether this has any (direct) property value.
 boolean hasPropertyValue(RDFProperty property, boolean includingSubproperties)
          Checks whether this has any property value.
 boolean hasPropertyValue(RDFProperty property, Object value)
          Checks whether this has a certain (direct) property value.
 boolean hasPropertyValue(RDFProperty property, Object value, boolean includingSuperproperties)
          Checks whether this has a certain property value.
 boolean hasProtegeType(RDFSClass type)
          Checks whether this resource has a given type.
 boolean hasProtegeType(RDFSClass type, boolean includingSuperclasses)
           
 boolean hasRDFType(RDFSClass type)
          Checks whether this resource has a given rdf:type.
 boolean hasRDFType(RDFSClass type, boolean includingSuperclasses)
           
 boolean isAnonymous()
          Checks whether this represents an anonymous resource / bnode.
 boolean isValidPropertyValue(RDFProperty property, Object object)
          A convenience method to access the corresponding method in OWLModel.
 Iterator listPropertyValues(RDFProperty property)
          Gets all direct values of a certain property as an Iterator.
 Iterator listPropertyValues(RDFProperty property, boolean includingSubproperties)
          Gets all values of a certain property as an Iterator.
 Iterator listPropertyValuesAs(RDFProperty property, Class javaInterface)
           
 Iterator listRDFTypes()
          Gets an Iterator on the rdf:types of this.
 void removeComment(String value)
          Removes an rdfs:comment from this resource.
 void removeDifferentFrom(RDFResource resource)
           
 void removeIsDefinedBy(RDFResource resource)
           
 void removeLabel(String label, String language)
          Removes a label that has been previously added.
 void removePropertyValue(RDFProperty property, Object value)
           
 void removePropertyValueListener(PropertyValueListener listener)
           
 void removeProtegeType(RDFSClass type)
          Removes a type from this resource.
 void removeRDFType(RDFSClass type)
          Removes an rdf:type from this resource.
 void removeResourceListener(ResourceListener listener)
           
 void removeSameAs(RDFResource resource)
           
 void removeVersionInfo(String versionInfo)
           
 void setComment(String comment)
           
 void setComments(Collection comments)
           
 void setDocumentation(String value)
           
 void setInferredTypes(Collection types)
           
 void setPropertyValue(RDFProperty property, Object value)
           
 void setPropertyValues(RDFProperty property, Collection values)
           
 void setProtegeType(RDFSClass type)
           
 void setProtegeTypes(Collection types)
           
 void setRDFType(RDFSClass type)
           
 void setRDFTypes(Collection types)
           
 String toString()
           
 
Methods inherited from class edu.stanford.smi.protege.model.DefaultSimpleInstance
rename
 
Methods inherited from class edu.stanford.smi.protege.model.DefaultInstance
addDirectType, addInstanceListener, copy, deepCopy, getBrowserText, getDirectType, getDirectTypes, getOwnFacetValue, getOwnFacetValues, getReachableSimpleInstances, hasDirectType, hasType, moveDirectType, removeDirectType, removeInstanceListener, setDirectType, setDirectTypes, shallowCopy
 
Methods inherited from class edu.stanford.smi.protege.model.DefaultFrame
addFrameListener, addOwnFacetValue, addOwnSlotValue, areValidOwnSlotValues, assertFrameName, compareTo, delete, equals, equals, getDefaultKnowledgeBase, getDefiningProjectURI, getDirectOwnSlotValue, getDirectOwnSlotValues, getFrameID, getInvalidOwnSlotValuesText, getInvalidOwnSlotValueText, getKnowledgeBase, getName, getOwnSlotAllowsMultipleValues, getOwnSlotAndSubslotValues, getOwnSlotDefaultValues, getOwnSlotFacets, getOwnSlotFacetValues, getOwnSlots, getOwnSlotValue, getOwnSlotValueCount, getOwnSlotValues, getOwnSlotValueType, getProject, getReferences, getReferences, hashCode, hasOwnSlot, isBeingDeleted, isDeleted, isEditable, isIncluded, isSystem, isValid, isValidOwnSlotValue, isVisible, localize, markDeleted, markDeleting, moveDirectOwnSlotValue, removeFrameListener, removeOwnSlotValue, setDirectOwnSlotValue, setDirectOwnSlotValues, setDocumentation, setEditable, setIncluded, setOwnFacetValue, setOwnFacetValues, setOwnSlotValue, setOwnSlotValues, setSystem, setVisible
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.stanford.smi.protegex.owl.model.RDFResource
delete, getBrowserText, getName, isVisible, setVisible
 
Methods inherited from interface edu.stanford.smi.protegex.owl.model.ProtegeInstance
addDirectType, addFrameListener, addInstanceListener, addOwnFacetValue, addOwnSlotValue, areValidOwnSlotValues, copy, deepCopy, getDirectOwnSlotValue, getDirectOwnSlotValues, getDirectType, getDirectTypes, getInvalidOwnSlotValuesText, getInvalidOwnSlotValueText, getKnowledgeBase, getOwnFacetValue, getOwnFacetValues, getOwnSlotAllowsMultipleValues, getOwnSlotAndSubslotValues, getOwnSlotDefaultValues, getOwnSlotFacets, getOwnSlotFacetValues, getOwnSlots, getOwnSlotValue, getOwnSlotValueCount, getOwnSlotValues, getOwnSlotValueType, getProject, getReachableSimpleInstances, getReferences, getReferences, hasDirectType, hasOwnSlot, hasType, isBeingDeleted, isDeleted, isEditable, isIncluded, isSystem, isValidOwnSlotValue, markDeleted, markDeleting, removeDirectType, removeFrameListener, removeInstanceListener, removeOwnSlotValue, setDirectOwnSlotValue, setDirectOwnSlotValues, setDirectType, setDirectTypes, setDocumentation, setEditable, setIncluded, setOwnFacetValue, setOwnFacetValues, setOwnSlotValue, setOwnSlotValues, shallowCopy
 
Methods inherited from interface edu.stanford.smi.protege.model.Instance
moveDirectType
 
Methods inherited from interface edu.stanford.smi.protege.model.Frame
assertFrameName, getFrameID, isValid, moveDirectOwnSlotValue, rename
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

DefaultRDFIndividual

public DefaultRDFIndividual(edu.stanford.smi.protege.model.KnowledgeBase kb,
                            edu.stanford.smi.protege.model.FrameID id)

DefaultRDFIndividual

public DefaultRDFIndividual()
Method Detail

accept

public void accept(OWLModelVisitor visitor)
Description copied from interface: Visitable
This method is provided to be used with the OWLModelVisitor, which is part of the visitor design pattern. By implementing this method, instances of the implementing class are stating that they can accept an OWLModelVisitor

Specified by:
accept in interface Visitable
Parameters:
visitor - The visitor that will operate on this object.

getIcon

public Icon getIcon()
Specified by:
getIcon in interface edu.stanford.smi.protege.model.Frame
Specified by:
getIcon in interface ProtegeInstance
Overrides:
getIcon in class edu.stanford.smi.protege.model.DefaultSimpleInstance
See Also:
ProtegeUI.getIcon(edu.stanford.smi.protegex.owl.model.RDFResource)

getIconName

public String getIconName()
Description copied from interface: RDFResource
Gets the local name of an icon for this type of resource. This method is used in conjunction with getIconLocation().

Specified by:
getIconName in interface RDFResource
Returns:
an icon name (without suffix, e.g. "RDFIndividual" for RDFIndividual.gif)
See Also:
RDFResource.getIconLocation()

addComment

public void addComment(String comment)
Description copied from interface: RDFResource
Adds an rdfs:comment to this resource.

Specified by:
addComment in interface RDFResource
Parameters:
comment - the comment to add
See Also:
RDFResource.getComments(), RDFResource.removeComment(java.lang.String)

addDifferentFrom

public void addDifferentFrom(RDFResource resource)
Description copied from interface: RDFResource
Adds an owl:differentFrom to this resource.

Specified by:
addDifferentFrom in interface RDFResource
Parameters:
resource - the resource to add
See Also:
RDFResource.getDifferentFrom(), RDFResource.removeDifferentFrom(edu.stanford.smi.protegex.owl.model.RDFResource)

addIsDefinedBy

public void addIsDefinedBy(RDFResource instance)
Description copied from interface: RDFResource
Adds an rdfs:isDefinedBy to this resource.

Specified by:
addIsDefinedBy in interface RDFResource
Parameters:
instance - the resource to add
See Also:
RDFResource.getIsDefinedBy(), RDFResource.removeIsDefinedBy(edu.stanford.smi.protegex.owl.model.RDFResource)

addLabel

public void addLabel(String label,
                     String language)
Description copied from interface: RDFResource
Adds a label to this.

Specified by:
addLabel in interface RDFResource
Parameters:
label - the text of the label to add
language - the language, or null for no language

addPropertyValue

public void addPropertyValue(RDFProperty property,
                             Object value)
Description copied from interface: RDFResource
Adds a value for a given property to this resource. The property should have the type of this resource in its domain.

Specified by:
addPropertyValue in interface RDFResource
Parameters:
property - the property to add a value for
value - the value to add (may be an RDFSLiteral, a primitive value or another Resource)
See Also:
RDFResource.getPropertyValue(edu.stanford.smi.protegex.owl.model.RDFProperty), RDFResource.getPropertyValues(edu.stanford.smi.protegex.owl.model.RDFProperty), RDFResource.listPropertyValues(edu.stanford.smi.protegex.owl.model.RDFProperty), RDFResource.removePropertyValue(edu.stanford.smi.protegex.owl.model.RDFProperty, java.lang.Object)

addPropertyValueListener

public void addPropertyValueListener(PropertyValueListener listener)
Description copied from interface: RDFResource
Adds a PropertyValueListener to receive events when property values have changed.

Specified by:
addPropertyValueListener in interface RDFResource
Parameters:
listener - the listener to add
See Also:
RDFResource.removePropertyValueListener(edu.stanford.smi.protegex.owl.model.event.PropertyValueListener)

addProtegeType

public void addProtegeType(RDFSClass type)
Description copied from interface: RDFResource
Adds an type to this resource.

Specified by:
addProtegeType in interface RDFResource
Parameters:
type - the type to add
See Also:
RDFResource.getProtegeTypes(), RDFResource.removeProtegeType(edu.stanford.smi.protegex.owl.model.RDFSClass)

addRDFType

public void addRDFType(RDFSClass type)
Description copied from interface: RDFResource
Adds an rdf:type to this resource.

Specified by:
addRDFType in interface RDFResource
Parameters:
type - the rdf:type to add
See Also:
RDFResource.getProtegeTypes(), RDFResource.removeProtegeType(edu.stanford.smi.protegex.owl.model.RDFSClass)

addResourceListener

public void addResourceListener(ResourceListener listener)
Description copied from interface: RDFResource
Adds a ResourceListener to receive events when the type of this has changed.

Specified by:
addResourceListener in interface RDFResource
Parameters:
listener - the listener to add
See Also:
RDFResource.removeResourceListener(edu.stanford.smi.protegex.owl.model.event.ResourceListener)

addSameAs

public void addSameAs(RDFResource resource)
Description copied from interface: RDFResource
Adds an owl:sameAs to this resource.

Specified by:
addSameAs in interface RDFResource
Parameters:
resource - the resource to add
See Also:
RDFResource.getSameAs(), RDFResource.removeSameAs(edu.stanford.smi.protegex.owl.model.RDFResource)

addVersionInfo

public void addVersionInfo(String versionInfo)
Description copied from interface: RDFResource
Adds an owl:versionInfo to this resource.

Specified by:
addVersionInfo in interface RDFResource
Parameters:
versionInfo - the version info to add
See Also:
RDFResource.getVersionInfo(), RDFResource.removeVersionInfo(java.lang.String)

as

public RDFResource as(Class javaInterface)
Description copied from interface: RDFResource
Converts this dynamically into an instance of a given Java interface. The interface must inherit from RDFResource and must be accompanied by a public class DefaultXY in the impl subpackage below the interface's package. Note: Work in Progress!

Specified by:
as in interface RDFResource
Parameters:
javaInterface - the Java interface to convert to
Returns:
an instance of the Java interface

canAs

public boolean canAs(Class javaInterface)
Description copied from interface: RDFResource
Checks whether this can be dynamically morphed into an instance of a given Java interface. The interface must inherit from RDFResource and must be accompanied by an implementation in the subpackage "impl" below the interface package. Note: Work in Progress!

Specified by:
canAs in interface RDFResource
Parameters:
javaInterface - the Java interface to test
Returns:
true if this can be morphed into the given Java class

equalsStructurally

public boolean equalsStructurally(RDFObject object)
Description copied from interface: RDFObject
Determines whether or not the specified class is structurally equal to this class. Note that this does not test for structural equivalence using structural subsumption tests.

Specified by:
equalsStructurally in interface RDFObject
Parameters:
object - The class to test against.
Returns:
true if the class is structurally equal to this, false if the class is not structurally equal to this.

getAllValuesFromOnTypes

public RDFResource getAllValuesFromOnTypes(RDFProperty property)
Description copied from interface: RDFResource
Checks for rdfs:range or owl:allValuesFrom restrictions on the types of this resource. This method can be used to check the "valid" value types for a given property. The implementation will check all rdf:types of this.

Specified by:
getAllValuesFromOnTypes in interface RDFResource
Parameters:
property - the property to check for restrictions
Returns:
the range or null if no restriction was found

getComments

public Collection getComments()
Description copied from interface: RDFResource
Gets all rdfs:comments for this resource.

Specified by:
getComments in interface RDFResource
Returns:
a Collection of Strings or RDFSLiterals
See Also:
RDFResource.addComment(java.lang.String), RDFResource.removeComment(java.lang.String)

getDifferentFrom

public Collection getDifferentFrom()
Description copied from interface: RDFResource
Gets all owl:differentFroms for this resource.

Specified by:
getDifferentFrom in interface RDFResource
Returns:
a Collection of RDFResources
See Also:
RDFResource.addDifferentFrom(edu.stanford.smi.protegex.owl.model.RDFResource), RDFResource.removeDifferentFrom(edu.stanford.smi.protegex.owl.model.RDFResource)

getHasValuesOnTypes

public Collection getHasValuesOnTypes(RDFProperty property)
Description copied from interface: RDFResource
Checks if there are any owl:hasValue restrictions defined on any rdf:type of this and returns the fillers of the restrictions (if found).

Specified by:
getHasValuesOnTypes in interface RDFResource
Parameters:
property - the property to look for restrictions
Returns:
the fillers of all owl:hasValue restriction defined on the types of this

getIconLocation

public Class getIconLocation()
Description copied from interface: RDFResource
Gets a class that serves as a location of the icon resource. This method is used in conjunction with getIconName().

Specified by:
getIconLocation in interface RDFResource
Returns:
the icon location class (e.g., OWLIcons.class)
See Also:
RDFResource.getIconName()

getProtegeType

public RDFSClass getProtegeType()
Description copied from interface: RDFResource
Gets the first asserted type of this resource. This is basically a convenience method for those cases where it is known in advance that the resource only has a single type. If the resource has multiple types, then the result of this method is undefined.

Specified by:
getProtegeType in interface RDFResource
Returns:
the first type of this
See Also:
RDFResource.getProtegeTypes()

getProtegeTypes

public Collection getProtegeTypes()
Description copied from interface: RDFResource
Gets the asserted types of this resource. Note that in the case of anonymous classes, this result is different from the sibling method getRDFTypes(): Anonymous classes are internally stored using some special Protege metaclasses (e.g. OWLNames.Cls.COMPLEMENT_CLASS instead of owl:Class).

Specified by:
getProtegeTypes in interface RDFResource
Returns:
the types of this
See Also:
RDFResource.getProtegeType()

getDocumentation

public Collection getDocumentation()
Specified by:
getDocumentation in interface edu.stanford.smi.protege.model.Frame
Specified by:
getDocumentation in interface ProtegeInstance
Overrides:
getDocumentation in class edu.stanford.smi.protege.model.DefaultFrame
See Also:
RDFResource.getComments()

getInferredTypes

public Collection getInferredTypes()
Description copied from interface: RDFResource
Gets the direct types that were inferred during the most recent execution of a reasoner.

Specified by:
getInferredTypes in interface RDFResource
Returns:
the collection of inferred direct types (RDFSClasses)

getIsDefinedBy

public Collection getIsDefinedBy()
Description copied from interface: RDFResource
Gets all rdfs:isDefinedBy for this resource.

Specified by:
getIsDefinedBy in interface RDFResource
Returns:
a Collection of RDFResources
See Also:
RDFResource.addIsDefinedBy(edu.stanford.smi.protegex.owl.model.RDFResource), RDFResource.removeIsDefinedBy(edu.stanford.smi.protegex.owl.model.RDFResource)

getLabels

public Collection getLabels()
Description copied from interface: RDFResource
Gets the rdfs:labels that are currenly defined for this.

Specified by:
getLabels in interface RDFResource
Returns:
a Collection of strings or RDFSLiterals

getLocalName

public String getLocalName()
Description copied from interface: RDFResource
Gets the local part of the full URI (name) of this resource. For example, for "owl:Class" this would return "Class".

Specified by:
getLocalName in interface RDFResource
Returns:
the part of the name after #

getPrefixedName

public String getPrefixedName()
Description copied from interface: RDFResource
Gets the qualified name as a namespace, local name pair (e.g. "owl:Class").

Specified by:
getPrefixedName in interface RDFResource
Returns:
the qualified name of the resource.

getNamespace</