简体   繁体   English

OrientDB按边缘属性查询

[英]OrientDB Query by edge property

I have two vertex classes: Location and User and I have two edges also: Friend and GoingTo. 我有两个顶点类:Location和User,还有两个边:Friend和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. 边缘GoingTo具有一个名为going_date的datetime属性,其中包含用户前往位置的日期。

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). 我想从作为特定起始“用户”的“朋友”的“用户”返回每个具有in(“ GoingTo”)边缘的“位置”(例如,#12:11)。

What I have here is all locations but without the date property of goingTo... 我在这里的所有位置,但是没有goingTo的date属性。

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

How can I query by this edge property? 如何通过该edge属性查询?

您可以过滤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 . 来不晚了,但是由于这对我的Google搜索来说是很高的结果,所以我想将我在另一个问题上找到的答案链接起来。

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 对于OP,应该是

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 这似乎是一种情况,您将有1个“去”边缘,所以可能是

WHERE out_goingTo[0-100] for a range or 在某个范围内WHERE out_goingTo[0-100]

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

HTH! HTH!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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