2015-12-03 69 views
0

我使用os x 10.6.8,java 6和orient 2.0.12。執行此代碼後,我注意到以下行爲:帶字母數字標籤的邊緣

package orientdb; 

import java.io.File; 
import com.tinkerpop.blueprints.Edge; 
import com.tinkerpop.blueprints.Vertex; 
import com.tinkerpop.blueprints.impls.orient.OrientGraph; 

public class testEdge { 

    public static void main(String[] args){ 
     try{ 
      File f = new File(System.getProperty("user.home") + File.separator + "edgeTest"); 
      if (f.exists()) 
       f.delete(); 
      f.mkdirs(); 
      OrientGraph g = new OrientGraph("plocal:" + f.getAbsolutePath()); 

      g.begin(); 
      Vertex v = g.addVertex(null); 
      Vertex v1 = g.addVertex(null); 
      Edge e = v.addEdge("2k", v1); 
      g.commit(); 
      g.shutdown(); 
     } 
     catch(Exception x){ 
      x.printStackTrace(); 
     } 
    } 
} 

我打開工作室並執行「從e中選擇」。反射的邊緣標籤是「-2k」而不是「2k」。如果標籤不包含數字,則不會發生。

這是一個約束嗎?

非常感謝!

回答

0

是的。 Edge的標籤是一個OrientDB類,它擴展了E(Edges的基類)。

+0

約束條件,意味着標籤不能以數字開頭。看來數據正在改變。我期待「2k」不是「-2k」 – efekctive

+0

所以引擎蓋下「2K」成爲一個類,所以Java的命名約定發揮作用? – efekctive