From eaa3018884da1f2d0ff7063e766b0f9d306bf91b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florentin=20D=C3=B6rre?= Date: Mon, 9 Oct 2023 15:15:02 +0200 Subject: [PATCH 1/2] Fix inconsistency between rel-types and schema Which would eventually lead to restore failures. --- .../main/java/org/neo4j/gds/beta/filter/GraphStoreFilter.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/subgraph-filtering/src/main/java/org/neo4j/gds/beta/filter/GraphStoreFilter.java b/subgraph-filtering/src/main/java/org/neo4j/gds/beta/filter/GraphStoreFilter.java index 0dafb6afcbd..726ac5a9c77 100644 --- a/subgraph-filtering/src/main/java/org/neo4j/gds/beta/filter/GraphStoreFilter.java +++ b/subgraph-filtering/src/main/java/org/neo4j/gds/beta/filter/GraphStoreFilter.java @@ -25,7 +25,6 @@ import org.neo4j.gds.RelationshipType; import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.api.GraphStore; -import org.neo4j.gds.api.schema.Direction; import org.neo4j.gds.api.schema.GraphSchema; import org.neo4j.gds.api.schema.MutableGraphSchema; import org.neo4j.gds.api.schema.MutableNodeSchema; @@ -186,9 +185,6 @@ public static MutableGraphSchema filterSchema(GraphSchema inputGraphSchema, Node .relationshipSchema() .filter(filteredRelationshipTypes) ); - if (relationshipSchema.availableTypes().isEmpty()) { - relationshipSchema.addRelationshipType(RelationshipType.ALL_RELATIONSHIPS, Direction.DIRECTED); - } return MutableGraphSchema.of(nodeSchema, relationshipSchema, Map.of()); } From 3ab8de648f7bafb490879b5256af680e86c37e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florentin=20D=C3=B6rre?= Date: Tue, 10 Oct 2023 09:00:05 +0200 Subject: [PATCH 2/2] Verify consistency between relTypes in projections --- .../java/org/neo4j/gds/projection/CypherAggregationTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cypher-aggregation/src/test/java/org/neo4j/gds/projection/CypherAggregationTest.java b/cypher-aggregation/src/test/java/org/neo4j/gds/projection/CypherAggregationTest.java index e8dba8c61cc..af87df8c218 100644 --- a/cypher-aggregation/src/test/java/org/neo4j/gds/projection/CypherAggregationTest.java +++ b/cypher-aggregation/src/test/java/org/neo4j/gds/projection/CypherAggregationTest.java @@ -380,6 +380,9 @@ void testNodeLabels(String labels) { "RETURN gds.graph.project('g', s, null, { sourceNodeLabels: " + labels + ", targetNodeLabels: NULL })"); var graphStore = GraphStoreCatalog.get("", db.databaseName(), "g").graphStore(); + + assertThat(graphStore.relationshipTypes()).containsExactlyInAnyOrderElementsOf(graphStore.schema().relationshipSchema().availableTypes()); + assertThat(graphStore.nodeLabels()).extracting(NodeLabel::name).containsExactly("A", "B"); }