aplbrain / aplbrain/grand-cypher
indirect edge match of zero edge hop does not work correctly
- Lingua principale
- Python
- Stelle
- 129
- Fork
- 17
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
I have this case not working correctly
```cypher
MATCH (U1:upgrade)-[:conflict]->(U2:upgrade)
MATCH (U1:upgrade)-[:dependent*0]->(U3:upgrade)
match (B1:batch) -[:contain]->(U1:upgrade)
match (B1:batch) -[:contain]->(U3:upgrade)
match (B2:batch) -[:contain]->(U2:upgrade)
RETURN ID(U1), ID(U3)
```
I give the test case below.
In the meantime, I suspect the reason this doesn't work correctly is because of the edge hop of zero
```cypher
MATCH (U1:upgrade)-[:dependent*0]->(U3:upgrade)
```
This zero hop doesn't work with in direct each match
```cypher
match (B1:batch) -[:contain]->(U3:upgrade)
```
We might have mapping for edge (U1, U3): (U1, U1)
But we don't process the mapping for edge (B1, U3): (B1, U1). We might instead keep (B1, U3): (B1, U3)
This is the test case
```python
def test_node_type_edge_zero_hop(self, graph_type):
host = graph_type()
host.add_node("u1", __labels__=set(["upgrade"]), foo="1")
host.add_node("u2", __labels__=set(["upgrade"]), foo="2")
# host.add_node("u3", __labels__=set(["upgrade"]), foo="3")
host.add_node("b1", __labels__=set(["batch"]))
host.add_node("b2", __labels__=set(["batch"]))
host.add_edge("b1", "u1", __labels__=set(["contain"]))
# host.add_edge("b1", "u3", __labels__=set(["contain"]))
host.add_edge("b2", "u2", __labels__=set(["contain"]))
host.add_edge("u1", "u2", __labels__=set(["conflict"]))
# host.add_edge("u1", "u3", __labels__=set(["dependent"]))
qry = """
MATCH (U1:upgrade)-[:conflict]->(U2:upgrade)
MATCH (U1:upgrade)-[:dependent*0]->(U3:upgrade)
match (B1:batch) -[:contain]->(U1:upgrade)
match (B1:batch) -[:contain]->(U3:upgrade)
match (B2:batch) -[:contain]->(U2:upgrade)
RETURN ID(U1), ID(U3)
"""
gc = GrandCypher(host)
res = gc.run(qry)
assert len(res) == 2
assert res["ID(U1)"] == ["u1", "u1"]
assert res["ID(U3)"] == ["u1", "u3"]
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.