Thanks, I tried it and with the Odocument class it works, but with the 
JSONObject class the same thing is saved this time as an embedded document 
but then I can not retrieve the attributes by query (I attached image)

I've only done it this way, but I do not think it's correct:

OrientGraph g=new OrientGraph(yourPath);   
ODocument pruebaJson = new ODocument("Person");

String jsonValue = 
"{'archetype_details':{'class':'ARCHETYPED','archetype_id':{'class':'ARCHETYPE_ID','value':'openEHR-EHR-COMPOSITION.report-mnd.v1'},'template_id':{'class':'TEMPLATE_ID','value':'Laboratory
 
Report'},'rm_version':'1.0.1'}}";

pruebaJson.field("name", "nombre de Prueba");
pruebaJson.field("adress", "adress de Prueba");
pruebaJson.fromJSON(jsonValue);

pruebaJson.save();
 
g.commit();




El jueves, 17 de noviembre de 2016, 15:45:42 (UTC+1), alessand...@gmail.com 
escribió:
>
> Hi, you could try with
>
> OrientGraph g=new OrientGraph(yourPath); 
>   
> ODocument pruebaJson = new ODocument("Person");
> JSONObject json = new JSONObject();
>
> json.put("name","someone");
> json.put("address","somewhere");
> json.put("value","{'archetype_details':{'class':'ARCHETYPED','archetype_id':{'class':'ARCHETYPE_ID','value':'openEHR-EHR-COMPOSITION.report-mnd.v1'},'template_id':{'class':'TEMPLATE_ID','value':'Laboratory
>  
> Report'},'rm_version':'1.0.1'}}");
>
> pruebaJson.fromJSON("{ 'data' : " + json.toString() + "}");
> pruebaJson.save();
>  
> g.commit();
>
>
>

-- 

--- 
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 orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to