Skip to content

Commit 2e0e342

Browse files
committed
Add default implementations for backwards compatability
1 parent de69b44 commit 2e0e342

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

core/src/main/java/org/neo4j/gds/core/loading/RelationshipsAndProperties.java

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,41 @@
4646
@ValueClass
4747
public interface RelationshipsAndProperties {
4848

49-
Map<RelationshipType, Relationships.Topology> relationships();
49+
@Value.Default
50+
default Map<RelationshipType, Relationships.Topology> relationships() {
51+
return importResults().entrySet().stream().collect(Collectors.toMap(
52+
Map.Entry::getKey,
53+
e -> {
54+
var importResult = e.getValue();
55+
return importResult.forwardTopology();
56+
}
57+
));
58+
}
5059

51-
Map<RelationshipType, RelationshipPropertyStore> properties();
60+
@Value.Default
61+
default Map<RelationshipType, RelationshipPropertyStore> properties() {
62+
return importResults().entrySet().stream()
63+
.filter(e -> e.getValue().forwardProperties().isPresent())
64+
.collect(Collectors.toMap(
65+
Map.Entry::getKey,
66+
e -> {
67+
var importResult = e.getValue();
68+
return importResult.forwardProperties().get();
69+
}
70+
));
71+
}
5272

53-
Map<RelationshipType, Direction> directions();
73+
@Value.Default
74+
default Map<RelationshipType, Direction> directions() {
75+
return importResults().entrySet().stream()
76+
.collect(Collectors.toMap(
77+
Map.Entry::getKey,
78+
e -> {
79+
var importResult = e.getValue();
80+
return importResult.direction();
81+
}
82+
));
83+
}
5484

5585
@Value.Parameter(false)
5686
@Value.Default

0 commit comments

Comments
 (0)