I'm using python and AWS Neptune.
I'm using the "upsert" pattern by id:
g.V().has(node_type,'id',node.id).fold()
.coalesce(__.unfold(),__.addV('node_type').property('id',node.id)).
property('property','first').next()
Indeed the the vertex is added (Or selected from the graph) with the added property. Now I want to add two more properties which I fail to add:
I want to add "max" property. If the vertex has the property, I want to take the max value of it and the value "10" (for example). Tried to add the following statement to my query but it doesn't work:
property('time_max', __.max(__.values('max'), 10))
But I'm getting an exception the "Could not locate method: DefaultGraphTraversal.max"
Another property that Increments "count" property the same way. I got the same exception on the "sack" method.
How can these properties can be added? Is the only way is to get the vertex and then commit it? I want it to be as efficient as possible.
Thanks!
The max() step is used to find the maximum value in a stream or collection such as in this simple example:
gremlin> g.inject(1,2,3).max()
==>3
You could do something like this instead
union(values('max'),constant(10)).max()