[英]OrientDB Include property from edge connected to specific vertex
I have the following case: 我有以下情况:
(p:p1)
V1 ---E1---\
\
V2 (with properties)
/
V1 ---E1---/
(p:p2)
So two vertices of class V1 are connected to another Vertex of type V2, both edges are of the same class E1 which has the property "p". 因此,类V1的两个顶点连接到类型V2的另一个顶点,两个边都属于具有属性“ p”的类E1。
I would like a query that: 我想要一个查询:
I have tried with: 我尝试过:
SELECT *,in('E1')[p] as p FROM (SELECT EXPAND(out('E1')) FROM <V1-rid>) UNWIND p
But that would of course give 2 results since the projection returns values from both the E1 edges. 但这当然会产生2个结果,因为投影会从两个E1边缘返回值。 I only want to inlcude p form the edge between my selected V1 and V2.
我只想包含所选V1和V2之间的边缘。
I have some other connections to V2 as well which need to be included, but I wanted to specify the problem more precise to reduce the question complexity and I think (hope) they won't interfere with the answer. 我还有一些其他到V2的连接,也需要包括在内,但是我想更精确地指定问题以减少问题的复杂性,我认为(希望)它们不会干扰答案。
Update 更新
Clarification: 澄清:
I would like the result to be whole V2-records with appended properties "p", so if V2 has properties v2p1:, v2p2, the resulting records should look something like: 我希望结果是带有附加属性“ p”的整个V2记录,因此,如果V2具有属性v2p1 :, v2p2,则结果记录应类似于:
{
"v2p1": <value>,
"v2p2": <value>,
"p": <value>
}
Where the last "p" value is from the edge and the other properties are from the actual V2 records. 最后的“ p”值来自边缘,其他属性来自实际的V2记录。
You could use this query 您可以使用此查询
SELECT FROM (
MATCH {CLASS:v1, AS:v1, WHERE: (@rid=#29:0)}.outE('e1'){AS:e1}.inV('e1'){AS:v2} RETURN v1, e1.p, v2
)
I hope that is clear enough. 我希望这很清楚。
尝试这个:
select *,traversedEdge(-1).p as p from(traverse outE('E1'),inV('E1') from #21:0) where @class='V2'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.