5

私は Titan v0.3.1 を使用しており、createKeyIndex. これどうやってするの?

4

2 に答える 2

5

Gremlin シェルでは、ブループリントのKeyIndexableGraph getIndexedKeys関数を使用できます。

gremlin> g.getIndexedKeys(Vertex.class)
==>my_key_1
==>my_key_2
==>my_key_3

( my_key_1my_key_2、およびmy_key_3は 3 つのインデックス付き頂点キーです)

エッジのキーのインデックスを取得するには、上記Edge.classの代わりに使用しVertex.classます。

于 2013-08-28T19:19:28.420 に答える
4

ご自身でわかったようにgetIndexedKeys(Vertex.class)、これには Blueprints メソッドを使用できますが、Titan 型システムにはcreateKeyIndex. Titan を使用する期間が長くなるほど、Type Maker システムについてより多くのことを学びたいと思うようになります。

https://github.com/thinkaurelius/titan/wiki/Type-Definition-Overview

その場合、 によって返される型ではgetIndexedKeys不十分な場合があります。詳細を取得するための Gremlin を次に示します。

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]

TitanKeyその呼び出しから返されるの詳細については、Titan API を参照してくださいgetVertices(型は頂点として格納されるため)。

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

于 2013-08-28T20:52:05.593 に答える