Gremlin TinkerPop:按边计数过滤

Gremlin TinkerPop:按边计数过滤,gremlin,tinkerpop3,Gremlin,Tinkerpop3,样本数据: 小结:我想找到已经创建了两个软件的人 我从基础开始,正确地计算了数量 g.V().hasLabel("Person").as("from" ,"to1" ) .repeat(bothE().as("e1").otherV().as("to1").dedup("from", "to1")).times(1) .emit(filter(hasLabel("Software"))).hasLabel("Software") .group().by(select("from").by("na

样本数据:

小结:我想找到已经创建了两个软件的人

我从基础开始,正确地计算了数量

g.V().hasLabel("Person").as("from" ,"to1" )
.repeat(bothE().as("e1").otherV().as("to1").dedup("from", "to1")).times(1)
.emit(filter(hasLabel("Software"))).hasLabel("Software")
.group().by(select("from").by("name")).by(count()).as("c")
结果:

>> {'Marko': 1, 'Peter': 1, 'Josh': 2}
因此,我尝试应用过滤器,但它不起作用(即结果不正确),我尝试的是:

g.V().hasLabel("Person").as("from")
.repeat(bothE().as("e1").otherV().as("to1").dedup("from", "to1")).times(1)
.filter(bothE().otherV().hasLabel("Software").count(local).is(eq(1)))
.dedup()
.values("name")
知道我做错了什么吗


样本数据:

如果您只需要边计数的“个人”顶点,我真的不明白您为什么需要所有的
repeat()
基础结构。只是:

gremlin> g.V().hasLabel('person').
......1>   filter(outE('created').limit(2).count().is(2))
==>v[4]
您只需要计算输出边,因为模式是这样的,“创建的”标签只连接到“软件”,所以您不需要检查输出边
“软件”顶点标签。您可以
限制(2)
尽快退出边迭代,但不能在尝试计数的2条边出现之前退出

重复用于人员->服务器->操作系统这样的用例,以及使用超过2个操作系统的人员进行搜索。您的查询工作,试图将其适应多跳搜索的情况