3

次のように、OrientGraph データベースの新しいインスタンスを作成しようとしています。

OrientGraph graph = new OrientGraph("local:C:/temp/graph/db");
graph.create(); //BUT no create method!!

とにかく、マニュアルに固執しながら、次のように ODatabaseDocumentTx でそれを行います。

db = new ODatabaseDocumentTx("plocal:c:/orientdb/db");
db.create();
....
db.shutdown();

次に、次のようなセッションを取得したい:

OrientGraphFactory factory = new OrientGraphFactory("plocal:c:/orientdb/db", "admin", "admin");
OrientGraphNoTx g = factory.getNoTx();
try
{

}
finally
{
    g.shutdown();
}

次の例外が発生しました。

java.lang.IncompatibleClassChangeError: Expected static method     com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.checkForGraphSchema(Lcom/orientechnologies/orient/core/db/document/ODatabaseDocumentTx;)

どうすれば新しいグラフ データベースを作成できますか???

ありがとうございました。

4

2 に答える 2

3

まず、「ローカル」エンジンはもう使用しないでください。廃止されました(最初の例)。次に、OrientGraph を作成する方法が明確に文書化されています

動作するはずの完全な例:

@Test
public void testNoTx() {
    // start with a non existing database
    final OrientGraphFactory factory = new OrientGraphFactory(
        "plocal:" + DB_DIR, "admin", "admin");
    assertFalse(factory.exists());        
    try {
        OrientGraphNoTx g = factory.getNoTx();
        // database is auto created
        assertFalse(g.isClosed());
        assertFalse(g.isRequireTransaction());
    } finally {
        // this also closes the OrientGraph instances created by the factory
        // Note that OrientGraphFactory does not implement Closeable
        factory.close();
    }
}

最後に、報告されたエラーは、一連の一貫性のない jar ファイルを示しています。あなたがすべき:

必要な依存関係:

- com.orientechnologies:orientdb-graphdb:jar:2.0-M2:compile
  +- com.orientechnologies:orientdb-core:jar:2.0-M2:compile
  |  +- org.xerial.snappy:snappy-java:jar:1.1.0.1:compile
  |  +- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-  lru:jar:1.4:compile
  |  +- net.java.dev.jna:jna:jar:4.0.0:compile
  |  \- net.java.dev.jna:jna-platform:jar:4.0.0:compile
  \- com.tinkerpop.blueprints:blueprints-core:jar:2.6.0:compile
     +- com.fasterxml.jackson.core:jackson-databind:jar:2.2.3:compile
     |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.2.3:compile
     |  \- com.fasterxml.jackson.core:jackson-core:jar:2.2.3:compile
     +- com.carrotsearch:hppc:jar:0.6.0:compile
     \- commons-configuration:commons-configuration:jar:1.6:compile
        +- commons-collections:commons-collections:jar:3.2.1:compile
        +- commons-lang:commons-lang:jar:2.4:compile
        +- commons-digester:commons-digester:jar:1.8:compile
        |  \- commons-beanutils:commons-beanutils:jar:1.7.0:compile
        \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile

アップデート:

完全な例については、https://github.com/rmuller/graphdb-playground (「orientdb-embedded-graph」の下) を参照してください。

于 2014-11-10T14:35:44.527 に答える
0

V2 で大奮闘した後、V.1.7.9 に戻し、すべてが機能しました。

Maven 依存関係: com.orientechnologies orientdb-graphdb 1.7.9

V.2.x には未解決の問題があるようです。1 か月以内に別の PoC を行う予定です。

于 2014-11-12T07:29:59.170 に答える