Thank you Giulia, for your reply, However there are still some pieces 
missing for me. I'll provide some context to help you understand what I 
want to achieve.

I would like to refactor a Class ("Thing") that today looks (somewhat) like 
this.
{
  "str_a": "value_a",
  "emb_b": ["#12:1", "#12:2"]
}

I would like to put the embedded list into an embedded map so the resulting 
json representation of the class would look like this.

{
  "str_a": "value_a",
  "emb_b": {
      "key_1": ["#12:1", "#12:2"],
      "key_2": ["#12:1", "#12:2"]
  } 
}

Since there already is data in the db i also need to update all records of 
this class. 

My initial approach was to use the JavaScript server side functions using 
Studio but that is not a requirement. What is the best way to accomplish 
the above?

Kind regards,

// Olof

Den torsdag 18 juni 2015 kl. 14:32:03 UTC+2 skrev Giulia Brignoli:
>
> Hi Olof,
>
> I didn't understand if you're using JavaScript or Java API, however i 
> posted two codes:
>
> if you use a graph database, the code in JavaScript is this:
>
>           var g= orient.getGraph();
>           g.command("sql", "insert into Prova(emb) values ({'test4': 3})");
>           g.commit();
>
> With Java API the code is: 
>            
>            OrientGraph g = new OrientGraph(path);
>
>            OClass test = g.createVertexType("Test","V");
>    test.createProperty("emb", OType.EMBEDDEDMAP);
>     Map<String,Object> params= new HashMap<String, Object>();
>    params.put("test1", 1);
>
>    Vertex v = g.addVertex("class:Test");
>    v.setProperty("emb", params);
>
> Regards,
> Giulia
>
>

-- 

--- 
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.

Reply via email to