jcreek.representation
Interface EntityData

All Known Implementing Classes:
LocalEntityData

public interface EntityData

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

Version:
1.0
Author:
Frode Sørmo

Method Summary
 void addConstraint(Constraint constraint)
           
 void addRelation(Relation relation)
          Adds a relation to the list of relations from this entity.
 void addRelationInstance(Relation relation)
          Registers a relation as beeing an instance of this entity (which then represents a relation type).
 long getCreationTime()
          Returns the time of creation for this entity in the same format as System.getCurrentMillis();
 java.lang.String getDescription()
          Returns the description of this entity.
 java.io.Serializable getEntityObject()
          Returns the current (if any) data object encapsulated by this entity.
 java.lang.Object getID()
          Returns a unique ID for the entity this EntityData represents.
 Constraint[] getLocalConstraints()
           
 Relation[] getLocalRelations()
          Returns all the relations from this entity.
 Relation[] getLocalRelations(Entity[] relationTypes)
          Returns the local relations from the entity represented by this object, where the type of each relation must be in the array of relation types supplied to this method.
 java.lang.String getName()
          Gives the name of this entity.
 Relation[] getRelationInstances()
          Returns the Relation objects that are of the relation type represented by this entity.
 void remove()
          Permanently deletes the entity.
 void removeConstraint(Constraint c)
           
 void removeRelation(Relation relation)
          Removes a relation to the list of relation from this entity.
 void removeRelationInstance(Relation relation)
          Removes a relation as beeing an instance of this entity (which then represents a relation type).
 void setCreationTime(long time)
          Sets the creation time.
 void setDescription(java.lang.String description)
          Sets the description of this entity.
 void setEntityObject(java.io.Serializable object)
          Sets data object encapsulated by this entity.
 void setName(java.lang.String name)
          Sets the name of this entity.
 

Method Detail

getID

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


setName

public void setName(java.lang.String name)
Sets the name of this entity.

Parameters:
name - The new name of the entity.

getName

public java.lang.String getName()
Gives the name of this entity.


setDescription

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

Parameters:
description - The description String.

getDescription

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


addRelationInstance

public void addRelationInstance(Relation relation)
Registers a relation as beeing an instance of this entity (which then represents a relation type).


removeRelationInstance

public void removeRelationInstance(Relation relation)
Removes a relation as beeing an instance of this entity (which then represents a relation type).

Parameters:
relation - The relation to remove.

addRelation

public void addRelation(Relation relation)
Adds a relation to the list of relations from this entity.

Parameters:
relation - The relation to add.

removeRelation

public void removeRelation(Relation relation)
Removes a relation to the list of relation from this entity.

Parameters:
relation - The relation to remove.

getRelationInstances

public Relation[] getRelationInstances()
Returns the Relation objects that are of the relation type represented by this entity. Only entities that represent relation types are expected to have such instances.


getCreationTime

public long getCreationTime()
Returns the time of creation for this entity 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 entity 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 entity was created.

getLocalRelations

public Relation[] getLocalRelations(Entity[] relationTypes)
Returns the local relations from the entity represented by this object, where the type of each relation must be in the array of relation types supplied to this method.

Parameters:
relationTypes - An array of the relation types of relations to return.

getLocalRelations

public Relation[] getLocalRelations()
Returns all the relations from this entity.


getEntityObject

public java.io.Serializable getEntityObject()
Returns the current (if any) data object encapsulated by this entity.


setEntityObject

public void setEntityObject(java.io.Serializable object)
Sets data object encapsulated by this entity.

Parameters:
object - Any Java object that implements the Serializable interface.

remove

public void remove()
Permanently deletes the entity.


addConstraint

public void addConstraint(Constraint constraint)

getLocalConstraints

public Constraint[] getLocalConstraints()

removeConstraint

public void removeConstraint(Constraint c)


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