本文整理匯總了Java中com.tinkerpop.blueprints.Edge.getId方法的典型用法代碼示例。如果您正苦於以下問題:Java Edge.getId方法的具體用法?Java Edge.getId怎麽用?Java Edge.getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.tinkerpop.blueprints.Edge
的用法示例。
在下文中一共展示了Edge.getId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: copyEdge
import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
private static void copyEdge(Graph graph, Edge edge)
{
Object id = edge.getId();
if (graph.getEdge(id) != null)
{
return;
}
Vertex src = graph.getVertex(edge.getVertex(Direction.OUT).getId());
Vertex dst = graph.getVertex(edge.getVertex(Direction.IN).getId());
if (src != null && dst != null)
{
Edge e = GraphHelper.addEdge(graph, id, src, dst, edge.getLabel());
if (e != null)
{
ElementHelper.copyProperties(edge, e);
}
}
}
示例2: testImplicitKey
import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
/**
* Test the correct application of {@link com.thinkaurelius.titan.graphdb.types.system.ImplicitKey}
* to vertices, edges, and properties.
*
* Additionally tests RelationIdentifier since this is closely related to ADJACENT and TITANID implicit keys.
*/
@Test
public void testImplicitKey() {
TitanVertex v = graph.addVertex(null), u = graph.addVertex(null);
v.setProperty("name","Dan");
Edge e = v.addEdge("knows",u);
graph.commit();
RelationIdentifier eid = (RelationIdentifier)e.getId();
assertEquals(v.getId(),v.getProperty("id"));
assertEquals(eid,e.getProperty("id"));
assertEquals("knows",e.getProperty("label"));
assertEquals(BaseVertexLabel.DEFAULT_VERTEXLABEL.getName(),v.getProperty("label"));
assertEquals(1,v.query().labels("knows").direction(BOTH).has("id",eid).count());
assertEquals(0,v.query().labels("knows").direction(BOTH).has("id",RelationIdentifier.get(new long[]{4,5,6,7})).count());
assertEquals(1,v.query().labels("knows").direction(BOTH).has("$titanid",eid.getRelationId()).count());
assertEquals(0,v.query().labels("knows").direction(BOTH).has("$titanid",110111).count());
assertEquals(1,v.query().has("$adjacent",u.getLongId()).count());
assertEquals(1,v.query().has("$adjacent",(int)u.getLongId()).count());
try {
//Not a valid vertex
assertEquals(0,v.query().has("$adjacent",110111).count());
fail();
} catch (IllegalArgumentException ex) {}
assertNotNull(graph.getEdge(eid));
assertEquals(eid,graph.getEdge(eid).getId());
//Test edge retrieval
}