public TitanLabel makeSimpleEdgeLabel(String name) { return tx.makeLabel(name).make(); }
public TitanLabel makeKeyedEdgeLabel(String name, TitanKey sort, TitanKey signature) { TitanLabel relType = tx.makeLabel(name). sortKey(sort).signature(signature).directed().make(); return relType; }
LabelMaker tm = tx.makeLabel("test" + i); if (i % 4 == 1) tm.unidirected(); tm.make();
public void testBatchLoadingLocking(boolean batchloading) { tx.makeKey("uid").dataType(Long.class).indexed(Vertex.class).single(TypeMaker.UniquenessConsistency.LOCK).unique(TypeMaker.UniquenessConsistency.LOCK).make(); tx.makeLabel("knows").oneToOne(TypeMaker.UniquenessConsistency.LOCK).make(); newTx(); TestLockerManager.ERROR_ON_LOCKING=true; clopen(ImmutableMap.of("storage.batch-loading", batchloading, "storage.lock-backend", "test")); int numV = 10000; long start = System.currentTimeMillis(); for (int i=0;i<numV;i++) { TitanVertex v = tx.addVertex(); v.setProperty("uid",i+1); v.addEdge("knows",v); } clopen(); // System.out.println("Time: " + (System.currentTimeMillis()-start)); for (int i=0;i<Math.min(numV,300);i++) { assertEquals(1,Iterables.size(graph.query().has("uid",i+1).vertices())); assertEquals(1,Iterables.size(graph.query().has("uid",i+1).vertices().iterator().next().getEdges(Direction.OUT,"knows"))); } }
dataType(String.class). make(); TitanLabel connect = tx.makeLabel("connect").signature(id, name).make(); int noNodes = 100; int div = 10;
public void makeTypes(TitanGraph g) { Preconditions.checkArgument(edgeLabels <= edgePropKeys); TitanTransaction tx = g.newTransaction(); for (int i = 0; i < vertexPropKeys; i++) { tx.makeKey(getVertexPropertyName(i)).dataType(Integer.class).indexed(Vertex.class).single().make(); } for (int i = 0; i < edgePropKeys; i++) { tx.makeKey(getEdgePropertyName(i)).dataType(Integer.class).indexed(Edge.class).single().make(); } for (int i = 0; i < edgeLabels; i++) { String labelName = getEdgeLabelName(i); String pkName = getSortKeyForLabel(labelName); TitanKey pk = tx.getPropertyKey(pkName); tx.makeLabel(getEdgeLabelName(i)).sortKey(pk).make(); } tx.makeKey(UID_PROP).dataType(Long.class).indexed(Vertex.class).single().unique().make(); tx.commit(); }
TitanKey id = tx.makeKey("uid").single().unique() .indexed(Vertex.class).dataType(Integer.class).make(); TitanLabel knows = tx.makeLabel("knows").sortKey(time).signature(location).make();
tx.makeLabel("link").unidirected().make(); TitanVertex v3 = tx.addVertex(); v21.addEdge("link", v3);
TitanLabel friend = tx.makeLabel("friend").directed().manyToMany().make(); TitanLabel link = tx.makeLabel("link").unidirected().make(); TitanLabel connect = tx.makeLabel("connect").signature(id, weight).manyToOne(TypeMaker.UniquenessConsistency.NO_LOCK).make(); TitanLabel parent = tx.makeLabel("parent").manyToOne().sortKey(weight).make(); assertTrue(parent.isUnique(OUT)); TitanLabel child = tx.makeLabel("child").oneToMany().make(); assertTrue(child.isUnique(IN)); TitanLabel spouse = tx.makeLabel("spouse").oneToOne().make(); assertTrue(spouse.isUnique(IN)); assertTrue(spouse.isUnique(OUT)); tx.makeLabel("link").unidirected().make(); fail(); } catch (IllegalArgumentException e) { tx.makeLabel("test").make(); try { tx.makeLabel("link2").unidirected(). sortKey(id, weight).signature(id).make(); fail(); TitanLabel link2 = tx.makeLabel("link2").unidirected().sortKey(id, weight).make();
TitanKey weight = tx.makeKey("weight").dataType(Double.class).single().make(); TitanLabel author = tx.makeLabel("author").manyToOne().unidirected().make(); TitanLabel connect = tx.makeLabel("connect").sortKey(time).make(); TitanLabel connectDesc = tx.makeLabel("connectDesc").sortKey(time).sortOrder(Order.DESC).make(); TitanLabel friend = tx.makeLabel("friend").sortKey(weight, time).sortOrder(Order.ASC).signature(author).make(); TitanLabel friendDesc = tx.makeLabel("friendDesc").sortKey(weight, time).sortOrder(Order.DESC).signature(author).make(); TitanLabel knows = tx.makeLabel("knows").sortKey(author, weight).make(); TitanLabel follows = tx.makeLabel("follows").make();