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

   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).
   


-- 
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