【问题标题】:Can you have multiple labels for a vertex in Gremlin Tinkerpop like we do in Neo4J graph?你能像我们在 Neo4J 图中那样在 Gremlin Tinkerpop 中为一个顶点设置多个标签吗?
【发布时间】:2020-09-06 18:55:49
【问题描述】:

Neo4J 允许同一节点有多个标签。这非常方便。我们在 Gremlin Tinkerpop 中有相同的能力吗?

【问题讨论】:

    标签: graph label gremlin


    【解决方案1】:

    TinkerPop 模型不像 Neo4j 那样允许多个标签。然而,它确实提供了一些特定的支持,特别是对 Neo4j (documentation):

    gremlin> vertex = (Neo4jVertex) g.addV('human::animal').next() 
    ==>v[0]
    gremlin> vertex.label() 
    ==>animal::human
    gremlin> vertex.labels() 
    ==>animal
    ==>human
    gremlin> vertex.addLabel('organism')
    ==>null
    gremlin> g.V().has(label,of('organism'))
    ==>v[0]
    

    【讨论】:

    • 您还可以在 Amazon Neptune 的顶点上使用多个标签。
    • 感谢斯蒂芬马利特
    • 感谢 bechbd。我会试试的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-29
    • 2020-04-06
    • 2021-12-25
    • 1970-01-01
    相关资源
    最近更新 更多