Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search should be a P-predicate (match.any(), match.exact(), etc.) #2

Open
okram opened this issue Jan 21, 2016 · 1 comment
Open

Search should be a P-predicate (match.any(), match.exact(), etc.) #2

okram opened this issue Jan 21, 2016 · 1 comment

Comments

@okram
Copy link

okram commented Jan 21, 2016

I noticed this in the documentation.

graph.search("hell*", Match.ANY).count()

If a P-predicate is created for Match.ANY (and the others) then, when the TraversalStrategy that folds has()-steps into BlazeGraphStep, it can do what it needs with the P-predicate and thus, the following would work:

g = graph.traversal()
g.V().has("key",matches.any("hell*")).count()

The reason that reg-ex (and stuff like geo) are NOT in TinkerPop is that various backends have different semantics for such predicates. Thus, we recommend that graph providers simply create respective P-predicates and GraphStep rules for handling the HasContainers.


  • P-predicates are easy to implement.

https://github.com/apache/incubator-tinkerpop/blob/master/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/P.java

  • How to fold in has()-steps.

https://github.com/apache/incubator-tinkerpop/blob/master/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/optimization/TinkerGraphStepStrategy.java

  • How to use the folds for index lookups in a GraphStep implementation.

https://github.com/apache/incubator-tinkerpop/blob/master/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java

@beebs-systap
Copy link
Contributor

@mikepersonick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants