您可以像在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]