2014-09-06 13 views
11

मैं प्रबंधन प्रणाली को देख रहा हूं लेकिन कुछ चीजें अभी भी मुझे आकर्षित करती हैं। अनिवार्य रूप से मैं क्या करना चाहता हूं:टाइटन डीबी सभी ग्राफ इंडेक्स को कैसे सूचीबद्ध करें

  • सभी एज आधारित इंडेक्स (वर्टेक्स केंद्रित सहित) सूचीबद्ध करें।
  • सभी वेरटेक्स आधारित इंडेक्स सूचीबद्ध करें (प्रति लेबल आधार पर यदि सूचकांक किसी लेबल से जुड़ा हुआ है)।

यह मूल रूप से ग्राफ स्कीमा को मैप करने जैसा है।

मैंने कुछ चीजों की कोशिश की है लेकिन मुझे केवल आंशिक डेटा ही मिलता है।

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. 

शून्य भरने में कोई भी मदद सहायक होगी।

क्रमांक जानना चाहते:

  • मैं अनुक्रमित एक लेबल (या लेबल एक सूचकांक से जुड़ी) indexOnly के माध्यम से()
  • मैं किनारे अनुक्रमित buildEdgeIndex के माध्यम से सेट कैसे सूचीकृत करूँ से जुड़ी कैसे मिल सकता है() और उनके संबंधित किनारे लेबल?

अग्रिम धन्यवाद।

अतिरिक्त जानकारी: टाइटन 0.5.0, कैसंड्रा बैकएंड, रेक्सस्टर के माध्यम से।

उत्तर

9

यह वास्तव में सीधे आगे नहीं है, इसलिए मैं इसे एक उदाहरण का उपयोग करके दिखा रहा हूं।

के देवताओं का ग्राफ़ + भगवान के नाम के लिए एक अतिरिक्त सूचकांक साथ शुरू करते हैं:

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.t[email protected]2f414e82 

gremlin> // get the index by its name 
gremlin> index = m.getGraphIndex("god-name") 
==>com.thinkau[email protected]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) 
==>[email protected] 

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() 
==>[email protected] 

gremlin> // finally get the schema type (that's the vertex label that's used in .indexOnly()) 
gremlin> sse.getSchemaType() 
==>god 

चीयर्स, डैनियल

+0

अद्भुत धन्यवाद! मैंने पहले से ही इसका हिस्सा निकाला था लेकिन वर्टेक्स लेबल प्राप्त करने में लापता था। –

संबंधित मुद्दे