Hi Fabio,
If I understand well you should insert this JSON:
{
"@class" : "Person",
"name" : "fabio",
"surname" : "benigni",
"address" : { "@class" : "Address", "street" : "colombo", "number" : "1",
"city" : "Rome"},
"vehicles" : [
{"@class" : "Car", "brand":"VW", "model":"Polo"},
{"@class" : "Car", "brand":"VW","model" : "Passat"},
{"@class" : "Motorbike", "brand":"Ducati","model" : "Monster 620 ie
Dark"}
]
}
But before create the classes as:
create class Person
create class Vehicle
create class Car extends Vehicle
create class Motorbike extends Vehicle
Lvc@
On 25 June 2014 12:40, Fabio Benigni <[email protected]> wrote:
> Hi Luca,
> I have the same issue.
> I would like to insert into orientdb a json with a complex syntax.
> This is a json example :
>
> {
> "person" : {
> "name" : "fabio",
> "surname" : "benigni",
> "address" : { "street" : "colombo", "number" : "1", "city" : "Rome"},
> "vehicles" : [{
> "vehicle" : {"type" : "car", "brand":"VW", "model":"Polo"},
> "vehicle" : {"type" : "car", "brand":"VW","model" : "Passat"},
> "vehicle" : {"type" : "motorbike", "brand":"Ducati","model" : "Monster
> 620 ie Dark"},
> }],
> }
> }
>
>
> Using
> create vertex Person content {...}
> or
> INSERT INTO PERSON content {...}
> I achieve the same result.
> The json object is inserted as is in a "person" attribute in the Person
> vertex.
>
> Otherwise if I remove the "person" from the json syntax I have the vertex
> inserted with all the attributes that are at the root level,
> name and surname, but attributes address and vehicles has the sub-json
> object as content.
>
> How I have to modify the structure of the Json to insert the attribute
> "@type" : "d" .
>
> I'm trying to use SQL through OrientDB Studio webb app with
> orientdb-community-1.7.
>
> Thank you for your help.
> I hope that this example could be useful for the community
>
> Fabio
>
>
>
>
> Il giorno lunedì 28 gennaio 2013 00:25:18 UTC+1, Lvc@ ha scritto:
>>
>> Hi Stefan,
>> are you referring to "info" attribute? Since in JSON there isn't
>> difference between a document (object) and a map using OrientDB you've to
>> specify the attribute "@type" : "d" that tells to OrientDB that's an
>> embedded document.
>>
>> Lvc@
>>
>>
>> On 27 January 2013 19:53, Stefán <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I have a nested structure in JSON {"info":{"some":"things","are":true}}
>>> which I'm storing as a document property.
>>> Should I store it in a "Embedded map" or is there a better way?
>>>
>>> Regards,
>>> -Stefan
>>>
>>> --
>>>
>>>
>>>
>>>
>>
>> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OrientDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.