Reputation: 12901
Using Amazon Neptune as a GraphDB, I'm trying to update a property of some of the vertex to include a list of values. The basic gremlin example from this guide:
// Add a list as a property value
g.V().has('code','AUS').property('places',out().values('code').fold())
Is failing with:
{
"requestId": "XXX",
"detailedMessage": "Unsupported property value type: java.util.ArrayList",
"code": "UnsupportedOperationException"
}
I tried also to add the list
modifier
g.V().has('code','AUS').property(list, 'places',out().values('code').fold())
is failing with:
{
"requestId": "XXX",
"detailedMessage": "list cardinality for vertex property is not supported",
"code": "UnsupportedOperationException"
}
If for some reason the python-gremlin or Amazon Neptune flavors don't support array or list as a property value, I can settle for a single value that will concatenate the values into a single string. I tried using various options:
g.V().has('code','AUS').property('places',out().values('code').fold(0) {a,b -> a + b.length()})
or
g.V().has('code','AUS').property('places',out().values('code')map {join(",",it.get().value('code'))})
but none is working.
Upvotes: 2
Views: 2148
Reputation: 2856
I think you have to insert each value in a separate property
step
like this:
g.V().has('code', 'AUS').as('airport').
out().values('code').as('code').select('airport').
property(set, 'places', select('code'))
EDIT:
I see in the AWS user guide that list cardinality is not supported. therefore the closest solution is to use the set
cardinality.
Neptune supports set cardinality and single cardinality. If it isn't specified, set cardinality is selected. This means that if you set a property value, it adds a new value to the property, but only if it doesn't already appear in the set of values. This is the Gremlin enumeration value of Set. List is not supported. For more information about property cardinality, see the Vertex topic in the Gremlin JavaDoc.
example: https://gremlify.com/9v
Upvotes: 1