jcreek.representation
Interface RelationData

All Known Implementing Classes:
LocalRelationData, TemporaryRelationData

public interface RelationData

This interface is used to access the data encapsulated by an Relation object. Typically, a KnowledgeModel-implementation will also implement this interface. The contract of this interface specifices that: - Each RelationData object can be encapsulated by multiple Relation objects. - The contract does NOT state that the data is stored locally in the RelationData object, and this can not be assumed. This means that the RelationData object can be an interface to a standard SQL database or a concurrently accessed knowledge model server. - The data represented by an RelationData object must be possible to access concurrently. If an implementation of RelationData allows multiple instances of RelationData to exist at once, the access must allow concurrentl, thread-safe even access to the data across the RelationData instances. - All manipulations of this object is done either from a KnowledgeModel or Relation object (or a subclass of these). RelationData classes should be viewed as internal classes to the Relation and KnowledgeModel classes.

Version:
1.0
Author:
Frode Sørmo

Method Summary
 void addOverridenBy(Relation override)
          This relation is market as beeing overriden by another relation.
 void addOverriding(Relation override)
          This relation is market as overriding another relation.
 long getCreationTime()
          Returns the time of creation for this relation in the same format as System.getCurrentMillis();
 java.lang.String getDescription()
          Returns the description of this entity.
 double getExplanationStrength()
          Returns the explanation strength for this relation.
 Entity getFrom()
          Returns the entity from where the relation originates.
 java.lang.Object getID()
          Returns a unique ID for the entity this elationData represents.
 Relation getInverse()
          Returns the inverse of this relation.
 Relation[] getOverridenBy()
          Returns which relations this relation is overriden by.
 Relation[] getOverrides()
          Returns the relation (if any) this relation overrides.
 Entity getRelationType()
          Returns the instance of Entity describing this relation's type.
 Entity getValue()
          Returns the entity this relation is pointing at.
 boolean isOverridden()
          Returns true if there is at least one relation overriding this relation.
 boolean isOverriding()
          Returns true if this relation overrides another relation.
 void remove()
          Permanently removes the relation represented by this RelationData object.
 void removeOverriddenBy(Relation override)
          Removes a relation from beeing overriden by this relation.
 void removeOverriding(Relation override)
          Removes a relation from beeing overriden by this relation.
 void setCreationTime(long time)
          Sets the creation time.
 void setDescription(java.lang.String description)
          Sets the desciption of this relation.
 void setExplanationStrength(double value)
          Sets the strength variable contains the explanation strength for this relation.
 void setFrom(Entity from)
          Sets the from-entity (the origin) of the relation.
 void setInverse(Relation inverse)
          Sets the inverse of this relation to be the given relation.
 void setRelationType(Entity relationType)
          Sets this relation's type.
 void setValue(Entity value)
          Sets the value (the target) of the relation.
 

Method Detail

getID

public java.lang.Object getID()
Returns a unique ID for the entity this elationData represents.


setFrom

public void setFrom(Entity from)
Sets the from-entity (the origin) of the relation.

Parameters:
from - The new from-entity of the relation.

getFrom

public Entity getFrom()
Returns the entity from where the relation originates.


setValue

public void setValue(Entity value)
Sets the value (the target) of the relation.

Parameters:
value - The new value of the relation.

getValue

public Entity getValue()
Returns the entity this relation is pointing at.


getRelationType

public Entity getRelationType()
Returns the instance of Entity describing this relation's type.


setRelationType

public void setRelationType(Entity relationType)
Sets this relation's type.

Parameters:
relationType - The Entity describing this relation's type.

setDescription

public void setDescription(java.lang.String description)
Sets the desciption of this relation.

Parameters:
description - The String containing the description.

getDescription

public java.lang.String getDescription()
Returns the description of this entity.


getCreationTime

public long getCreationTime()
Returns the time of creation for this relation in the same format as System.getCurrentMillis();


setCreationTime

public void setCreationTime(long time)
Sets the creation time. This is normally not necessary as the creation time is automatically set when the relation is created, but in some odd cases (like the importModel method in KnowledgeModel), it can be required.

Parameters:
time - The time in the format of System.getCurrentMillis() this relation was created.

setExplanationStrength

public void setExplanationStrength(double value)
Sets the strength variable contains the explanation strength for this relation. This value must be [0.0..1.0] - any value below this range is set to 0.0, any value above this range is set to 1.0.

Parameters:
value - The explanation strength.

getExplanationStrength

public double getExplanationStrength()
Returns the explanation strength for this relation.


addOverriding

public void addOverriding(Relation override)
This relation is market as overriding another relation.

Parameters:
override - The relation to override

removeOverriding

public void removeOverriding(Relation override)
Removes a relation from beeing overriden by this relation.

Parameters:
override - The relation to remove from the overide list.

getOverrides

public Relation[] getOverrides()
Returns the relation (if any) this relation overrides. See setOverriding().


isOverriding

public boolean isOverriding()
Returns true if this relation overrides another relation. See setOverriding().


isOverridden

public boolean isOverridden()
Returns true if there is at least one relation overriding this relation. See setOverriding().


addOverridenBy

public void addOverridenBy(Relation override)
This relation is market as beeing overriden by another relation.

Parameters:
override - The relation to override

removeOverriddenBy

public void removeOverriddenBy(Relation override)
Removes a relation from beeing overriden by this relation.

Parameters:
override - The relation to remove from the overide list.

getOverridenBy

public Relation[] getOverridenBy()
Returns which relations this relation is overriden by. See setOverriding().


remove

public void remove()
Permanently removes the relation represented by this RelationData object.


setInverse

public void setInverse(Relation inverse)
Sets the inverse of this relation to be the given relation.


getInverse

public Relation getInverse()
Returns the inverse of this relation. If it has none, null is returned.



Created at IDI, NTNU by the Artificial Intelligence and Learning group