edu.stanford.smi.protegex.owl.model
Interface RDFProperty

All Superinterfaces:
Comparable, Deprecatable, edu.stanford.smi.protege.model.Frame, edu.stanford.smi.protege.model.Instance, ProtegeInstance, ProtegeSlot, RDFObject, RDFResource, edu.stanford.smi.protege.model.Slot, Visitable
All Known Subinterfaces:
OWLDatatypeProperty, OWLObjectProperty, OWLProperty
All Known Implementing Classes:
AbstractOWLProperty, DefaultOWLDatatypeProperty, DefaultOWLObjectProperty, DefaultRDFProperty

public interface RDFProperty
extends ProtegeSlot, RDFResource, Deprecatable

An RDFResource representing an rdf:Property or an instance of a subclass of rdf:Property such as owl:ObjectProperty and owl:FunctionalProperty.

Author:
Holger Knublauch

Method Summary
 void addEquivalentProperty(RDFProperty property)
          Adds a property to the list of equivalent properties of this.
 void addPropertyListener(PropertyListener listener)
          Adds a PropertyListener to receive events on changes in the property.
 void addSuperproperty(RDFProperty superProperty)
          Adds a property to the super properties of this.
 void addUnionDomainClass(RDFSClass domainClass)
          Adss a class to the domain of this, applying union semantics.
 RDFSClass getDomain(boolean includingSuperproperties)
          Gets the first value of the rdfs:domain property.
 Collection getDomains(boolean includingSuperproperties)
          Gets the values of the rdfs:domain property.
 Collection getEquivalentProperties()
          Gets the equivalent slots of this.
 RDFProperty getFirstSuperproperty()
          Gets the first superproperty of this (if any exists).
 Icon getInheritedIcon()
           
 RDFProperty getInverseProperty()
          Gets the inverse property of this.
 RDFResource getRange()
          Equivalent to getRange(false).
 RDFResource getRange(boolean includingSuperproperties)
          Gets the range defined at this.
 RDFSDatatype getRangeDatatype()
          Gets the direct or inherited RDFSDatatype of this.
 Collection getRanges(boolean includingSuperproperties)
          Gets all range definitions at this (or optionally its superproperties).
 Collection getSubproperties(boolean transitive)
          Gets the subproperties of this, and possibly the subproperties of the subproperties etc.
 int getSubpropertyCount()
          Gets the number of properties that have this as rdfs:subPropertyOf.
 Collection getSuperproperties(boolean transitive)
          Gets the superproperties of this, and possibly the superproperties of the superproperties etc.
 int getSuperpropertyCount()
          Gets the number of values of the rdfs:subPropertyOf properties.
 Collection getUnionDomain()
          Equivalent to getUnionDomain(false).
 Collection getUnionDomain(boolean includingSuperproperties)
          Gets the domain of this, with union semantics.
 Collection getUnionRangeClasses()
          Gets the range of this with union semantics.
 boolean hasDatatypeRange()
          Checks whether this can take only primitive, datatype values.
 boolean hasObjectRange()
          Checks whether this can take only object/reference values.
 boolean hasRange(boolean includingSuperproperties)
          Checks whether this has any concrete range definition.
 boolean isAnnotationProperty()
          Checks whether this Slot is an OWL AnnotationProperty.
 boolean isDomainDefined()
          Checks whether the domain of this property has been explicitly defined.
 boolean isDomainDefined(boolean transitive)
          Checks whether the domain of this property has been explicitly defined.
 boolean isFunctional()
          Checks whether this is a functional property.
 boolean isRangeDefined()
          Checks whether this property defines its own range.
 boolean isReadOnly()
          Checks if the values of this slot should be treated as read-only.
 boolean isSubpropertyOf(RDFProperty superproperty, boolean transitive)
          Checks if this is a subproperty of a given superproperty.
 void removeEquivalentProperty(OWLProperty property)
          Removes a property from the list of equivalent properties.
 void removePropertyListener(PropertyListener listener)
          Removes a PropertyListener to receive events on changes in the property.
 void removeSuperproperty(RDFProperty superproperty)
          Removes a superproperty.
 void removeUnionDomainClass(RDFSClass domainClass)
          Removes a domain class, with union semantics.
 void setDomain(RDFSClass domainClass)
          Sets the value of rdfs:domain to the given class.
 void setDomainDefined(boolean value)
          Specifies whether the domain of this property is defined or not.
 void setDomains(Collection domainClasses)
          Sets the values of the rdfs:domain property at this.
 void setEquivalentProperties(Collection properties)
          Sets the equivalent properties of this.
 void setFunctional(boolean value)
          Adds or removes owl:FunctionalProperty to/from the rdf:types of this.
 void setInverseProperty(RDFProperty inverseProperty)
          Sets the inverse property of this.
 void setRange(RDFResource range)
          Sets the rdfs:range of this.
 void setRanges(Collection ranges)
          Sets all ranges of this (in the unlikely case that multiple are needed).
 void setUnionRangeClasses(Collection classes)
           
 void synchronizeDomainAndRangeOfInverse()
          Makes sure that the range and domain of the current inverse property match the domain and range of this.
 
Methods inherited from interface edu.stanford.smi.protegex.owl.model.ProtegeSlot
addDirectSuperslot, addSlotListener, getAllowedClses, getAllowedParents, getAllowedValues, getAllowsMultipleValues, getAssociatedFacet, getDefaultValues, getDirectDomain, getDirectSubslotCount, getDirectSubslots, getDirectSuperslotCount, getDirectSuperslots, getDocumentation, getDomain, getInverseSlot, getMaximumCardinality, getMaximumValue, getMinimumCardinality, getMinimumValue, getSubslots, getSuperslots, getValues, getValueType, hasDirectSuperslot, hasSuperslot, hasValueAtSomeFrame, moveDirectSubslot, removeDirectSuperslot, removeSlotListener, setAllowedClses, setAllowedParents, setAllowedValues, setAllowsMultipleValues, setAssociatedFacet, setDefaultValues, setDirectTypeOfSubslots, setDocumentation, setInverseSlot, setMaximumCardinality, setMaximumValue, setMinimumCardinality, setMinimumValue, setValues, setValueType
 
Methods inherited from interface edu.stanford.smi.protegex.owl.model.ProtegeInstance
addDirectType, addFrameListener, addInstanceListener, addOwnFacetValue, addOwnSlotValue, areValidOwnSlotValues, copy, deepCopy, getBrowserText, getDirectOwnSlotValue, getDirectOwnSlotValues, getDirectType, getDirectTypes, getFrameID, getIcon, 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
delete, getName, isValid, isVisible, moveDirectOwnSlotValue, setName, setVisible
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface edu.stanford.smi.protege.model.Slot
getTemplateSlotClses
 
Methods inherited from interface edu.stanford.smi.protegex.owl.model.RDFResource
addComment, addDifferentFrom, addIsDefinedBy, addLabel, addPropertyValue, addPropertyValueListener, addProtegeType, addRDFType, addResourceListener, addSameAs, addVersionInfo, as, canAs, delete, getAllValuesFromOnTypes, getBrowserText, getComments, getDifferentFrom, getHasValuesOnTypes, getIconLocation, getIconName, getInferredTypes, getIsDefinedBy, getLabels, getLocalName, getName, getNamespace, getNamespacePrefix, getOWLModel, getPossibleRDFProperties, getPropertyValue, getPropertyValue, getPropertyValueAs, getPropertyValueCount, getPropertyValueLiteral, getPropertyValueLiterals, getPropertyValues, getPropertyValues, getPropertyValuesAs, getProtegeType, getProtegeTypes, getRDFProperties, getRDFType, getRDFTypes, getReferringAnonymousClasses, getSameAs, getURI, getVersionInfo, hasPropertyValue, hasPropertyValue, hasPropertyValue, hasPropertyValue, hasProtegeType, hasProtegeType, hasRDFType, hasRDFType, isAnonymous, isValidPropertyValue, isVisible, listPropertyValues, listPropertyValues, listPropertyValuesAs, listRDFTypes, removeComment, removeDifferentFrom, removeIsDefinedBy, removeLabel, removePropertyValue, removePropertyValueListener, removeProtegeType, removeRDFType, removeResourceListener, removeSameAs, removeVersionInfo, setComment, setComments, setInferredTypes, setName, setPropertyValue, setPropertyValues, setProtegeType, setProtegeTypes, setRDFType, setRDFTypes, setVisible
 
