MuhammadTahaNaveed commented on issue #829:
URL: https://github.com/apache/age/issues/829#issuecomment-1519109605

   > Ideally, the second MATCH should work as an intersection over the results 
of the first MATCH. So the result should be only one vertex " {"id": 
844424930131969, "label": "Person", "properties": {"name": "bobby"}}::vertex". 
This is how it works in Neo4j as well, and the second MATCH does perform 
intersection in case of properties with AGE as well. As demonstrated here
   > 
   > ```
   > test=# SELECT * from cypher('test', $$
   >   CREATE ({name:'bobby', age:25}),
   >          (:Person {name:'bobby'}),
   >          (:Bobby {name:'bobby', age:25, cigar:2})
   > $$) as (a agtype);
   >  a 
   > ---
   > (0 rows)
   > 
   > test=# SELECT * from cypher('test', $$
   >       MATCH (u {name:'bobby'})
   >       MATCH (u {cigar:2})
   >       RETURN u
   > $$) as (a agtype);
   >                                                      a                     
                                 
   > 
------------------------------------------------------------------------------------------------------------
   >  {"id": 1407374883553282, "label": "Bobby", "properties": {"age": 25, 
"name": "bobby", "cigar": 2}}::vertex
   > (1 row)
   > ```
   > 
   > Another interesting result is this
   > 
   > ```
   > test=# SELECT * from cypher('test', $$
   >       MATCH (u:Bobby {name:'bobby'})
   >       MATCH (u:Person)
   >       RETURN u
   > $$) as (a agtype);
   >                                                      a                     
                                 
   > 
------------------------------------------------------------------------------------------------------------
   >  {"id": 1407374883553281, "label": "Bobby", "properties": {"name": 
"bobby"}}::vertex
   >  {"id": 1407374883553282, "label": "Bobby", "properties": {"age": 25, 
"name": "bobby", "cigar": 2}}::vertex
   > (2 rows)
   > ```
   > 
   > And this
   > 
   > ```
   > test=# SELECT * from cypher('test', $$
   >       MATCH (u:Bobby {name:'bobby'})
   >       MATCH (u:Person {age:25})
   >       RETURN u
   > $$) as (a agtype);
   >                                                      a                     
                                 
   > 
------------------------------------------------------------------------------------------------------------
   >  {"id": 1407374883553282, "label": "Bobby", "properties": {"age": 25, 
"name": "bobby", "cigar": 2}}::vertex
   > (1 row)
   > ```
   > 
   > It appears that AGE performs filtration based on the first MATCH clause, 
ignores the label (if any) of the second clause, only performs filtration based 
on the given properties and returns the result.
   > 
   > It should instead give an error regarding support of multiple labels (as 
of now).
   > 
   > Hence, yes, I would call it a bug.
   > 
   > Given that in case 2 labels are provided in 2 different MATCH clauses, it 
does not perform an intersection of the 2 MATCH clauses, instead completely 
ignores the label provided in the second MATCH clause.
   
   Thanks for your valuable response.
   
   In addition to your response, the below query also filters out results in 
neo4j
   
   `MATCH (u),(u:Person) RETURN u`
   
   But this same query errors out in AGE saying `ERROR:  multiple labels for 
variable 'u' are not supported`
   
   So the query
   `MATCH (u) MATCH (u:Person) RETURN` should also error out the same until it 
is supported.
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@age.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to