aplbrain / aplbrain/grand-cypher

Variable length relationship defaults differ from neo4j cypher specs

未关闭
#77 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
129
派生
17
PR 合并指标
PR 指标待抓取

描述

Hey there, I think I found another bug. And this time I have a fix!

I guess it's not even strictly a bug, but a question of convention. My changes break your test cases, so clearly we disagree on this point - but I have doubts you intended this. Consider this simple graph:

```
0--->1--->2
```

I want to find paths from 0 to 2:

```python
import grand
from grandcypher import GrandCypher

G = grand.Graph(backend=grand.backends.NetworkXBackend(directed=True))

G.nx.add_node(0, index=0)
G.nx.add_node(1, index=1)
G.nx.add_node(2, index=2)

G.nx.add_edge(0, 1)
G.nx.add_edge(1, 2)

qry = "MATCH p=(n)-[]->(m) WHERE n.index == 0 AND m.index=2 RETURN p"
res = GrandCypher(G.nx).run(qry)
print(res["p"]) # prints: []
```

I would expect this to return the entire graph. The reason that it doesn't is that this sets `minh` to 1 and `maxh` to 2 (which means it searches only for paths with 1 hop, as far as I can tell). That's not what the neo4j 4.4 specs say:

https://neo4j.com/docs/cypher-manual/4.4/syntax/patterns/

https://neo4j.com/docs/cypher-manual/4.4/clauses/match/#varlength-rels

> minHops and maxHops are optional and default to 1 and infinity respectively.

I proposed some changes in #76.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。