简体   繁体   中英

OrientDB Query by edge property

I have two vertex classes: Location and User and I have two edges also: Friend and GoingTo. A User can be 'Friend' with another User and a User can also 'GoingTo' a Location. The edge GoingTo has a datetime property called going_date with the date the user is going to the Location.

I want to return every 'Location' that has a in(“GoingTo”) edge from an 'User' that is a (“Friend”) of a specific starting 'User' (#12:11 as example).

What I have here is all locations but without the date property of goingTo...

SELECT expand(both('Friend').out('goingTo')) FROM #12:11

How can I query by this edge property?

您可以过滤edge的属性:

SELECT expand(both('Friend').outE('goingTo')[going_date='2015-01-01'].inV()) FROM #12:11

Little late but since this was a high result for my google search, thought I'd link the answer I found on another question .

My use case, and I believe a wide category of use cases leaning on recursion, has to store data in edge properties.

For OP, it should be

SELECT expand(both('Friend').out('goingTo')) FROM #12:11 
WHERE out_goingTo[0].going_date = '2015-01-01'

This seems like a case where you'd have 1-many "going to" edges, so it could be

WHERE out_goingTo[0-100] for a range or

WHERE out_goingTo[0,5,10] for a set.

HTH!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM