0
私はOrientDBをテストしており、OrientDB-Graph APIには慣れていません。そして今、私はネット上のコードをコピーし、例外を発生させます。 次は私のコードです:OrientDB:なぜなら、常に:現在のデータベースにクラスが既に存在しています
import com.tinkerpop.blueprints.impls.orient.*;
import com.tinkerpop.blueprints.Element.*;
import java.util.*;
class OrientInsert {
public static void testInsertion(OrientGraphNoTx graph) {
System.out.println(new Date());
int count = 1000;
for (int i = 0; i < count; ++i) {
OrientVertex vertex1 = graph.addVertex("class:CLASS1", "prop1", Integer.toString(i), "prop2", "22", "prop3", "3333");
for (int j = 0; j < count; ++j) {
OrientVertex vertex2 = graph.addVertex("class:CLASS2", "prop1", Integer.toString(i + j/1000), "prop2", "22", "prop3", "3333");
graph.addEdge(null, vertex1, vertex2, "v1v2");
}
}
graph.commit();
System.out.println(new Date());
}
public static void main(String[] args) {
OrientGraphFactory factory = new OrientGraphFactory("remote:10.240.137.12/test", "admin", "admin");
OrientGraphNoTx graph = factory.getNoTx();
OrientInsert.testInsertion(graph);
}
} `
、出力は次のとおりです。どうやら
Mar 29, 2016 11:45:19 AM com.orientechnologies.common.log.OLogManager log
INFO: OrientDB auto-config DISKCACHE=3,725MB (heap=14,288MB os=64,292MB disk=7,451MB)
Tue Mar 29 11:45:19 CST 2016
Exception in thread "main" com.orientechnologies.orient.server.distributed.ODistributedException: Error on execution distributed COMMAND
at com.orientechnologies.orient.server.distributed.ODistributedStorage.command(ODistributedStorage.java:346)
at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:67)
at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.command(ONetworkProtocolBinary.java:1323)
at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.executeRequest(ONetworkProtocolBinary.java:400)
at com.orientechnologies.orient.server.network.protocol.binary.OBinaryNetworkProtocolAbstract.execute(OBinaryNetworkProtocolAbstract.java:223)
at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:77)
Caused by: com.orientechnologies.orient.core.exception.OSchemaException: Class CLASS1 already exists in current database
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.doCreateClass(OSchemaShared.java:983)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.createClass(OSchemaShared.java:415)
at com.orientechnologies.orient.core.metadata.schema.OSchemaProxy.createClass(OSchemaProxy.java:127)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLCreateClass.execute(OCommandExecutorSQLCreateClass.java:179)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:90)
at com.orientechnologies.orient.server.distributed.task.OSQLCommandTask.execute(OSQLCommandTask.java:116)
at com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin.executeOnLocalNode(OHazelcastPlugin.java:810)
at com.orientechnologies.orient.server.hazelcast.ODistributedWorker.onMessage(ODistributedWorker.java:279)
at com.orientechnologies.orient.server.hazelcast.ODistributedWorker.run(ODistributedWorker.java:103)
、それは最初graphDatabaseにvertex1とvertex2を挿入し、クラス1とクラス2を作成します。しかし、2番目の挿入については、class1とclass2を作成したいと考えています。どうして?どのように私はクラスの作成を制御することができます。しかし、多くのユーザーがこのapiをテストに使用しています。
こんにちは@Qingerである私はあなたのコードを試してみました、それは私のために正しく –
おかげで動作しますあなたの試みのために。スタンドアロンサーバーまたは分散サーバークラスターで実行しますか?今、私は3つのサーバーインスタンスを持つクラスター上で実行しています。 – Qinger
私はスタンドアロンサーバー上で実行していますが、今は分散サーバーを試しています。すぐにお知らせします –