Skip to content

Commit 8bfaf6a

Browse files
committed
Add dedicated data verification step in preparation
1 parent 8bbb0e9 commit 8bfaf6a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Data verification DEPENDS_ON relationship distinct label constellations
2+
3+
MATCH (s)-[r:DEPENDS_ON]->(t)
4+
WHERE s <> t
5+
RETURN count(DISTINCT s) AS sourceNodeCount

scripts/prepareAnalysis.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Prepares and validates the graph database before analysis
44

5-
# Requires executeQueryFunctions.sh
5+
# Requires executeQueryFunctions.sh, parseCsvFunctions.sh
66

77
# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands)
88
set -o errexit -o pipefail
@@ -27,13 +27,23 @@ echo "prepareAnalysis: CYPHER_DIR=${CYPHER_DIR}"
2727
# Define functions to execute a cypher query from within the given file (first and only argument)
2828
source "${SCRIPTS_DIR}/executeQueryFunctions.sh"
2929

30+
# Define function(s) (e.g. is_csv_column_greater_zero) to parse CSV format strings from Cypher query results.
31+
source "${SCRIPTS_DIR}/parseCsvFunctions.sh"
32+
3033
# Local Constants
3134
PACKAGE_WEIGHTS_CYPHER_DIR="$CYPHER_DIR/Package_Relationship_Weights"
3235
PACKAGE_METRICS_CYPHER_DIR="$CYPHER_DIR/Metrics"
3336
EXTERNAL_DEPENDENCIES_CYPHER_DIR="$CYPHER_DIR/External_Dependencies"
3437
ARTIFACT_DEPENDENCIES_CYPHER_DIR="$CYPHER_DIR/Artifact_Dependencies"
3538
TYPES_CYPHER_DIR="$CYPHER_DIR/Types"
3639

40+
# Preparation - Data verification: DEPENDS_ON releationships
41+
dataVerificationResult=$( execute_cypher "${CYPHER_DIR}/Data_verification_DEPENDS_ON_relationships.cypher" "${@}")
42+
if ! is_csv_column_greater_zero "${dataVerificationResult}" "sourceNodeCount"; then
43+
echo "prepareAnalysis: Error: Data verification failed. At least one DEPENDS_ON relationship constellation required."
44+
exit 1
45+
fi
46+
3747
# Preparation - Create indices
3848
execute_cypher "${CYPHER_DIR}/Create_index_for_full_qualified_type_name.cypher"
3949

0 commit comments

Comments
 (0)