Fundamentally the thing is, nothing here is technically impossible. But if you attack it in established languages I know of, it becomes a gnarly mess of custom expressions and transformations. 

And instead it should be easy like writing an SQL or Cypher/GQL query.