[GitHub] tinkerpop issue #945: TINKERPOP-2053 Support for OptionsStrategy

2018-10-05 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/945
  
VOTE +1


---


[GitHub] tinkerpop issue #951: Optimizes Set with enum using the EnumSet implementati...

2018-10-05 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/951
  
VOTE +1


---


[GitHub] tinkerpop issue #946: TINKERPOP-2037 removed groovy-sql

2018-10-05 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/946
  
VOTE +1


---


[GitHub] tinkerpop issue #949: TINKERPOP-2056 Use NumberHelper in Compare

2018-10-05 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/949
  
From what we've seen in previous tests, it should be marginally faster. I 
haven't run any new tests as this was more about consistency.


---


[GitHub] tinkerpop issue #950: TINKERPOP-2058 Contains predicates should rely on Comp...

2018-10-04 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/950
  
Reminder: Merge #949 first, then rebase this PRs branch and fix `PTest` 
(include differing number tests for `Contains` predicates).


https://github.com/apache/tinkerpop/pull/949/files#diff-dc8c8777ab12a44729fc5f2c9c255c66R115


---


[GitHub] tinkerpop pull request #950: TINKERPOP-2058 Contains predicates should rely ...

2018-10-04 Thread dkuppitz
GitHub user dkuppitz opened a pull request:

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

TINKERPOP-2058 Contains predicates should rely on Compare predicates

https://issues.apache.org/jira/browse/TINKERPOP-2058

If the object to be filtered is a number, `Contains` predicates will now 
scan the provided collection, comparing each element using `Compare.eq`. For 
non-numeric values `Contains.within` will still use `collection.contains()` in 
order to make use of search-optimized data types (e.g. `Set`).

This is a breaking change as the test suite previously ensured that number 
types had an effect on `Contains` predicates. This, however, was inconsistent 
with `Compare` predicates which ignore the number type.

`docker/build.sh -t -i -n` passed.

VOTE +1

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

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

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

https://github.com/apache/tinkerpop/pull/950.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 #950


commit ec0d8805fe18e6d1985af5544106f78169f3f5b4
Author: Daniel Kuppitz 
Date:   2018-10-04T14:15:09Z

TINKERPOP-2058 Use `Compare.eq` in `Contains.within` to ensure equal filter 
behaviors.

If the object to be filtered is a number, `Contains` predicates will now 
scan the provided collection, comparing
each element using `Compare.eq`. For non-numeric values `Contains.within` 
will still use `collection.contains()`
in order to make use of search-optimized data types (e.g. `Set`).




---


[GitHub] tinkerpop pull request #949: TINKERPOP-2056 Use NumberHelper in Compare

2018-10-04 Thread dkuppitz
GitHub user dkuppitz opened a pull request:

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

TINKERPOP-2056 Use NumberHelper in Compare

Instead of converting all numbers to `BigDecimal`, `Compare` predicates now 
use `NumberHelper` for numerical comparisons.

`docker/build.sh -t -i -n` passed.

VOTE +1

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

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

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

https://github.com/apache/tinkerpop/pull/949.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 #949


commit 8759b39ce83b2165bc1415d1feead005e970a505
Author: Daniel Kuppitz 
Date:   2018-10-04T14:07:27Z

TINKERPOP-2056 Made use of `NumberHelper` in `Compare` predicates.




---


[GitHub] tinkerpop issue #948: Optimizes Map with enum using the EnumMap implementati...

2018-10-03 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/948
  
That's the kind of benchmark I was looking for. I don't think it needs to 
be part of the project (these micro-benchmarks always seem to be too unstable 
and making them part of the test suite usually just makes the builds fail at 
some point) - thus a manual test is good enough.

VOTE + 1


---


[GitHub] tinkerpop issue #948: Optimizes Map with enum using the EnumMap implementati...

2018-10-03 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/948
  
Although this looks like a very reasonable change and I don't have any 
objections, could you please run some benchmarks to show what we gain by this 
change?


---


[GitHub] tinkerpop pull request #944: TINKERPOP-2041 Text Predicates

2018-10-02 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/944#discussion_r222065189
  
--- Diff: docs/src/reference/the-traversal.asciidoc ---
@@ -3356,24 +3356,32 @@ interface. Steps that allow for this type of 
modulation will explicitly state so
 [[a-note-on-predicates]]
 == A Note on Predicates
 
-A `P` is a predicate of the form `Function`. That is, 
given some object, return true or false. The
-provided predicates are outlined in the table below and are used in 
various steps such as <>-step,
+A `P` is a predicate of the form `Function`. That is, 
given some object, return true or false. As of
+the relase of TinkerPop 3.4.0, Gremlin also supports simple text 
predicates, which only work on `String` values. The `TextP`
+text predicates extend the `P` predicates, but are specialized in that 
they are of the form `Function`.
+The provided predicates are outlined in the table below and are used in 
various steps such as <>-step,
 <>-step, <>-step, etc.
 
 [width="100%",cols="3,15",options="header"]
 |=
 | Predicate | Description
-| `eq(object)` | Is the incoming object equal to the provided object?
-| `neq(object)` | Is the incoming object not equal to the provided object?
-| `lt(number)` | Is the incoming number less than the provided number?
-| `lte(number)` | Is the incoming number less than or equal to the 
provided number?
-| `gt(number)` | Is the incoming number greater than the provided number?
-| `gte(number)` | Is the incoming number greater than or equal to the 
provided number?
-| `inside(number,number)` | Is the incoming number greater than the first 
provided number and less than the second?
-| `outside(number,number)` | Is the incoming number less than the first 
provided number or greater than the second?
-| `between(number,number)` | Is the incoming number greater than or equal 
to the first provided number and less than the second?
-| `within(objects...)` | Is the incoming object in the array of provided 
objects?
-| `without(objects...)` | Is the incoming object not in the array of the 
provided objects?
+| `P.eq(object)` | Is the incoming object equal to the provided object?
+| `P.neq(object)` | Is the incoming object not equal to the provided 
object?
+| `P.lt(number)` | Is the incoming number less than the provided number?
+| `P.lte(number)` | Is the incoming number less than or equal to the 
provided number?
+| `P.gt(number)` | Is the incoming number greater than the provided number?
+| `P.gte(number)` | Is the incoming number greater than or equal to the 
provided number?
+| `P.inside(number,number)` | Is the incoming number greater than the 
first provided number and less than the second?
+| `P.outside(number,number)` | Is the incoming number less than the first 
provided number or greater than the second?
+| `P.between(number,number)` | Is the incoming number greater than or 
equal to the first provided number and less than the second?
+| `P.within(objects...)` | Is the incoming object in the array of provided 
objects?
+| `P.without(objects...)` | Is the incoming object not in the array of the 
provided objects?
+| `TextP.startsWith(string)` | Does the incoming `String` start with the 
provided `String`?
+| `TextP.endsWith(string)` | Does the incoming `String` end with the 
provided `String`?
+| `TextP.contains(string)` | Does the incoming `String` contain the 
provided `String`?
+| `TextP.startsNotWith(string)` | TODO: find a better name
--- End diff --

Sounds good to me, much better than what it is now.


---


[GitHub] tinkerpop issue #943: TINKERPOP-2044 Configurable traversal to validate host...

2018-10-02 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/943
  
VOTE +1


---


[GitHub] tinkerpop issue #920: optmizes collection copy with Collections addAll

2018-10-01 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/920
  
I haven't done any extensive performance benchmarks, but the overall build 
time went down by 1 minute -- wohoo :)

Anyway, `docker/build.sh -t -i` passed.

VOTE +1


---


[GitHub] tinkerpop issue #928: TINKERPOP-2015 Expose WebSocket configuration in Greml...

2018-10-01 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/928
  
Hm, alright. I don't have an environment to test it myself, but apparently 
I'm missing something; I thought it would be a simple property delegation.

VOTE +1


---


[GitHub] tinkerpop issue #928: TINKERPOP-2015 Expose WebSocket configuration in Greml...

2018-10-01 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/928
  
IMO it would be better to expose the options as a property unless there's a 
good reason to not allow any changes in options after the client has been 
initialized. But since the underlying `ClientWebSocket` allows a change in 
options at any point in time, `GremlinClient` should preferably do the same.


---


[GitHub] tinkerpop issue #939: TINKERPOP-2045 removed duplicate non-indy groovy core ...

2018-10-01 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/939
  
VOTE +1


---


[GitHub] tinkerpop issue #941: TINKERPOP-2040 Improve flexibility of GroovyTranslator...

2018-10-01 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/941
  
VOTE +1


---


[GitHub] tinkerpop issue #942: TINKERPOP-2049 Added with(k) overload

