在OrienDB中查询输出?

时间:2017-03-16 17:01:52

标签: orientdb

查看以下图片:

Graph

我需要一个只输出四行的查询:

A1.SomeProperty, B1.SomeProperty, C1.SomeProperty
A1.SomeProperty, B1.SomeProperty, C2.SomeProperty
A1.SomeProperty, B2.SomeProperty, C3.SomeProperty
A1.SomeProperty, B2.SomeProperty, C4.SomeProperty

我尝试了以下内容:

SELECT 
SomeProperty as A_Property
out(L1).SomeProperty as B_Property,
out(L1).out(L2).SomeProperty as C_Property
from A
UNWIND B_Property, C_Property

我无法理解UNWIND - 我认为问题是跟随(L1)和输出(L2)。

2 个答案:

答案 0 :(得分:0)

如果您使用的是v 2.2,则可以使用MATCH语句:

MATCH
  {class:A, as:a} -L1-> {as:b} -L2-> {as:c}
RETURN 
  a.SomeProperty as A_Property, 
  b.SomeProperty as B_Property, 
  c.SomeProperty as C_Property

如果你还需要边缘:

MATCH
  {class:A, as:a} .outE("L1"){as:edge1}.inV() {as:b} .outE("L2"){as:edge2}.inV() {as:c}
RETURN 
  a.SomeProperty as A_Property, 
  b.SomeProperty as B_Property, 
  c.SomeProperty as C_Property,
  edge1.something as xxx,
  edge2.something as yyy

答案 1 :(得分:0)

感谢路易吉。

需要从"结果"获得其他属性。没有解开

$conn = new mysqli($host, $user, $pass, $db);