Gremlin Titan db如何列出所有图形索引

Gremlin Titan db如何列出所有图形索引,gremlin,titan,tinkerpop,Gremlin,Titan,Tinkerpop,我一直在研究管理系统,但有些事情我还是不明白。基本上,我想做的是: 列出所有基于边的索引(包括以顶点为中心) 列出所有基于顶点的索引(如果索引附着到标签,则以每个标签为基础) 这基本上就像绘制出图形模式 我尝试了一些方法,但最多只能得到部分数据 g.getIndexdKeys(<Vertex or Edge>); //basic information. Doesn't seem to return any buildEdgeIndex() based indexes mgm

我一直在研究管理系统,但有些事情我还是不明白。基本上,我想做的是:

  • 列出所有基于边的索引(包括以顶点为中心)
  • 列出所有基于顶点的索引(如果索引附着到标签,则以每个标签为基础)
这基本上就像绘制出图形模式

我尝试了一些方法,但最多只能得到部分数据

g.getIndexdKeys(<Vertex or Edge>); 
//basic information. Doesn't seem to return any buildEdgeIndex() based indexes

mgmt.getVertexLabels(); 
// gets labels, can't find a way of getting indexes attached to these labels.

mgmt.getGraphIndexes(Vertex.class); 
// works nicely I can retrieve Vertex indexes and get pretty much any 
// information I want out of them except for information regarding 
// indexOnly(label). So I can't tell what label these indexes are attached to.

mgmt.getGraphIndexes(Edge.class); 
// doesn't seem to return any buildEdgeIndex() indexes.
g.getIndexdKeys();
//基本信息。似乎不返回任何基于buildEdgeIndex()的索引
管理getVertexLabels();
//获取标签,找不到将索引附加到这些标签的方法。
管理GetGraphIndex(顶点类);
//工作很好,我可以检索顶点索引,并得到几乎所有
//我想从他们那里得到的信息除了关于
//间接地(标签)。所以我不知道这些索引附加在什么标签上。
管理GetGraphIndex(Edge.class);
//似乎不返回任何buildEdgeIndex()索引。
任何填补空白的帮助都是有帮助的

我想知道:

  • 如何通过indexOnly()查找附加到标签(或附加到索引的标签)的索引
  • 如何列出通过buildEdgeIndex()设置的边缘索引及其各自的边缘标签
提前谢谢

额外信息:
Titan 0.5.0,Cassandra后端,通过rexster。

这并不是很直截了当,因此我将用一个例子来展示它

让我们从神的图形+神名的附加索引开始:

g = TitanFactory.open("conf/titan-cassandra-es.properties")
GraphOfTheGodsFactory.load(g)
m = g.getManagementSystem()
name = m.getPropertyKey("name")
god = m.getVertexLabel("god")
m.buildIndex("god-name", Vertex.class).addKey(name).unique().indexOnly(god).buildCompositeIndex()
m.commit()
现在,让我们再次拉出索引信息

gremlin> m = g.getManagementSystem()
==>com.thinkaurelius.titan.graphdb.database.management.ManagementSystem@2f414e82

gremlin> // get the index by its name
gremlin> index = m.getGraphIndex("god-name")
==>com.thinkaurelius.titan.graphdb.database.management.TitanGraphIndexWrapper@e4f5395

gremlin> // determine which properties are covered by this index
gremlin> gn.getFieldKeys()
==>name

//
// the following part shows what you're looking for
//
gremlin> import static com.thinkaurelius.titan.graphdb.types.TypeDefinitionCategory.*

gremlin> // get the schema vertex for the index
gremlin> sv = m.getSchemaVertex(index)
==>god-name

gremlin> // get index constraints
gremlin> rel = sv.getRelated(INDEX_SCHEMA_CONSTRAINT, Direction.OUT)
==>com.thinkaurelius.titan.graphdb.types.SchemaSource$Entry@5162bf3

gremlin> // get the first constraint; no need to do a .hasNext() check in this
gremlin> // example, since we know that we will only get a single entry
gremlin> sse = rel.iterator().next()
==>com.thinkaurelius.titan.graphdb.types.SchemaSource$Entry@5162bf3

gremlin> // finally get the schema type (that's the vertex label that's used in .indexOnly())
gremlin> sse.getSchemaType()
==>god
干杯,
丹尼尔

太棒了,谢谢!我已经算出了其中的一部分,但是没有得到顶点标签。