Created
July 12, 2015 20:16
-
-
Save anonymous/14a04fa4a27d2167df39 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Index lookup for the node representing the doctor is omitted for brevity | |
Iterable<Relationship> relationships = doctor.getRelationships( Direction.INCOMING, COMPANION_OF ); | |
for ( Relationship rel : relationships ) | |
{ | |
Node companionNode = rel.getStartNode(); | |
if ( companionNode.hasRelationship( Direction.OUTGOING, IS_A ) ) | |
{ | |
Relationship singleRelationship = companionNode.getSingleRelationship( IS_A, Direction.OUTGOING ); | |
Node endNode = singleRelationship.getEndNode(); | |
if ( endNode.equals( human ) ) | |
{ | |
// Found one! | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment