title: OrientDB query for hierarchical data
body: <p>OrientDB Server v2.0.10 , 
  I am trying to come up with a query for the following scenario.</p>
  
  <p>I have 2 hierarchies: A->B->C and D->E->F
  The number of nodes in the hierarchy can change.
  The node in 1st hierarchy can be connected to the other hierarchy using some relation say 'Assigned'.
  What I want is the parent node of the 2nd hierarchy if there is any incoming edge to any of the node in that 2nd hierarchy from the 1st.</p>
  
  <p>For example, say we have Car-Child->Engine-Child->Piston and Country-Child->State-Child->City
  And a relationship Made_In which relates Car or Engine or Piston to either Country or State or City
  So if there is a relation with either of Country or State or City, the Country should be returned. Example, Engine1-Made_In->Berlin, this would return Germany.
  Sorry for such a toyish example. I hope it is clear.</p>
  
  <p>Thanks.</p>