|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjcreek.representation.Entity
The Entity Class encapsulates a node in the semantic network, and has references to all relations from and to the entity. An Entity instance actually encapsulates the node, and there may be several instances of Entity representing each node, like a pointer. This means that an Entity can't be serialized directly (but a KnowledgeModel object may be), and a clone created of an Entity will not make another node in the semantic network but another pointer to the same node.
Constructor Summary | |
Entity(KnowledgeModel knowledgeModel,
java.lang.String name,
java.lang.String description)
Create a new entity with the given name, description and creator object. |
|
Entity(KnowledgeModel knowledgeModel,
java.lang.String name,
java.lang.String description,
java.lang.Object user)
Added for compatibility reason. |
Method Summary | |
void |
addConstraint(Constraint constraint)
Adds a constrait to the entity. |
Relation |
addRelation(RelationType relationType,
Entity value)
Adds a relation. |
Relation |
addRelation(RelationType relationType,
Entity value,
double strength)
Adds a relation with the given strength. |
Relation |
addRelation(java.lang.String relationType,
Entity value)
Adds a relation. |
Relation |
addRelation(java.lang.String relationType,
Entity value,
double explanationStrength)
Adds a relation with a given strength. |
Relation |
addRelation(java.lang.String relationType,
java.lang.String value)
Adds a relation with the default strength. |
Relation |
addRelation(java.lang.String relationType,
java.lang.String value,
double explanationStrength)
Adds a relation with a given strength. |
java.lang.Object |
clone()
Creates a clone of this Entity. |
int |
compareTo(java.lang.Object o)
Sorting function, sorts the entity according to name. |
boolean |
equals(java.lang.Object ob)
Two entities are considered equal if they represent the same EntityData object. |
Entity[] |
getAllSubclasses()
Returns all direct and indirect subclasses of this entity. |
java.util.Collection |
getAllSubclassesCollection()
|
Entity[] |
getAllSuperclasses()
Returns all direct and indirect subclasses of this entity. |
java.util.Collection |
getAllSuperclassesCollection()
|
Constraint[] |
getConstraints()
Returns all local and inherited constraints for this entity. |
long |
getCreationTime()
Returns the time of creation of this concept, in the the format as System.currentTimeMillis(); |
Partition |
getCurrentPartition()
Returns the current partition, if set. |
java.lang.String |
getDescription()
Returns a description of this entity. |
protected EntityData |
getEntityData()
Returns the EntityData object in case a subclass needs to manipulate it directly. |
java.io.Serializable |
getEntityObject()
Returns the object encapsulated by this entity. |
java.lang.String |
getFrameString()
Returns a string representation of this entity, including all relations from it. |
java.lang.Object |
getID()
Returns the unique ID of this relation. |
Entity[] |
getImmediateSubclasses()
Returns all the direct subclasses of this entity. |
java.util.Collection |
getImmediateSubclassesCollection()
|
Entity[] |
getImmediateSuperclasses()
Returns the direct superclass(es) of this entity. |
java.util.Collection |
getImmediateSuperclassesCollection()
|
Constraint[] |
getInheritedConstraints()
Returns all inherited constraints for this entity |
KnowledgeModel |
getKnowledgeModel()
Returns the knowledgemodel this concept belongs to. |
Constraint[] |
getLocalConstraints()
Returns all local constraints for this entity. |
Relation |
getLocalRelation(RelationType rcd)
Returns the first relation of a given type (local relations only, no inherited relations). |
Relation |
getLocalRelation(RelationType[] rcd)
Returns the first relation of a given set of types (local relations only, no inherited relations). |
Relation |
getLocalRelation(RelationType relationType,
Entity value)
Returns the first relation of the given type to the given value. |
Relation |
getLocalRelation(RelationType relationType,
Entity value,
double strength)
Returns the first relation of the given type to the given value and explanation strength. |
Relation |
getLocalRelation(java.lang.String relationName)
Returns the first relation of a given type (only local relations, no inherited relations). |
Relation |
getLocalRelation(java.lang.String[] relationName)
Given an array of strings, this method retrieves the set of local relations where the name of the relation-type (the RelationType) match any of the given relation name, and returns the first from that set. |
Relation[] |
getLocalRelations()
Returns all local relations from this entity. |
Relation[] |
getLocalRelations(RelationType relationClass)
Returns all relations of the type relationClass that lead from or to this entity. |
Relation[] |
getLocalRelations(RelationType[] types)
Returns all local relations from or to this entity with any of the specified relation types. |
Relation[] |
getLocalRelations(java.lang.String relationName)
Returns all relations from or to this entity with the specified name. |
Relation[] |
getLocalRelations(java.lang.String[] relationName)
Returns all relations from or to this entity with any of the specified names. |
java.lang.String |
getName()
Returns the name of this entity. |
Relation |
getRelation(RelationType rcd)
Returns the first relation of a given type. |
Relation |
getRelation(RelationType[] rcd)
Returns the first relation in a set of given types. |
Relation |
getRelation(java.lang.String relationName)
Returns the first relation of a given type. |
Relation |
getRelation(java.lang.String[] relationName)
Given an array of strings, this method retrieves the set of relations where the name of the relation-type (the RelationType) match any of the given relation name, and returns the first from that set. |
java.lang.String[] |
getRelationNames()
Return all the names of the relation types from this element. |
Relation[] |
getRelations()
Returns all relations - local and inherited - for this entity. |
Relation[] |
getRelations(RelationType relationClass)
Returns all relations - local and inherited - for this entity. |
Relation[] |
getRelations(RelationType[] relationClass)
Returns all relations - local and inherited - for this entity. |
Relation[] |
getRelations(RelationType[] relationClass,
InheritanceMethod method)
The same as the getRelations(RelationType, InheritanceMethod) method, but it accepts a set of RelationTypes and will return relations with relation-types that match or are subclasses of any of the supplied RelationTypes. |
Relation[] |
getRelations(RelationType relationClass,
InheritanceMethod method)
Returns all relations - local and inherited - for this entity using the supplied inheritance method. |
Relation[] |
getRelations(java.lang.String relationName)
Returns all relations from or to this entity with the specified name. |
Relation[] |
getRelations(java.lang.String[] relationName)
Returns all relations from or to this entity with the specified names. |
RelationType[] |
getRelationTypes()
Returns all the different relation types from or to the entity. |
java.lang.String |
getValueString()
Alternative toString method that should construct a brief string of the entity. |
boolean |
hasEntityObject()
Returns true if this Entity encapsulates a Java object. |
int |
hashCode()
Overrides the hashCode() method to match the class' new equals() method. |
boolean |
isAssignableFrom(Entity subclassType)
Returns true if this entity is a direct or indirect superclass of the given entity. |
void |
remove()
Removes the entity. |
void |
removeConstraint(Constraint constraint)
Removes a constraint from the entity |
void |
removeEntityData()
Removes the EntityData-object encapsulated by this entity. |
void |
setDescription(java.lang.String description)
Sets the description of this entity. |
void |
setEntityObject(java.io.Serializable data)
Sets an object as beeing encapsulated by this entity. |
void |
setName(java.lang.String name)
Attempts to set the name of this entity. |
java.lang.String |
toString()
Constructs the string representation of the Object conatined in the value. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Entity(KnowledgeModel knowledgeModel, java.lang.String name, java.lang.String description) throws NameAlreadyExistException
knowledgeModel
- The KnowledgeModel this concept is a part of.name
- The name of the concept. This name must be unique in the KnowledgeModel unless the
model is set to accept duplicates. If it is not, a ConceptAlreadyExistException is thrown.description
- An (optional) description of the entity.public Entity(KnowledgeModel knowledgeModel, java.lang.String name, java.lang.String description, java.lang.Object user) throws NameAlreadyExistException
knowledgeModel
- The KnowledgeModel this concept is a part of.name
- The name of the concept. This name must be unique in the KnowledgeModel unless the
model is set to accept duplicates. If it is not, a ConceptAlreadyExistException is thrown.description
- An (optional) description of the entity.user
- The user creating this object, now ignored.Method Detail |
public void remove()
protected EntityData getEntityData()
public java.lang.Object getID()
public Relation addRelation(RelationType relationType, Entity value)
relationType
- The RelationType of the new relation to create.public Relation addRelation(RelationType relationType, Entity value, double strength)
relationType
- The name of the relation type of the new relation to create.strength
- A double value between 0 and 1 representing the relation's strength.public Relation addRelation(java.lang.String relationType, Entity value) throws NoSuchRelationTypeException
NoSuchRelationTypeException
public Relation addRelation(java.lang.String relationType, java.lang.String value) throws NoSuchRelationTypeException, NoSuchEntityException
relationType
- The name of the relation typeype of the new relation to create.
NoSuchRelationTypeException
NoSuchEntityException
public Relation addRelation(java.lang.String relationType, Entity value, double explanationStrength) throws NoSuchRelationTypeException
relationType
- the name of relationtype.value
- the reference to entity to create relation to.explanationStrength
- the explanation strength for this relation
NoSuchRelationTypeException
public Relation addRelation(java.lang.String relationType, java.lang.String value, double explanationStrength) throws NoSuchRelationTypeException, NoSuchEntityException
relationType
- the name of relationtype.value
- the reference to entity to create relation to.explanationStrength
- the explanation strength for this relation
NoSuchRelationTypeException
NoSuchEntityException
public java.lang.String[] getRelationNames()
public RelationType[] getRelationTypes()
public Relation[] getLocalRelations(RelationType relationClass)
public Relation[] getLocalRelations(java.lang.String relationName)
relationName
- The name of the relation type to return.public Relation[] getLocalRelations(java.lang.String[] relationName)
relationName
- The name of the relation type to return.public Relation[] getRelations()
public Relation[] getRelations(java.lang.String relationName)
relationName
- The name of the relation type to return.public Relation[] getRelations(java.lang.String[] relationName)
relationName
- The list of names of the relation types to return.public Relation[] getRelations(RelationType relationClass)
relationClass
- The RelationType for the type of
relations returned.public Relation[] getRelations(RelationType[] relationClass)
relationClass
- The set of RelationTypes for the type of
relations returned.public Relation[] getRelations(RelationType relationClass, InheritanceMethod method)
relationClass
- The RelationType for the type of
relations returned.
method The inheritance method used.public Relation[] getRelations(RelationType[] relationClass, InheritanceMethod method)
relationClass
- The set of RelationType for the type of
relations returned.
method The inheritance method used.public Relation getRelation(RelationType rcd) throws NoSuchRelationException
rcd
- The RelationType of the relation-type to find.
NoSuchRelationException
public Relation getRelation(RelationType[] rcd) throws NoSuchRelationException
rcd
- The set of RelationType of the relation-type to find.
NoSuchRelationException
public Relation getLocalRelation(RelationType rcd) throws NoSuchRelationException
rcd
- The RelationType of the relation-type to find.
NoSuchRelationException
public Relation getLocalRelation(RelationType[] rcd) throws NoSuchRelationException
rcd
- The RelationType of the relation-type to find.
NoSuchRelationException
public Relation getRelation(java.lang.String relationName) throws NoSuchRelationException, NoSuchRelationTypeException
relationName
- The name of the relation-type to find.
NoSuchRelationException
NoSuchRelationTypeException
public Relation getRelation(java.lang.String[] relationName) throws NoSuchRelationException, NoSuchRelationTypeException
NoSuchRelationException
NoSuchRelationTypeException
public Relation getLocalRelation(java.lang.String relationName) throws NoSuchRelationException, NoSuchRelationTypeException
relationName
- The name of the relation-type to find.
NoSuchRelationException
NoSuchRelationTypeException
public Relation getLocalRelation(java.lang.String[] relationName) throws NoSuchRelationException, NoSuchRelationTypeException
NoSuchRelationException
NoSuchRelationTypeException
public Relation getLocalRelation(RelationType relationType, Entity value) throws NoSuchRelationException
relationType
- The relation type of the relation to returnvalue
- The value of the relation
NoSuchRelationException
public Relation getLocalRelation(RelationType relationType, Entity value, double strength) throws NoSuchRelationException
relationType
- The relation type of the relation to returnvalue
- The value of the relationstrength
- The explanation strength of the relation
NoSuchRelationException
public Relation[] getLocalRelations(RelationType[] types)
types
- An array of the types of relations to return.public Relation[] getLocalRelations()
public void setName(java.lang.String name) throws NameAlreadyExistException
name
- The (new) name to assign to this entity.
NameAlreadyExistException
public java.lang.String getName()
public Partition getCurrentPartition()
public java.lang.String getValueString()
public java.lang.String toString()
public java.lang.String getFrameString()
public void setEntityObject(java.io.Serializable data)
public void removeEntityData()
public java.io.Serializable getEntityObject()
public boolean hasEntityObject()
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
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 java.lang.Object clone()
public long getCreationTime()
public Entity[] getImmediateSuperclasses()
public java.util.Collection getImmediateSuperclassesCollection()
public Entity[] getImmediateSubclasses()
public java.util.Collection getImmediateSubclassesCollection()
public Entity[] getAllSubclasses()
public java.util.Collection getAllSubclassesCollection()
public Entity[] getAllSuperclasses()
public java.util.Collection getAllSuperclassesCollection()
public boolean isAssignableFrom(Entity subclassType)
subclassType
- A relation type to test.public void addConstraint(Constraint constraint)
constraint
- The constraint to be addedpublic Constraint[] getConstraints()
public Constraint[] getLocalConstraints()
public Constraint[] getInheritedConstraints()
public void removeConstraint(Constraint constraint)
constraint
- the constraint to be removed
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |