gremlin - 从 Vertex 中删除标签

标签 gremlin amazon-neptune

Amazon Neptune 支持一个顶点的多个标签。虽然我可以向顶点添加新标签,但我找不到删除它的方法。

我发现

vertex.addLabel('human')
vertex.removeLabel('human')

http://tinkerpop.apache.org/docs/current/reference/#_multi_label

AWS Neptune 不支持。


还尝试 drop() 标签,例如属性不起作用。

海王星 documentation说:

gremlin> g.addV('label1').property(id, 'customid')
gremlin> g.addV('label2').property(id, 'customid')
gremlin> g.V('customid').label()
==>label1::label2

但是这样你就只能添加标签,而不能删除标签。

我正在寻找像 removeLabel() 这样的方法来删除标签而不删除顶点。

最佳答案

您可以在 Apache TinkerPop 文档 [1] 中找到此文本

“这是因为 TinkerPop 不允许在创建顶点后更改顶点标签。”

根据 TinkerPop 引用文档和实现,不允许在创建顶点标签后更改顶点标签。据我所知,大多数(如果不是全部)TinkerPop 启用的图形数据库都尊重这一点。

您发现的示例是直接连接时 Neo4J 自定义支持的一部分(不是通过 Gremlin 服务器样式的连接),可以直接操作顶点对象。

如果您需要可编辑标签的概念,我建议您使用属性。按属性查找与按标签查找的最终结果大致相同,而且更加便携。

[1] http://tinkerpop.apache.org/docs/current/reference/#_graphml_reader_writer

关于gremlin - 从 Vertex 中删除标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54019536/

相关文章:

graph - 如何将新属性添加到 gremlin 中的现有顶点?

python-3.x - Graph Factory 找不到 gremlin.graph 属性配置

gremlin - 升级 gremlin 会断开连接

performance - AWS 海王星性能

python - Gremlin Python - "Server disconnected - please try to reconnect"错误

graph-databases - 有没有办法优化这个 Gremlin 查询?

java - TinkerPop - 从多个顶点检索值会产生奇怪的输出

titan - Gremlin:找到两个顶点之间的边的有效方法是什么?

c# - ExRam Gremlinq 无法与 Cosmos DB 配合使用

java - Peapod : Impl is not abstract and does not override abstract method start() in peapod. FramedVertexTraversal