问题标签 [gremlinpython]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
72 浏览

gremlin - Gremlin - 从属性值的压缩列表中过滤边缘

我的 Edge 上有两个要过滤的属性:ab. 我想使用以下列表过滤这些属性:

...并使用以下逻辑:

为了在单个值对上过滤边缘,lst我可以:

为了过滤所有这些,我可以:

该方法有效,需要手动输入过滤器参数。因此,一旦变量的内容lst发生变化,它就会中断。

给定 variable 的格式,有没有办法lst通过lst传入查询来计算解决这个问题?

0 投票
1 回答
323 浏览

gremlin - Gremlin - 如何在获得最短路径时过滤属性边缘

以下查询搜索从给定顶点 (377524408) 到具有属性 的边的另一个顶点的最短路径集test_property,并在 3 次迭代后退出(即,如果在 3 次遍历中没有找到顶点,我们将不返回任何路径)。

但是,我想过滤上述查询遍历的边缘。

例如,仅遍历属性filter_property< 100 的边。如何修改上述查询以包含此边过滤器?

0 投票
2 回答
599 浏览

gremlin - Gremlin - 同时限制遍历迭代和搜索边缘属性

我有一段(损坏的)gremlin 代码来生成从给定顶点到具有参数的最短路径test_parameter。如果在边上找不到该参数,则不应返回任何路径。

断线的是.until(or(__.outE().has('test_property', gt(0)), loops().is(4)))

目前——而且它的原因是有道理的——它给出了距离起始顶点 4 跳的所有路径。

我正在尝试对其进行调整,以便如果遍历是 4 次迭代,并且如果找不到该属性test_property那么它不应该返回任何路径。如果test_property找到,它应该只返回该顶点的路径。

我试图在times(4)条件中加入约束并删除loops()条件,但不知道如何同时拥有times(4)this 和.has('test_property', gt(0))约束。

0 投票
1 回答
257 浏览

graph-databases - AWS Neptune 查找连接到特定顶点的所有顶点的 ID

我正在尝试获取连接到特定顶点的所有顶点的 ID。其中 id 不是“id”属性,而是节点的 id (T.id)

但是当我试图只获取顶点的 id 时,我什么也得不到。

我想要的是如下所示:

0 投票
1 回答
228 浏览

bulk-load - Gremlin bulk load csv date formate

I am trying to upload data in to the AWS neptune, but getting error because of date format

sample format of csv: ~id, ~from, ~to, ~label, date:Date e1, v1, v2, created, 2019-11-04

can some one help me on this?

0 投票
2 回答
368 浏览

gremlin - Gremlin - 搜索多个子字符串

对于给定的顶点,我可以找到一个属性是否myproperty包含单个substring substring1,如下所示:

如何扩展它以在同一查询中搜索多个子字符串?

类似于以下内容:

有没有更好的方法来代替使用 lambda 表达式?请注意,我不想使用内置的图形数据库(在我的情况下为 JanusGraph),因为我使用的是 gremlin-python。

0 投票
1 回答
538 浏览

python-3.x - Amazon Neptune:如何使用 tinkerpop/gremlinpython 包在 Python 中创建自定义顶点 ID?

如此处所述https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-differences.html自定义顶点 id 只能使用不带引号的id属性进行设置,即g.addV('label1').property(id, 'customid'). 如何使用 gremlinpython 包来实现这一点?我在 中看到了一个id函数,但是在尝试使用它时gremlin_python.process.graph_traversal我得到了一个(如预期的那样)。UnsupportedOperationException

0 投票
1 回答
506 浏览

gremlin - Gremlin Python:在一个查询中计算顶点及其子项

我试图在一个查询中获取具有特定标签的所有顶点及其所有子节点的计数,如下所示:

理想情况下,这应该返回 [{a: 200, b: 400}],但我得到的是这样的列表:

我如何才能达到预期的效果?

gremlinpython:3.4.4(最新)

蟒蛇 3.7

图数据库:AWS Neptune

0 投票
1 回答
1138 浏览

gremlin - tinkerpop/gremlin-python:next() 与 iterate()

使用 gremlin 时 next() 和 iterate() 有什么区别?为什么调用时 next() 返回添加的顶点g.addV(),但 iterate() 不返回?什么时候应该使用 next(),什么时候应该使用 iterate()?

0 投票
1 回答
589 浏览

graph-databases - How can one use the 'as' keyword in gremlin python?

When attempting to translate a query I wrote and tested in the Gremlin CLI to gremlin-python, I'm encountering unexpected token 'as' errors on my .as('foo') expressions. How can one use the Gremlin as keyword when using gremlin-python?