gov.sandia.cognition.text.relation
Interface RelationNetwork<ObjectType,RelationType>

Type Parameters:
ObjectType - The type of the objects that the relations are between. This is also the type of the nodes in the network.
RelationType - The type of the relations between objects in the network. This is also the type of the edges in the network.
All Known Implementing Classes:
MatrixBasedTermSimilarityNetwork

public interface RelationNetwork<ObjectType,RelationType>

An interface for a network of relations between objects.

Since:
3.0
Author:
Justin Basilico

Method Summary
 Set<RelationType> getAllRelations(ObjectType source, ObjectType target)
          Gets all the relation between the source and the target.
 int getObjectCount()
          Gets the number of objects that the relations are between.
 Set<ObjectType> getObjects()
          Gets the set of objects that make up the nodes in the network.
 RelationType getRelation(ObjectType source, ObjectType target)
          Gets a relation between the source and the target.
 ObjectType getRelationSource(RelationType relation)
          Gets the source of a given relation.
 ObjectType getRelationTarget(RelationType relation)
          Gets the target of a given relation.
 boolean hasRelation(ObjectType source, ObjectType target)
          Determines if the network has a relation between the two given objects.
 boolean isObject(Object o)
          Determines whether or not the given object is a node in the relation network.
 Set<RelationType> relationsFrom(ObjectType source)
          Gets all of the relations where the given object is the source.
 Set<RelationType> relationsOf(ObjectType o)
          Gets all of the relations that involve the given object.
 Set<RelationType> relationsTo(ObjectType target)
          Gets all of the relations where the given object is the target.
 

Method Detail

getObjectCount

int getObjectCount()
Gets the number of objects that the relations are between. It is the number of nodes in the network.

Returns:
The number of objects the relations are between.

getObjects

Set<ObjectType> getObjects()
Gets the set of objects that make up the nodes in the network.

Returns:
The set of objects that make up the nodes in the network.

isObject

boolean isObject(Object o)
Determines whether or not the given object is a node in the relation network.

Parameters:
o - An object.
Returns:
True if the object is a node in the relation network. Otherwise, false.

hasRelation

boolean hasRelation(ObjectType source,
                    ObjectType target)
Determines if the network has a relation between the two given objects.

Parameters:
source - The source object.
target - The target object.
Returns:
True if the source and target are in the network and there exists is a relation from the source to the target. Otherwise, false.

getRelation

RelationType getRelation(ObjectType source,
                         ObjectType target)
Gets a relation between the source and the target.

Parameters:
source - The source object.
target - The target object.
Returns:
A relation between the source and target objects, if one exists. Otherwise, false.

getAllRelations

Set<RelationType> getAllRelations(ObjectType source,
                                  ObjectType target)
Gets all the relation between the source and the target.

Parameters:
source - The source object.
target - The target object.
Returns:
All the relations between the source and target objects, if they exist. Otherwise, an empty set is returned.

getRelationSource

ObjectType getRelationSource(RelationType relation)
Gets the source of a given relation.

Parameters:
relation - A relation from the network.
Returns:
The source of the relation.

getRelationTarget

ObjectType getRelationTarget(RelationType relation)
Gets the target of a given relation.

Parameters:
relation - A relation from the network.
Returns:
The target of the relation.

relationsOf

Set<RelationType> relationsOf(ObjectType o)
Gets all of the relations that involve the given object. This includes both the relations where the object is the source and the relations where the object is the destination.

Parameters:
o - An object (node) from the network.
Returns:
The all of the relations involving that node.

relationsFrom

Set<RelationType> relationsFrom(ObjectType source)
Gets all of the relations where the given object is the source.

Parameters:
source - An object (node) from the network.
Returns:
A set of all the relations where the object is the source.

relationsTo

Set<RelationType> relationsTo(ObjectType target)
Gets all of the relations where the given object is the target.

Parameters:
target - An object (node) from the network.
Returns:
A set of all the relations where the object is the target.