Methods inherited from interface edu.stanford.smi.protegex.owl.model.RDFObject
equalsStructurally
 
Methods inherited from interface edu.stanford.smi.protegex.owl.model.visitor.Visitable
accept
 
Methods inherited from interface edu.stanford.smi.protegex.owl.model.Deprecatable
isDeprecated, setDeprecated
 

Method Detail

addEquivalentProperty

public void addEquivalentProperty(RDFProperty property)
Adds a property to the list of equivalent properties of this. This will add an owl:equivalentProperty statement.

Parameters:
property - the property to declare to be equivalent to this

addPropertyListener

public void addPropertyListener(PropertyListener listener)
Adds a PropertyListener to receive events on changes in the property. Note that for the sake of backward compatibility this currenty needs to take a PropertyAdapter as argument, but this may later change to take a real PropertyListener.

Parameters:
listener - the PropertyListener to add (must be a PropertyAdapter)

addSuperproperty

public void addSuperproperty(RDFProperty superProperty)
Adds a property to the super properties of this. This will add an rdfs:subPropertyOf statement.

Parameters:
superProperty - the new super property

addUnionDomainClass

public void addUnionDomainClass(RDFSClass domainClass)
Adss a class to the domain of this, applying union semantics. This means that if there is already a class in the domain, then the union of the existing class and the new class is taken as domain. If the first entry of the current domain is a union class, then the new class is added to the union.

Parameters:
domainClass - the new domain class

getDomain

public RDFSClass getDomain(boolean includingSuperproperties)
Gets the first value of the rdfs:domain property. Note that in most cases, this is only one value (possibly a union class).

Parameters:
includingSuperproperties - true to also consider superproperties
Returns:
the first value of rdfs:domain or null

getDomains

public Collection getDomains(boolean includingSuperproperties)
Gets the values of the rdfs:domain property. Note that in most cases, this is only one value (possibly a union class).

Parameters:
includingSuperproperties - true to also consider superproperties
Returns:
the values of rdfs:domain

getEquivalentProperties

public Collection getEquivalentProperties()
Gets the equivalent slots of this.

Returns:
a Collection of OWLProperty objects

getFirstSuperproperty

public RDFProperty getFirstSuperproperty()
Gets the first superproperty of this (if any exists).

Returns:
the first superproperty or null

getInheritedIcon

public Icon getInheritedIcon()

getInverseProperty

public RDFProperty getInverseProperty()
Gets the inverse property of this.

Returns:
the inverse property or null if none is defined

getRange

public RDFResource getRange()
Equivalent to getRange(false).

Returns:
the (direct) range of this

getRange

