A small question about cypher semantics

How should I understand the semantics of these cypher statements. Why the first and second statements have no results and the third statement outputs a line of results?

neo4j@neo4j> with 3 as c1 match (v:nonexist) return count(v) as c2, c1;
+---------+
| c2 | c1 |
+---------+
+---------+

0 rows available after 65 ms, consumed after another 17 ms
neo4j@neo4j> with 3 as c1 match (v:nonexist) return c1;
+----+
| c1 |
+----+
+----+

0 rows available after 41 ms, consumed after another 0 ms
neo4j@neo4j> with 3 as c1 match (v:nonexist) return count(v) as c2;
+----+
| c2 |
+----+
| 0 |
+----+

neo4j@neo4j> match (v:nonexist) return count(v) as c2;
+----+
| c2 |
+----+
| 0 |
+----+

A neo4j query produces rows of data for a single match. The way 'with' works is its variable is added to each row of the 'match' result. For example, 'with 3 as c1 match(n) return *', would result in rows as follows (assuming there is a match):

c1, n

3, first instance of n

3, second instance of n

etc.

Based on above, this is how I view each of your questions.

1. when 'with c1 match(v:nonexist)' produces a null result, you get a empty result since you are returning something from the result set (c1).

2. Same reason as #1

3 & 4. These differ from #1 and #2, since you are not requesting something returned from the row data, only the aggregate count of the rows is returned, which is zero for the null rows result.

@glilienfield Very clear answer! thanks a lot for the reply.