net.sf.extjwnl.data.relationship
Class Relationship

java.lang.Object
  extended by net.sf.extjwnl.data.relationship.Relationship
Direct Known Subclasses:
AsymmetricRelationship, SymmetricRelationship

public abstract class Relationship
extends Object

A Relationship encapsulates the relationship between two synsets. Basically, it is a list of synsets/words that one must traverse to get from the source synset to the target synset of the relationship, for some relationship type.

There are two types of relationships - Symmetric and Asymmetric.

Author:
John Didion , Aliaksandr Autayeu

Constructor Summary
protected Relationship(PointerType type, PointerTargetNodeList nodes, Synset sourceSynset, Synset targetSynset)
           
 
Method Summary
 boolean equals(Object obj)
          Two relationships are assumed equal if they have the same source synset, target synset, and type
 int getDepth()
          Returns the depth of this relationship.
 PointerTargetNodeList getNodeList()
          Returns the list that contains the nodes of this relationship.
 int getSize()
           
 PointerTarget getSourcePointerTarget()
          Returns the pointer target of the source node.
 Synset getSourceSynset()
          Returns the synset that is the source of this relationship.
 PointerTarget getTargetPointerTarget()
          Returns the pointer target of the target node.
 Synset getTargetSynset()
          Returns the synset that is the target of this relationship.
 PointerType getType()
           
abstract  Relationship reverse()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Relationship

protected Relationship(PointerType type,
                       PointerTargetNodeList nodes,
                       Synset sourceSynset,
                       Synset targetSynset)
Method Detail

reverse

public abstract Relationship reverse()
                              throws CloneNotSupportedException
Throws:
CloneNotSupportedException

getNodeList

public PointerTargetNodeList getNodeList()
Returns the list that contains the nodes of this relationship.

Returns:
the list that contains the nodes of this relationship

getSourcePointerTarget

public PointerTarget getSourcePointerTarget()
Returns the pointer target of the source node.

Returns:
the pointer target of the source node

getTargetPointerTarget

public PointerTarget getTargetPointerTarget()
Returns the pointer target of the target node.

Returns:
the pointer target of the target node

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Two relationships are assumed equal if they have the same source synset, target synset, and type

Overrides:
equals in class Object

getType

public PointerType getType()

getSourceSynset

public Synset getSourceSynset()
Returns the synset that is the source of this relationship.

Returns:
synset that is the source of this relationship

getTargetSynset

public Synset getTargetSynset()
Returns the synset that is the target of this relationship.

Returns:
synset that is the target of this relationship

getSize

public int getSize()

getDepth

public int getDepth()
Returns the depth of this relationship. Depth is a concept that can be defined by each relationship type. The default notion of depth is the number of pointers that need to be traversed to go from the source to target synset. This is basically getSize() - 1.

Returns:
the depth of this relationship


Copyright © 2011. All Rights Reserved.