public RDFResource getRange(boolean includingSuperproperties)
Gets the range defined at this. This will return the first of the direct values of the rdfs:range property defined at this property, regardless of other values (which would be interpreted as an intersection.

Parameters:
includingSuperproperties - true to also consider superproperties
Returns:
the range of this
See Also:
setRange(edu.stanford.smi.protegex.owl.model.RDFResource), hasDatatypeRange(), hasObjectRange()

getRangeDatatype

public RDFSDatatype getRangeDatatype()
Gets the direct or inherited RDFSDatatype of this. If the range of this is an RDFSDatatype, this will return that type. If the range of this is an OWLDataRange, this will return the type of the first element in the datarange. In all other cases, this will return null. If there is no local range defined at this property, the method will recurse into superproperties.

Returns:
the RDFSDatatype

getRanges

public Collection getRanges(boolean includingSuperproperties)
Gets all range definitions at this (or optionally its superproperties).

Parameters:
includingSuperproperties - true to also consider superproperties
Returns:
the ranges of this

getSubproperties

public Collection getSubproperties(boolean transitive)
Gets the subproperties of this, and possibly the subproperties of the subproperties etc.

Parameters:
transitive - true to get subproperties recursively
Returns:
a collection of RDFProperty

getSubpropertyCount

public int getSubpropertyCount()
Gets the number of properties that have this as rdfs:subPropertyOf.

Returns:
the number of (direct) subproperties

getSuperproperties

public Collection getSuperproperties(boolean transitive)
Gets the superproperties of this, and possibly the superproperties of the superproperties etc.

Parameters:
transitive - true to get superproperties recursively
Returns:
a collection of RDFProperty

getSuperpropertyCount

public int getSuperpropertyCount()
Gets the number of values of the rdfs:subPropertyOf properties.

Returns:
the number of (direct) superproperties

getUnionDomain

public Collection getUnionDomain()
Equivalent to getUnionDomain(false).

Returns:
the direct (union) domain

getUnionDomain

public Collection getUnionDomain(boolean includingSuperproperties)
Gets the domain of this, with union semantics. This means, that if the first entry of the domain is a union class, then the operands of the union will be returned. If the argument is true, then the method will recurse into the superproperties if the local domain of this property is not defined, i.e. the domain is only inherited.

Parameters:
includingSuperproperties - true to walk up the superproperty tree
Returns:
the union domain of this

getUnionRangeClasses

public Collection getUnionRangeClasses()
Gets the range of this with union semantics. This means that if the first entry of the range is a union class, then the operands of the union will be returned.

Returns:
a Collection of RDFSClass

hasDatatypeRange

public boolean hasDatatypeRange()
Checks whether this can take only primitive, datatype values. This is true if the range of this (or its superproperties) only consists of RDFSDatatype or an OWLDataRange, or if this is an owl:DatatypeProperty.

Returns:

hasObjectRange

public boolean hasObjectRange()
Checks whether this can take only object/reference values. This is true if the range of this (or its superproperties) only consists of RDFSClasses (or if this is an owl:ObjectProperty).

Returns:

hasRange

public boolean hasRange(boolean includingSuperproperties)
Checks whether this has any concrete range definition. Optionally this can be extended to its superproperties.

Parameters:
includingSuperproperties - true to also look at the range of the superproperties
Returns:
true if this has an rdfs:range statement (or its superproperties)

isAnnotationProperty

public boolean isAnnotationProperty()
Checks whether this Slot is an OWL AnnotationProperty. Annotation properties are used to assign arbitrary metadata (mostly strings) to resources. In contrast to normal properties, they are ignored by most algorithms.

Returns:
true if this is an annotation property

isDomainDefined

public boolean isDomainDefined()
Checks whether the domain of this property has been explicitly defined. This only checks for the direct domain, i.e. it does not check for the domain definitions in possible superproperties. This is comparable to isDomainDefined(false).

Returns:
true if the (direct) domain is defined

isDomainDefined

public boolean isDomainDefined(boolean transitive)
Checks whether the domain of this property has been explicitly defined. A top-level property does not have a direct domain defined, iff its domain contains owl:Thing. A subproperty does not have a direct domain defined, if it's value of the rdfs:domain property is null.

Parameters:
transitive - true to also consider the superproperties recursively
Returns:
true if the domain is defined

isFunctional

public boolean isFunctional()
Checks whether this is a functional property. A property is functional if it either has the rdf:type owl:FunctionalProperty or one of its superproperties is functional.

Returns:
true if this is functional

isRangeDefined

public boolean isRangeDefined()
Checks whether this property defines its own range. This is true for all top-level properties. Subproperties have no range defined if they don't overload the inherited range from the superproperties.

Returns:
true if the range of this has been defined

isReadOnly

public boolean isReadOnly()
Checks if the values of this slot should be treated as read-only. This is typically true when the protege:readOnly annotation property has the value true on this property.

Returns:
true if this is read only

isSubpropertyOf

public boolean isSubpropertyOf(RDFProperty superproperty,
                               boolean transitive)
Checks if this is a subproperty of a given superproperty.

Parameters:
superproperty - the potential superproperty
transitive - true to traverse the superproperty hierarchy recursively
Returns:
true if this is a subproperty of superproperty

removeEquivalentProperty

public void removeEquivalentProperty(OWLProperty property)
Removes a property from the list of equivalent properties.

Parameters:
property - the equivalent property to remove

removePropertyListener

public void removePropertyListener(PropertyListener listener)
Removes a PropertyListener to receive events on changes in the property. Note that for the sake of backward compatibility this currenty needs to take a PropertyAdapter as argument, but this may later change to take a real PropertyListener.

Parameters:
listener - the PropertyListener to remove (must be a PropertyAdapter)

removeSuperproperty

public void removeSuperproperty(RDFProperty superproperty)
Removes a superproperty.

Parameters:
superproperty - the property to remove from the superproperties

removeUnionDomainClass

public void removeUnionDomainClass(RDFSClass domainClass)
Removes a domain class, with union semantics.

Parameters:
domainClass - the domain class to remove from the domain

setDomain

public void setDomain(RDFSClass domainClass)
Sets the value of rdfs:domain to the given class.

Parameters:
domainClass - the new domain

setDomains

public void setDomains(Collection domainClasses)
Sets the values of the rdfs:domain property at this.

Parameters:
domainClasses - the new domains (RDFSClasses)

setDomainDefined

public void setDomainDefined(boolean value)
Specifies whether the domain of this property is defined or not. This will first empty the domain of this. Then, if the new value is false, it either adds owl:Thing to the domain (if this does not have superproperties), or sets the domain to null (if this has superproperties).


setEquivalentProperties

public void setEquivalentProperties(Collection properties)
Sets the equivalent properties of this.

Parameters:
properties - a Collection of RDFProperty objects

setFunctional

public void setFunctional(boolean value)
Adds or removes owl:FunctionalProperty to/from the rdf:types of this.

Parameters:
value - true to make this a functional property, false to make this unfunctional

setInverseProperty

public void setInverseProperty(RDFProperty inverseProperty)
Sets the inverse property of this.

Parameters:
inverseProperty - the new inverse property or null to clear the value

setRange

public void setRange(RDFResource range)
Sets the rdfs:range of this. The range of a property defines the types of valid values that it can take anywhere. The range can consist of RDFSClasses, RDFDatatypes or RDFDataRanges. If this is supposed to hold datatype values, then a typical range would be OWLModel.getXSDint. If this is supposed to hold instances of multiple classes, you can pass in a union class. Note that this call will completely replace any previous ranges of this.

Parameters:
range - the new range of this property or null to delete the range

setRanges

public void setRanges(Collection ranges)
Sets all ranges of this (in the unlikely case that multiple are needed).

Parameters:
ranges - a Collection of RDFResources (possibly empty)
See Also:
setRange(edu.stanford.smi.protegex.owl.model.RDFResource)

setUnionRangeClasses

public void setUnionRangeClasses(Collection classes)

synchronizeDomainAndRangeOfInverse

public void synchronizeDomainAndRangeOfInverse()
Makes sure that the range and domain of the current inverse property match the domain and range of this. This method should be called after editing steps to ensure that the domain of the inverse equals the range of this etc.