edu.columbia.cs.ref.model.relationship
Class Relationship

java.lang.Object
  extended by edu.columbia.cs.ref.model.relationship.Relationship
All Implemented Interfaces:
Matchable, java.io.Serializable

public class Relationship
extends java.lang.Object
implements java.io.Serializable, Matchable

The Class Relationship represents relationships between several entities present in a document.

A Relationship is defined by its type which is an instance of a RelationshipType.

Additionally, a relationship contains a set of entities that may be related or not. Each of these entities fufills a role in the relationship.

Since:
2011-09-27
Version:
0.1
Author:
Pablo Barrio, Goncalo Simoes
See Also:
Serialized Form

Constructor Summary
Relationship(RelationshipType type)
          Instantiates a new relationship given a relationship type
 
Method Summary
 boolean equals(java.lang.Object o)
           
 Entity[] getEntities()
          Gets an array containing the entities involved in the relationship
 java.lang.String getId()
          Gets the id of the relationship.
 java.lang.String getLabel()
          Gets the label.
 RelationshipType getRelationshipType()
          Gets the relationship type.
 Entity getRole(java.lang.String role)
          Gets the entity that fulfills a given role.
 java.util.Collection<java.lang.String> getRoles()
          Gets the roles that are present in the relationship.
 int hashCode()
           
 void setLabel(java.lang.String label)
          Sets the label.
 void setRelationshipType(RelationshipType type)
          Sets the relationship type.
 void setRole(java.lang.String role, Entity e)
          Indicates that a given entity is fulfilling a given role in the relationship.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Relationship

public Relationship(RelationshipType type)
Instantiates a new relationship given a relationship type

Parameters:
type - the type of relationship that this Relationship represents
Method Detail

setRelationshipType

public void setRelationshipType(RelationshipType type)
Sets the relationship type.

Parameters:
type - the new relationship type

setRole

public void setRole(java.lang.String role,
                    Entity e)
Indicates that a given entity is fulfilling a given role in the relationship.

Parameters:
role - the role that the entity is fulfilling
e - the entity that is fulfilling the role

getRole

public Entity getRole(java.lang.String role)
Gets the entity that fulfills a given role.

Parameters:
role - the desired role
Returns:
the entity that fulfills the input role

getId

public java.lang.String getId()
Gets the id of the relationship.

Returns:
the id of the relationship

getEntities

public Entity[] getEntities()
Gets an array containing the entities involved in the relationship

Returns:
an array containing the entities involved in the relationship

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

getLabel

public java.lang.String getLabel()
Gets the label.

Returns:
the label

setLabel

public void setLabel(java.lang.String label)
Sets the label.

Parameters:
label - the new label

getRelationshipType

public RelationshipType getRelationshipType()
Gets the relationship type.

Returns:
the relationship type

getRoles

public java.util.Collection<java.lang.String> getRoles()
Gets the roles that are present in the relationship.

Returns:
the roles that are present in the relationship