gremlin-scala icon indicating copy to clipboard operation
gremlin-scala copied to clipboard

Support for list types with cardinality

Open bowofolaf opened this issue 5 years ago • 4 comments

Hi,

Please see the following SO question. This happened when using Seq and List for properties on my CC.

https://stackoverflow.com/questions/56568962/unsupported-property-value-type-java-util-linkedhashmap-when-writing-to-neptune

I was able to step through your code, and it appears that for a List type addVertex proceeds to add the whole list as a property which is unsupported. Is there a way to make it iterate through and add all said items to the property the Gremlin way i.e.

g.addV("person").property("friend", "john").property("friend","joe")

bowofolaf avatar Jun 12 '19 21:06 bowofolaf

from the stack overflow question: Unsupported property value type: java.util.LinkedHashMap I don't have a working neptune setup, but a plain scala List might work. If not, here's the relevant sections in the macro: https://github.com/mpollmeier/gremlin-scala/blob/2e32ae0/macros/src/main/scala/gremlin/scala/Marshallable.scala#L178-L179 https://github.com/mpollmeier/gremlin-scala/blob/2e32ae0/macros/src/main/scala/gremlin/scala/Marshallable.scala#L110-L120

mpollmeier avatar Jun 15 '19 22:06 mpollmeier

Thanks, will try this and get back to you

bowofolaf avatar Jun 20 '19 14:06 bowofolaf

Plain scala List didnt work. Even Map doesn't work. Seems like a neptune feature gap, but will try and confirm this.

bowofolaf avatar Jun 26 '19 18:06 bowofolaf

From Neptune team:

Neptune supports Single and Set cardinality properties when using the Gremlin property() step etc. It currently does not support List cardinality. Now those are all 'TinkerPop' types. What Neptune also does not support is arbitrary Java data types

So as I first suggested, the issue is addVertex/marshaller does not support translating lists to list cardinality properties, or sets to set cardinality properties but instead tries to just shove the whole object in.

Also from Neptune team

You should not assume hosted graph databases which have to be more language agnostic will support native programming language complex types such as maps and hashes.

bowofolaf avatar Jun 27 '19 19:06 bowofolaf