簡體   English   中英

OrientDB在頂點和ODocument之間創建邊緣

[英]OrientDB Create Edge between a Vertex and ODocument

我有一個包含一堆ODocument記錄的數據庫。 它們具有自己的類層次結構,並且不擴展V。

我正在添加新集合並支持某些功能-我們想使用graph db功能。

所以我創建了一個新的頂點
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)

為了成為頂點,類Person必須擴展V類。 試試這個命令:

alter class Person superclass V

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM