More higher order constructs?

53 views
Skip to first unread message

Marko Rodriguez

unread,
Nov 23, 2016, 7:46:51 AM11/23/16
to d...@tinkerpop.apache.org, gremli...@googlegroups.com
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.


Florian Hockmann

unread,
Nov 23, 2016, 8:36:01 AM11/23/16
to Gremlin-users, d...@tinkerpop.apache.org
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 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. 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

Stephen Mallette

unread,
Nov 29, 2016, 7:23:52 AM11/29/16
to Gremlin-users, d...@tinkerpop.apache.org
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.

--
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/msgid/gremlin-users/cad59885-1e41-4b27-858c-d111e197a0d6%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages