OrientDB 3.0.4控制台EMBEDDEDLIST创建VERTEX [英] OrientDB 3.0.4 Console EMBEDDEDLIST CREATE VERTEX

查看:146
本文介绍了OrientDB 3.0.4控制台EMBEDDEDLIST创建VERTEX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来,OrientDB 3.0.4中的控制台应用程序与OrientDB 3.0.2不能向后兼容,以创建具有EMBEDDEDLIST的顶点.

It appears that console application in OrientDB 3.0.4 is not backward compatible with OrientDB 3.0.2 for creating Vertex having EMBEDDEDLIST.

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

Following Query fails in OrientDB 3.0.4 console:

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

如何解决该问题? v3.0.4做了哪些更改?在哪里可以找到更新的文档?

How can I resolve the issue? What are the changes for v3.0.4 and where can I find updated documentation?



    OrientDB console v.3.0.2 - Veloce (build e47e693f1470a7a642461be26983d4eca70777fd, branch develop) https://www.orientdb.com
    Type 'help' to display all the supported commands.
    orientdb> create database remote:localhost/mydb root orientdb

    Creating database [remote:localhost/mydb] using the storage type [PLOCAL]...
    Database created successfully.

    Current database is: remote:localhost/mydb
    orientdb {db=mydb}> create class Phone EXTENDS V

    Class created successfully.

    orientdb {db=mydb}> create property Phone.number String

    Property created successfully.

    orientdb {db=mydb}> create class Profile EXTENDS V

    Class created successfully.

    orientdb {db=mydb}> create property Profile.name String

    Property created successfully.

    orientdb {db=mydb}> create property Profile.phone embeddedList Phone

    Property created successfully.

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

    Created vertex '[Profile#33:0{name:John,phone:[1]} v1]' in 0.023000 sec(s).

-------


OrientDB控制台v.3.0.4-Veloce(内部版本4578b51f72a55feaa0852bc8ddd52929011d956c,分支3.0.x)



    OrientDB console v.3.0.4 - Veloce (build 4578b51f72a55feaa0852bc8ddd52929011d956c, branch 3.0.x) https://www.orientdb.com
    Type 'help' to display all the supported commands.
    orientdb> create database remote:localhost/mydb root orientdb

    Creating database [remote:localhost/mydb] using the storage type [PLOCAL]...
    Database created successfully.

    Current database is: remote:localhost/mydb

    orientdb {db=mydb}> create class Phone EXTENDS V

    Class created successfully.

    orientdb {db=mydb}> create property Phone.number String

    Property created successfully.

    orientdb {db=mydb}> create class Profile EXTENDS V

    Class created successfully.

    orientdb {db=mydb}> create property Profile.name String

    Property created successfully.

    orientdb {db=mydb}> create property Profile.phone embeddedList Phone

    Property created successfully.

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

    Error: com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error parsing query:
    create VERTEX Profile SET name = "John", phone = [{ "@type":"d", "number" : "212" }
                                                     ^
    Encountered " "[" "[ "" at line 1, column 50.
    Was expecting one of:
         ...
         ...
         ...
        "{" ...
         ...
         ...
         ...
        "{" ...
        "{" ...
         ...
         ...
         ...
        "{" ...
        "{" ...
        "{" ...
         ...
         ...
         ...
        "{" ...
        "{" ...
         ...
         ...
         ...
        "{" ...
        "{" ...
         ...
         ...
         ...
        "{" ...
        "{" ...
        "{" ...

        DB name="mydb"
        Error Code="1"
        DB name="mydb"

    !Unrecognized command: ']'
    orientdb {db=mydb}> 

推荐答案

问题是您已将属性声明为"电话",然后尝试使用小写的名称"电话",与架构不匹配. 此外,也不需要使用方括号,因此请尝试使用以下命令代替最后一个查询:

The issue is that you've declared your property as "Phone" and then you're trying to create your vertex using the name "phone" in lowercase which doesn't match the schema. Also there's no need to use square brackets so instead of that last query, try using:

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

这篇关于OrientDB 3.0.4控制台EMBEDDEDLIST创建VERTEX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