Skip to content

Commit 6d2897b

Browse files
committed
Add function to check if a projection exists
1 parent e8e9a44 commit 6d2897b

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Check if the projection exists. Variables: dependencies_projection
2+
3+
RETURN CASE WHEN gds.graph.exists($dependencies_projection + '-cleaned') THEN 1
4+
ELSE 0 END AS projectionCount

scripts/projectionFunctions.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,23 @@ verifyDataReadyForProjection() {
112112
fi
113113
}
114114

115+
# Checks if the projection already exists.
116+
# Returns true (=0) if the projection exists.
117+
# Returns false (=1) if the projection doesn't exist.
118+
# Exits with an error if there are technical issues.
119+
# Required Parameters:
120+
# - dependencies_projection=...
121+
# Name prefix for the in-memory projection name for dependencies. Example: "type-centrality"
122+
projectionExists() {
123+
local verificationResult
124+
verificationResult=$( execute_cypher "${PROJECTION_CYPHER_DIR}/Dependencies_0_Check_Projection_Exists.cypher" "${@}")
125+
if is_csv_column_greater_zero "${verificationResult}" "projectionCount"; then
126+
true;
127+
else
128+
false;
129+
fi
130+
}
131+
115132
# Creates a directed Graph projection for dependencies between nodes specified by the parameter "dependencies_projection_node".
116133
# Nodes without incoming and outgoing dependencies will be filtered out using a subgraph.
117134
#

0 commit comments

Comments
 (0)