2018-10-01 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/942
  
VOTE +1


---


[GitHub] tinkerpop pull request #944: TINKERPOP-2041 Text Predicates

2018-10-01 Thread dkuppitz
GitHub user dkuppitz opened a pull request:

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

TINKERPOP-2041 Text Predicates

https://issues.apache.org/jira/browse/TINKERPOP-2041

This PR adds a few text predicates (`TP`):

* `startsWith`
* `endsWith`
* `contains`

By the contract definition, every predicate needs an opposite predicate, 
hence I also added the following:

* `startsNotWith`
* `endsNotWith`
* `absent`

However, I don't like the naming too much. If anybody has better 
suggestions, I'm all ears.

`docker/build.sh -t -i -n` passed.

VOTE +1

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

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

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

https://github.com/apache/tinkerpop/pull/944.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 #944


commit 242a9e399f4c73c02068dda73cc3bd52eeb7e00f
Author: Daniel Kuppitz 
Date:   2018-09-26T22:44:35Z

TINKERPOP-2041 Implemented text predicates

commit 1a0ca3ade124dcc34761085ee58db2f7e68e3d06
Author: Stephen Mallette 
Date:   2018-09-27T20:33:26Z

TINKERPOP-2041 Fixed gremlin-javascript serializers for TP

commit 441cf6aa4769805215045e460e1daad8b46a1cfb
Author: Stephen Mallette 
Date:   2018-09-28T12:27:25Z

TINKERPOP-2041 Fixed .NET tests around TP predicates




---


[GitHub] tinkerpop issue #933: TINKERPOP-1913 Make status attributes available

2018-09-24 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/933
  
VOTE +1


---


[GitHub] tinkerpop issue #934: Apply StringEscapeUtils in GroovyTranslator#convertToS...

2018-09-24 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/934
  
Changes and tests look good to me.

VOTE +1


---


[GitHub] tinkerpop pull request #935: TINKERPOP-2025 Change to SHA-256/512 and drop S...

2018-09-24 Thread dkuppitz
GitHub user dkuppitz opened a pull request:

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

TINKERPOP-2025 Change to SHA-256/512 and drop SHA-1 for releases

https://issues.apache.org/jira/browse/TINKERPOP-2025

Unfortunately, upgrading the Apache parent pom didn't solve the problem 
completely. With the upgrade we get the sha512 checksum file for the source 
release, but not for the other artifacts.

This PR upgrades the parent pom, but also adds a step in the release 
process to replace any remaining sha1 checksum file with its sha512 counterpart.

The release validation script was adjusted to reflect those changes; the 
validation will fail if there exists

* a md5 file
* a sha1 file
* no asc file
* no sha512 file

... for any of the release artifacts.

VOTE +1

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

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

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

https://github.com/apache/tinkerpop/pull/935.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 #935


commit 1fb3431910c0b22a06c3c9b86020c9e4db36af96
Author: Daniel Kuppitz 
Date:   2018-09-24T15:47:27Z

Remove release artifact SHA1 checksums and generate SHA512 checksums 
instead.




---


[GitHub] tinkerpop pull request #931: TINKERPOP-2029 ConcurrentModificationException ...

2018-09-14 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/931#discussion_r217759875
  
--- Diff: docs/src/upgrade/release-3.4.x.asciidoc ---
@@ -29,6 +29,29 @@ Please see the 
link:https://github.com/apache/tinkerpop/blob/3.4.0/CHANGELOG.asc
 
 === Upgrading for Users
 
+ Changed infix behavior
+
+The infix notation of `and()` and `or()` now supports an arbitrary number 
of traversals and `ConnectiveStrategy` produces a traversal with the correct 
AND and OR semantics. Furthermore,
+previous versions failed to apply 3 or more `and()` steps in an infix 
notation, this is now fixed.
+
+[source,groovy]
+
+gremlin> g.V().has("name","marko").and().has("age", 
lt(30)).or().has("name","josh").and().has("age", gt(30)).and().out("created")
+==>v[1]
+==>v[4]
+
+
+In previous versions the above traversal 
--- End diff --

Ugh, I was going to remove this piece as I mentioned previous versions in 
the comments above.


---


[GitHub] tinkerpop issue #932: TINKERPOP-2033 Maintain order in profile() annotations

2018-09-14 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/932
  
VOTE +1


---


[GitHub] tinkerpop pull request #931: TINKERPOP-2029 ConcurrentModificationException ...

2018-09-11 Thread dkuppitz
GitHub user dkuppitz opened a pull request:

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

TINKERPOP-2029 ConcurrentModificationException for InlineFilterStrategy

https://issues.apache.org/jira/browse/TINKERPOP-2029

To fix the original issue, I basically rewrote `ConnectiveStrategy`. The 
infix notation of `and()` and `or()` now supports an arbitrary number of 
traversals and `ConnectiveStrategy` produces a traversal with correct `AND` and 
`OR` semantics.

The reason for targeting `master/` is that there were no strict semantics 
before and thus this needs to be considered a breaking change.

```
# BEHAVIOR

Input: a.or.b.and.c.or.d.and.e.or.f.and.g.and.h.or.i

## BEFORE
Output: or(a, or(and(b, c), or(and(d, e), or(and(and(f, g), h), i

## NOW
Output: or(a, and(b, c), and(d, e), and(f, g, h), i)
```

`docker/build.sh -t -i -n` passed.

VOTE +1

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

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

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

https://github.com/apache/tinkerpop/pull/931.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 #931


commit 46ee42686a875baf123176040b2f341218e02e1a
Author: Stephen Mallette 
Date:   2018-09-05T17:08:01Z

TINKERPOP-2029 Added tests demonstrating strategy failures

Identified potentially two problems, one with ConnectedStrategy and by 
virtue of its application InlineFilterStrategy.

commit e518c9af9a4aca56449af2b743f24d35a8a43b50
Author: Daniel Kuppitz 
Date:   2018-09-10T18:41:34Z

Rewrote `ConnectiveStrategy`. It's a breaking change as it now behaves 
slightly differently, but now it

* produces correct AND and OR semantics.
* has fewer recursive calls (at most 1).
* is faster in its own execution and produces fewer steps in the final 
traversal which should make the processed traversal faster as well.

commit 2ce9a6def3426b2a2ff89e6b556ae8b2653f6098
Author: Daniel Kuppitz 
Date:   2018-09-10T18:47:46Z

Merge branch 'TINKERPOP-2029' into TINKERPOP-2029-master

commit 9330fcbc477e6a64649b6c6aa22f697756d31140
Author: Daniel Kuppitz 
Date:   2018-09-10T18:49:52Z

Removed note about infix restriction for `and()` and `or()` as they are no 
longer existent.

commit 40b21bbd1361712c7b3cef140773ea87da30dbd0
Author: Daniel Kuppitz 
Date:   2018-09-10T19:21:17Z

updated docs




---


[GitHub] tinkerpop issue #921: Add self loop example to Cycle Detection recipe.

2018-08-31 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/921
  
VOTE +1


---


[GitHub] tinkerpop pull request #921: Add self loop example to Cycle Detection recipe...

2018-08-28 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/921#discussion_r213398454
  
--- Diff: docs/src/recipes/cycle-detection.asciidoc ---
@@ -48,6 +48,31 @@ the length of the cycle is known to be three and there 
is no need to exceed that
 cycle. It returned three, because there was one for each vertex that 
started the cycle (i.e. one for `A`, one for `B`
 and one for `C`). This next line introduce deduplication to only return 
unique cycles.
 
+Note that these traversals won't detect self-loops (vertices directly 
connected to themselves).
+To do so, you would need to `.emit()` a Traverser before the repeat()-loop.
+
+[gremlin-groovy]
+
+g.addV().property(id,'a').as('a').
+  addV().property(id,'b').as('b').
+  addV().property(id,'c').as('c').
+  addV().property(id,'d').as('d').
+  addE('knows').from('a').to('b').
+  addE('knows').from('b').to('c').
+  addE('knows').from('c').to('a').
+  addE('knows').from('a').to('d').
+  addE('knows').from('c').to('d').
+  addE('self').from('a').to('a').iterate()
+g.V().as('a').
+emit().
+repeat(outE().inV().simplePath()).
+times(2).
+outE().inV().where(eq('a')).
+path().
+  by(id).
+  by(label)
+
+
--- End diff --

Yep.


---


[GitHub] tinkerpop pull request #921: Add self loop example to Cycle Detection recipe...

2018-08-28 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/921#discussion_r213364785
  
--- Diff: docs/src/recipes/cycle-detection.asciidoc ---
@@ -48,6 +48,31 @@ the length of the cycle is known to be three and there 
is no need to exceed that
 cycle. It returned three, because there was one for each vertex that 
