【发布时间】:2020-09-06 18:55:49
【问题描述】:
Neo4J 允许同一节点有多个标签。这非常方便。我们在 Gremlin Tinkerpop 中有相同的能力吗?
【问题讨论】:
Neo4J 允许同一节点有多个标签。这非常方便。我们在 Gremlin Tinkerpop 中有相同的能力吗?
【问题讨论】:
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]
【讨论】: