OrientDB如何匹配多个相关类
OrientDB how to match multiple related classes
我正在尝试编写一个 MATCH 语句来提取相关数据。
CREATE CLASS Member EXTENDS V;
CREATE CLASS DirectVolumes EXTENDS V;
CREATE SEQUENCE dvSequence TYPE ORDERED;
CREATE CLASS GroupVolumes EXTENDS V;
CREATE SEQUENCE groupVolumesSequence TYPE ORDERED;
CREATE CLASS GenerationVolumes EXTENDS V;
CREATE SEQUENCE genGroupVolumesSequence TYPE ORDERED;
CREATE SEQUENCE memberIdSeq TYPE ORDERED;
CREATE VERTEX Member SET id=sequence('memberIdSeq').next();
CREATE VERTEX DirectVolumes set id=sequence('dvSequence').next();
CREATE VERTEX GroupVolumes set id=sequence('groupVolumesSequence').next();
CREATE VERTEX GenerationVolumes set id=sequence('genGroupVolumesSequence').next();
CREATE EDGE OWNS_DV_CURRENT FROM (SELECT FROM Member WHERE id = 1) TO (select from DirectVolumes where id = 1);
CREATE EDGE OWNS_PG_CURRENT FROM (SELECT FROM Member WHERE id = 1) TO (select from GroupVolumes where id = 1);
CREATE EDGE OWNS_GG_CURRENT FROM (SELECT FROM Member WHERE id = 1) TO (select from GenerationVolumes where id = 1);
现在我想要成员,andOWNS_DV_CURRENT,OWNS_PG_CURRENT,OWNS_GG_CURRENT 边缘数据在一起。为简单起见,我删除了属性。
使用 MATCH 执行此操作的正确方法是什么?我没有弄清楚如何获取多个相关 类。查询似乎没问题,但它 returns 0 我认为它正在 OWNS_DV_CURRENT 之上而不是 Member 本身寻找 OWNS_PG_CURRENT。
select from (MATCH {class: Member, as:member}.out("OWNS_DV_CURRENT"){as:dv}.out("OWNS_PG_CURRENT") {as: pg} RETURN member, dv,pg)
试试这个:
MATCH
{class: Member, as:member}.out("OWNS_DV_CURRENT"){as:dv},
{as:member}.out("OWNS_PG_CURRENT") {as: pg}
RETURN member, dv,pg
我正在尝试编写一个 MATCH 语句来提取相关数据。
CREATE CLASS Member EXTENDS V;
CREATE CLASS DirectVolumes EXTENDS V;
CREATE SEQUENCE dvSequence TYPE ORDERED;
CREATE CLASS GroupVolumes EXTENDS V;
CREATE SEQUENCE groupVolumesSequence TYPE ORDERED;
CREATE CLASS GenerationVolumes EXTENDS V;
CREATE SEQUENCE genGroupVolumesSequence TYPE ORDERED;
CREATE SEQUENCE memberIdSeq TYPE ORDERED;
CREATE VERTEX Member SET id=sequence('memberIdSeq').next();
CREATE VERTEX DirectVolumes set id=sequence('dvSequence').next();
CREATE VERTEX GroupVolumes set id=sequence('groupVolumesSequence').next();
CREATE VERTEX GenerationVolumes set id=sequence('genGroupVolumesSequence').next();
CREATE EDGE OWNS_DV_CURRENT FROM (SELECT FROM Member WHERE id = 1) TO (select from DirectVolumes where id = 1);
CREATE EDGE OWNS_PG_CURRENT FROM (SELECT FROM Member WHERE id = 1) TO (select from GroupVolumes where id = 1);
CREATE EDGE OWNS_GG_CURRENT FROM (SELECT FROM Member WHERE id = 1) TO (select from GenerationVolumes where id = 1);
现在我想要成员,andOWNS_DV_CURRENT,OWNS_PG_CURRENT,OWNS_GG_CURRENT 边缘数据在一起。为简单起见,我删除了属性。 使用 MATCH 执行此操作的正确方法是什么?我没有弄清楚如何获取多个相关 类。查询似乎没问题,但它 returns 0 我认为它正在 OWNS_DV_CURRENT 之上而不是 Member 本身寻找 OWNS_PG_CURRENT。
select from (MATCH {class: Member, as:member}.out("OWNS_DV_CURRENT"){as:dv}.out("OWNS_PG_CURRENT") {as: pg} RETURN member, dv,pg)
试试这个:
MATCH
{class: Member, as:member}.out("OWNS_DV_CURRENT"){as:dv},
{as:member}.out("OWNS_PG_CURRENT") {as: pg}
RETURN member, dv,pg