你可以尝试使用上FramedGraph的addEdge方法,当你提供两个顶点涉及返回边缘。所以更细一点。
E.g.
com.tinkerpop.frames.FramedGraphFactory.FramedTransactionalGraph graph = ...
Vertex user1 = graph.addVertex(null);
Vertex project1 = graph.addVertex(null);
Edge newEdge = graph.addEdge(null, user1, project1, "CREATED");
// ... do something with newEdge
的TinkerPop有关FramedGraph接口addVertex和addEdge也有重载的方法,这样就可以提供您诬陷类的类型,有一个框架的顶点或边返回它可以是方便。
E.g.
Vertex user1 = graph.addVertex(null, Person.class);
Vertex project1 = graph.addVertex(null, Project.class);
Edge newEdge = graph.addEdge(null, user1, project1, "CREATED",Direction.OUT, MyEdge.class);
当然也可以graph.frame(newEdge, MyEdge.class)
后的事实也是如此,如果你只有一个com.tinkerpop.blueprints.Edge
和。
Here is the Javadoc for FramedGraph