[ 
https://issues.apache.org/jira/browse/TINKERPOP-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17013032#comment-17013032
 ] 

Stephen Mallette commented on TINKERPOP-2325:
---------------------------------------------

[~m.valzelli] thanks for commenting....

I did that initial change to {{TraversalBuilder}} too with good effect:

{code}
gremlin> g.sparql("SELECT ?x WHERE { ?x v:name 'marko' }").explain()
==>Traversal Explanation
===============================================================================================================================================================
Original Traversal                 [InjectStep([SELECT ?x WHERE { ?x v:name 
'marko' }])]

ConnectiveStrategy           [D]   [InjectStep([SELECT ?x WHERE { ?x v:name 
'marko' }])]
SparqlStrategy               [D]   [GraphStep(vertex,[]), 
MatchStep(AND,[[MatchStartStep(x), HasStep([name.eq(marko)]), MatchEndStep]]), 
SelectOneStep(last,x)]
EarlyLimitStrategy           [O]   [GraphStep(vertex,[]), 
MatchStep(AND,[[MatchStartStep(x), HasStep([name.eq(marko)]), MatchEndStep]]), 
SelectOneStep(last,x)]
MatchPredicateStrategy       [O]   [GraphStep(vertex,[]), 
MatchStep(AND,[[MatchStartStep(x), HasStep([name.eq(marko)]), MatchEndStep]]), 
SelectOneStep(last,x)]
FilterRankingStrategy        [O]   [GraphStep(vertex,[]), 
MatchStep(AND,[[MatchStartStep(x), HasStep([name.eq(marko)]), MatchEndStep]]), 
SelectOneStep(last,x)]
InlineFilterStrategy         [O]   [GraphStep(vertex,[]), 
HasStep([name.eq(marko)])@[x], SelectOneStep(last,x)]
IncidentToAdjacentStrategy   [O]   [GraphStep(vertex,[]), 
HasStep([name.eq(marko)])@[x], SelectOneStep(last,x)]
AdjacentToIncidentStrategy   [O]   [GraphStep(vertex,[]), 
HasStep([name.eq(marko)])@[x], SelectOneStep(last,x)]
RepeatUnrollStrategy         [O]   [GraphStep(vertex,[]), 
HasStep([name.eq(marko)])@[x], SelectOneStep(last,x)]
CountStrategy                [O]   [GraphStep(vertex,[]), 
HasStep([name.eq(marko)])@[x], SelectOneStep(last,x)]
PathRetractionStrategy       [O]   [GraphStep(vertex,[]), 
HasStep([name.eq(marko)])@[x], SelectOneStep(last,x)]
LazyBarrierStrategy          [O]   [GraphStep(vertex,[]), 
HasStep([name.eq(marko)])@[x], SelectOneStep(last,x)]
TinkerGraphCountStrategy     [P]   [GraphStep(vertex,[]), 
HasStep([name.eq(marko)])@[x], SelectOneStep(last,x)]
TinkerGraphStepStrategy      [P]   
[TinkerGraphStep(vertex,[name.eq(marko)])@[x], SelectOneStep(last,x)]
ProfileStrategy              [F]   
[TinkerGraphStep(vertex,[name.eq(marko)])@[x], SelectOneStep(last,x)]
StandardVerificationStrategy [V]   
[TinkerGraphStep(vertex,[name.eq(marko)])@[x], SelectOneStep(last,x)]

Final Traversal                    
[TinkerGraphStep(vertex,[name.eq(marko)])@[x], SelectOneStep(last,x)]
{code}

The change seemed almost too easy so I asked for thoughts from [~harsh9t] and 
am awaiting response:

https://twitter.com/spmallette/status/1215618361603870720

I'd be happy to review a pull request with your changes if you'd care to submit 
what you have.



> Generate traversals that will better yield index lookups with SPARQL
> --------------------------------------------------------------------
>
>                 Key: TINKERPOP-2325
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2325
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: sparql
>    Affects Versions: 3.4.4
>            Reporter: Stephen Mallette
>            Priority: Major
>
> The following simple bit of SPARQL generates a {{match()}} that wont easily 
> be converted to further utilize indices. 
> {code}
> gremlin> s.sparql("SELECT ?x WHERE { ?x v:name 'marko' }").explain()
> ==>Traversal Explanation
> ===========================================================================================================================================================================================
> Original Traversal                 [InjectStep([SELECT ?x WHERE { ?x v:name 
> 'marko' }])]
> ConnectiveStrategy           [D]   [InjectStep([SELECT ?x WHERE { ?x v:name 
> 'marko' }])]
> SparqlStrategy               [D]   [GraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> MatchPredicateStrategy       [O]   [GraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> FilterRankingStrategy        [O]   [GraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> EarlyLimitStrategy           [O]   [GraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> InlineFilterStrategy         [O]   [GraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> IncidentToAdjacentStrategy   [O]   [GraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> AdjacentToIncidentStrategy   [O]   [GraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> RepeatUnrollStrategy         [O]   [GraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> CountStrategy                [O]   [GraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> PathRetractionStrategy       [O]   [GraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> LazyBarrierStrategy          [O]   [GraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> TinkerGraphCountStrategy     [P]   [GraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> TinkerGraphStepStrategy      [P]   [TinkerGraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> ProfileStrategy              [F]   [TinkerGraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> StandardVerificationStrategy [V]   [TinkerGraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> Final Traversal                    [TinkerGraphStep(vertex,[]), 
> MatchStep(AND,[[MatchStartStep(x), PropertiesStep([name],value), 
> IsStep(eq(marko)), MatchEndStep]]), SelectOneStep(last,x)]
> {code}
> {{sparql-gremlin}} needs some improvements in this area.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to