如何将所选属性从一个小精灵查询管道传输到另一个查询



我正在尝试将所选属性从一个遍历传递到另一个遍历。但它并不是以纯粹的小精灵方式工作的。

g.V().has('pname', name).has('version', within(V().has('ecosystem', ecosystem).has('name', name).values('latest_version', 'latest_non_cve_version').))

但是,当我将上面的查询拆分为多个语句时,它是有效的。

x = g.V().has('ecosystem', ecosystem).has('name', name).values('latest_version', 'latest_non_cve_version').toList(); g.V().has('pname', name).has('version', within(x))

有没有一种方法可以用纯粹的小精灵方式实现同样的目的?

within谓词不能进行遍历。您应该能够通过简单地反转查询的两个部分来完成所需的操作。由于我没有你的数据,我展示了一个使用航线数据集的例子。你需要的查询最终会是这样的:

gremlin> g.V().has('region',within('US-NM','US-TX')).
values('region').
fold().as('a').
V().hasLabel('airport').
where(within('a')).
by('region').
by().
count()
==>36

最新更新