started the cycle (i.e. one for `A`, one for `B`
 and one for `C`). This next line introduce deduplication to only return 
unique cycles.
 
+Note that these traversals won't detect self-loops (vertices directly 
connected to themselves).
+To do so, you would need to `.emit()` a Traverser before the repeat()-loop.
+
+[gremlin-groovy]
+
+g.addV().property(id,'a').as('a').
+  addV().property(id,'b').as('b').
+  addV().property(id,'c').as('c').
+  addV().property(id,'d').as('d').
+  addE('knows').from('a').to('b').
+  addE('knows').from('b').to('c').
+  addE('knows').from('c').to('a').
+  addE('knows').from('a').to('d').
+  addE('knows').from('c').to('d').
+  addE('self').from('a').to('a').iterate()
+g.V().as('a').
+emit().
+repeat(outE().inV().simplePath()).
+times(2).
+outE().inV().where(eq('a')).
+path().
+  by(id).
+  by(label)
+
+
--- End diff --

I mean just put the paragraph that starts with
> The above case assumed that ...

above your new block that starts with
> Note that these ...

That would make more sense, no?


---


[GitHub] tinkerpop pull request #921: Add self loop example to Cycle Detection recipe...

2018-08-27 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/921#discussion_r213148817
  
--- Diff: docs/src/recipes/cycle-detection.asciidoc ---
@@ -48,6 +48,31 @@ the length of the cycle is known to be three and there 
is no need to exceed that
 cycle. It returned three, because there was one for each vertex that 
started the cycle (i.e. one for `A`, one for `B`
 and one for `C`). This next line introduce deduplication to only return 
unique cycles.
 
+Note that these traversals won't detect self-loops (vertices directly 
connected to themselves).
+To do so, you would need to `.emit()` a Traverser before the repeat()-loop.
+
+[gremlin-groovy]
+
+g.addV().property(id,'a').as('a').
+  addV().property(id,'b').as('b').
+  addV().property(id,'c').as('c').
+  addV().property(id,'d').as('d').
+  addE('knows').from('a').to('b').
+  addE('knows').from('b').to('c').
+  addE('knows').from('c').to('a').
+  addE('knows').from('a').to('d').
+  addE('knows').from('c').to('d').
+  addE('self').from('a').to('a').iterate()
+g.V().as('a').
+emit().
+repeat(outE().inV().simplePath()).
+times(2).
+outE().inV().where(eq('a')).
+path().
+  by(id).
+  by(label)
+
+
--- End diff --

Cool, much better. What I didn't notice in the first place, was that the 
paragraph below really only refers to the previous code snippets. I think you 
should move it above you changes.


---


[GitHub] tinkerpop pull request #921: Add self loop example to Cycle Detection recipe...

2018-08-27 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/921#discussion_r213065687
  
--- Diff: docs/src/recipes/cycle-detection.asciidoc ---
@@ -48,6 +48,25 @@ the length of the cycle is known to be three and there 
is no need to exceed that
 cycle. It returned three, because there was one for each vertex that 
started the cycle (i.e. one for `A`, one for `B`
 and one for `C`). This next line introduce deduplication to only return 
unique cycles.
 
+Note that these traversals won't detect self-loops (vertices directly 
connected to themselves).
+To do so, you would need to `.emit()` a Traverser before the repeat()-loop.
+
+[gremlin-groovy]
+
+g.addV().property(id,'a').as('a').
+  addV().property(id,'b').as('b').
+  addV().property(id,'c').as('c').
+  addV().property(id,'d').as('d').
+  addE('knows').from('a').to('b').
+  addE('knows').from('b').to('c').
+  addE('knows').from('c').to('a').
+  addE('knows').from('a').to('d').
+  addE('knows').from('c').to('d').
+  addE('self').from('a').to('a').iterate()
+g.V().as('a').emit().repeat(out().simplePath()).times(2).
+  where(out().as('a')).path()
--- End diff --

Really just readability. To me `[a,self,a]` looks better than just `[a,a]`.


---


[GitHub] tinkerpop pull request #921: Add self loop example to Cycle Detection recipe...

2018-08-25 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/921#discussion_r212807145
  
--- Diff: docs/src/recipes/cycle-detection.asciidoc ---
@@ -48,6 +48,25 @@ the length of the cycle is known to be three and there 
is no need to exceed that
 cycle. It returned three, because there was one for each vertex that 
started the cycle (i.e. one for `A`, one for `B`
 and one for `C`). This next line introduce deduplication to only return 
unique cycles.
 
+Note that these traversals won't detect self-loops (vertices directly 
connected to themselves).
+To do so, you would need to `.emit()` a Traverser before the repeat()-loop.
+
+[gremlin-groovy]
+
+g.addV().property(id,'a').as('a').
+  addV().property(id,'b').as('b').
+  addV().property(id,'c').as('c').
+  addV().property(id,'d').as('d').
+  addE('knows').from('a').to('b').
+  addE('knows').from('b').to('c').
+  addE('knows').from('c').to('a').
+  addE('knows').from('a').to('d').
+  addE('knows').from('c').to('d').
+  addE('self').from('a').to('a').iterate()
+g.V().as('a').emit().repeat(out().simplePath()).times(2).
+  where(out().as('a')).path()
--- End diff --

I would tweaks the traversal a little bit to make the output easier to 
grasp:
```
gremlin> g.V().as('a').
..1>   emit().
..2> repeat(outE().inV().simplePath()).
..3> times(2).
..4>   outE().inV().where(eq('a')).
..5>   path().
..6> by(id).
..7> by(label)
==>[a,self,a]
==>[a,knows,b,knows,c,knows,a]
==>[b,knows,c,knows,a,knows,b]
==>[c,knows,a,knows,b,knows,c]
```


---


[GitHub] tinkerpop issue #920: optmizes collection copy with Collections addAll

2018-08-25 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/920
  
I can see why `Collections.addAll(...)` would be faster than 
`c.addAll(Arrays.asList(...))`, but not why it would be faster than a simple 
loop. I think if you really want to squeeze out as much as possible, you should 
prevent the use of lists altogether (ultimately the list is converted back to 
an array, so there's really no point of dealing with lists there, other than 
making the code more readable).

Only having arrays could look like this:

```java
default GraphTraversal hasId(final Object id, final Object... 
otherIds) {
if (id instanceof P)
return this.hasId((P) id);
else {
Object[] ids;
if (id instanceof Object[]) {
ids = (Object[]) id;
} else {
ids = new Object[] {id};
}
int size = ids.length;
int capacity = size;
for (final Object i : otherIds) {
if (i.getClass().isArray()) {
final Object[] tmp = (Object[]) i;
int newLength = size + tmp.length;
if (capacity < newLength) {
ids = Arrays.copyOf(ids, capacity = size + tmp.length);
}
System.arraycopy(tmp, 0, ids, size, tmp.length);
size = newLength;
} else {
if (capacity == size) {
ids = Arrays.copyOf(ids, capacity = size * 2);
}
ids[size++] = i;
}
}
if (capacity > size) {
ids = Arrays.copyOf(ids, size);
}
this.asAdmin().getBytecode().addStep(Symbols.hasId, ids);
return TraversalHelper.addHasContainer(this.asAdmin(), new 
HasContainer(T.id.getAccessor(), ids.length == 1 ? P.eq(ids[0]) : 
P.within(ids)));
}
}
```

This is untested and thus not benchmarked, I'm just guessing that it should 
perform better than the current implementation.


---


[GitHub] tinkerpop issue #912: TINKERPOP-2023 SSL Enhancements

2018-08-25 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/912
  
Very nice work.

VOTE: +1


---


[GitHub] tinkerpop issue #919: String loop to String builder [tp32]

2018-08-23 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/919
  
In the future, can we please let those (potential) CTR's sit for a bit 
longer? I haven't had a chance to really look at it and I guess I would have 
voted against it (it's not bad, but also not perfect in my opinion).

So I'm not asking to revert it, just for a little more patience (at least 
for outside PRs).


---


[GitHub] tinkerpop issue #911: TINKERPOP-2024 Make server archetype use remote traver...

2018-08-16 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/911
  
VOTE +1


---


[GitHub] tinkerpop issue #902: TINKERPOP-1878 sparql-gremlin

2018-08-13 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/902
  
VOTE: +1


---


[GitHub] tinkerpop pull request #902: TINKERPOP-1878 sparql-gremlin

2018-08-10 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/902#discussion_r209334263
  
--- Diff: docs/site/home/index.html ---
@@ -259,6 +259,7 @@ Query 
Languages
 https://github.com/pm-dev/kotlin-gremlin-ogm";>kotlin-gremlin-ogm 
(kotlin/dsl) - An Object Graph Mapping Library for Kotlin and Gremlin.
 http://ogre.clojurewerkz.org/";>ogre 
(clojure/variant) - A Clojure language wrapper for TinkerPop3.
 http://bayofmany.github.io/";>Peapod 
(java/dsl) - An object-graph-wrapper.
+http://tinkerpop.apache.org/docs/current/reference/#sparql-gremlin";>sparql-gremlin
 (sparql/distinct) - A SPARQL to Gremlin traversal compiler.
 https://github.com/LITMUS-Benchmark-Suite/sparql-to-gremlin";>sparql-gremlin
 (sparql/distinct) - A SPARQL to Gremlin traversal compiler.
--- End diff --

Does it make sense to keep the link to the old repo?


---


[GitHub] tinkerpop pull request #902: TINKERPOP-1878 sparql-gremlin

2018-08-10 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/902#discussion_r209336628
  
--- Diff: docs/src/reference/compilers.asciidoc ---
@@ -0,0 +1,416 @@
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+[[compilers]]
+= Gremlin Compilers
+
+There are many languages built to query data. SQL is typically used to 
query relational data. There is SPARQL for RDF
+data. Cypher is used to do pattern matching in graph data. The list could 
go on. Compilers convert languages like
+these to Gremlin so that it becomes possible to use them in any context 
that Gremlin is used. In other words, a
+Gremlin Compiler enables a particular query language to work on any 
TinkerPop-enabled graph system.
+
+[[sparql-gremlin]]
+== SPARQL-Gremlin
+
+image::gremlintron.png[width=225]
+
+The SPARQL-Gremlin compiler, transforms 
link:https://en.wikipedia.org/wiki/SPARQL[SPARQL] queries into Gremlin
+traversals. It uses the https://jena.apache.org/index.html[Apache Jena] 
SPARQL processor
+link:https://jena.apache.org/documentation/query/index.html[ARQ], which 
provides access to a syntax tree of a
+SPARQL query.
+
+The goal of this work is to bridge the query interoperability gap between 
the two famous, yet fairly disconnected,
+graph communities: Semantic Web (which relies on the RDF data model) and 
Graph database (which relies on property graph
+data model).
+
+NOTE: The foundational research work on SPARQL-Gremlin compiler (aka 
Gremlinator) can be found in the
+link:https://arxiv.org/pdf/1801.02911.pdf[Gremlinator paper]. This paper 
presents the graph query language semantics of
+SPARQL and Gremlin, and a formal mapping between SPARQL pattern matching 
graph patterns and Gremlin traversals.
+
+[source,xml]
+
+
+   org.apache.tinkerpop
+   sparql-gremlin
+   x.y.z
+
+
+
+The SPARQL-Gremlin compiler converts 
link:https://en.wikipedia.org/wiki/SPARQL[SPARQL] queries into Gremlin so that
+they can be executed across any TinkerPop-enabled graph system. To use 
this compiler in the Gremlin Console, first
+install and activate the "tinkerpop.sparql" plugin:
+
+[source,text]
+
+gremlin> :install org.apache.tinkerpop sparql-gremlin x.y.z
+==>Loaded: [org.apache.tinkerpop, sparql-gremlin, x.y.z]
+gremlin> :plugin use tinkerpop.sparql
+==>tinkerpop.sparql activated
+
+
+Installing this plugin will download appropriate dependencies and import 
certain classes to the console so that they
+may be used as follows:
+
+[gremlin-groovy,modern]
+
+graph = TinkerFactory.createModern()
+g = graph.traversal(SparqlTraversalSource) 
<1>
+g.sparql("""SELECT ?name ?age
+WHERE { ?person v:name ?name . ?person v:age ?age }
+ORDER BY ASC(?age)""") 
<2>
+
+
+<1> Define `g` as a `TraversalSource` that uses the 
`SparqlTraversalSource` - by default, the `traversal()` method
+usually returns a `GraphTraversalSource` which includes the standard 
Gremlin starts steps like `V()` or `E()`. In this
+case, the `SparqlTraversalSource` enables starts steps that are specific 
to SPARQL only - in this case the `sparql()`
+start step.
+<2> Execute a SPARQL query against the TinkerGraph instance. The 
`SparqlTraversalSource` uses a
+<> to transparently converts that 
SPARQL query into a standard Gremlin traversal
+and then when finally iterated, executes that against the TinkerGraph.
+
+[[prefixes]]
+=== Prefixes
+
+The SPARQL-Gremlin compiler supports the following prefixes to traverse 
the graph:
+
+[cols=",",options="header",]
+|
+|Prefix |Purpose
+|`v:` |label-access traversal
+|`e:` |out-edge

[GitHub] tinkerpop pull request #902: TINKERPOP-1878 sparql-gremlin

2018-08-10 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/902#discussion_r209346676
  
--- Diff: 
sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
 ---
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.sparql.process.traversal.dsl.sparql;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
+import 
org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoration.RemoteStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import 
org.apache.tinkerpop.gremlin.process.traversal.step.map.ConstantStep;
+import 
org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.InjectStep;
+import 
org.apache.tinkerpop.gremlin.sparql.process.traversal.strategy.SparqlStrategy;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Transaction;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+
+/**
+ * A {@link TraversalSource} implementation that spawns {@link 
SparqlTraversal} instances.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class SparqlTraversalSource implements TraversalSource {
+protected transient RemoteConnection connection;
+protected final Graph graph;
+protected TraversalStrategies strategies;
+protected Bytecode bytecode = new Bytecode();
+
+public SparqlTraversalSource(final Graph graph, final 
TraversalStrategies traversalStrategies) {
+this.graph = graph;
+this.strategies = traversalStrategies;
+}
+
+public SparqlTraversalSource(final Graph graph) {
+this(graph, 
TraversalStrategies.GlobalCache.getStrategies(graph.getClass()));
+}
+
+@Override
+public TraversalStrategies getStrategies() {
+return this.strategies;
+}
+
+@Override
+public Graph getGraph() {
+return this.graph;
+}
+
+@Override
+public Bytecode getBytecode() {
+return this.bytecode;
+}
+
+@SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException")
+public SparqlTraversalSource clone() {
+try {
+final SparqlTraversalSource clone = (SparqlTraversalSource) 
super.clone();
+clone.strategies = this.strategies.clone();
+clone.bytecode = this.bytecode.clone();
+return clone;
+} catch (final CloneNotSupportedException e) {
+throw new IllegalStateException(e.getMessage(), e);
+}
+}
+
+ CONFIGURATIONS
+
+@Override
+public SparqlTraversalSource withStrategies(final TraversalStrategy... 
traversalStrategies) {
+return (SparqlTraversalSource) 
TraversalSource.super.withStrategies(traversalStrategies);
+}
+
+@Override
+@SuppressWarnings({"unchecked"})
+public SparqlTraversalSource withoutStrategies(final Class... traversalStrategyClasses) {
+return (SparqlTraversalSource) 
TraversalSource.super.withoutStrategies(traversalStrategyClasses);
+}
+
+@Override
+public SparqlTraversalSource withRemote(final Configuration conf) {
+return (SparqlTraversalSource) 
TraversalSource.super.withRemote(conf);
+}
+
+@Override
+public SparqlTraversalSource withRemote(final String configFile)

[GitHub] tinkerpop issue #909: TINKERPOP-1976 GLV testing for computer tests

2018-08-08 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/909
  
VOTE: +1


---


[GitHub] tinkerpop pull request #882: TINKERPOP-1990 Add a shortestPath() step

2018-08-02 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/882#discussion_r207377923
  
--- Diff: docs/src/recipes/shortest-path.asciidoc ---
@@ -136,3 +158,44 @@ g.withSack(0.0).V().as("from").   <1>
 <7> Order the output by the start vertex id and then the end vertex id 
(for better readability).
 <8> Deduplicate vertex pairs (the shortest path from `v[1]` to `v[6]` is 
the same as the path from `v[6]` to `v[1]`).
 
+Again, this can be translated into an OLAP query using the 
`shortestPath()` step.
+
+[gremlin-groovy,existing]
+
+result = g.withComputer().V().
+  shortestPath().
+with(ShortestPath.distance, 'weight').
+with(ShortestPath.includeEdges, true).
+  filter(count(local).is(gt(1))).
+  group().
+by(project('from','to').
+ by(limit(local, 1)).
+ by(tail(local, 1))).
+  unfold().
+  order().
+by(select(keys).select('from').id()).
+by(select(keys).select('to').id()).toList()
+
+
+The obvious difference in the result is the absence of property values in 
the OLAP result. Since OLAP traversers are not
+allowed to leave the local star graph, it's not possible to have the exact 
same result in an OLAP query. However, the determined
+shortest paths can be passed back into the OLTP `GraphTraversalSource`, 
which can then be used to query the values.
+
+[gremlin-groovy,existing]
+
+g.withSideEffect('v', []).<1>
+  inject(result.toArray()).as('kv').select(values).
+  unfold().
+  map(unfold().as('v_or_e').
+  coalesce(V().where(eq('v_or_e')).store('v'),
+   select('v').tail(local, 1).bothE().where(eq('v_or_e'))).
+  values('name','weight').
+  fold()).
+  group().
+by(select('kv').select(keys)).unfold().
+  order().
+by(select(keys).select('from').id()).
+by(select(keys).select('to').id()).toList()
+
+
+<1> The side-effect `v` is used to keep track of the last processed 
vertex, hence it needs to be an order-preserving list. Without this explicit 
definition `v` would become a `BulkSet` which doesn't preserve the insert order.
--- End diff --

I was surprised that the elements didn't get dereferenced automatically 
(`result` contains `ReferencePath` objects holding `ReferenceVertex` and 
`ReferenceEdge` instances). If they were automatically reattached, the `map` 
step would be as simple as this:

```
  map(unfold().values('name','weight').fold())
```


---


[GitHub] tinkerpop pull request #882: TINKERPOP-1990 Add a shortestPath() step

2018-08-02 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/882#discussion_r207375700
  
--- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
 ---
@@ -2451,6 +2452,24 @@ else if (value instanceof Traversal)
 return this.asAdmin().addStep((Step) new 
PeerPressureVertexProgramStep(this.asAdmin()));
 }
 
+/**
+ * Executes a Shortest Path algorithm over the graph.
+ *
+ * @return the traversal with the appended {@link 
ShortestPathVertexProgramStep}
+ * @see http://tinkerpop.apache.org/docs/${project.version}/reference/#shortestpath-step";
 target="_blank">Reference Documentation - ShortestPath Step
+ */
+public default GraphTraversal shortestPath() {
+if (this.asAdmin().getEndStep() instanceof GraphStep) {
--- End diff --

Oh, totally forgot about this corner case (that's something you should test 
in `ConnectedComponentVP` too). And right, if you only have `g.V().has(...)` 
followed by a VP step, your VP won't see any halted traversers and thus behave 
like it was just `g.V()`. I spent quite some time trying to fix that properly, 
but couldn't come up with anything.


---


[GitHub] tinkerpop pull request #882: TINKERPOP-1990 Add a shortestPath() step

2018-08-02 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/882#discussion_r207374407
  
--- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Traversal.java
 ---
@@ -496,15 +496,17 @@ public default void reset() {
 public void setGraph(final Graph graph);
 
 public default boolean equals(final Traversal.Admin other) {
-final List steps = this.getSteps();
-final List otherSteps = other.getSteps();
-if (steps.size() == otherSteps.size()) {
-for (int i = 0; i < steps.size(); i++) {
-if (!steps.get(i).equals(otherSteps.get(i))) {
-return false;
+if (this.getClass().equals(other.getClass())) {
--- End diff --

I don't think so. The main reason why I had to change it was that 
traversals without steps were considered equal using the old method. That means 
all `TrueTraversal`, `ConstantTraversal`, `ValueTraversal`, etc. instances were 
equal compared to each other.


---


[GitHub] tinkerpop pull request #882: TINKERPOP-1990 Add a shortestPath() step

2018-08-02 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/882#discussion_r207373358
  
--- Diff: docs/src/recipes/shortest-path.asciidoc ---
@@ -48,6 +48,17 @@ course, it is possible for there to be more than one 
path in the graph of the sa
 length three), but this example is not considering that.
 <2> It might be interesting to know the path lengths for all paths between 
vertex "1" and "5".
 <3> Alternatively, one might wish to do a path length distribution over 
all the paths.
+<4> The preferred way to get a shortest path in OLAP is the 
`shortestPath()` step.
--- End diff --

Ah, forgot to remove it, that's from when OLTP and OLAP were still mixed in 
one block.


---


[GitHub] tinkerpop issue #882: TINKERPOP-1990 Add a shortestPath() step

2018-08-01 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/882
  
Done.


---


[GitHub] tinkerpop issue #897: TINKERPOP-1967 connectedComponent()

2018-07-30 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/897
  
Nice.

VOTE: +1


---


[GitHub] tinkerpop issue #897: TINKERPOP-1967 connectedComponent()

2018-07-30 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/897
  
Mucho mejor.

```
gremlin> g.withComputer().V().dedup().connectedComponent().valueMap()

==>[gremlin.connectedComponentVertexProgram.component:[1],name:[ripple],lang:[java]]

==>[gremlin.connectedComponentVertexProgram.component:[1],name:[marko],age:[29]]

==>[gremlin.connectedComponentVertexProgram.component:[1],name:[lop],lang:[java]]

==>[gremlin.connectedComponentVertexProgram.component:[1],name:[vadas],age:[27]]

==>[gremlin.connectedComponentVertexProgram.component:[1],name:[josh],age:[32]]

==>[gremlin.connectedComponentVertexProgram.component:[1],name:[peter],age:[35]]
```

Perhaps there should be a test case for this query, just in case somebody's 
gonna try to optimize the extra halted traverser code away.


---


[GitHub] tinkerpop pull request #882: TINKERPOP-1990 Add a shortestPath() step

2018-07-30 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/882#discussion_r206207720
  
--- Diff: docs/src/reference/the-traversal.asciidoc ---
@@ -2489,6 +2489,62 @@ 
link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/grem
 
link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/structure/Column.html++[`Column`],
 
link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/Pop.html++[`Pop`]
 
+[[shortestpath-step]]
+=== ShortestPath step
+
+The `shortestPath()`-step provides an easy way to find shortest non-cyclic 
paths in a graph. It is configurable
+using the `with()`-modulator with the options given below.
+
+[width="100%",cols="3,3,15,5",options="header"]
+|=
+| Key | Type | Description | Default
+| `target` | `Traversal` | Sets a filter traversal for the end vertices 
(e.g. `__.has('name','marko')`). | all vertices (`__.identity()`)
+| `edges` | `Traversal` or `Direction` | Sets a `Traversal` that emits the 
edges to traverse from the current vertex or the `Direction` to traverse during 
the shortest path discovery. | `Direction.BOTH`
+| `distance` | `Traversal` or `String` | Sets the `Traversal` that 
calculates the distance for the current edge or the name of an edge property to 
use for the distance calculations. | `__.constant(1)`
+| `maxDistance` | `Number` | Sets the distance limit for all shortest 
paths. | none
+| `includeEdges` | `Boolean` | Whether to include edges in the result or 
not. | `false`
+|=
+
+[gremlin-groovy,modern]
+
+a = g.withComputer()
--- End diff --

I know, but we also never mixed two traversal sources in a single code 
block. Better suggestions?


---


[GitHub] tinkerpop pull request #897: TINKERPOP-1967 connectedComponent()

2018-07-29 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/897#discussion_r205981525
  
--- Diff: docs/src/recipes/connected-components.asciidoc ---
@@ -35,46 +54,92 @@ g.addV().property(id, "A").as("a").
   addE("link").from("d").to("e").iterate()
 
 
-One way to detect the various subgraphs would be to do something like this:
+ Small graph traversals
 
+Connected components in a small graph can be determined with either an 
OLTP traversal or the OLAP
+`connectedComponent()`-step. The `connectedComponent()`-step is available 
as of TinkerPop 3.4.0 and is
+described in more detail in the

+link:http://tinkerpop.apache.org/docs/x.y.z/reference/#connectedcomponent-step[Reference
 Documentation].
+The traversal looks like:
 [gremlin-groovy,existing]
 

-g.V().emit(cyclicPath().or().not(both())).repeat(both()).until(cyclicPath()).  
<1>
-  path().aggregate("p").   
<2>
-  unfold().dedup().
<3>
-  map(__.as("v").select("p").unfold(). 
<4>
- filter(unfold().where(eq("v"))).
- unfold().dedup().order().by(id).fold()).
-  dedup()  
<5>
+g.withComputer().V().connectedComponent().
+group().by('gremlin.connectedComponentVertexProgram.component').
--- End diff --

I think you should use the constant 
`ConnectedComponentVertexProgram.COMPONENT`.


---


[GitHub] tinkerpop pull request #893: TINKERPOP-1996 io()

2018-07-27 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/893#discussion_r205930660
  
--- Diff: 
gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs ---
@@ -1704,11 +1713,11 @@ public 
GraphTraversal(ICollection traversalStrategies, Bytec
 }
 
 /// 
-/// Adds the with step to this .
--- End diff --

This is a bit confusing. Why did `With` disappear?


---


[GitHub] tinkerpop pull request #893: TINKERPOP-1996 io()

2018-07-27 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/893#discussion_r205930559
  
--- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/IoStep.java
 ---
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect;
+
+import org.apache.tinkerpop.gremlin.process.traversal.IO;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.ReadWriting;
+import 
org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
+import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.util.EmptyTraverser;
+import 
org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
+import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
+import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLReader;
+import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Handles read and write operations into the {@link Graph}.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class IoStep extends AbstractStep implements ReadWriting {
+
+private Parameters parameters = new Parameters();
+private boolean first = true;
+private String file;
+private Mode mode = Mode.UNSET;
+
+public IoStep(final Traversal.Admin traversal, final String file) {
+super(traversal);
+
+if (null == file || file.isEmpty())
+throw new IllegalArgumentException("file cannot be null or 
empty");
+
+this.file = file;
+}
+
+@Override
+public void setMode(final Mode mode) {
+this.mode = mode;
+}
+
+@Override
+public Mode getMode() {
+return mode;
+}
+
+@Override
+public String getFile() {
+return file;
+}
+
+@Override
+public Parameters getParameters() {
+return this.parameters;
+}
+
+@Override
+public void configure(final Object... keyValues) {
+this.parameters.set(null, keyValues);
+}
+
+@Override
+protected Traverser.Admin processNextStart() {
+if (mode == Mode.UNSET) throw new IllegalStateException("IO mode 
was not set to read() or write()");
+if (!this.first) throw FastNoSuchElementException.instance();
+
+this.first = false;
+final File file = new File(this.file);
+
+if (mode == Mode.READING) {
+if (!file.exists()) throw new IllegalStateException(this.file 
+ " does n

[GitHub] tinkerpop issue #894: TINKERPOP-2011 Use NumberHelper on choose()

2018-07-20 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/894
  
Yep, done. I added an entry in the root `.gitignore` file and added another 
`.gitignore` file in `docker/hadoop/`. The two auto-generated `Dockerfile`s 
will be ignored from now on.


---


[GitHub] tinkerpop issue #894: TINKERPOP-2011 Use NumberHelper on choose()

2018-07-20 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/894
  
By the way, the `Dockerfile`, that's removed by this PR, has nothing to do 
with the PR, but the file is an autogenerated file that shouldn't be in the 
repository.


---


[GitHub] tinkerpop pull request #894: TINKERPOP-2011 Use NumberHelper on choose()

2018-07-20 Thread dkuppitz
GitHub user dkuppitz opened a pull request:

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

TINKERPOP-2011 Use NumberHelper on choose()

https://issues.apache.org/jira/browse/TINKERPOP-2011

Treat numerical options in `ChooseStep` as in any other numerical 
comparison (value matters, data type does not). It was a little bit trickier 
than I thought as option values are only used for `HashMap` lookups and not for 
direct comparisons. Anyway, I think this solution is pretty solid (and easy to 
extend, should we run into any similar issues in the future).

`docker/build.sh -t -i -n` passed.

VOTE: +1

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

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

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

https://github.com/apache/tinkerpop/pull/894.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 #894


commit f7d628e344ff132fca9c4460521a40231aa8acce
Author: Daniel Kuppitz 
Date:   2018-07-18T19:34:16Z

TINKERPOP-2011 Treat numerical options in `ChooseStep` as in any other 
numerical comparison (value matters, data type does not).




---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-07-13 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r202456800
  
--- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_NL_O_P_S_SE_SL_Traverser.java
 ---
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.traverser;
+
+import org.apache.commons.collections.map.ReferenceMap;
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.util.LabelledCounter;
+
+
+import java.util.Iterator;
+import java.util.Stack;
+
+public class B_LP_NL_O_P_S_SE_SL_Traverser extends 
B_LP_O_P_S_SE_SL_Traverser {
+
+protected Stack nestedLoops;
+protected ReferenceMap loopNames = null;
--- End diff --

Hmm, to be realistic, I don't expect more than 2 or 3 named repeat steps in 
a single traversal, so an index for the names might really not be necessary 
(IMO). 


---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-07-13 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r202453831
  
--- Diff: 
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStepTest.java
 ---
@@ -39,7 +39,9 @@
 __.repeat(out()).times(3),
 __.repeat(out().as("x")).times(3),
 __.out().emit().repeat(out()).times(3),
-__.repeat(out()).until(hasLabel("x"))
+__.repeat(out()).until(hasLabel("x")),
+__.repeat("a", __.out()).times(3),
--- End diff --

Ah, alright, I totally missed the first entry, all good then.

We would have to shift or rotate the `loopName`'s hashCode value by the 
depth of the repeat traversal. Unfortunately, we don't have this information 
and I don't see how your `hashCode` implementation above would solve the 
problem. Anyway, it's an unlikely corner case and I don't think we need to care 
about it too much, so no big deal if we don't have a solution for now.


---


[GitHub] tinkerpop issue #876: TINKERPOP-967 Support nested-repeat() structures

2018-07-13 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/876
  
VOTE: +1


---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-07-13 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r202438650
  
--- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_NL_O_P_S_SE_SL_Traverser.java
 ---
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.traverser;
+
+import org.apache.commons.collections.map.ReferenceMap;
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.util.LabelledCounter;
+
+
+import java.util.Iterator;
+import java.util.Stack;
+
+public class B_LP_NL_O_P_S_SE_SL_Traverser extends 
B_LP_O_P_S_SE_SL_Traverser {
+
+protected Stack nestedLoops;
+protected ReferenceMap loopNames = null;
--- End diff --

So, for my own education, does that mean that `ReferenceMap` automagically 
removes entries from the map, when there's no more reference to the value (e.g. 
when you pop a labeled counter from the stack)?


---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-07-13 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r202437245
  
--- Diff: 
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStepTest.java
 ---
@@ -39,7 +39,9 @@
 __.repeat(out()).times(3),
 __.repeat(out().as("x")).times(3),
 __.out().emit().repeat(out()).times(3),
-__.repeat(out()).until(hasLabel("x"))
+__.repeat(out()).until(hasLabel("x")),
+__.repeat("a", __.out()).times(3),
--- End diff --

Sorry, perhaps I should have been more clear on what kind of traversals to 
add here.

Can you please also add `__.repeat(out()).times(3)`? Without the changes in 
`hashCode()` this traversal would have had the same hashCode as `__.repeat("a", 
out()).times(3)` and thus this test would have failed.

I guess these two will still collide:

```
__.repeat("a", __.repeat("b", out()))
__.repeat("b", __.repeat("a", out()))
```

...but I can't think of a solution that doesn't involve any expensive 
method calls.


---


[GitHub] tinkerpop issue #886: TINKERPOP-1987 Bump to Spark 2.3.1 and Netty 4.1.25.Fi...

2018-07-12 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/886
  
VOTE: +1


---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-07-12 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r202104064
  
--- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
 ---
@@ -2289,6 +2302,21 @@ else if (value instanceof Traversal)
 return RepeatStep.addRepeatToTraversal(this, (Traversal.Admin) repeatTraversal);
 }
 
+/**
+ * This step is used for looping over a some traversal given some 
break predicate.
--- End diff --

```
over a some traversal
 ^^
```

Minor thing.


---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-07-12 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r202104896
  
--- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
 ---
@@ -43,6 +43,7 @@
 private Traversal.Admin repeatTraversal = null;
 private Traversal.Admin untilTraversal = null;
 private Traversal.Admin emitTraversal = null;
+private String loopName = null;
--- End diff --

This field should be included in `RepeatStep::hashCode()`.


---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-07-12 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r202114064
  
--- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_NL_O_P_S_SE_SL_Traverser.java
 ---
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.traverser;
+
+import org.apache.commons.collections.map.ReferenceMap;
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.util.LabelledCounter;
+
+
+import java.util.Iterator;
+import java.util.Stack;
+
+public class B_LP_NL_O_P_S_SE_SL_Traverser extends 
B_LP_O_P_S_SE_SL_Traverser {
+
+protected Stack nestedLoops;
+protected ReferenceMap loopNames = null;
--- End diff --

Just asking for a comment here: Why can this not be a simple 
`HashMap`? This would save you the class casting later 
on and you wouldn't have to register a new class for the Gryo serializer.


---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-07-12 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r202105366
  
--- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LoopsStep.java
 ---
@@ -26,12 +26,15 @@
  */
 public final class LoopsStep extends MapStep {
 
-public LoopsStep(final Traversal.Admin traversal) {
+private String loopName;
--- End diff --

`LoopsStep` should now implement `hashCode()`.


---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-07-12 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r202110691
  
--- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_S_SE_SL_Traverser.java
 ---
@@ -32,6 +32,7 @@
 
 protected Object sack = null;
 protected short loops = 0;  // an optimization hack to use a short 
internally to save bits :)
+protected String loopName = null;
--- End diff --

Again, this should be included in `hashCode()`.


---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-07-12 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r202114725
  
--- Diff: 
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatTest.java
 ---
@@ -386,5 +531,51 @@ public void 
g_V_hasXname_markoX_repeatXoutE_inV_simplePathX_untilXhasXname_rippl
 public Traversal 
get_g_V_hasXloop_name_loopX_repeatXinX_timesX5X_path_by_name() {
 return 
g.V().has("loops","name","loop").repeat(__.in()).times(5).path().by("name");
 }
+
+@Override
+public Traversal 
get_g_V_repeatXout_repeatXoutX_timesX1XX_timesX1X_limitX1X_path_by_name() {
+// NB We need to prevent the RepeatUnrollStrategy from 
applying to properly exercise this test as this traversal can be simplified
+return 
g.V().repeat(out().repeat(out()).times(1)).times(1).limit(1).path().by("name");
+}
+
+@Override
+public Traversal 
get_g_V_repeatXoutXknowsXX_untilXrepeatXoutXcreatedXX_emitXhasXname_lopXXX_path_byXnameX()
 {
+return 
g.V().repeat(out("knows")).until(__.repeat(out("created")).emit(__.has("name", 
"lop"))).path().by("name");
+}
+
+@Override
+public Traversal 
get_g_V_repeatXrepeatXout_createdXX_untilXhasXname_rippleXXXemit_lang() {
+return 
g.V().repeat(__.repeat(out("created")).until(__.has("name", 
"ripple"))).emit().values("lang");
+}
+
+@Override
+public Traversal 
get_g_V_untilXconstantXtrueXX_repeatXrepeatXout_createdXX_untilXhasXname_rippleXXXemit_lang()
 {
+return 
g.V().until(__.constant(true)).repeat(__.repeat(out("created")).until(__.has("name",
 "ripple"))).emit().values("lang");
+}
+
+@Override
+public Traversal 
get_g_VX3X_repeatXbothX_createdXX_untilXloops_is_40XXemit_repeatXin_knowsXX_emit_loopsXisX1Xdedup_values(final
 Object v3Id) {
+return 
g.V(v3Id).repeat(__.both("created")).until(loops().is(40)).emit(__.repeat(__.in("knows")).emit(loops().is(1))).dedup().values("name");
+}
+
+@Override
+public Traversal 
get_g_V_repeatXa_outXknows_repeatXb_outXcreatedX_filterXloops_isX0XX_emit_lang()
 {
+return g.V().repeat("a", out("knows").repeat("b", 
out("created").filter(loops("a").is(0))).emit()).emit().values("lang");
+}
+
+@Override
+public Traversal 
get_g_V_emit_repeatXa_outXknows_filterXloops_isX0XX_lang() {
+return g.V().emit().repeat("a", 
out("knows").filter(loops("a").is(0))).values("lang");
+}
+
+@Override
+public Traversal 
get_g_VX6X_repeatXa_bothXcreatedXX_emitXrepeatXb_bothXknowsXX_untilXorXloops_isX2X_loopsXbX_isXloopsXa_hasXname_vadasXX_dedup_name(final
 Object v6Id) {
+return g.V(v6Id).repeat("a", 
both("created")).emit(__.repeat("b", 
__.both("knows")).until(__.or(loops().is(2), 
loops("b").is(loops("a".has("name", "vadas")).dedup().values("name");
--- End diff --

See my comment in the asciidoc file (same query).


---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-07-12 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r202111311
  
--- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_OB_S_SE_SL_Traverser.java
 ---
@@ -30,6 +30,7 @@
 
 protected Object sack = null;
 protected short loops = 0;  // an optimization hack to use a short 
internally to save bits :)
+protected String loopName = null;
--- End diff --

`hashCode()`


---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-07-12 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r202113071
  
--- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/LabelledCounter.java
 ---
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.process.traversal.traverser.util;
+
+import org.apache.commons.lang.mutable.MutableShort;
+
+import java.io.Serializable;
+
+/**
+ * Class to track a count associated with a Label
+ */
+public class LabelledCounter implements Serializable, Cloneable {
+
+private final String label;
+private final MutableShort count = new MutableShort();
--- End diff --

Just asking for a comment here: Why can this not be a simple `int`?


---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-07-12 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r202102880
  
--- Diff: docs/src/reference/the-traversal.asciidoc ---
@@ -2125,6 +2125,17 @@ traverser repeats. However, because the 
emit-predicate is declared true, those v
   Given that `loops==2`, the until-predicate fails and ripple and lop are 
emitted.
 Therefore, the traverser has seen the vertices: lop, vadas, josh, ripple, 
and lop.
 
+`repeat()`-steps may be nested inside each other or inside the `emit()` or 
`until()` predicates and they can also be 'named' by passing a string as the 
first parameter to `repeat()`. The loop counter of a named repeat step can be 
accessed within the looped context with `loops(loopName)` where `loopName` is 
the name set whe creating the `repeat()`-step.
+
+[gremlin-groovy,modern]
+

+g.V(1).repeat(out("knows")).until(__.repeat(out("created")).emit(__.has("name",
 "lop"))) <1>
+g.V(6).repeat('a', both('created')).emit(repeat('b', 
__.both('knows')).until(or(loops().is(2), 
loops('b').is(loops('a'.hasId(2)).dedup() <2>
--- End diff --

I haven't tried it yet, but I don't think this query does what the 
description says. It only works because it has the early break condition 
`loops().is(2)`. `.is(loops('a'))`, on the other hand, should always return 
`false`, since it's comparing the incoming `Long` value against a `Traversal`. 
To match the description, the query should look more like this (IMO):

```
g.V(6).
  repeat('a', both('created').simplePath()).
emit(repeat('b', __.both('knows')).
   until(loops('b').as('b').where(loops('a').as('b'.
  hasId(2)).dedup()
```


---


[GitHub] tinkerpop issue #876: TINKERPOP-967 Support nested-repeat() structures

2018-06-25 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/876
  
I agree it should be treated differently. Since `as()` labeling has an 
impact on the path history, it really shouldn't be used for this case.


---


[GitHub] tinkerpop issue #885: TINKERPOP-1978 Gremlin.Net: Add check for connection s...

2018-06-25 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/885
  
VOTE: +1


---


[GitHub] tinkerpop pull request #885: TINKERPOP-1978 Gremlin.Net: Add check for conne...

2018-06-25 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/885#discussion_r197851424
  
--- Diff: gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs ---
@@ -45,19 +44,28 @@ public ConnectionPool(ConnectionFactory 
connectionFactory)
 
 public async Task GetAvailableConnectionAsync()
 {
-Connection connection = null;
-lock (_connectionsLock)
-{
-if (!_connections.IsEmpty)
-_connections.TryTake(out connection);
-}
-
-if (connection == null)
+if (!TryGetConnectionFromPool(out var connection))
 connection = await 
CreateNewConnectionAsync().ConfigureAwait(false);
 
 return new ProxyConnection(connection, AddConnectionIfOpen);
 }
 
+private bool TryGetConnectionFromPool(out Connection connection)
+{
+while (true)
+{
+connection = null;
+lock (_connectionsLock)
+{
+if (_connections.IsEmpty) return false;
+_connections.TryTake(out connection);
+}
+
+if (connection.IsOpen) return true;
+connection.Dispose();
--- End diff --

Won't that lead to a never-ending loop? I'm assuming that 
`connection.Dispose()` won't remove it from the `_connections` collection, but 
I might be wrong.


---


[GitHub] tinkerpop issue #884: TINKERPOP-1985 Changing position on bulk import/export

2018-06-25 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/884
  
VOTE: +1


---


[GitHub] tinkerpop issue #883: TINKERPOP-1864 Run python glv tests on GraphSON 2.0 an...

2018-06-25 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/883
  
VOTE: +1

... but maybe make the configuration mandatory and throw an exception if ` 
world.config.user_data["graphson"]` was not set.


---


[GitHub] tinkerpop issue #880: TINKERPOP-1989 Enforce order of plugin load in Gremlin...

2018-06-25 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/880
  
VOTE: +1


---


[GitHub] tinkerpop pull request #881: TINKERPOP-1365 Refactored use of Random in test...

2018-06-25 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/881#discussion_r197826190
  
--- Diff: 
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java ---
@@ -51,11 +52,19 @@
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public final class TestHelper {
+private static final Logger logger = 
LoggerFactory.getLogger(TestHelper.class);
 
+public static final Random RANDOM;
 private static final String SEP = File.separator;
 private static final char URL_SEP = '/';
 public static final String TEST_DATA_RELATIVE_DIR = "test-case-data";
 
+static {
+final long seed = Long.parseLong(System.getProperty("testSeed", 
String.valueOf(System.currentTimeMillis(;
+logger.info("*** THE RANDOM TEST SEED IS {} ***", seed);
+RANDOM = new Random();
--- End diff --

This should be `RANDOM = new Random(seed);`.


---


[GitHub] tinkerpop issue #879: TINKERPOP-1986 Removed deprecated methods

2018-06-22 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/879
  
VOTE: +1


---


[GitHub] tinkerpop pull request #882: TINKERPOP-1990 Add a shortestPath() step

2018-06-21 Thread dkuppitz
GitHub user dkuppitz opened a pull request:

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

TINKERPOP-1990 Add a shortestPath() step

Implemented `ShortestPathVertexProgram` and `ShortestPathVertexProgramStep`.

`docker/build.sh -t -i -n -d` passed.

VOTE: +1

I can wait for TINKERPOP-1991 before I merge it or merge it into `master/` 
now and then go from there with TINKERPOP-1991, I don't care.

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

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

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

https://github.com/apache/tinkerpop/pull/882.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 #882


commit 8a43eaadfdb4ab662f955cc4a1cde6bf5739f7db
Author: Daniel Kuppitz 
Date:   2018-05-23T12:46:34Z

TINKERPOP-1990 Implemented `ShortestPathVertexProgram` and 
`ShortestPathVertexProgramStep`.




---


[GitHub] tinkerpop pull request #876: TINKERPOP-967 Support nested-repeat() structure...

2018-06-18 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/876#discussion_r196096436
  
--- Diff: 
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatTest.java
 ---
@@ -386,5 +456,26 @@ public void 
g_V_hasXname_markoX_repeatXoutE_inV_simplePathX_untilXhasXname_rippl
 public Traversal 
get_g_V_hasXloop_name_loopX_repeatXinX_timesX5X_path_by_name() {
 return 
g.V().has("loops","name","loop").repeat(__.in()).times(5).path().by("name");
 }
+
+@Override
+public Traversal 
get_g_V_repeatXout_repeatXoutX_timesX1XX_timesX1X_limitX1X_path_by_name() {
+// NB We need to prevent the RepeatUnrollStrategy from 
applying to properly exercise this test as this traversal can be simplified
--- End diff --

For now, an extra check seems good to me. In the long run, we should get 
rid of these NoOpBarrierStep injections altogether as it should only be done by 
`LazyBarrierStrategy` (that goes back to the whole DFS vs BFS discussion).


---


[GitHub] tinkerpop issue #874: TINKERPOP-1979 Fix math() on OLAP/Spark

2018-06-08 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/874
  
VOTE: +1


---


[GitHub] tinkerpop issue #873: TINKERPOP-1518 Cache Graph.Features for tests

2018-06-08 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/873
  
VOTE: +1

Though I would change the Jira ticket title before it makes it into the 
CHANGELOG, as the implementation doesn't really cache anything.


---


[GitHub] tinkerpop issue #872: TINKERPOP-1831 Refactored EventStrategy

2018-06-08 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/872
  
VOTE: +1


---


[GitHub] tinkerpop issue #871: TINKERPOP-1975 Introduced with() step and Configuring ...

2018-06-05 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/871
  
VOTE: +1


---


[GitHub] tinkerpop pull request #871: TINKERPOP-1975 Introduced with() step and Confi...

2018-06-04 Thread dkuppitz
Github user dkuppitz commented on a diff in the pull request:

https://github.com/apache/tinkerpop/pull/871#discussion_r192922149
  
--- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java 
---
@@ -260,6 +261,7 @@
 CLASS_IMPORTS.add(PeerPressureVertexProgram.class);
 CLASS_IMPORTS.add(PageRankMapReduce.class);
 CLASS_IMPORTS.add(PageRankVertexProgram.class);
+CLASS_IMPORTS.add(PageRankVertexProgramStep.PageRank.class);
--- End diff --

I think `PeerPressureVertexProgramStep.PeerPressure` should be a core 
import too.


---


[GitHub] tinkerpop issue #865: TINKERPOP-1963 Fixed branch() problems with reducing s...

2018-05-30 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/865
  
VOTE: +1


---


[GitHub] tinkerpop issue #870: TINKERPOP-1968 Refactor Gremlin Server integration tes...

2018-05-30 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/870
  
VOTE: +1


---


[GitHub] tinkerpop issue #866: TINKERPOP-1962 GroovyTranslator handles empty maps pro...

2018-05-15 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/866
  
VOTE: +1


---


[GitHub] tinkerpop pull request #864: TINKERPOP-1958 Fixed a bug in TinkerGraphCountS...

2018-05-11 Thread dkuppitz
GitHub user dkuppitz opened a pull request:

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

TINKERPOP-1958 Fixed a bug in TinkerGraphCountStrategy

https://issues.apache.org/jira/browse/TINKERPOP-1958

The strategy did not consider, that certain map steps may not emit an 
element.

`docker/build.sh -t -i` passed.

VOTE: +1

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

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

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

https://github.com/apache/tinkerpop/pull/864.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 #864


commit da5b7da2c4dd7202b69f2a211542e9aa711fd2d8
Author: Daniel Kuppitz 
Date:   2018-05-09T14:53:24Z

TINKERPOP-1958 Fixed a bug in TinkerGraphCountStrategy

The strategy did not consider, that certain map steps may not emit an 
element.




---


[GitHub] tinkerpop issue #862: TINKERPOP-1961 Removed duplication of images in binari...

2018-05-11 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/862
  
VOTE: +1


---


[GitHub] tinkerpop issue #863: TINKERPOP-1685 Added supportUpsert() feature

2018-05-10 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/863
  
VOTE: +1


---


[GitHub] tinkerpop issue #766: TINKERPOP-1447 Add some JavaScript intelligence to the...

2018-05-10 Thread dkuppitz
Github user dkuppitz commented on the issue:

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

![image](https://user-images.githubusercontent.com/572377/39879742-7f5ff648-5430-11e8-8afc-97dd669f6709.png)

Worked well for me.


---


[GitHub] tinkerpop issue #860: TINKERPOP-1595 Optimize TraversalVertexProgram

2018-04-27 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/860
  
VOTE: +1


---


[GitHub] tinkerpop issue #861: TINKERPOP-1956 Deprecated Order.incr and Order.decr

2018-04-27 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/861
  
VOTE: +1


---


[GitHub] tinkerpop issue #854: TINKERPOP-1933 gremlin-python maximum recursion depth ...

2018-04-27 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/854
  
VOTE: +1

But I do think a simple test would be nice. The code screams "make me 
recursive" and a future contributor, not aware of this issue, might try to 
change it back and not realize that it introduces a bug.


---


[GitHub] tinkerpop issue #859: TINKERPOP-1296 Remove previously deprecated Gremlin Se...

2018-04-26 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/859
  
VOTE: +1


---


[GitHub] tinkerpop issue #858: TINKERPOP-1943 Support GraphSON3 in Gremlin-JavaScript

2018-04-25 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/858
  
VOTE: +1


---


[GitHub] tinkerpop issue #852: TINKERPOP-1944 Export DriverRemoteConnection

2018-04-25 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/852
  
VOTE: +1


---


[GitHub] tinkerpop issue #766: TINKERPOP-1447 Add some JavaScript intelligence to the...

2018-04-25 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/766
  
It does scale to up to 4 tabs. Should we ever have more, we only need to 
tweak the 
[maxTabs](https://github.com/apache/tinkerpop/pull/766/files#diff-c362bf9cce8980393d4230e56c86a655R31)
 property and regenerate the CSS.


---


[GitHub] tinkerpop issue #843: TINKERPOP-1947 Fixed path history problem with mutatio...

2018-04-24 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/843
  
VOTE: +1


---


[GitHub] tinkerpop issue #848: TINKERPOP-1946 Removed old version of Credentials DSL

2018-04-24 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/848
  
VOTE: +1


---


[GitHub] tinkerpop issue #853: TINKERPOP-1953 Bump to Groovy 2.4.15

2018-04-24 Thread dkuppitz
Github user dkuppitz commented on the issue:

https://github.com/apache/tinkerpop/pull/853
  
VOTE: +1


---


  1   2   3   4   5   6   7   >