OrientDB 在顶点和 ODocument 之间创建边

OrientDB Create Edge between a Vertex and ODocument

我有一个包含一大堆 ODocument 记录的数据库。他们有自己的 Class 层次结构,并且不扩展 V.

我正在添加新集合并支持某些功能 - 我们想使用图形数据库功能。

所以我为每个
创建了一个新的顶点 Vertex company = graph.addVertex(null);

我找到现有的 ODoc 并将其转换为顶点

Vertex person = null; for (Vertex v : graph.getVertices("Person.name", "Jay")) { person = v; }

并尝试创建边

Edge sessionInIncident = graph.addEdge(null, company, person, "employs");

边缘创建导致以下

Class 'Person' is not an instance of V
java.lang.IllegalArgumentException
at com.tinkerpop.blueprints.impls.orient.OrientElement.checkForClassInSchema(OrientElement.java:635)
at com.tinkerpop.blueprints.impls.orient.OrientVertex.addEdge(OrientVertex.java:905)
at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.addEdge(OrientBaseGraph.java:685)

为了成为顶点,class Person 必须扩展 V class。试试这个命令:

alter class Person superclass V