private void setupChainGraph(int numV, String[] strs, boolean sameNameMapping) { clopen(option(INDEX_NAME_MAPPING, INDEX), sameNameMapping); TitanGraphIndex vindex = getExternalIndex(Vertex.class, INDEX); TitanGraphIndex eindex = getExternalIndex(Edge.class, INDEX); TitanGraphIndex pindex = getExternalIndex(TitanVertexProperty.class, INDEX); PropertyKey name = makeKey("name", String.class); mgmt.addIndexKey(vindex, name, getStringMapping()); mgmt.addIndexKey(eindex, name, getStringMapping()); mgmt.addIndexKey(pindex, name, getStringMapping(), Parameter.of("mapped-name", "xstr")); PropertyKey text = makeKey("text", String.class); mgmt.addIndexKey(vindex, text, getTextMapping(), Parameter.of("mapped-name", "xtext")); mgmt.addIndexKey(eindex, text, getTextMapping()); mgmt.addIndexKey(pindex, text, getTextMapping()); mgmt.makeEdgeLabel("knows").signature(name).make(); mgmt.makePropertyKey("uid").dataType(String.class).signature(text).make(); finishSchema(); TitanVertex previous = null; for (int i = 0; i < numV; i++) { TitanVertex v = graph.addVertex("name", strs[i % strs.length], "text", strs[i % strs.length]); Edge e = v.addEdge("knows", previous == null ? v : previous, "name", strs[i % strs.length], "text", strs[i % strs.length]); VertexProperty p = v.property("uid", "v" + i, "name", strs[i % strs.length], "text", strs[i % strs.length]); previous = v; } }
addKey(name, getStringMapping()).addKey(time).buildMixedIndex(INDEX); mgmt.buildIndex("index2", Vertex.class).indexOnly(event). addKey(text, getTextMapping()).buildMixedIndex(INDEX);
mgmt.buildIndex("mi", Vertex.class).addKey(name, getTextMapping()).addKey(age).buildMixedIndex(INDEX); finishSchema(); Vertex vs[] = new TitanVertex[4];
addKey(name, getStringMapping()).addKey(time).buildMixedIndex(INDEX); mgmt.buildIndex("index2", Edge.class).indexOnly(label). addKey(text, getTextMapping()).buildMixedIndex(INDEX);
addKey(name, getStringMapping()).buildMixedIndex(INDEX); TitanGraphIndex index2 = mgmt.buildIndex("index2", Vertex.class).indexOnly(person). addKey(text, getTextMapping()).addKey(weight).buildMixedIndex(INDEX); TitanGraphIndex index3 = mgmt.buildIndex("index3", Vertex.class).indexOnly(org). addKey(text, getTextMapping()).addKey(weight).buildMixedIndex(INDEX);
mgmt.makePropertyKey("phone").dataType(String.class).cardinality(Cardinality.LIST).make(); mgmt.buildIndex("theIndex", Vertex.class).addKey(text, getTextMapping(), getFieldMap(text)).buildMixedIndex(INDEX); finishSchema();
.addKey(text, getTextMapping()).buildMixedIndex(INDEX); mixed.name(); composite.name();
private void setupChainGraph(int numV, String[] strs, boolean sameNameMapping) { clopen(option(INDEX_NAME_MAPPING,INDEX),sameNameMapping); TitanGraphIndex vindex = getExternalIndex(Vertex.class,INDEX); TitanGraphIndex eindex = getExternalIndex(Edge.class,INDEX); TitanGraphIndex pindex = getExternalIndex(TitanProperty.class,INDEX); PropertyKey name = makeKey("name",String.class); mgmt.addIndexKey(vindex, name, getStringMapping()); mgmt.addIndexKey(eindex, name, getStringMapping()); mgmt.addIndexKey(pindex, name, getStringMapping(), Parameter.of("mapped-name", "xstr")); PropertyKey text = makeKey("text",String.class); mgmt.addIndexKey(vindex, text, getTextMapping(), Parameter.of("mapped-name","xtext")); mgmt.addIndexKey(eindex, text, getTextMapping()); mgmt.addIndexKey(pindex, text, getTextMapping()); mgmt.makeEdgeLabel("knows").signature(name).make(); mgmt.makePropertyKey("uid").dataType(String.class).signature(text).make(); finishSchema(); TitanVertex previous = null; for (int i=0;i<numV;i++) { TitanVertex v = graph.addVertex(null); v.setProperty("name",strs[i%strs.length]); v.setProperty("text",strs[i%strs.length]); TitanEdge e = v.addEdge("knows",previous==null?v:previous); e.setProperty("name",strs[i%strs.length]); e.setProperty("text",strs[i%strs.length]); TitanProperty p = v.addProperty("uid","v"+i); p.setProperty("name", strs[i % strs.length]); p.setProperty("text", strs[i % strs.length]); previous=v; } }
addKey(name, getStringMapping()).addKey(time).buildMixedIndex(INDEX); mgmt.buildIndex("index2",Edge.class).indexOnly(label). addKey(text, getTextMapping()).buildMixedIndex(INDEX);
addKey(name, getStringMapping()).addKey(time).buildMixedIndex(INDEX); mgmt.buildIndex("index2",Vertex.class).indexOnly(event). addKey(text, getTextMapping()).buildMixedIndex(INDEX);
mgmt.buildIndex("mi",Vertex.class).addKey(name, getTextMapping()).addKey(age).buildMixedIndex(INDEX); finishSchema(); TitanVertex vs[] = new TitanVertex[4];
PropertyKey height = mgmt.makePropertyKey("height").dataType(Decimal.class).make(); TitanGraphIndex index = mgmt.buildIndex("theIndex",Vertex.class) .addKey(text, getTextMapping(), getFieldMap(text)).buildMixedIndex(INDEX); finishSchema();
addKey(name, getStringMapping()).buildMixedIndex(INDEX); TitanGraphIndex index2 = mgmt.buildIndex("index2",Vertex.class).indexOnly(person). addKey(text, getTextMapping()).addKey(weight).buildMixedIndex(INDEX); TitanGraphIndex index3 = mgmt.buildIndex("index3",Vertex.class).indexOnly(org). addKey(text, getTextMapping()).addKey(weight).buildMixedIndex(INDEX);
.addKey(text, getTextMapping()).buildMixedIndex(INDEX); mixed.getName(); composite.getName(); finishSchema();