Open Lincyaw opened 1 year ago
@Lincyaw you're right the semantic is not well defined in Cypher, counting different overlapping paths on the first example is considered as a single result for the count.
So in your example, two directed paths that have the same components will be count as a single path.
You can overcome this by counting unique paths.
GRAPH.QUERY 0 "MATCH p=(n1:L3)-[]-(n2:L2)-[]-(n3:L1:L2)-[r1:T1]-(n4:L3:L0:L4) RETURN COUNT(p)"
You are right, but for the same queries, the neo4j's results seems different from the FalkerDB. Is that normal?
Yes, the semantic is not well defined in Cypher so you might find different vendors interpenetration
After searching the Cypher Specification, I found the following use cases.
https://github.com/opencypher/openCypher/blob/master/tck/features/clauses/match/Match8.feature
And in the following test case
Scenario: [2] Counting rows after MATCH, MERGE, OPTIONAL MATCH
Given an empty graph
And having executed:
"""
CREATE (a:A), (b:B)
CREATE (a)-[:T1]->(b),
(b)-[:T2]->(a)
"""
When executing query:
"""
MATCH (a)
MERGE (b)
WITH *
OPTIONAL MATCH (a)--(b)
RETURN count(*)
"""
Then the result should be, in any order:
| count(*) |
| 6 |
And no side effects
The behavior of Neo4j is exactly the same as the expected result, but in falkerDB, the result is different.
Version: Docker image falkordb/falkordb:edge OS: Ubuntu 22.04 API/Driver: Cypher
According to the following query, the 18 should equals to 10+12
The create statement is attached below for your reproduction 1692914926.9295375.log