0

我正在试验 OrientDB(社区版 v1.7-rc2)/ Oriento(0.4.0)

功能

function linkChildToParent(oChild, oParent) {
    return (
        oDB.edge.from(oChild).to(oParent)
        .create({"@class": 'OrgUnit_isPartOf_OrgUnit'})
        .tap(log)
        .return(oChild)
    );
}

异常失败

C:\Users\Udo\workspace\NodeOrient\node_modules\oriento\node_modules\bluebird\js\main\async.js:93
                throw res.e;
                         ^
OrientDB.RequestError: Cannot find a command executor for the command request: sql.#11.1
    at Operation.parseError (C:\Users\Udo\workspace\NodeOrient\node_modules\oriento\lib\transport\binary\protocol\operation.js:806:13)
    at Operation.consume (C:\Users\Udo\workspace\NodeOrient\node_modules\oriento\lib\transport\binary\protocol\operation.js:396:35)
    at Connection.process (C:\Users\Udo\workspace\NodeOrient\node_modules\oriento\lib\transport\binary\connection.js:324:17)
    at Connection.handleSocketData (C:\Users\Udo\workspace\NodeOrient\node_modules\oriento\lib\transport\binary\connection.js:250:17)
    at Socket.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:764:14)
    at Socket.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:426:10)
    at emitReadable (_stream_readable.js:422:5)
    at readableAddChunk (_stream_readable.js:165:9)
From previous event:
    at Function.Promise$All [as all] (C:\Users\Udo\workspace\NodeOrient\node_modules\bluebird\js\main\promise.js:193:12)
    at generateDependents (C:\Users\Udo\workspace\NodeOrient\setupOrgDB.js:202:35)
From previous event:
    at Function.Promise$Join [as join] (C:\Users\Udo\workspace\NodeOrient\node_modules\bluebird\js\main\join.js:118:15)
    at BinaryTransport.populateDB (C:\Users\Udo\workspace\NodeOrient\setupOrgDB.js:219:20)

所以我调试到驱动程序直到我发现

function createEdge (db, config, from, to) {
  var command = "CREATE EDGE",
      className, attributes;
  config = edgeConfig(config);
  className = config[0];
  attributes = config[1];
  command += ' ' + className + ' FROM ' + edgeReference(from)  + ' TO ' + edgeReference(to);

  if (attributes) {
    command += ' CONTENT ' + JSON.stringify(attributes);
  }

  return db.query(command);
}

之前命令的内容return db.query(command);

CREATE EDGE OrgUnit_isPartOf_OrgUnit FROM (#11.1) TO (#11.0)

然后我使用(基于浏览器的)控制台来验证 OrgUnit_isPartOf_OrgUnit 实际上是从 Edge 继承的。我还验证了它将 OrgUnit 与 OrgUnit Vertices 链接,并且 OrgUnit 是从 Vertex 派生的。我还双重验证了记录 #11.1 和 #11.0 确实存在于数据库中。

然后我发出

CREATE EDGE OrgUnit_isPartOf_OrgUnit FROM (#11.1) TO (#11.0)

直接在控制台中得到

com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException: Cannot find a command executor for the command request: sql.#11:1

这基本上是相同的例外。通过 Google,我找到了一些Javadoc 来解决这个异常。然而,这根本没有帮助我。

出了什么问题,我该如何解决?

4

1 回答 1

2

正确的命令应该不带括号。括号执行子查询:

CREATE EDGE OrgUnit_isPartOf_OrgUnit FROM #11:1 TO #11:0

有关更多信息,请查看创建边缘命令。

于 2014-09-23T13:29:08.143 回答