Jas*_*onG 3 graph orientdb gremlin
我似乎无法在图中找到特定节点而不遍历整个事物.有什么我想念的吗?
我正在使用tinkerpop蓝图.
Orientdb为节点提供某种非语义ID,例如'#8:1' - 如何在不知道id的情况下找到它?vertex有一个像'user = jason'这样的属性来识别它.我想我只会使用redis存储用户/位置对或以其他方式使用超级节点(不,谢谢)
ste*_*tte 10
蓝图具有关键指数的概念.
https://github.com/tinkerpop/blueprints/wiki/Graph-Indices
给出您的示例,为"user"定义一个键索引,然后使用键索引进行查询.以下是使用Gremlin提示符中的OrientDB的示例:
gremlin> g = new OrientGraph("memory://graph")
==>orientgraph[memory://graph]
gremlin> g.createKeyIndex("user", Vertex.class)
==>null
gremlin> g.addVertex([user:"Jason"])
==>v[#8:-3]
gremlin> g.addVertex([user:"Rick"])
==>v[#8:-4]
gremlin> g.stopTransaction(SUCCESS)
==>null
gremlin> g.V('user','Jason')
==>v[#8:1]
Run Code Online (Sandbox Code Playgroud)