本文整理匯總了Java中com.thinkaurelius.titan.graphdb.types.StandardEdgeLabelMaker類的典型用法代碼示例。如果您正苦於以下問題:Java StandardEdgeLabelMaker類的具體用法?Java StandardEdgeLabelMaker怎麽用?Java StandardEdgeLabelMaker使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StandardEdgeLabelMaker類屬於com.thinkaurelius.titan.graphdb.types包,在下文中一共展示了StandardEdgeLabelMaker類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testCreateDelete
import com.thinkaurelius.titan.graphdb.types.StandardEdgeLabelMaker; //導入依賴的package包/類
@Test
public void testCreateDelete() {
makeKey("weight", Double.class);
PropertyKey uid = makeVertexIndexedUniqueKey("uid", Integer.class);
((StandardEdgeLabelMaker) mgmt.makeEdgeLabel("knows")).sortKey(uid).sortOrder(Order.DESC).directed().make();
mgmt.makeEdgeLabel("father").multiplicity(Multiplicity.MANY2ONE).make();
finishSchema();
TitanVertex v1 = graph.addVertex(), v3 = graph.addVertex("uid", 445);
Edge e = v3.addEdge("knows", v1, "uid", 111);
Edge e2 = v1.addEdge("friend", v3);
assertEquals(111, e.<Integer>value("uid").intValue());
graph.tx().commit();
v3 = getV(graph, v3);
assertEquals(445, v3.<Integer>value("uid").intValue());
e = getOnlyElement(v3.query().direction(Direction.OUT).labels("knows").edges());
assertEquals(111, e.<Integer>value("uid").intValue());
assertEquals(e, getE(graph, e.id()));
assertEquals(e, getE(graph, e.id().toString()));
VertexProperty p = getOnlyElement(v3.properties("uid"));
p.remove();
v3.property("uid", 353);
e = getOnlyElement(v3.query().direction(Direction.OUT).labels("knows").edges());
e.property("uid", 222);
e2 = getOnlyElement(v1.query().direction(Direction.OUT).labels("friend").edges());
e2.property("uid", 1);
e2.property("weight", 2.0);
assertEquals(1, e2.<Integer>value("uid").intValue());
assertEquals(2.0, e2.<Double>value("weight").doubleValue(), 0.0001);
clopen();
v3 = getV(graph, v3.id());
assertEquals(353, v3.<Integer>value("uid").intValue());
e = getOnlyElement(v3.query().direction(Direction.OUT).labels("knows").edges());
assertEquals(222, e.<Integer>value("uid").intValue());
}
示例2: makeKeyedEdgeLabel
import com.thinkaurelius.titan.graphdb.types.StandardEdgeLabelMaker; //導入依賴的package包/類
public EdgeLabel makeKeyedEdgeLabel(String name, PropertyKey sort, PropertyKey signature) {
EdgeLabel relType = ((StandardEdgeLabelMaker)tx.makeEdgeLabel(name)).
sortKey(sort).signature(signature).directed().make();
return relType;
}
示例3: testCreateDelete
import com.thinkaurelius.titan.graphdb.types.StandardEdgeLabelMaker; //導入依賴的package包/類
@Test
public void testCreateDelete() {
makeKey("weight",Double.class);
PropertyKey id = makeVertexIndexedUniqueKey("uid",Integer.class);
((StandardEdgeLabelMaker)mgmt.makeEdgeLabel("knows")).sortKey(id).sortOrder(Order.DESC).directed().make();
mgmt.makeEdgeLabel("father").multiplicity(Multiplicity.MANY2ONE).make();
finishSchema();
id = tx.getPropertyKey("uid");
TitanVertex n1 = graph.addVertex(null), n3 = graph.addVertex(null);
TitanEdge e = n3.addEdge("knows", n1);
Edge e2 = n1.addEdge("friend",n3);
e.setProperty(id, 111);
n3.addProperty(id, 445);
assertEquals(111, e.getProperty(id));
graph.commit();
n3 = graph.getVertex(n3.getLongId());
assertEquals(445, n3.getProperty("uid"));
e = (TitanEdge) Iterables.getOnlyElement(n3.getEdges(OUT, "knows"));
assertEquals(111, e.getProperty("uid"));
assertEquals(e, graph.getEdge(e.getId()));
assertEquals(e, graph.getEdge(e.getId().toString()));
TitanProperty p = Iterables.getOnlyElement(n3.getProperties("uid"));
p.remove();
n3.addProperty("uid", 353);
e = (TitanEdge)Iterables.getOnlyElement(n3.getEdges(Direction.OUT,"knows"));
e.setProperty(id,222);
e2 = Iterables.getOnlyElement(n1.getEdges(OUT,"friend"));
e2.setProperty("uid", 1);
e2.setProperty("weight", 2.0);
assertEquals(1,e2.getProperty("uid"));
assertEquals(2.0,e2.getProperty("weight"));
clopen();
n3 = graph.getVertex(n3.getLongId());
assertEquals(353, n3.getProperty("uid"));
e = (TitanEdge)Iterables.getOnlyElement(n3.getEdges(Direction.OUT,"knows"));
assertEquals(222,e.getProperty(id));
}