Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gremlin 有没有一种有效的方法来查看在一个小精灵的Upsert中创建了多少边和垂直?_Gremlin - Fatal编程技术网

Gremlin 有没有一种有效的方法来查看在一个小精灵的Upsert中创建了多少边和垂直?

Gremlin 有没有一种有效的方法来查看在一个小精灵的Upsert中创建了多少边和垂直?,gremlin,Gremlin,使用如下查询 g.V().has('person','name','marko'). fold(). coalesce(unfold(), addV('person').property('name','marko')). property('age',29) 是否有一种有效的方法可以同时返回创建了多少垂直方向 例如,如果marko顶点存在,则为0,如果marko顶点不存在,则为1。我认为

使用如下查询

g.V().has('person','name','marko').
           fold().
           coalesce(unfold(),
                    addV('person').property('name','marko')).
           property('age',29)
是否有一种有效的方法可以同时返回创建了多少垂直方向


例如,如果marko顶点存在,则为0,如果marko顶点不存在,则为1。

我认为我应该使用
union()

这与你所要求的1和0的存在相反,但我认为如果你真的需要的话,这是很容易补救的,但它会增加围绕
count(local)
的遍历的额外复杂性,这现在很容易阅读

gremlin> g.V().has('person','name','marko').
......1>   fold().
......2>   union(coalesce(unfold(),
......3>                  addV('person').property('name','marko')).
......4>         property('age',29),
......5>         count(local))
==>v[1]
==>1
gremlin> g.V().has('person','name','darko').
......1>   fold().
......2>   union(coalesce(unfold(),
......3>                  addV('person').property('name','marko')).
......4>         property('age',29),
......5>         count(local))
==>v[13]
==>0