[ 
https://issues.apache.org/jira/browse/TINKERPOP3-761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14716826#comment-14716826
 ] 

Matt Frantz commented on TINKERPOP3-761:
----------------------------------------

In TINKERPOP3-744 (whose concerns are folded into this issue), [~bryncooke] 
argues for property operators that can be mapped to vendor implementations like 
counter increment, soundex matching, etc.  I think that we could extend the 
mutator API to include modification of existing elements using an {{Operator}} 
syntax that is consistent with the {{curry}} intent above.  For example, you 
could increment a numeric property like so:
{noformat}
g.V().property('age', curry(Operator.add, constant(1)))
{noformat}

The general form would be {{property(String key, Traversal newValue)}}, with 
the current property value being presented as the traverser to the {{newValue}} 
traversal.

Vendor-specific strategies could recognize certain combinations of {{curry}} 
and {{Operator}} that could map to backend primitives.

We could enrich the {{Operator}} namespace as necessary, but vendors and 
applications may provide their own as well, since they would just be 
{{Functions}}.

This issue also relates to the discussion on the dev list with [~rvesse] about 
full text search and extensibility of {{has}} implementation.  There is a 
discussion of the extensibility of a hypothetical {{Functions}} namespace which 
overlaps with the {{Operators}} being discussed here.  They are probably the 
same thing.  If we have a general {{has(String key, Traversal value)}}, then 
the {{value}} traversal could be something which uses {{curry(Operators...)}} 
to perform vendor-optimized matching.
{noformat}
g.V().has('resume', curry(Operators.fulltext, 'sushi chef'))
{noformat}

The options for extensibility discussed in that thread include a URI or Java 
package namespace lookup feature, which should be considered in the context of 
this issue.

> Some basic mathematical functions / steps
> -----------------------------------------
>
>                 Key: TINKERPOP3-761
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-761
>             Project: TinkerPop 3
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.0.0-incubating
>            Reporter: Daniel Kuppitz
>            Assignee: Marko A. Rodriguez
>
> Every once in a while I wish to have steps for some basic mathematical 
> operations ({{add()}}, {{sub()}}, {{mul()}}, {{div()}}). Since {{sub(num)}} 
> is the same as {{add(-num)}} and {{div(num)}} is the same as {{mul(1/num)}}, 
> we would only need two new step implementations.
> Oh, and then there's also {{mod()}}, thus 3 new step implementations.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to