GATE
Version 3.1-2270

gate.creole.ontology
Class PropertyImpl

java.lang.Object
  extended by gate.creole.ontology.OntologyResourceImpl
      extended by gate.creole.ontology.PropertyImpl
All Implemented Interfaces:
OntologyConstants, OntologyResource, Property
Direct Known Subclasses:
DatatypePropertyImpl, ObjectPropertyImpl

public class PropertyImpl
extends OntologyResourceImpl
implements Property

This class provides implementations for methods common to all types of ontological properties.


Field Summary
protected  Set directDomain
          The set of domain restrictions (i.e.
protected  Set directRange
          The set of range restrictions (i.e.
protected  Set domain
          The set of domain restrictions (i.e.
protected  boolean functional
           
protected  boolean inverseFunctional
           
protected  Set range
          The set of range restrictions (i.e.
protected  Set samePropertiesSet
           
protected  Set subPropertiesSet
           
protected  Set subPropertiesTransitiveClosure
           
protected  Set superPropertiesSet
           
protected  Set superPropertiesTransitiveClosure
           
 
Fields inherited from class gate.creole.ontology.OntologyResourceImpl
comment, instanceProperties, name, ontology, taxonomy, uri
 
Fields inherited from interface gate.creole.ontology.OntologyConstants
DIRECT_CLOSURE, TRANSITIVE_CLOSURE
 
Constructor Summary
PropertyImpl(String name, String comment, OClass aDomainClass, Object aRangeType, Ontology ontology)
           
PropertyImpl(String name, String comment, Set domain, Set range, Ontology ontology)
          Creates a property.
 
Method Summary
 void addSubProperty(Property property)
          Add a SuperPropertyOf relation between the given property and this.
 void addSuperProperty(Property property)
          Adds a SubPropertyOf relation between the given property and this.
protected  void calculateSubPropertiesClosure()
           
protected  void calculateSuperPropertiesClosure()
           
 Set getDomain()
          Returns the set of domain classes for this property.
 String getName()
          Gets resource name.
 Set getRange()
          Returns the set of range classes for this property.
 Set getSamePropertyAs()
          Returns a set of all KBProperty instances that are in SamePropertyAs relation with this property.
 Set getSubProperties(byte closure)
          Gets the set of sub-properties for this property.
 Set getSuperProperties(byte closure)
          Gets the set of super-properties for this property.
 String getURI()
          Gets the URI of the resource.
 boolean isFunctional()
          Answers whether this property is a functional property.
 boolean isInverseFunctional()
          Answers whether this property is an inverse functional property.
 boolean isValidDomain(OntologyResource resource)
          Checks whether a provided value can be a domain value for this property.
 boolean isValidRange(Object value)
          Checks whether a provided instance can be a range value for this property.
protected  void recalculateDomain()
          Notifies this property that it should recalculate the range set (because the range of a super-property has changed).
protected  void recalculateRange()
          Notifies this property that it should recalculate the range set (because the range of a super-property has changed).
 void removeSubProperty(Property property)
          Removes a SuperPropertyOf relation between the given property and this.
 void removeSuperProperty(Property property)
          Removes a SubPropertyOf relation between the given property and this.
 void setFunctional(boolean functional)
          Sets the functional property flag on this property.
 void setInverseFunctional(boolean inverseFunctional)
          Sets the inverse functional property flag on this property.
 void setSamePropertyAs(Property theProperty)
          Add a samePropertyAs relation between the two properties.
 void setURI(String theURI)
          Sets the URI of the resource.
 String toString()
           
 
Methods inherited from class gate.creole.ontology.OntologyResourceImpl
addPropertyValue, getComment, getOntology, getPropertyValue, getPropertyValues, getSetPropertiesNames, getTaxonomy, removePropertyValue, removePropertyValues, setComment, setName, setOntology
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gate.creole.ontology.OntologyResource
addPropertyValue, getComment, getOntology, getPropertyValues, getSetPropertiesNames, getTaxonomy, removePropertyValue, removePropertyValues, setComment, setName
 

Field Detail

domain

protected Set domain
The set of domain restrictions (i.e. OClass objects} for this property. This is composed from the directDomain plus all the domain restrictions from the super-properties. Once calculated this value is cached.


directDomain

protected Set directDomain
The set of domain restrictions (i.e. OClass objects} set as domain directly for this property.


range

protected Set range
The set of range restrictions (i.e. OClass or Class objects) for this property. This is composed from the directRange plus all the range restrictions from the super-properties. Once calculated this value is cached.


directRange

protected Set directRange
The set of range restrictions (i.e. OClass or Class objects) set as range directly for this property.


samePropertiesSet

protected Set samePropertiesSet

superPropertiesSet

protected Set superPropertiesSet

subPropertiesSet

protected Set subPropertiesSet

superPropertiesTransitiveClosure

protected Set superPropertiesTransitiveClosure

subPropertiesTransitiveClosure

protected Set subPropertiesTransitiveClosure

functional

protected boolean functional

inverseFunctional

protected boolean inverseFunctional
Constructor Detail

PropertyImpl

public PropertyImpl(String name,
                    String comment,
                    Set domain,
                    Set range,
                    Ontology ontology)
Creates a property.

Parameters:
name - the name of the property
domain - the ontology class representing the domain for this property.
range - a set containing range restrictions. These can either be OClass or Class objects depending on the types of the values that are permitted.
ontology - the ontology this property is defined in.

PropertyImpl

public PropertyImpl(String name,
                    String comment,
                    OClass aDomainClass,
                    Object aRangeType,
                    Ontology ontology)
Method Detail

getName

public String getName()
Description copied from interface: OntologyResource
Gets resource name.

Specified by:
getName in interface OntologyResource
Overrides:
getName in class OntologyResourceImpl
Returns:
Returns the name.

getURI

public String getURI()
Description copied from interface: OntologyResource
Gets the URI of the resource.

Specified by:
getURI in interface OntologyResource
Overrides:
getURI in class OntologyResourceImpl
Returns:
Returns the URI.

setURI

public void setURI(String theURI)
Description copied from interface: OntologyResource
Sets the URI of the resource.

Specified by:
setURI in interface OntologyResource
Overrides:
setURI in class OntologyResourceImpl
Parameters:
theURI - The URI to set.

setSamePropertyAs

public void setSamePropertyAs(Property theProperty)
Description copied from interface: Property
Add a samePropertyAs relation between the two properties. Each property has a set of these, so it is possible to have samePropertyAs relation between more than two properties.

Specified by:
setSamePropertyAs in interface Property

getSamePropertyAs

public Set getSamePropertyAs()
Description copied from interface: Property
Returns a set of all KBProperty instances that are in SamePropertyAs relation with this property. Or null if there are no such properties.

Specified by:
getSamePropertyAs in interface Property
Returns:
a Set value.

addSuperProperty

public void addSuperProperty(Property property)
Description copied from interface: Property
Adds a SubPropertyOf relation between the given property and this.

Specified by:
addSuperProperty in interface Property

recalculateDomain

protected void recalculateDomain()
Notifies this property that it should recalculate the range set (because the range of a super-property has changed).


recalculateRange

protected void recalculateRange()
Notifies this property that it should recalculate the range set (because the range of a super-property has changed).


removeSuperProperty

public void removeSuperProperty(Property property)
Description copied from interface: Property
Removes a SubPropertyOf relation between the given property and this.

Specified by:
removeSuperProperty in interface Property

addSubProperty

public void addSubProperty(Property property)
Add a SuperPropertyOf relation between the given property and this.

Specified by:
addSubProperty in interface Property
Parameters:
property -

removeSubProperty

public void removeSubProperty(Property property)
Description copied from interface: Property
Removes a SuperPropertyOf relation between the given property and this.

Specified by:
removeSubProperty in interface Property

getDomain

public Set getDomain()
Returns the set of domain classes for this property. This is composed from the classes declared as domain restriction for this property plus all the domain restrictions from the super-properties.

Specified by:
getDomain in interface Property

getRange

public Set getRange()
Returns the set of range classes for this property. This is composed from the classes declared as range restriction for this property plus all the range restrictions from the super-properties.

Specified by:
getRange in interface Property
Returns:
a set of OClass or Class objects.

isFunctional

public boolean isFunctional()
Description copied from interface: Property
Answers whether this property is a functional property. Functional properties are the ones that can have at most one value for any given value from the domain. Both object properties and datatype properties can be functional.

Specified by:
isFunctional in interface Property
Returns:
true if this property is functional.

isInverseFunctional

public boolean isInverseFunctional()
Description copied from interface: Property
Answers whether this property is an inverse functional property. Inverse functional properties are the ones that for any given domain value there can be at most one range value that is valid for this property. Both object properties and datatype properties can be inverse functional.

Specified by:
isInverseFunctional in interface Property
Returns:
true if this property is inverse functional.

setFunctional

public void setFunctional(boolean functional)
Description copied from interface: Property
Sets the functional property flag on this property.

Specified by:
setFunctional in interface Property
Parameters:
functional - true iff the property should be marked as functional.

setInverseFunctional

public void setInverseFunctional(boolean inverseFunctional)
Description copied from interface: Property
Sets the inverse functional property flag on this property.

Specified by:
setInverseFunctional in interface Property
Parameters:
inverseFunctional - true iff the property should be marked as inverse functional.

isValidDomain

public boolean isValidDomain(OntologyResource resource)
Checks whether a provided value can be a domain value for this property. If the value is an OInstance then, in order to be a valid domain value it needs to be a member of all the classes defined as members of the domain of this property. The domain of this property is defined recursively based on its super-properties as well. For any other types of values it returns true.

Specified by:
isValidDomain in interface Property
Parameters:
instance - the instance to be checked.
Returns:
true if the provided instance can be a domain value for this property.

isValidRange

public boolean isValidRange(Object value)
Checks whether a provided instance can be a range value for this property. For an instance to be a valid range value it needs to be a member of all the classes defined as members of the range of this property. The range of this property is defined recursively based on its super-properties as well.

Specified by:
isValidRange in interface Property
Parameters:
instance - the instance to be checked.
Returns:
true if the provided instance can be a range value for this property.

toString

public String toString()
Overrides:
toString in class Object

getSuperProperties

public Set getSuperProperties(byte closure)
Gets the set of super-properties for this property.

Specified by:
getSuperProperties in interface Property
Parameters:
{@link - OntologyConstants#DIRECT_CLOSURE} for direct super-properties only or OntologyConstants.TRANSITIVE_CLOSURE for all the super-properties.
Returns:
a set of Property values.

calculateSuperPropertiesClosure

protected void calculateSuperPropertiesClosure()

getSubProperties

public Set getSubProperties(byte closure)
Gets the set of sub-properties for this property.

Specified by:
getSubProperties in interface Property
Parameters:
{@link - OntologyConstants#DIRECT_CLOSURE} for direct sub-properties only or OntologyConstants.TRANSITIVE_CLOSURE for all the sub-properties.
Returns:
a set of Property values.

calculateSubPropertiesClosure

protected void calculateSubPropertiesClosure()

GATE
Version 3.1-2270