Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions cypher/Exploration/Explore_schema.cypher
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions cypher/Overview/Dependency_node_labels.cypher
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion domains/anomaly-detection/anomalyDetectionVisualization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
source "${ANOMALY_DETECTION_GRAPHS_DIR}/anomalyDetectionGraphs.sh"
1 change: 1 addition & 0 deletions scripts/reports/OverviewCsv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading