You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by okram <gi...@git.apache.org> on 2016/10/04 18:16:20 UTC

[GitHub] tinkerpop pull request #447: TINKERPOP-1455: Provide String-based withStrate...

GitHub user okram opened a pull request:

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

    TINKERPOP-1455: Provide String-based withStrategy()/withoutStrategy() for language variant usage

    https://issues.apache.org/jira/browse/TINKERPOP-1455
    
    Added TraversalSource.withStrategy(String, Object...) and TraversalSource.withoutStrategy(String). This allows Gremlin language variants (e.g. Gremlin-Python) to add and remove strategies from a traversal source. Prior to this moment, strategy addition/removal was via strategy instances (Java objects) and classes (Class objects). That is not language variants friendly.
    
    This branch is backwards compatible. If a `TraversalStrategy` does not have a builder and exposes a static `instance()`-method, then `g.withStrategy('com.blah.MyStrategy')` will work as expected. If a `TraversalStrategy` does have a builder (that is, can be configured), then it should expose a static `create(Configuration)`-method. Note Gremlin language variants could not use `withStrategies()` prior to this and thus, this addition is backwards compatible. Finally, `TraversalSource.withComputer(Object...)` was added as well for the same reasons.
    
    ```
    >>> g = g.withStrategy('org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy','vertices',hasLabel('person'),'edges',has('weight',gt(0.5)))
    >>> g.V().name.toList()
    [u'marko', u'vadas', u'josh', u'peter']
    ```
    
    The CHANGELOG, gremlin-variants.asciidoc, and upgrade doc have all been updated accordingly.
    
    VOTE +1

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

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

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

    https://github.com/apache/tinkerpop/pull/447.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 #447
    
----
commit e6e59e417f119c1b71a43141fce04cb212bc0a58
Author: Marko A. Rodriguez <ok...@gmail.com>
Date:   2016-10-04T14:37:07Z

    first push. We now have TraversalSource.withStrategy(String, Object...) and TraversalSource.withoutStrategy(String). Added a test case to Gremlin-Python that uses SubgraphStrategy and it works :).

commit 95557bf3aac279282e3f3779d68ce195bd4ca058
Author: Marko A. Rodriguez <ok...@gmail.com>
Date:   2016-10-04T16:26:12Z

    added static create(Configuration) methods to all Builder-based strategies except EventStrategy as that requires Java objects :(. Deprecated PartitionStrategy.Builder.addReadParition() in favor of readParitions(String...). Computer now has a Configuration-based constructor and corresponding withComputer(Object...) arguments.

commit 20dec2076b79441c7dcf06827014ace72fcaea6c
Author: Marko A. Rodriguez <ok...@gmail.com>
Date:   2016-10-04T18:15:31Z

    updated gremlin-variants.asciidoc with new withStrategy()/withoutStrategy() method discussion. Built docs. Success.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop issue #447: TINKERPOP-1455: Provide String-based withStrategy()/wi...

Posted by dkuppitz <gi...@git.apache.org>.
Github user dkuppitz commented on the issue:

    https://github.com/apache/tinkerpop/pull/447
  
    Code looks good, `docker/build.sh -t -i` succeeded.
    
    VOTE: +1


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop issue #447: TINKERPOP-1455: Provide String-based withStrategy()/wi...

Posted by spmallette <gi...@git.apache.org>.
Github user spmallette commented on the issue:

    https://github.com/apache/tinkerpop/pull/447
  
    no problem from me.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop issue #447: TINKERPOP-1455: Provide String-based withStrategy()/wi...

Posted by dkuppitz <gi...@git.apache.org>.
Github user dkuppitz commented on the issue:

    https://github.com/apache/tinkerpop/pull/447
  
    Cool.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop pull request #447: TINKERPOP-1455: Provide String-based withStrate...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop issue #447: TINKERPOP-1455: Provide String-based withStrategy()/wi...

Posted by okram <gi...@git.apache.org>.
Github user okram commented on the issue:

    https://github.com/apache/tinkerpop/pull/447
  
    So this is now done and merged. This branch provided a wealth of testing infrastructure, test cases, and ways of serializing `TraversalStrategy` instances. Now, with all that, I think we should actually NOT have `withStrategies(Map...)` and we should really make `g:TraversalStrategy`. I started going down that road to see how easy it would be and its actually pretty hard given how `GraphSONMapper` works -- and the need to register all strategies by class. Anywho... if we do decide to go down that route then in Gremlin-Python/etc. we would have `TraversalStrategy({config:map,is:this})`.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop issue #447: TINKERPOP-1455: Provide String-based withStrategy()/wi...

Posted by okram <gi...@git.apache.org>.
Github user okram commented on the issue:

    https://github.com/apache/tinkerpop/pull/447
  
    ```
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 05:09 h
    [INFO] Finished at: 2016-10-04T22:33:42-06:00
    [INFO] Final Memory: 157M/1520M
    [INFO] ------------------------------------------------------------------------
    ```


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop issue #447: TINKERPOP-1455: Provide String-based withStrategy()/wi...

Posted by okram <gi...@git.apache.org>.
Github user okram commented on the issue:

    https://github.com/apache/tinkerpop/pull/447
  
    ```
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 05:10 h
    [INFO] Finished at: 2016-10-06T02:35:44-06:00
    [INFO] Final Memory: 158M/1358M
    [INFO] ------------------------------------------------------------------------
    ```


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop issue #447: TINKERPOP-1455: Provide String-based withStrategy()/wi...

Posted by okram <gi...@git.apache.org>.
Github user okram commented on the issue:

    https://github.com/apache/tinkerpop/pull/447
  
    If you guys don't mind, I'm going to change the method signatures (the NEW methods added -- nothing from before changed).
    
    {code}
    withStrategy(String, Object...) -> withStrategies(Map<String,Object>...)
    withoutStrategy(String) -> withoutStrategies(String...)
    {code}
    
    The reason this is smart is:
    
    1. Registering strategies is expensive as it costs a `TraversalSource` clone and a `TraversalStrategies` sort. This is why doing all strategy declarations in one method is smart.
    
    2. While creating `Map`s in Java is horrendous, Java users would NOT use these methods. They would use the Java object version of these methods. However, for Gremlin-Python, Groovy, JavaScript -- creating maps is natural and looks good. Also, we don't run into the "multi-key" issues.
    
    Nothing fudamental here, just some asethetics. If you don't object, I will just do this, update docs, and merge.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop issue #447: TINKERPOP-1455: Provide String-based withStrategy()/wi...

Posted by spmallette <gi...@git.apache.org>.
Github user spmallette commented on the issue:

    https://github.com/apache/tinkerpop/pull/447
  
    This is a great PR. Didn't think we'd have this for 3.2.3. Nice
    
    All tests pass with `docker/build.sh -t -i` - final "todo" would be to add a JIRA to track the deprecation for future removal. 
    
    VOTE +1


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---