Re: Failing to store List as property value

Debasish Kanhar <d.k...@...>

And next time please use JanusGraph users mailing list for such queries :-)

On Sunday, 19 August 2018 14:12:42 UTC+5:30, Debasish Kanhar wrote:
Hi Manish,

Well you are adding List property to JanusGraph in wrong way. The way I do to create List properties once the schema is defined is as follows:

The following things should work, and if it doesn't let us know.

JanusGraph graph ="/
JanusGraphManagement mgmt = graph.openManagement();
JanusGraphVertex v = graph.addVertex();
ArrayList al = new ArrayList();

Now we have to iterate over the list elements, and add it to JanusGraphVertex v object as follows:

for (int i = 0; i < al.size(); ++i) {
    elem = al.get(i);"test1", elem);

Or else, if you want to add manually, this should suffice:"test1", "aaaa").property("test1", "bbbb").property("test1", "cccc")......

As you can see, gremlin doesn't expect you to pass List, and it will parse that list into property. Rather it expects you to pass the list element wise, and it keeps on appending to property key which you defined as List in schema declaration. If the same wasn't declared as List in schema, then it replaces the prior value.

Join { to automatically receive all group messages.