Class Relationship
- java.lang.Object
-
- net.didion.jwnl.data.relationship.Relationship
-
- Direct Known Subclasses:
AsymmetricRelationship
,SymmetricRelationship
public abstract class Relationship extends java.lang.Object
ARelationship
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
andAsymmetric
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Relationship.StringBufferOutputStream
-
Field Summary
Fields Modifier and Type Field Description private PointerTargetNodeList
_nodes
The nodes that comprise the relationship.private Synset
_sourceSynset
private Synset
_targetSynset
private PointerType
_type
The relationship's type
-
Constructor Summary
Constructors Modifier Constructor Description protected
Relationship(PointerType type, PointerTargetNodeList nodes, Synset sourceSynset, Synset targetSynset)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Two relationships are assumed equal if they have the same source synset, target synset, and typeint
getDepth()
Get the depth of this relationship.PointerTargetNodeList
getNodeList()
Get the list that contains the nodes of this relationship.int
getSize()
PointerTarget
getSourcePointerTarget()
Get the pointer target of the source node.Synset
getSourceSynset()
Get the Synset that is the source of this relationship.PointerTarget
getTargetPointerTarget()
Get the pointer target of the target node.Synset
getTargetSynset()
Get the Synset that is the target of this relationship.PointerType
getType()
abstract Relationship
reverse()
java.lang.String
toString()
-
-
-
Field Detail
-
_nodes
private PointerTargetNodeList _nodes
The nodes that comprise the relationship.
-
_type
private PointerType _type
The relationship's type
-
_sourceSynset
private Synset _sourceSynset
-
_targetSynset
private Synset _targetSynset
-
-
Constructor Detail
-
Relationship
protected Relationship(PointerType type, PointerTargetNodeList nodes, Synset sourceSynset, Synset targetSynset)
-
-
Method Detail
-
reverse
public abstract Relationship reverse()
-
getNodeList
public PointerTargetNodeList getNodeList()
Get the list that contains the nodes of this relationship.
-
getSourcePointerTarget
public PointerTarget getSourcePointerTarget()
Get the pointer target of the source node.
-
getTargetPointerTarget
public PointerTarget getTargetPointerTarget()
Get the pointer target of the target node.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Two relationships are assumed equal if they have the same source synset, target synset, and type- Overrides:
equals
in classjava.lang.Object
-
getType
public PointerType getType()
-
getSourceSynset
public Synset getSourceSynset()
Get the Synset that is the source of this relationship.
-
getTargetSynset
public Synset getTargetSynset()
Get the Synset that is the target of this relationship.
-
getSize
public int getSize()
-
getDepth
public int getDepth()
Get 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.
-
-