OrientDB - 匹配推荐者的查询

时间:2017-01-29 22:08:26

标签: orientdb orientdb2.2

我正在尝试使用OrientDB解决一个简单的MATCH查询。

我建议用户A为用户B提供共同的产品P.

当我尝试此查询时,我收到一条错误,指出"错误到第1行第33列"

SELECT d1.UserId, d2.UserId FROM (
  MATCH 
  {class:User, as: U1} -buy-> {class:Product, as:P},
  {class:User, as: U2} -buy-> {as:P},
  {as:U2} -buy-> {class:Product, as P2}
  RETURN U1 as d1, U2 as d2, O as o
)

您有任何建议可以解决我的问题吗?

由于 罗布

2 个答案:

答案 0 :(得分:1)

您在最后一个模式结束时错过:,只需尝试以下

SELECT d1.UserId, d2.UserId FROM (
  MATCH 
  {class:User, as: U1} -buy-> {class:Product, as:P},
  {class:User, as: U2} -buy-> {as:P},
  {as:U2} -buy-> {class:Product, as:P2}
  RETURN U1 as d1, U2 as d2, O as o
)

答案 1 :(得分:0)

最后,我认为最好的解决方案是

SELECT d1.UserId, d2.UserId FROM (
  MATCH 
  {class:User, as: U1, where: (UserId=12345) } -buy-> {class:Product, as:P},
  {class:User, as: U2, where: (UserId<>12345)} -buy-> {as:OP},
  {as:U2} -buy-> {class:Product, as:P2}
  RETURN U2 as d2, P, OP
)

感谢您的帮助。

R上。