String definitionKeyPath=targetRelationship.definition();
NSArray<String> definitionKeys=NSArray.componentsSeparatedByString(definitionKeyPath,".");
EOEntity lastStopEntity=targetRelationship.entity();
EORelationship firstHopRelationship= lastStopEntity.relationshipNamed(definitionKeys.objectAtIndex(0));
EOEntity endOfFirstHopEntity= firstHopRelationship.destinationEntity();
EOJoin join= firstHopRelationship.joins().objectAtIndex(0); // assumes 1 join
EOAttribute sourceAttribute=join.sourceAttribute();
EOAttribute targetAttribute=join.destinationAttribute();
EORelationship secondHopRelationship=endOfFirstHopEntity.relationshipNamed(definitionKeys.objectAtIndex(1));
join= secondHopRelationship.joins().objectAtIndex(0); // assumes 1 join
EOAttribute secondHopSourceAttribute=join.sourceAttribute();