From b1d98f7f489b0ff8710b0cddcfd5b9d285e7eb06 Mon Sep 17 00:00:00 2001 From: JohT <7671054+JohT@users.noreply.github.com> Date: Tue, 28 Oct 2025 07:32:45 +0100 Subject: [PATCH 1/2] Fix anomaly Graph visualization executed twice --- domains/anomaly-detection/anomalyDetectionVisualization.sh | 2 +- ...DetectionGraphVisualization.sh => anomalyDetectionGraphs.sh} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename domains/anomaly-detection/graphs/{anomalyDetectionGraphVisualization.sh => anomalyDetectionGraphs.sh} (100%) diff --git a/domains/anomaly-detection/anomalyDetectionVisualization.sh b/domains/anomaly-detection/anomalyDetectionVisualization.sh index 513af9962..c62df85f3 100755 --- a/domains/anomaly-detection/anomalyDetectionVisualization.sh +++ b/domains/anomaly-detection/anomalyDetectionVisualization.sh @@ -24,4 +24,4 @@ ANOMALY_DETECTION_SCRIPT_DIR=${ANOMALY_DETECTION_SCRIPT_DIR:-$(CDPATH=. cd -- "$ ANOMALY_DETECTION_GRAPHS_DIR=${ANOMALY_DETECTION_GRAPHS_DIR:-"${ANOMALY_DETECTION_SCRIPT_DIR}/graphs"} # Contains everything (scripts, queries, templates) to create the Markdown summary report for anomaly detection # Delegate the execution to the responsible script. -source "${ANOMALY_DETECTION_GRAPHS_DIR}/anomalyDetectionGraphVisualization.sh" \ No newline at end of file +source "${ANOMALY_DETECTION_GRAPHS_DIR}/anomalyDetectionGraphs.sh" \ No newline at end of file diff --git a/domains/anomaly-detection/graphs/anomalyDetectionGraphVisualization.sh b/domains/anomaly-detection/graphs/anomalyDetectionGraphs.sh similarity index 100% rename from domains/anomaly-detection/graphs/anomalyDetectionGraphVisualization.sh rename to domains/anomaly-detection/graphs/anomalyDetectionGraphs.sh From c001aa2271e0688680943746f363d34f0a89b278 Mon Sep 17 00:00:00 2001 From: JohT <7671054+JohT@users.noreply.github.com> Date: Tue, 28 Oct 2025 08:07:09 +0100 Subject: [PATCH 2/2] Add DEPENDS_ON relationship schema to overview report --- cypher/Exploration/Explore_schema.cypher | 33 +++++++++++++++++++ cypher/Overview/Dependency_node_labels.cypher | 28 ++++++++++++++++ scripts/reports/OverviewCsv.sh | 1 + 3 files changed, 62 insertions(+) create mode 100644 cypher/Exploration/Explore_schema.cypher create mode 100644 cypher/Overview/Dependency_node_labels.cypher diff --git a/cypher/Exploration/Explore_schema.cypher b/cypher/Exploration/Explore_schema.cypher new file mode 100644 index 000000000..0385ad52e --- /dev/null +++ b/cypher/Exploration/Explore_schema.cypher @@ -0,0 +1,33 @@ +// Explore node labels and their relationships for a schema overview + + MATCH (allNodes) + WITH COUNT(allNodes) AS totalNodeCount +MATCH (source)-[link]->(target) +WITH totalNodeCount + ,labels(source) AS sourceLabels + ,labels(target) AS targetLabels + ,collect(DISTINCT type(link)) AS relationshipTypes + ,count(*) AS numberOfNodes +UNWIND sourceLabels AS sourceLabel + WITH * + WHERE NOT sourceLabel STARTS WITH 'Mark4' + WITH totalNodeCount + ,collect(DISTINCT sourceLabel) AS sourceLabels + ,targetLabels + ,relationshipTypes + ,numberOfNodes +UNWIND targetLabels AS targetLabel + WITH * + WHERE NOT targetLabel STARTS WITH 'Mark4' + WITH totalNodeCount + ,sourceLabels + ,collect(DISTINCT targetLabel) AS targetLabels + ,relationshipTypes + ,numberOfNodes +RETURN apoc.text.join(sourceLabels, ',') AS sourceLabels + ,apoc.text.join(relationshipTypes, ',') AS relationshipTypes + ,apoc.text.join(targetLabels, ',') AS targetLabels + ,numberOfNodes + ,round(toFloat(numberOfNodes) / totalNodeCount * 100.0, 2) AS percentageOfTotalNodes +ORDER BY numberOfNodes DESC +LIMIT 200 \ No newline at end of file diff --git a/cypher/Overview/Dependency_node_labels.cypher b/cypher/Overview/Dependency_node_labels.cypher new file mode 100644 index 000000000..29d260870 --- /dev/null +++ b/cypher/Overview/Dependency_node_labels.cypher @@ -0,0 +1,28 @@ +// Explore DEPENDS_ON relationship node labels + + MATCH (allNodes) + WITH COUNT(allNodes) AS totalNodeCount +MATCH (source)-[:DEPENDS_ON]->(target) +WITH totalNodeCount + ,labels(source) AS sourceLabels + ,labels(target) AS targetLabels + ,count(*) AS numberOfNodes +UNWIND sourceLabels AS sourceLabel + WITH * + WHERE NOT sourceLabel STARTS WITH 'Mark4' + WITH totalNodeCount + ,collect(DISTINCT sourceLabel) AS sourceLabels + ,targetLabels + ,numberOfNodes +UNWIND targetLabels AS targetLabel + WITH * + WHERE NOT targetLabel STARTS WITH 'Mark4' + WITH totalNodeCount + ,sourceLabels + ,collect(DISTINCT targetLabel) AS targetLabels + ,numberOfNodes +RETURN apoc.text.join(sourceLabels, ',') AS sourceLabels + ,apoc.text.join(targetLabels, ',') AS targetLabels + ,numberOfNodes + ,round(toFloat(numberOfNodes) / totalNodeCount * 100.0, 2) AS percentageOfTotalNodes +ORDER BY numberOfNodes DESC, sourceLabels, targetLabels \ No newline at end of file diff --git a/scripts/reports/OverviewCsv.sh b/scripts/reports/OverviewCsv.sh index 777941847..791d7724d 100755 --- a/scripts/reports/OverviewCsv.sh +++ b/scripts/reports/OverviewCsv.sh @@ -53,6 +53,7 @@ execute_cypher "${OVERVIEW_CYPHER_DIR}/Number_of_elements_per_module_for_Typescr execute_cypher "${OVERVIEW_CYPHER_DIR}/Node_label_count.cypher" > "${FULL_REPORT_DIRECTORY}/Node_label_count.csv" execute_cypher "${OVERVIEW_CYPHER_DIR}/Node_label_combination_count.cypher" > "${FULL_REPORT_DIRECTORY}/Node_label_combination_count.csv" execute_cypher "${OVERVIEW_CYPHER_DIR}/Relationship_type_count.cypher" > "${FULL_REPORT_DIRECTORY}/Relationship_type_count.csv" +execute_cypher "${OVERVIEW_CYPHER_DIR}/Dependency_node_labels.cypher" > "${FULL_REPORT_DIRECTORY}/Dependency_node_labels.csv" # TODO Performance needs improvement. Included (limited) in OverviewGeneral Jupyter Notebook. # execute_cypher "${OVERVIEW_CYPHER_DIR}/Node_labels_and_their_relationships.cypher" > "${FULL_REPORT_DIRECTORY}/Node_labels_and_their_relationships.csv"