|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjcreek.representation.Relation
The Relation class represents a relation (like an edge in a graph) between two entities. Associated with each relation is a RelationType object that siginifies its type. If the RelationType has an inverse type, an inverse relation is also created (in the other direction) between the two entities.
Constructor Summary | |
protected |
Relation(Entity from,
Entity type,
Entity value,
double strength,
boolean ignore)
Creates a new relation without supplying a RelationType object (the RelationType class is really a convinience class of a representation level higher than Relation since the type of a relation in the formalism is represented by an Entity). |
|
Relation(Entity from,
RelationType type,
Entity value)
Create a new relation of a given type from an origin entity to a target entity. |
|
Relation(Entity from,
RelationType type,
Entity value,
double strength)
Create a new relation of a given type from an origin entity to a target entity. |
|
Relation(Entity from,
RelationType type,
Entity value,
Relation override)
Create a new relation of a given type from an origin entity to a target entity. |
Method Summary | |
void |
addOriginal(Relation rel)
If this relation is inherited, this method adds a relation that is counted as beeing among the originals of this relations. |
protected void |
addOverriddenBy(Relation rel)
|
void |
addOverriding(Relation override)
This relation is market as overriding another relation. |
java.lang.Object |
clone()
Returns a clone of this relation. |
void |
confirm()
If this relation is temporary (e.g. inherited), this method will make it permanent and decouple it from its original source. |
boolean |
equals(java.lang.Object ob)
Two entities are considered equal if they represent the same RelationData object. |
long |
getCreationTime()
Returns the time of creation of this relation, in the the format as System.currentTimeMillis(); |
Partition |
getCurrentPartition()
Returns the current partition, if set. |
java.lang.String |
getDescription()
Returns a description of this relation. |
ExplanationModel |
getExplanationModel()
If this relation is inherited, this method returns the model that justifies the inheritance. |
Explanation[] |
getExplanations()
Returns an array of explanations for this relation. |
double |
getExplanationStrength()
Returns the strength variable contains the explanation strength for this relation. |
Entity |
getFrom()
Returns the entity from where the relation originates. |
java.lang.Object |
getID()
Returns the unique ID of this relation. |
Relation |
getInverse()
Returns the reverse of this relation, i.e. the relation going from the target of this relation to the origin of this relation with a relation type that is the inverse of this relation's type. |
java.lang.String |
getInverseName()
getInverseName returns the name of the inverse relation. |
KnowledgeModel |
getKnowledgeModel()
Returns the knowledgemodel this relation belongs to. |
java.lang.String |
getName()
Returns the name of this relation. |
java.lang.String |
getNaturalInverseName()
Returns the natural inverse name of the relation. |
java.lang.String |
getNaturalName()
Returns the natural name of the relation. |
Relation[] |
getOriginal()
When this relation is an inherited relation, it returnes the original relation it was inherited from. |
Relation[] |
getOverridenBy()
Returns which relations this relation is overriden by. |
Relation[] |
getOverridingRelations()
Returns the relations (if any) this relation overrides. |
SubModel |
getPathModel()
If this relation is inherited, this method returns a submodel of the knowledgemodel which contains all relations and all entities contained in all explanation-paths from the origin to the target entity. |
protected RelationData |
getRelationData()
Returns this relation's RelationData object. |
RelationType |
getRelationType()
Returns an instance of RelationType describing this relations type. |
Entity |
getValue()
Returns the entity this relation is pointing at. |
int |
hashCode()
Overrides the hashCode() method to match the class' new equals() method. |
boolean |
hasInverse()
Returns true if this relation has an inverse relation. |
boolean |
hasOriginal(Relation rel)
Returns true if the supplied relations is among the originals of this relation. |
Relation |
inherit(Entity inheritedTo,
ExplanationModel model)
When inheriting a relation, a copy of the relation is made and returned. |
boolean |
isInherited()
Returns true if this relation is inherited. |
boolean |
isNegated()
Returns true if this relation is negated, i.e. represents an explicit representation of a lack of relation between two entities. |
boolean |
isOverridden()
Returns true if there is at least one relation overriding this relation. |
boolean |
isOverriding()
Returns true if this relation overrides another relation.See setOverriding(). |
boolean |
isPersistent()
Returns true if this relation is composite, i.e. composed of a chain of relations. |
static void |
main(java.lang.String[] argv)
|
void |
negate()
Sets the explanation strength to 0 - in effect representing explicitly that there is NOT a relationship of this kind between the two entities. |
void |
remove()
Removes this relation. |
protected void |
removeOverriddenBy(Relation rel)
|
void |
removeOverriding(Relation override)
Removes a relation from the list of overridden relations. |
void |
setDescription(java.lang.String description)
Sets the description 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 |
setRelationType(RelationType relationType)
Sets the relation-type of this relation. |
void |
setValue(Entity value)
Sets the value (the target) of the relation. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected Relation(Entity from, Entity type, Entity value, double strength, boolean ignore)
public Relation(Entity from, RelationType type, Entity value)
type
- The type of the relation to create.from
- The origin entity - where the relation is from.value
- The target entity - where the relation is pointing to.public Relation(Entity from, RelationType type, Entity value, double strength)
type
- The type of the relation to create.from
- The origin entity - where the relation is from.value
- The target entity - where the relation is pointing to.strength
- The explanation strength of the relation.public Relation(Entity from, RelationType type, Entity value, Relation override)
type
- The type of the relation to create.from
- The origin entity - where the relation is from.value
- The target entity - where the relation is pointing to.override
- The relation that this relation overrides.Method Detail |
public void remove()
public void setExplanationStrength(double value)
value
- The explanation strength.public double getExplanationStrength()
public void negate()
public boolean isNegated()
public Entity getValue()
public Entity getFrom()
public java.lang.String getInverseName()
public java.lang.String getName()
public boolean hasInverse()
public java.lang.String getNaturalInverseName()
public java.lang.String getNaturalName()
public Relation getInverse()
public RelationType getRelationType()
public void addOverriding(Relation override)
public void removeOverriding(Relation override)
public Relation[] getOverridingRelations()
public boolean isOverriding()
public boolean isOverridden()
public Relation[] getOverridenBy()
protected void removeOverriddenBy(Relation rel)
protected void addOverriddenBy(Relation rel)
public void setValue(Entity value)
value
- The new value of the relation.public void setFrom(Entity from)
from
- The new from-entity of the relation.public void setRelationType(RelationType relationType)
relationType
- The new relation-type.public boolean equals(java.lang.Object ob)
public int hashCode()
public java.lang.String getDescription()
public void setDescription(java.lang.String description)
public KnowledgeModel getKnowledgeModel()
public long getCreationTime()
public Relation inherit(Entity inheritedTo, ExplanationModel model)
inheritedTo
- The entity this relation shall be inherited to.model
- The ExplanationModel justifying this inheritance.public ExplanationModel getExplanationModel()
public SubModel getPathModel()
public Explanation[] getExplanations() throws TaskTooComplexException
TaskTooComplexException
public boolean isInherited()
public boolean isPersistent()
public Relation[] getOriginal()
public boolean hasOriginal(Relation rel)
rel
- The relation to test.public void addOriginal(Relation rel)
rel
- The (additional) original relation.public void confirm()
protected RelationData getRelationData()
public Partition getCurrentPartition()
public java.lang.Object getID()
public java.lang.Object clone()
public java.lang.String toString()
public static void main(java.lang.String[] argv)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |