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/06/15 13:27:18 UTC
[GitHub] tinkerpop pull request #337: TINKERPOP-1332: Improve .explain() Dialogue
GitHub user okram opened a pull request:
https://github.com/apache/tinkerpop/pull/337
TINKERPOP-1332: Improve .explain() Dialogue
https://issues.apache.org/jira/browse/TINKERPOP-1332
`TraversalExplanation.toString()` now supports word wrapping and `GraphFilter` information.
*First, here is word wrap in action*:
```
gremlin> g.V().out().out().out().out().count().explain()
==>Traversal Explanation
=======================================================================================================================================
Original Traversal [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), CountGlobalStep]
ConnectiveStrategy [D] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), CountGlobalStep]
RangeByIsCountStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), CountGlobalStep]
IdentityRemovalStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), CountGlobalStep]
IncidentToAdjacentStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), CountGlobalStep]
AdjacentToIncidentStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,edge), CountGlobalStep]
FilterRankingStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,edge), CountGlobalStep]
MatchPredicateStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,edge), CountGlobalStep]
TinkerGraphStepStrategy [P] [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,edge), CountGlobalStep]
ProfileStrategy [F] [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,edge), CountGlobalStep]
StandardVerificationStrategy [V] [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,edge), CountGlobalStep]
Final Traversal [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,edge), CountGlobalStep]
gremlin>
```
*Second, here is GraphFilter information in action.*
```
gremlin> g = TinkerFactory.createModern().traversal().withComputer()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], graphcomputer]
gremlin> g = g.withStrategies(GraphFilterStrategy.instance())
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], graphcomputer]
gremlin> g.V().out().out().out().out().count().explain()
==>Traversal Explanation
==========================================================================================================================================
Original Traversal [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), CountGlobalStep]
VertexProgramStrategy [D] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,vertex), CountGlobalStep],graphfilter[none]),
ComputerResultStep]
ConnectiveStrategy [D] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,vertex), CountGlobalStep],graphfilter[none]),
ComputerResultStep]
RangeByIsCountStrategy [O] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,vertex), CountGlobalStep],graphfilter[none]),
ComputerResultStep]
IdentityRemovalStrategy [O] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,vertex), CountGlobalStep],graphfilter[none]),
ComputerResultStep]
IncidentToAdjacentStrategy [O] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,vertex), CountGlobalStep],graphfilter[none]),
ComputerResultStep]
AdjacentToIncidentStrategy [O] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,edge), CountGlobalStep],graphfilter[none]),
ComputerResultStep]
FilterRankingStrategy [O] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,edge), CountGlobalStep],graphfilter[none]),
ComputerResultStep]
MatchPredicateStrategy [O] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,edge), CountGlobalStep],graphfilter[none]),
ComputerResultStep]
OrderLimitStrategy [O] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,edge), CountGlobalStep],graphfilter[none]),
ComputerResultStep]
PathProcessorStrategy [O] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,edge), CountGlobalStep],graphfilter[none]),
ComputerResultStep]
GraphFilterStrategy [O] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,edge), CountGlobalStep],graphfilter[[VertexStep(OUT,edge)]]),
ComputerResultStep]
TinkerGraphStepStrategy [P] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,edge), CountGlobalStep],graphfilter[[VertexStep(OUT,edge)]]),
ComputerResultStep]
ProfileStrategy [F] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,edge), CountGlobalStep],graphfilter[[VertexStep(OUT,edge)]]),
ComputerResultStep]
ComputerVerificationStrategy [V] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,edge), CountGlobalStep],graphfilter[[VertexStep(OUT,edge)]]),
ComputerResultStep]
StandardVerificationStrategy [V] [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,edge), CountGlobalStep],graphfilter[[VertexStep(OUT,edge)]]),
ComputerResultStep]
Final Traversal [TraversalVertexProgramStep([GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex),
VertexStep(OUT,vertex), VertexStep(OUT,edge), CountGlobalStep],graphfilter[[VertexStep(OUT,edge)]]),
ComputerResultStep]
gremlin>
```
**PLEASE ADVISE**
Note that I have hardcoded the wordwrap amount `final int maxLineLength = 75;`. It would be nice if this was set to the console window size in some way... :/ ... any thoughts on how to make this more dynamic?
**CHANGELOG**
```
* `VertexProgramStep.toString()` contains `GraphFilter` information.
* `TraversalExplanation.toString()` supports word wrapping.
```
`mvn clean install` passed.
VOTE +1.
cc/ @rjbriody @RussellSpitzer
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/tinkerpop TINKERPOP-1332
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tinkerpop/pull/337.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 #337
----
commit fc62efec4d578b5e767676b04789cf35535f53f0
Author: Marko A. Rodriguez <ok...@gmail.com>
Date: 2016-06-15T13:00:44Z
TraversalExplanation now supports word wrapping and VertexProgamStep.toStrings() have GraphFilter information attached.
commit a4771b6c9f8c02a94f4735fea20b82d0ab1e1671
Author: Marko A. Rodriguez <ok...@gmail.com>
Date: 2016-06-15T13:07:52Z
Merge branch 'master' into TINKERPOP-1332
----
---
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 #337: TINKERPOP-1332: Improve .explain() Dialogue
Posted by spmallette <gi...@git.apache.org>.
Github user spmallette commented on the issue:
https://github.com/apache/tinkerpop/pull/337
Note that there are comments on this PR in the JIRA ticket itself.
---
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 #337: TINKERPOP-1332: Improve .explain() Dialogue
Posted by RussellSpitzer <gi...@git.apache.org>.
Github user RussellSpitzer commented on the issue:
https://github.com/apache/tinkerpop/pull/337
I still think this is pretty verbose, but I'm happy with the inclusion of the
```graphfilter[[VertexStep(OUT,edge)]]``` so +1 on that
---
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 #337: TINKERPOP-1332: Improve .explain() Dialogue
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/tinkerpop/pull/337
---
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 #337: TINKERPOP-1332: Improve .explain() Dialogue
Posted by okram <gi...@git.apache.org>.
Github user okram commented on the issue:
https://github.com/apache/tinkerpop/pull/337
Note that there is a fall back if the `getWidth()` is "too small" ... people say when it fails, it returns -1 so the fall back will kick in.
---
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 #337: TINKERPOP-1332: Improve .explain() Dialogue
Posted by PommeVerte <gi...@git.apache.org>.
Github user PommeVerte commented on the issue:
https://github.com/apache/tinkerpop/pull/337
Jline should have some support for obtaining terminal width though it might not be all that reliable :
```java
jline.TerminalFactory.get().getWidth();
```
I think the above might fail in some instances such as resizing the window after launching the app, or if the users are using a shell that doesn't support some column global envs. So falling back to 75 might be a good approach if the above doesn't return a width.
This looks good. 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 #337: TINKERPOP-1332: Improve .explain() Dialogue
Posted by okram <gi...@git.apache.org>.
Github user okram commented on the issue:
https://github.com/apache/tinkerpop/pull/337
Can someone else VOTE on this please?
---
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 #337: TINKERPOP-1332: Improve .explain() Dialogue
Posted by dkuppitz <gi...@git.apache.org>.
Github user dkuppitz commented on the issue:
https://github.com/apache/tinkerpop/pull/337
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 #337: TINKERPOP-1332: Improve .explain() Dialogue
Posted by PommeVerte <gi...@git.apache.org>.
Github user PommeVerte commented on the issue:
https://github.com/apache/tinkerpop/pull/337
duh I totally missed that line when looking through the changes. Late to the party >.<
---
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.
---