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/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 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"