GitHub user okram opened a pull request:

    https://github.com/apache/tinkerpop/pull/495

    TINKERPOP-1502 & TINKERPOP-1482: Chained has-containers and AndP stringency

    https://issues.apache.org/jira/browse/TINKERPOP-1502
    https://issues.apache.org/jira/browse/TINKERPOP-1482
    
    This ticket accomplishes various things around `GraphTraversal.has()`. 
    
    1.) A write-time optimization is provided where if a `HasStep` is the 
traversal's end step, simply `HasStep.addHasContainer()`. This reduces the time 
required by `InlineFilterStrategy` and provider strategies to fold in 
`HasContainers` and remove `HasSteps`. 
    
    2.) `GraphTraversal.hasXXX()` was tweaked by @dkuppitz a release ago. He 
used `Object` to determine numerous things like `String`, `P`, etc.  This is 
bad. We want the `GraphTraversal` API to be explicit so I added stricter 
typing: e.g. `hasLabel(String,String...)` and `hasLabel(P<String>)`. 
    
    3.) `HasContainer.makeHasContainers()` was a TinkerPop hack trying to help 
providers and it shouldn't be done. This method turned `AndP(x,y)` into 
individual `x` and `y` predicates so providers didn't have to analyze `AndP` 
trees.  We shouldn't do this as the provider will be getting `AndP` 
compositions elsewhere and will need to be able to handle it. I updated 
`Neo4jGraphStep` and `TinkerGraphStep` to process `AndP` predicates accordingly 
for index lookups. Added a note to upgrade docs for other providers --- simple 
update if they want to use the old "break apart `AndP`"-model.
    
    4.) Found a bug in `InlineFilterStrategy` around `outE().hasLabel()` where 
`outE('knows').hasLabel('created')` was turned into `outE('knows','created')` 
and thus, semantically incorrect.
    
    Going to add a few more tests before VOTING.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/tinkerpop TINKERPOP-1502

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tinkerpop/pull/495.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #495
    
----
commit 83f2ddb6629eab9c4dca8c4103dce60a3b8fc7a6
Author: Marko A. Rodriguez <[email protected]>
Date:   2016-11-14T19:54:07Z

    first push on 'left-append' of has() containers.

commit d471f2d22fe0e040504ab98a1735ad9a6edaa692
Author: Marko A. Rodriguez <[email protected]>
Date:   2016-11-14T20:46:00Z

    fixed up the hasXXX() methods to account of P and Object differently. Will 
go through and create a TraversalHelper.addHasContainer() method which will 
left append or right append depending on Traversal state. this will simplify 
methods signficiantly.

commit 07f264241fa7a1124faac27a06df83a7449b75c9
Author: Marko A. Rodriguez <[email protected]>
Date:   2016-11-14T22:44:40Z

    added TraversalHelper.addHasContainer() which will either append a HasStep 
with container or if the traverasl ends with a HasContainerHolder, fold the 
container into the holder. This just makes the code in GraphTravesrsal cleaner 
with less copy/paste.

commit e29e1c33fddf2ea245027fe91dec882b8ffdf4d7
Author: Marko A. Rodriguez <[email protected]>
Date:   2016-11-15T15:27:24Z

    found a bug in HasContainer.makeHasContainers() around AndP recurssion. No 
biggie, just didn't yield ultimate optimization. Found a bug in 
InlineFilterStrategy where hasLabel() should only back propagate into 
VertexStep[edges] if the step doesn't already have edge labels. Removed 
HasContainer.makeHasContainers() -- another ticket I'm putting into this 
branch. GraphTraversal.has() is fixed up accordingly with left-fold 
HasContainers and valid Object[] usage. Going to add a few more tests around 
hasXXX() steps.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to