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

Stephen Mallette commented on TINKERPOP-2625:
---------------------------------------------

Started out implementing this, but ended up with just some additional tests: 
https://github.com/apache/tinkerpop/commit/98efe6f98b88f76c5a21faffbf4b0553c70bf430

There is no true/false value for {{P}} so implementing this exactly as 
described doesn't quite work. To determine those states you have to do a 
complex {{if-then}} to get there. I tried adding a {{Logical}} form of 
predicate that could represent true/false and it simplified that but also 
obfuscated things for users a bit because {{within/out()}} basically converted 
internally to {{true/false}}. There is some precedence for that I suppose with 
{{in/outside/between()}} going to connective versions of {{P}}. It also felt 
like in our reference implementations I was adding complexity where the cost of 
an empty {{within/out()}} was actually really low. 

My instinct is that perhaps it should be up to providers to handle their own 
optimization for these cases. If they can determine it useful for their case to 
do this then they can take on the complexity it includes.

> Optimize empty P within/without
> -------------------------------
>
>                 Key: TINKERPOP-2625
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2625
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: language, process
>    Affects Versions: 3.5.1
>            Reporter: Stephen Mallette
>            Priority: Minor
>
> On TINKERPOP-2621 we allowed the grammer to properly process empty 
> {{P.within/out()}}. From there a next step would be to optimize those a bit:
> * {{has(key, within(''))}} is always false in which case we can replace 
> within('') with false.
> * {{has(hey, without(''))}} is always true in which case this 
> step/HasContainer can be removed from the traversal as a filter.



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

Reply via email to