targetRelationship=targetEntity.relationshipNamed(toManyKeys.lastObject());
targetEntity=targetRelationship.destinationEntity();
if (targetRelationship.joins()==null || targetRelationship.joins().isEmpty()) {
// we have a flattened many to many
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