[ 
https://issues.apache.org/jira/browse/TINKERPOP-2800?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stephen Mallette closed TINKERPOP-2800.
---------------------------------------
    Resolution: Not A Problem

starting to question if the first query was every right. conjunctives used that 
way should be taken to mean "for a single property" and therefore it would 
always be false if you did {{startingWith("2").and(startingWith("4"))}} as no 
one property can satisfy that. if you wanted the multi-property approach for 
{{and()}} you would have to do it in two {{has()}} like:
{{has('variant',startingWith("2").has('variant',startingWith("4"))}} - which i 
think is easier to reason about:

{code}
gremlin> g.V().has("variant", 
startingWith("2")).has('variant',startingWith("4")).valueMap()
==>[variant:[2wd,4wd]]
gremlin> g.V().has("variant", 
startingWith("2")).or(has('variant',startingWith("4")),has('variant',startingWith("6"))).valueMap()
==>[variant:[2wd,4wd]]
==>[variant:[2wd,6wd]]
{code}

> ConnectiveP doesn't get evaluated right for list/set cardinality
> ----------------------------------------------------------------
>
>                 Key: TINKERPOP-2800
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2800
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.5.4
>            Reporter: Stephen Mallette
>            Priority: Major
>
> Given:
> {code}
> g = TinkerGraph.open().traversal()
> g.addV().property(list,"variant","2wd").property(list,"variant","4wd").iterate()
> g.addV().property(list,"variant","2wd").property(list,"variant","6wd").iterate()
> g.addV().property(list,"variant","8wd").property(list,"variant","6wd").iterate()
> // 
> gremlin> 
> g.V().has("variant",startingWith("2").and(startingWith("4"))).valueMap()
> ==>[variant:[2wd,4wd]]
> gremlin> g.V().or(has("variant",startingWith("2").and(startingWith("4"))),
> ......1>          
> has("variant",startingWith("2").and(startingWith("6")))).valueMap()
> gremlin> g.V().union(has("variant",startingWith("2").and(startingWith("4"))),
> ......1>             
> has("variant",startingWith("2").and(startingWith("6")))).valueMap()
> gremlin> 
> g.V().has("variant",startingWith("2").and(startingWith("4"))).aggregate("x").fold().
> ......1>   
> V().has("variant",startingWith("2").and(startingWith("6"))).aggregate("x").fold().
> ......2>   cap("x").unfold().valueMap()
> ==>[variant:[2wd,4wd]]
> ==>[variant:[2wd,6wd]]
> {code}
> The {{HasContainer}} doesn't seem to get applied properly in the case of 
> multi-properties. It sorta just treats properties as {{single}} in those 
> cases.
> The consistency issue seems best resolved by following the latter cases and 
> making it so that {{and()}} operates against a single property and prefer 
> that multiproperties be resolved over multiple {{has()}}:
> {code}
> gremlin> g.V().has("variant", 
> startingWith("2").and(startingWith("4"))).valueMap()
> gremlin> g.V().has("variant", 
> startingWith("2")).has('variant',startingWith("4")).valueMap()
> ==>[variant:[2wd,4wd]]
> gremlin> g.V().has("variant", 
> startingWith("2")).or(has('variant',startingWith("4")),has('variant',startingWith("6"))).valueMap()
> ==>[variant:[2wd,4wd]]
> ==>[variant:[2wd,6wd]]
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to