无法在Orientjs中创建EDGE

时间:2017-08-31 14:52:34

标签: javascript orientdb orientjs

我正在使用OrientJS,我正在尝试在两个节点之间创建边缘。直到几天前,所有这些都与下面的脚本一起运行良好:

module.exports.insertRelatedToAssociation = (nodeFrom, nodeTo) => {
    db.create('EDGE', 'RelatedTo')
        .from(nodeFrom).to(nodeTo)
        .one()
        .then(function (result) {
             return (result !== undefined)
         })     
}

但现在,每次运行脚本时,我都会突然收到此错误消息:

com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error parsing query:
CREATE EDGE RelatedTo FROM #29:5
     ^
Encountered " <CREATE> "CREATE "" at line 1, column 1.
Was expecting one of:
    <SELECT> ...
    <TRAVERSE> ...
    <MATCH> ...
    <INSERT> ...
    <RETURN> ...
    <PROFILE> ...
    <FIND> ...
    <REBUILD> ...
    <OPTIMIZE> ...
    <GRANT> ...
    <REVOKE> ...
    <BEGIN> ...
    <COMMIT> ...
    <ROLLBACK> ...
    <IF> ...
    <SLEEP> ...
    <CONSOLE> ...

    DB name="test-graph"
    at com.orientechnologies.orient.core.sql.parser.OStatementCache.throwParsingException(OStatementCache.java:109)
    at com.orientechnologies.orient.core.sql.parser.OStatementCache.parse(OStatementCache.java:103)
    at com.orientechnologies.orient.core.sql.parser.OStatementCache.get(OStatementCache.java:81)
    at com.orientechnologies.orient.core.sql.parser.OStatementCache.get(OStatementCache.java:64)
    at com.orientechnologies.orient.core.sql.OCommandExecutorSQLAbstract.preParse(OCommandExecutorSQLAbstract.java:232)
    at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLCreateEdge.parse(OCommandExecutorSQLCreateEdge.java:66)
    at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLCreateEdge.parse(OCommandExecutorSQLCreateEdge.java:46)
    at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:58)
    at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:39)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:3144)
    at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:69)
    at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.command(ONetworkProtocolBinary.java:1529)
    at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.executeRequest(ONetworkProtocolBinary.java:646)
    at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.sessionRequest(ONetworkProtocolBinary.java:384)
    at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.execute(ONetworkProtocolBinary.java:207)
    at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:77)

也许,OrientDB改变了它的解析器,但我在GitHub Wiki(https://github.com/orientechnologies/orientdb/wiki/OrientDB-2.2-Release-Notes#2226---august-16-2017)上找不到它。

注意:我正在运行orientdb-community-importers-2.2.24。版本2.2.26也是如此。

1 个答案:

答案 0 :(得分:0)

我发现了错误。只是参数nodeFromundefined。因此,将undefined传递给db.create('EDGE','RelatedTo).from(undefined).to(nodeTo)会产生错误!