0

OrientDB 3.0.4 中的控制台应用程序似乎不向后兼容 OrientDB 3.0.2 以创建具有 EMBEDDEDLIST 的顶点。

OrientDB 3.0.4 控制台中的以下查询失败:

 CREATE VERTEX Profile SET name = "John", phone = [{ "@type":"d", "number" : "212" }]

我该如何解决这个问题?v3.0.4 有哪些变化?在哪里可以找到更新的文档?


OrientDB 控制台 v.3.0.2 - Veloce(构建 e47e693f1470a7a642461be26983d4eca70777fd,分支开发)

    OrientDB 控制台 v.3.0.2 - Veloce(构建 e47e693f1470a7a642461be26983d4eca70777fd,分支开发)https://www.orientdb.com
    键入“帮助”以显示所有支持的命令。
    orientdb> 创建数据库远程:localhost/mydb root orientdb

    使用存储类型 [PLOCAL] 创建数据库 [remote:localhost/mydb]...
    数据库创建成功。

    当前数据库是:remote:localhost/mydb
    orientdb {db=mydb}> 创建类Phone EXTENDS V

    类创建成功。

    orientdb {db=mydb}> 创建属性 Phone.number String

    属性创建成功。

    orientdb {db=mydb}> 创建类 Profile EXTENDS V

    类创建成功。

    orientdb {db=mydb}> 创建属性 Profile.name 字符串

    属性创建成功。

    orientdb {db=mydb}> 创建属性 Profile.phone EmbeddedList Phone

    属性创建成功。

    orientdb {db=mydb}> CREATE VERTEX Profile SET name = "John", phone = [{ "@type":"d", "number" : "212" }]

    在 0.023000 秒内创建了顶点 '[Profile#33:0{name:John,phone:[1]} v1]'。

--------

OrientDB 控制台 v.3.0.4 - Veloce(构建 4578b51f72a55feaa0852bc8ddd52929011d956c,分支 3.0.x)

    OrientDB 控制台 v.3.0.4 - Veloce(构建 4578b51f72a55feaa0852bc8ddd52929011d956c,分支 3.0.x)https://www.orientdb.com
    键入“帮助”以显示所有支持的命令。
    orientdb> 创建数据库远程:localhost/mydb root orientdb

    使用存储类型 [PLOCAL] 创建数据库 [remote:localhost/mydb]...
    数据库创建成功。

    当前数据库是:remote:localhost/mydb

    orientdb {db=mydb}> 创建类Phone EXTENDS V

    类创建成功。

    orientdb {db=mydb}> 创建属性 Phone.number String

    属性创建成功。

    orientdb {db=mydb}> 创建类 Profile EXTENDS V

    类创建成功。

    orientdb {db=mydb}> 创建属性 Profile.name 字符串

    属性创建成功。

    orientdb {db=mydb}> 创建属性 Profile.phone EmbeddedList Phone

    属性创建成功。

    orientdb {db=mydb}> CREATE VERTEX Profile SET name = "John", phone = [{ "@type":"d", "number" : "212" }]

    错误:com.orientechnologies.orient.core.sql.OCommandSQLParsingException:解析查询时出错:
    创建 VERTEX Profile SET name = "John", phone = [{ "@type":"d", "number" : "212" }
                                                     ^
    在第 1 行第 50 列遇到“”[”“[””。
    期待其中之一:
         ...
         ...
         ...
        “{”...
         ...
         ...
         ...
        “{”...
        “{”...
         ...
         ...
         ...
        “{”...
        “{”...
        “{”...
         ...
         ...
         ...
        “{”...
        “{”...
         ...
         ...
         ...
        “{”...
        “{”...
         ...
         ...
         ...
        “{”...
        “{”...
        “{”...

        数据库名称="mydb"
        错误代码="1"
        数据库名称="mydb"

    !无法识别的命令:']'
    orientdb {db=mydb}>

4

1 回答 1

0

问题是您已将您的属性声明为“ Phone ”,然后您尝试使用与架构不匹配的小写名称“ phone ”来创建您的顶点。也没有必要使用方括号,所以代替最后一个查询,尝试使用:

CREATE VERTEX Profile SET name = "John", Phone = { "@type":"d", "number" : "212"}
于 2018-07-13T21:36:32.853 回答