dukeofhazardz commented on issue #951:
URL: https://github.com/apache/age/issues/951#issuecomment-1566968030

   It would seem that the problematic part is the attempt to use a relationship 
pattern `(u:User {id: 'user1'})-[:WATCHED]->(allMovie)` directly within the 
WHERE clause. which could be as a result of a slight variations in the AGE 
syntax. In order to fix this you should avoid  using the relationship pattern 
directly within the WHERE clause. Instead, add an additional MATCH clause 
`(u)-[:WATCHED]->(am)` to achieve the desired filtering as I did below.
   
   ```
   demo=# SELECT * FROM cypher('munmud', $$
   MATCH (u:User {id: 'user1'})-[:WATCHED]->(m:Movie)
   WITH DISTINCT m AS watchedMovies
   MATCH (g:Genre)<-[]-(watchedMovies)
   WITH DISTINCT g AS genre, watchedMovies
   MATCH (genre)<-[:BELONGS_TO]-(am)
   MATCH (u)-[:WATCHED]->(am)
   RETURN am
   $$) AS (V agtype);
                                                              v
   
------------------------------------------------------------------------------------------------------------------------
    {"id": 1125899906842625, "label": "Movie", "properties": {"id": "movie1", 
"name": "The Shawshank Redemption"}}::vertex
    {"id": 1125899906842625, "label": "Movie", "properties": {"id": "movie1", 
"name": "The Shawshank Redemption"}}::vertex
    {"id": 1125899906842626, "label": "Movie", "properties": {"id": "movie2", 
"name": "The Godfather"}}::vertex
   (3 rows)
   ```
   
   By using an additional MATCH clause, you can specify the relationship 
pattern separately and include it in the WITH and RETURN clauses to achieve the 
desired result.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to