2017-07-07 67 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