Class AsymmetricRelationship
java.lang.Object
net.didion.jwnl.data.relationship.Relationship
net.didion.jwnl.data.relationship.AsymmetricRelationship
An asymmetric relationship is one whose source and target synsets have lineages with a definite divergence point.
The commonParentIndex is the index of the node in the relationship that represents this divergence point.
For example, in finding a hypernym relationship between dog and cat, the relationship is dog -> canine -> carnivore -> feline -> cat. The ancestry of "dog" and the ancestry of "cat" diverge at "carnivore," so the common parent index is thus 2.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private int
The index of the node in the relationship that represents the point at which the source and target nodes' ancestries diverge. -
Constructor Summary
ConstructorsConstructorDescriptionAsymmetricRelationship
(PointerType type, PointerTargetNodeList nodes, int commonParentIndex, Synset sourceSynset, Synset targetSynset) -
Method Summary
Modifier and TypeMethodDescriptionint
int
Get the depth of the target, from the commonParentIndex, relative to the depth of the source.reverse()
Methods inherited from class net.didion.jwnl.data.relationship.Relationship
equals, getDepth, getNodeList, getSize, getSourcePointerTarget, getSourceSynset, getTargetPointerTarget, getTargetSynset, getType, toString
-
Field Details
-
_commonParentIndex
private int _commonParentIndexThe index of the node in the relationship that represents the point at which the source and target nodes' ancestries diverge. -
_cachedRelativeTargetDepth
private transient int _cachedRelativeTargetDepth
-
-
Constructor Details
-
AsymmetricRelationship
public AsymmetricRelationship(PointerType type, PointerTargetNodeList nodes, int commonParentIndex, Synset sourceSynset, Synset targetSynset)
-
-
Method Details
-
getCommonParentIndex
public int getCommonParentIndex() -
getRelativeTargetDepth
public int getRelativeTargetDepth()Get the depth of the target, from the commonParentIndex, relative to the depth of the source. If both target and source are eqidistant from the commonParentIndex, this method returns 0; -
reverse
- Specified by:
reverse
in classRelationship
-