Commit a2fc3d4a authored by Tim Bleimehl's avatar Tim Bleimehl 🤸🏼
Browse files

fix failure if relations has filtered out nodes

parent c3abfe80
Pipeline #1656 passed with stage
in 46 seconds
......@@ -71,21 +71,22 @@ class GraphSchema(py2neo.Subgraph):
rel_nodes[0] = clean_rel_node
elif node.identity == rel.end_node.identity:
rel_nodes[1] = clean_rel_node
rel_ident = f"{list(rel_nodes[0].labels)[0]}_{type(rel).__name__}_{list(rel_nodes[1].labels)[0]}"
if rel_ident in parent_capture_point.parent_logger.all_schema_rels:
clean_rel = parent_capture_point.parent_logger.all_schema_rels[
rel_ident
]
else:
parent_capture_point.parent_logger.all_schema_rels[
rel_ident
] = clean_rel = py2neo.Relationship(
rel_nodes[0],
type(rel).__name__,
rel_nodes[1],
**extra_props,
)
schema_graph = schema_graph | clean_rel
if rel_nodes[0] and rel_nodes[1]:
rel_ident = f"{list(rel_nodes[0].labels)[0]}_{type(rel).__name__}_{list(rel_nodes[1].labels)[0]}"
if rel_ident in parent_capture_point.parent_logger.all_schema_rels:
clean_rel = parent_capture_point.parent_logger.all_schema_rels[
rel_ident
]
else:
parent_capture_point.parent_logger.all_schema_rels[
rel_ident
] = clean_rel = py2neo.Relationship(
rel_nodes[0],
type(rel).__name__,
rel_nodes[1],
**extra_props,
)
schema_graph = schema_graph | clean_rel
# atm we ignored any nodes without any relation.
# lets make up that leeway
......
......@@ -69,6 +69,13 @@ test_graph.run(
)
mlog.capture(name="RelationCluster")
test_graph.run("CREATE (:_SystemNode{name:'test'})")
test_graph.run("CREATE (:_SystemNode{name:'test2'})")
test_graph.run(
"MATCH (sn:_SystemNode{name:'test'}),(sn2:_SystemNode{name:'test2'}) CREATE (sn)-[:WORKS_WITH]->(sn2)"
)
test_graph.run(
"MATCH (sn:_SystemNode{name:'test'}),(wE:World{name:'Earth'}) CREATE (sn)-[:WATCHES]->(wH)"
)
mlog.capture()
print("###get_numeric_last_changes###\n", mlog.get_numeric_last_changes())
print("###get_schemagraph_last_changes###\n", mlog.get_schemagraph_last_changes())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment