Hi, Could you try select name from Person where gender = 'M' and out('owns')[0].model = "Ferrari" and out('likes')[0].mov_name = "Need For Speed"
On Thu, Mar 27, 2014 at 5:13 AM, Joel Mathew <meetj...@gmail.com> wrote: > Hi group, > I have below schema with three classes > > orientdb {demo1}> select from Person > ----+-----+-----+------+--------+--------- > # |@RID |name |gender|out_owns|out_likes > ----+-----+-----+------+--------+--------- > 0 |#11:0|Matt |M |#12:0 |#13:0 > 1 |#11:1|Helen|F |#12:1 |#13:1 > ----+-----+-----+------+--------+--------- > > orientdb {demo1}> select from Car > ----+-----+-------+------- > # |@RID |model |in_owns > ----+-----+-------+------- > 0 |#12:0|Ferrari|#11:0 > 1 |#12:1|BMW |#11:1 > ----+-----+-------+------- > > orientdb {demo1}> select from Movie > ----+-----+--------------+-------- > # |@RID |mov_name |in_likes > ----+-----+--------------+-------- > 0 |#13:0|Need For Speed|#11:0 > 1 |#13:1|Matrix |#11:1 > ----+-----+--------------+-------- > > Person(name,gender) > Car(model) > Movie(mov_name) > Person > owns > Car > Person > likes > Movie > > I'm looking at a query which matches values across three classes across > the edges > Find Person.name where Person.gender='M' and who owns Car.model='Ferrari' > and who likes Movie.mov_name='Need For Speed' > > One way to achieve the same with gremlin is > g.V('@class','Car').has('model','Ferrari').in('owns').has('@class','Person').has('gender','M').as('x').out('likes').has('@class','Movie').has('mov_name','Need > For Speed').select(["x"]) > I'm using OrientDB 1.7-rc2-SNAPSHOT.. > Please help me with some pointers towards equivalent orientdb sql. > > Thanks, > Mathew > > > -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to orient-database+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Best regards, Andrey Lomakin. Orient Technologies the Company behind OrientDB -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.