如何获取Titan中的索引键列表? [英] How can I get a list of indexed keys in Titan?

查看:50
本文介绍了如何获取Titan中的索引键列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Titan v0.3.1,并且想查看我已经通过createKeyIndex索引了哪些键的列表.我该怎么办?

I am using Titan v0.3.1 and would like to see a list of which keys I have already indexed via createKeyIndex. How can I do this?

推荐答案

您自己发现可以为此使用Blueprints getIndexedKeys(Vertex.class)方法,但是Titan类型系统提供的功能比createKeyIndex大得多.与Titan合作的时间越长,您就越想了解Type Maker系统:

As you found for yourself you can use the Blueprints getIndexedKeys(Vertex.class) method for this, however the Titan type system has a lot more to offer than createKeyIndex. The longer you work with Titan the more you will want to learn about the Type Maker system:

https://github.com/thinkaurelius/titan/wiki/Type-定义概述

在这种情况下,getIndexedKeys返回的类型可能不够.这是一些Gremlin,可为您提供更多详细信息:

In that case the types returned by getIndexedKeys may not be enough. Here's some Gremlin to get you more details:

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]

您可能希望查看Titan API,以获取有关从getVertices调用返回的TitanKey的更多信息(因为类型存储为顶点):

You might want to look at the Titan API for more information on the TitanKey that is returned from that call to getVertices (as types are stored as vertices):

http://thinkaurelius. github.io/titan/javadoc/0.3.2/com/thinkaurelius/titan/core/TitanKey.html

这篇关于如何获取Titan中的索引键列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