You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by Marko Rodriguez <ok...@gmail.com> on 2016/11/23 12:46:46 UTC
More higher order constructs?
Hi,
g.V(1).as(‘a’).
V(2).as(‘b’).
shortestPath().from(‘a’).to(‘b’).
by(outE(‘knows’).has(’since’,lt(2010)).inV()).
path()
Is equivalent to:
g.V(1).as(‘a’).
V(2).as(‘b’).
repeat(outE(‘knows’).has(’since’,lt(2010)).inV()).until(where(‘a’)).limit(1).
path()
However, for the Gremlin-Java VM a BiDirectionalSearchStep could then be added in the compilation as a more optimal way of doing this.
Basically, should we be adding more high-order constructs for common patterns….? If so, what other common patterns do you know of that we should make steps?
Marko.
http://markorodriguez.com
Re: [TinkerPop] Re: More higher order constructs?
Posted by Stephen Mallette <sp...@gmail.com>.
I like the general direction of this idea. Turning "recipes" into steps
would probably be a welcome addition for most users. I think it's worth
creating a ticket to track it for something in the future.
On Wed, Nov 23, 2016 at 8:36 AM, Florian Hockmann <fh...@florian-hockmann.de>
wrote:
> Hi,
>
> there are some use cases / patterns that are needed by many users and I
> think it is a good idea to support them directly in TinkerPop with such
> higher-order patterns. For me personally, I would really appreciate
> getOrCreate steps for vertices and edges and also some upsert step. Both
> are already described in an old ticket
> <https://issues.apache.org/jira/browse/TINKERPOP-479> and they are also
> frequently requested on this mailing list and on StackOverflow.
>
> Another pattern that could be interesting for Gremlin is a getSimilar
> step. Elasticsearch has for example a More Like This Query
> <https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-mlt-query.html>.
> For a graph, this could be solved by traversing the neighborhood of the
> start vertex and trying to find vertices with the same label that have
> short paths to the start vertex and ideally those paths have only few
> branches (e.g., a path including a supernode doesn't mean that those
> vertices are similar). But this use case might already be too special /
> complicated. So I would start with easier patterns like the bidirectional
> search.
>
> Regards,
> Florian
>
> Am Mittwoch, 23. November 2016 13:46:51 UTC+1 schrieb Marko A. Rodriguez:
>>
>> Hi,
>>
>> g.V(1).as(‘a’).
>> V(2).as(‘b’).
>> shortestPath().from(‘a’).to(‘b’).
>> by(outE(‘knows’).has(’since’,lt(2010)).inV()).
>> path()
>>
>>
>> Is equivalent to:
>>
>> g.V(1).as(‘a’).
>> V(2).as(‘b’).
>> repeat(outE(‘knows’).has(’since’,lt(2010)).inV()).until(wher
>> e(‘a’)).limit(1).
>> path()
>>
>>
>> However, for the Gremlin-Java VM a BiDirectionalSearchStep could then be
>> added in the compilation as a more optimal way of doing this.
>>
>> Basically, should we be adding more high-order constructs for common
>> patterns….? If so, what other common patterns do you know of that we should
>> make steps?
>>
>> Marko.
>>
>> http://markorodriguez.com
>>
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Gremlin-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to gremlin-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/gremlin-users/cad59885-1e41-4b27-858c-d111e197a0d6%40googlegroups.com
> <https://groups.google.com/d/msgid/gremlin-users/cad59885-1e41-4b27-858c-d111e197a0d6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
Re: More higher order constructs?
Posted by Florian Hockmann <fh...@florian-hockmann.de>.
Hi,
there are some use cases / patterns that are needed by many users and I
think it is a good idea to support them directly in TinkerPop with such
higher-order patterns. For me personally, I would really appreciate
getOrCreate steps for vertices and edges and also some upsert step. Both
are already described in an old ticket
<https://issues.apache.org/jira/browse/TINKERPOP-479> and they are also
frequently requested on this mailing list and on StackOverflow.
Another pattern that could be interesting for Gremlin is a getSimilar step.
Elasticsearch has for example a More Like This Query
<https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-mlt-query.html>.
For a graph, this could be solved by traversing the neighborhood of the
start vertex and trying to find vertices with the same label that have
short paths to the start vertex and ideally those paths have only few
branches (e.g., a path including a supernode doesn't mean that those
vertices are similar). But this use case might already be too special /
complicated. So I would start with easier patterns like the bidirectional
search.
Regards,
Florian
Am Mittwoch, 23. November 2016 13:46:51 UTC+1 schrieb Marko A. Rodriguez:
>
> Hi,
>
> g.V(1).as(‘a’).
> V(2).as(‘b’).
> shortestPath().from(‘a’).to(‘b’).
> by(outE(‘knows’).has(’since’,lt(2010)).inV()).
> path()
>
>
> Is equivalent to:
>
> g.V(1).as(‘a’).
> V(2).as(‘b’).
> repeat(outE(‘knows’).has(’since’,lt(2010))
> .inV()).until(where(‘a’)).limit(1).
> path()
>
>
> However, for the Gremlin-Java VM a BiDirectionalSearchStep could then be
> added in the compilation as a more optimal way of doing this.
>
> Basically, should we be adding more high-order constructs for common
> patterns….? If so, what other common patterns do you know of that we should
> make steps?
>
> Marko.
>
> http://markorodriguez.com
>
>
>
>