Thanks for sharing your use case. It's an interesting idea actually. I'll adjust your example slightly as the more I stare at this the more I think "upsert" is a new step and it's just addV/E(Map).by() to get the upsert logic:
g.addV('person', [(T.id): 100, name:'marko']).by(T.id).
property('duration',100,PropertySum)
I wonder if the definition you're looking for here is just some form of:
property(String, Object, Operator)
which would then be like:
g.addV('person', [(T.id): 100, name:'marko']).by(T.id).
property('duration',100,sum)
Haven't thought it all through but it looks interesting. I think booleans end up interesting that way as this:
gremlin> g.addV().property('enabled',false)
==>v[0]
gremlin> g.V().property('enabled',coalesce(has('enabled',true).constant(false),constant(true))).elementMap()
==>[id:0,label:vertex,enabled:false]
gremlin> g.V().property('enabled',coalesce(has('enabled',true).constant(false),constant(true))).elementMap()
==>[id:0,label:vertex,enabled:true]
gremlin> g.V().property('enabled',coalesce(has('enabled',true).constant(false),constant(true))).elementMap()
==>[id:0,label:vertex,enabled:false]
changes to something like:
g.V().property('enabled',false,and)
interesting that under the covers our current property(k,v) would then really be:
property(k,v,assign)
ha - does that really work as nicely as all that?