我正在使用Titan v0.3.1,并希望看到我已通过createKeyIndex
索引了哪些键的列表。我怎样才能做到这一点?如何获取Titan中的索引键列表?
5
A
回答
4
正如你自己找到的,你可以使用Blueprints getIndexedKeys(Vertex.class)
方法,但是泰坦类型系统比createKeyIndex
提供更多提供。你与泰坦的工作时间越长,你就越想了解该类型设备系统:
https://github.com/thinkaurelius/titan/wiki/Type-Definition-Overview
在这种情况下,通过getIndexedKeys
返回的类型可能是不够的。下面是一些精怪让你更多的细节:
gremlin> g = GraphOfTheGodsFactory.create('/tmp/titan')
13/08/28 16:28:23 INFO diskstorage.Backend: Configuring index [search] based on:
...
13/08/28 16:28:25 INFO cluster.metadata: [Astaroth/Asteroth] [titan] update_mapping [vertex] (dynamic)
==>titangraph[local:/tmp/titan]
gremlin> import static com.thinkaurelius.titan.graphdb.types.system.SystemKey.*
==>import com.tinkerpop.gremlin.*
==>import com.tinkerpop.gremlin.java.*
==>import com.tinkerpop.gremlin.pipes.*
==>import com.tinkerpop.gremlin.pipes.filter.*
==>import com.tinkerpop.gremlin.pipes.sideeffect.*
==>import com.tinkerpop.gremlin.pipes.transform.*
...
==>import static com.thinkaurelius.titan.graphdb.types.system.SystemKey.*
gremlin> import com.thinkaurelius.titan.graphdb.types.*
==>import com.tinkerpop.gremlin.*
==>import com.tinkerpop.gremlin.java.*
==>import com.tinkerpop.gremlin.pipes.*
==>import com.tinkerpop.gremlin.pipes.filter.*
==>import com.tinkerpop.gremlin.pipes.sideeffect.*
==>import com.tinkerpop.gremlin.pipes.transform.*
...
==>import com.thinkaurelius.titan.graphdb.types.*
gremlin> g.newTransaction().getVertices(TypeClass, TitanTypeClass.KEY).collect{[it.name,it.dataType]}
==>[reason, class java.lang.String]
==>[name, class java.lang.String]
==>[type, class java.lang.String]
==>[time, class java.lang.Integer]
==>[place, class com.thinkaurelius.titan.core.attribute.Geoshape]
==>[age, class java.lang.Integer]
你可能想看看泰坦API用于对从该调用返回getVertices
的TitanKey
更多的信息(如类型存储为顶点):
http://thinkaurelius.github.io/titan/javadoc/0.3.2/com/thinkaurelius/titan/core/TitanKey.html
5
在小鬼的外壳,你可以使用蓝图KeyIndexableGraphgetIndexedKeys
功能:
gremlin> g.getIndexedKeys(Vertex.class)
==>my_key_1
==>my_key_2
==>my_key_3
(my_key_1
,my_key_2
和my_key_3
是3个索引顶点键)
要在抢索引键边缘,使用Edge.class
代替上面的Vertex.class
。
相关问题
- 1. 从列表列表中获取索引
- 2. 如何获取下拉列表索引
- 3. 如何获取键值对的索引
- 4. SML - 获取列表索引
- 5. Python:获取列表索引
- 6. 如何获取给定表的索引列的列表
- 7. 获取列表中物品的索引
- 8. 如何在javafx的gridpane中获取列索引和行索引
- 9. 如何从C#中的列表中获取索引值?
- 10. 如何在迭代列表中获取* .ftl中的索引
- 11. 如何获取C#中列表中新增项目的索引?
- 12. 如何获取Python/Google应用引擎中的键名列表?
- 13. 如何从表中获取索引值?
- 14. 如何获取Lucene中所有搜索关键字的列表?
- 15. 如何获取WPF列表框实例中的listboxitem的索引?
- 16. 在列表中获取唯一索引?
- 17. 从列表中获取元素索引
- 18. 如何获取存储在索引中的值列表?
- 19. 如何获取链接列表中的数字索引?
- 20. 如何从下拉列表中获取未选定的索引?
- 21. 如何获取Java列表中的对象索引
- 22. 如何获取列表A-Z中某个字母的索引?
- 23. 如何获取Whoosh索引中所有术语的列表?
- 24. 如何获取列表中索引的总和?
- 25. 如何获取Haskell列表中的元素索引
- 26. 如何从Google表格行中获取列的序号索引?
- 27. 如何获取列表框中单击按钮的索引
- 28. 如何通过freemarker模板中的索引获取列表项?
- 29. 如何获取在Kibana中创建的索引列表?
- 30. 如何获取列表框中某个项目的索引
这太好了,谢谢@ stephen-mallette。对于泰坦的其他类型你是对的:我已经在探索与Titan的ElasticSearch集成以进行更高级的索引和搜索。 – bcm360