Hi, I created this <https://github.com/orientechnologies/orientdb/issues/1961>feature request that could be useful for you.
Best regards, Artem Orobets * Orient Technologiesthe Company behind OrientDB* 2014/1/14 Artem Orobets <[email protected]> > Hi, > > Try following way: > > 1. Select a wrench. > 2. traverse to all UsesTool edges > 3. filter this edges by car > 4. traverse to mechanics > > Implementation could be like following: > select expand(outV()) from (select expand(inE('UsesTool')) from Tool where > name='Wrench') where CarId[0] in (select from Car where name='Mercedes') > > This query fine in small datasets but it will slow down as soon as you > have lots of tools, cars and UsesTool entries. To improve that can divide > it on 3 queries different and add some indexes. > > I suppose there is a mistake in your schema. When you execute a subquery > it returns a collection of elements so the type of property UsesTool.CarId > will be LINKLIST, but I suppose you need just a LINK. To fix that you > should modify "create edge UsesTool.." query. And then you can use CarId > instead of CarId[0] in query above. > > > > Best regards, > Artem Orobets > > * Orient Technologiesthe Company behind OrientDB* > > > 2014/1/14 arosta <[email protected]> > >> Hi guys. Apologies for the newbie question but two of us have been >> trying to figure out how to query the ‘CarId’ property on the edge called >> ‘UsedOn’ to determine the following with no luck: >> >> *Who are all the people that use a wrench on a Mercedes?* >> >> >> Here is the script to create the sample db: >> >> create class Car extends V >> >> create vertex Car set name='Mercedes' >> >> >> create class Mechanic extends V >> >> create vertex Mechanic set firstName=‘Andy’, lastName=‘Miller’ >> >> create vertex Mechanic set firstName = ‘Billy’, lastName = ‘Edwards’ >> >> >> create class Tool extends V >> >> create vertex Tool set name=‘Wrench’ >> >> >> create class WorksOn extends E >> >> create edge WorksOn from (select from Mechanic where firstName=‘Billy’) >> to (select from Car where name=‘Mercedes’) >> >> >> create class UsesTool extends E >> >> create edge UsesTool from (select from Mechanic where firstName='Billy') >> to (select from Tool where name='Wrench') set CarId = (select @Rid from Car >> where name='Mercedes') >> >> >> We've tried googling similar examples but there doesn't seem to be in >> depth documentation about querying based on edge properties (or we're just >> not googling the right search phrase). That said, any help is greatly >> appreciated. >> >> >> >> -- >> >> --- >> 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 [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- --- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
