Hello everyone, I am very new to Cypher. This is probably related to a basic concept but I somehow wasn't able to find the answer to this. Currently, I am looking at pattern comprehension in cypher, but I am very confused about what it does. Here's what the document says:
A pattern comprehension will match the specified pattern just like a normal MATCH clause, with predicates just like a normal WHERE clause, but will yield a custom projection as specified.
However, it seems to have different behaviors based on whether or not a match clause exists. If there is no match clause:
Return [(a:Person)-[]->(b:Movie) | elementId(a) + elementId(b)] as IDs
the statement above returns a single list:
["4:6c7257a5-f51e-4206-bc11-f5aec142409b:84:6c7257a5-f51e-4206-bc11-f5aec142409b:0", "4:6c7257a5-f51e-4206-bc11-f5aec142409b:74:6c7257a5-f51e-4206-bc11-f5aec142409b:0", "4:6c7257a5-f51e-4206-bc11-f5aec142409b:64:6c7257a5-f51e-4206-bc11-f5aec142409b:0", "4:6c7257a5-f51e-4206-bc11-f5aec142409b:54:6c7257a5-f51e-4206-bc11-f5aec142409b:0", "4:6c7257a5-f51e-4206-bc11-f5aec142409b:44:6c7257a5-f51e-4206-bc11-f5aec142409b:0", ...]
However, if there is a match clause:
Match (a:Person)-[]->(b:Movie)
Return [(a)-[]->(b) | elementId(a) + elementId(b)] as IDs
Then this one returns multiple rows, where each row has a small list:
╒══════════════════════════════════════════════════════════════════════╕
│IDs │
╞══════════════════════════════════════════════════════════════════════╡
│["4:6c7257a5-f51e-4206-bc11-f5aec142409b:84:6c7257a5-f51e-4206-bc11-f5│
│aec142409b:0"] │
├──────────────────────────────────────────────────────────────────────┤
│["4:6c7257a5-f51e-4206-bc11-f5aec142409b:74:6c7257a5-f51e-4206-bc11-f5│
│aec142409b:0"] │
├──────────────────────────────────────────────────────────────────────┤
│["4:6c7257a5-f51e-4206-bc11-f5aec142409b:64:6c7257a5-f51e-4206-bc11-f5│
│aec142409b:0"] │
├──────────────────────────────────────────────────────────────────────┤
│["4:6c7257a5-f51e-4206-bc11-f5aec142409b:54:6c7257a5-f51e-4206-bc11-f5│
│aec142409b:0"] │
├──────────────────────────────────────────────────────────────────────┤
│["4:6c7257a5-f51e-4206-bc11-f5aec142409b:44:6c7257a5-f51e-4206-bc11-f5│
│aec142409b:0"] │
...
Why are these two results different? Am I missing anything about the language? Thanks!