orientdbgremlintinkerpoptinkerpop-frames

OrientDB query for nodes connected to origin by multiple ways


For example, I have employee managing particular country and particular company. I want to query only accounts which are in countries AND companies managed by the given employee. Ideas? Performance issues to be aware of?

Gremlin query is acceptable, also!


Solution

  • This seems to work:

    select from Account where 
    @rId in 
    (select expand(out('managingCountry').in('inCountry')).@rId
    from Employee where userId = 3) 
    AND 
    @rId in 
    (select expand(out('managingCompany').in('inCompany')).@rId
    from Employee where userId = 3) 
    

    Remains if someone has the better solution