|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The KnowledgeModel is the main interface to the model of entities and relations. As the entities can be compared to a node and a relation to an edge, the KnowledgeModel can be thought of as the graph containing these nodes and edges. The KnowledgeModel interface provides a uniform way of accessing the data that is independent on how this data is stored. Any code that access and manipulate model contents should refer to this interface instead of any specific implementations of the interface.
Method Summary | |
void |
addContext(Context c)
Registers a context with the KnowledgeModel. |
void |
addModelChangeListener(ModelChangeListener listen)
Registrers a listener that will get notified if there are any changes to the model. |
int |
entitySize()
Returns the number of entities in the model. |
void |
fireModelChangeEvent(ModelChangeEvent event)
Notifies the listeners that a change has occured in the model. |
java.lang.String |
getAuthor()
Returns the author of the model. |
Constraint |
getConstraint(java.lang.Object id)
Find a constraint in the model with the given ID. |
java.util.Iterator |
getConstraintIterator()
Returns an iterator of all the constraints in the model. |
Constraint[] |
getConstraints()
Returns an array of all constraints in the model. |
Context[] |
getContexts()
Returns an array of all registered contexts. |
Context[] |
getContexts(java.lang.Class c)
Returns all context object registrered with the KnowledgeModel that is of the Class given as a parameter to the method. |
java.lang.String |
getDescription()
Returns the description of the model. |
Entity[] |
getEntities()
Returns an array of all entities in the model. |
Entity |
getEntity(java.lang.Object id)
Find an entity in the model with the given name or ID. |
java.util.Iterator |
getEntityIterator()
Returns an iterator of all the entities in the model. |
LRUCache |
getInferenceCache()
Returns this models inference cache. |
java.lang.String |
getName()
Returns the name of the model. |
Partition |
getPartition(java.lang.Object id)
Returns the partition with the given name or ID. |
java.util.Iterator |
getPartitionIterator()
Returns an iterator for all the partitions in this KnowledgeModel. |
Partition[] |
getPartitions()
Returns an array of all partitions in this KnowledgeModel. |
Relation |
getRelation(java.lang.Object id)
Find a relation in the model with the given ID. |
java.util.Iterator |
getRelationIterator()
Returns an iterator of all the realtions in the model. |
Relation[] |
getRelations()
Returns an array of all relations in the model. |
RelationType |
getRelationType(java.lang.String name)
Find a relation class in the model of the given name. |
java.lang.String |
getTitle()
Returns the title of the model. |
boolean |
hasContext(Context c)
Returns true if the give context is registred with the KnowledgeModel. |
boolean |
hasEntity(java.lang.Object id)
Returns true if an entity with the given name exists in the KnowledgeModel or an entity is registered with this key. |
boolean |
hasPartition(java.lang.Object id)
Returns true if the KnowledgeModel contains a Partition with the given ID or name. |
void |
importModel(KnowledgeModel model)
Removes any existing content from the KnowledgeModel and replaces it with the contents of the current model. |
ConstraintData |
makeConstraint()
|
EntityData |
makeEntity()
Creates a new data object for storing data for an Entity. |
PartitionData |
makePartition()
Creates a new data object for storing data for a Partition. |
RelationData |
makeRelation(Entity from,
Entity type,
Entity value)
Creates a new data object for storing data for a Relation. |
EntityType[] |
matchEntityType(EntityType[] arr)
Returns an array of all entities in the model that match a given EntityType. |
void |
mergeModel(KnowledgeModel model)
This method merges the contents of a given model into the current model. |
void |
registerEntity(java.lang.String name,
Entity ent)
Indexes a given entity with the given name. |
void |
registerPartition(java.lang.String name,
Partition partition)
Registers a partition under the given name in this models partition index. |
int |
relationSize()
Returns the number of relations in the model. |
void |
removeContext(Context c)
Removes the given context from this KnowledgeModel. |
void |
removeModelChangeListener(ModelChangeListener listen)
Removes a ModelChangeListener listening to changes to this model. |
void |
setAuthor(java.lang.String authorName)
Sets the author of the model. |
void |
setDescription(java.lang.String description)
Sets description of model. |
void |
setName(java.lang.String name)
Sets name of model. |
void |
setTitle(java.lang.String title)
Sets title of model. |
void |
unregisterEntity(java.lang.String name)
Removes the index with the given name from the entity index. |
void |
unregisterPartition(java.lang.String name)
Unregisters an index entry from the parition index. |
Method Detail |
public void importModel(KnowledgeModel model)
model
- The KnowledgeModel that will have its contents copied into this model.public void mergeModel(KnowledgeModel model)
model
- The knowledgemodel to merge into this model.public void setName(java.lang.String name)
name
- The name of the model.public java.lang.String getName()
public void setDescription(java.lang.String description)
description
- The description of the model.public java.lang.String getDescription()
public void setTitle(java.lang.String title)
title
- The title of the model.public java.lang.String getTitle()
public java.lang.String getAuthor()
public void setAuthor(java.lang.String authorName)
authorName
- The name of the author.public Entity getEntity(java.lang.Object id)
id
- The name or ID of the entity to be found.
public Relation getRelation(java.lang.Object id)
id
- The unique identifier for this relation.public void registerEntity(java.lang.String name, Entity ent) throws NameAlreadyExistException
name
- The name to assoicate with this entity.ent
- The Entity object.
NameAlreadyExistException
public void unregisterEntity(java.lang.String name)
name
- The name (key) of the index entry to remove.public boolean hasEntity(java.lang.Object id)
id
- The index key of the entity.public int entitySize()
public int relationSize()
public java.util.Iterator getEntityIterator()
public java.util.Iterator getRelationIterator()
public Entity[] getEntities()
public Relation[] getRelations()
public LRUCache getInferenceCache()
public EntityType[] matchEntityType(EntityType[] arr)
arr
- An array of the type of EntityType to find.public RelationType getRelationType(java.lang.String name)
name
- The name of the relation class to be found
public void addModelChangeListener(ModelChangeListener listen)
listen
- The ModelChangeListener to add.public void removeModelChangeListener(ModelChangeListener listen)
listen
- The ModelChangeListener to remove.public EntityData makeEntity()
public RelationData makeRelation(Entity from, Entity type, Entity value)
from
- The Entity this relation is from (the origin).value
- The Entity this relation is to (the target).type
- The Entity that represents the type of the relation.public PartitionData makePartition() throws NameAlreadyExistException
NameAlreadyExistException
public Partition[] getPartitions()
public java.util.Iterator getPartitionIterator()
public Partition getPartition(java.lang.Object id)
id
- The name or ID of the partition to return.public void registerPartition(java.lang.String name, Partition partition) throws NameAlreadyExistException
name
- The name (key) to register the partition under.partition
- The Partition to register under this name.
NameAlreadyExistException
public void unregisterPartition(java.lang.String name)
name
- The name of the index entry to remove.public boolean hasPartition(java.lang.Object id)
id
- The name (string) or id of a partition to test for.public void fireModelChangeEvent(ModelChangeEvent event)
event
- The event object reporting this change.public void addContext(Context c)
public Context[] getContexts()
public Context[] getContexts(java.lang.Class c)
public void removeContext(Context c)
public boolean hasContext(Context c)
public ConstraintData makeConstraint()
public Constraint getConstraint(java.lang.Object id)
id
- The unique identifier for this constraint.public java.util.Iterator getConstraintIterator()
public Constraint[] getConstraints()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |