Search code examples
orientdb

How to query classes with edges in orient Db?


enter image description here

My problem is, how can I query “Chat” table to retrieve person’s details in Profile Table.

ParticipatinIn edge started from Person to chat. HasProfile Edge came started person to Profile.

Please Help me to solve this..

Thank You


Solution

  • I have used this structure

    enter image description here

    You can use a query like this :

    select name, person.name, person.out("hasProfile").name as profile from (select name, in('ParticipatinIn') as person from Chat unwind person) unwind profile
    

    enter image description here

    If you use traverse, if a person is a part of two different Chat, you got that person only one time.

    Hope it helps.