2017-07-07 69 views
0

我在小鬼的查询,使用Datastax工作室,看起来像这样:小鬼.match()

g.V().has('vertexLabel', 'vertexProperty1', '12345').match(
    __.as('d').in('edgeLabel1').values('property2').as('NAME1'), 
    __.as('d').in('edgeLabel2').values('property3').as('NAME2'), 
    __.as('d').in('edgeLabel1').out('edgeLabel3').values('property4').as('NAME3') 
    ).select('NAME1', 'NAME2', 'NAME3') 

这只是正常,如果所有的实体存在,但如果其中一人是不是在图上,没有找到结果,尽管我知道有结果。我怎样才能做一个。或查询,如果它们存在,将查找值。假如在edgeLabel3的末尾没有找到property4,我的查询如何仍然给我另外两个结果(property2和property3)?我试过做或者查询,但我没有任何运气。

回答

1

您是否尝试过使用union一步小鬼?它应该看起来像这样:

g.V('book:882178048:25').has('vertexLabel', 'vertexProperty1', '12345') 
.union(
    as('d').in('edgeLabel1').values('property2').store('NAME1'), 
    as('d').in('edgeLabel2').values('property3').store('NAME2'), 
    as('d').in('edgeLabel1').out('edgeLabel3').values('property4').store('NAME3') 
).cap('NAME1', 'NAME2', 'NAME3') 
+0

感谢您的回答。我确实使用过联盟,但稍微改了一下。 – user5294007