From 62e5f618e3cae8741d7ff484ef2030255925e885 Mon Sep 17 00:00:00 2001 From: JohT <7671054+JohT@users.noreply.github.com> Date: Sat, 25 Apr 2026 09:24:10 +0200 Subject: [PATCH 1/2] Remove legacy extended internal dependencies reports and notebooks --- CHANGELOG.md | 10 +- COMMANDS.md | 6 +- README.md | 6 +- ...ulate_and_set_Abstractness_for_Java.cypher | 28 - ...ness_for_Java_including_Subpackages.cypher | 37 - ...and_set_Abstractness_for_Typescript.cypher | 29 - ...culate_and_set_Instability_for_Java.cypher | 38 - ...lity_for_Java_Including_Subpackages.cypher | 37 - ..._and_set_Instability_for_Typescript.cypher | 35 - ...stractness_and_instability_for_Java.cypher | 11 - ...lity_for_Java_including_subpackages.cypher | 14 - ...ness_and_instability_for_Typescript.cypher | 12 - .../Count_and_set_abstract_types.cypher | 54 -- .../Metrics/Get_Abstractness_for_Java.cypher | 12 - ...ness_for_Java_including_Subpackages.cypher | 13 - .../Get_Abstractness_for_Typescript.cypher | 12 - ..._Incoming_Java_Package_Dependencies.cypher | 15 - ..._Dependencies_Including_Subpackages.cypher | 15 - ...ming_Typescript_Module_Dependencies.cypher | 13 - .../Metrics/Get_Instability_for_Java.cypher | 20 - ...lity_for_Java_Including_Subpackages.cypher | 20 - .../Get_Instability_for_Typescript.cypher | 17 - ..._Outgoing_Java_Package_Dependencies.cypher | 15 - ..._Dependencies_Including_Subpackages.cypher | 15 - ...oing_Typescript_Module_Dependencies.cypher | 13 - ..._Incoming_Java_Package_Dependencies.cypher | 33 - ..._Dependencies_Including_Subpackages.cypher | 40 -- ...ming_Typescript_Module_Dependencies.cypher | 34 - ..._Outgoing_Java_Package_Dependencies.cypher | 33 - ..._Dependencies_Including_Subpackages.cypher | 40 -- ...oing_Typescript_Module_Dependencies.cypher | 34 - .../Words_for_universal_Wordcloud.cypher | 17 - ...tistics_for_elements_for_Typescript.cypher | 39 -- ...ive_visibility_statistics_for_types.cypher | 35 - ..._elements_per_module_for_Typescript.cypher | 23 - ...blic_types_to_all_types_per_package.cypher | 21 - domains/internal-dependencies/COPIED_FILES.md | 175 ----- .../explore/InternalDependenciesJava.ipynb | 24 +- .../InternalDependenciesTypescript.ipynb | 16 +- .../ObjectOrientedDesignMetricsJava.ipynb | 36 +- ...bjectOrientedDesignMetricsTypescript.ipynb | 18 +- .../explore/PathFindingJava.ipynb | 24 +- .../explore/PathFindingTypescript.ipynb | 18 +- .../explore/VisibilityMetricsJava.ipynb | 4 +- .../explore/VisibilityMetricsTypescript.ipynb | 4 +- .../explore/Wordcloud.ipynb | 4 +- ...git_author_Wordcloud_with_frequency.cypher | 0 .../DependenciesGraphExplorationJava.ipynb | 312 --------- ...pendenciesGraphExplorationTypescript.ipynb | 314 --------- jupyter/ObjectOrientedDesignMetricsJava.ipynb | 655 ------------------ ...bjectOrientedDesignMetricsTypescript.ipynb | 490 ------------- jupyter/VisibilityMetricsJava.ipynb | 436 ------------ jupyter/VisibilityMetricsTypescript.ipynb | 444 ------------ jupyter/Wordcloud.ipynb | 286 -------- .../reports/ObjectOrientedDesignMetricsCsv.sh | 85 --- scripts/reports/VisibilityMetricsCsv.sh | 50 -- 56 files changed, 85 insertions(+), 4156 deletions(-) delete mode 100644 cypher/Metrics/Calculate_and_set_Abstractness_for_Java.cypher delete mode 100644 cypher/Metrics/Calculate_and_set_Abstractness_for_Java_including_Subpackages.cypher delete mode 100644 cypher/Metrics/Calculate_and_set_Abstractness_for_Typescript.cypher delete mode 100644 cypher/Metrics/Calculate_and_set_Instability_for_Java.cypher delete mode 100644 cypher/Metrics/Calculate_and_set_Instability_for_Java_Including_Subpackages.cypher delete mode 100644 cypher/Metrics/Calculate_and_set_Instability_for_Typescript.cypher delete mode 100644 cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java.cypher delete mode 100644 cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java_including_subpackages.cypher delete mode 100644 cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Typescript.cypher delete mode 100644 cypher/Metrics/Count_and_set_abstract_types.cypher delete mode 100644 cypher/Metrics/Get_Abstractness_for_Java.cypher delete mode 100644 cypher/Metrics/Get_Abstractness_for_Java_including_Subpackages.cypher delete mode 100644 cypher/Metrics/Get_Abstractness_for_Typescript.cypher delete mode 100644 cypher/Metrics/Get_Incoming_Java_Package_Dependencies.cypher delete mode 100644 cypher/Metrics/Get_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher delete mode 100644 cypher/Metrics/Get_Incoming_Typescript_Module_Dependencies.cypher delete mode 100644 cypher/Metrics/Get_Instability_for_Java.cypher delete mode 100644 cypher/Metrics/Get_Instability_for_Java_Including_Subpackages.cypher delete mode 100644 cypher/Metrics/Get_Instability_for_Typescript.cypher delete mode 100644 cypher/Metrics/Get_Outgoing_Java_Package_Dependencies.cypher delete mode 100644 cypher/Metrics/Get_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher delete mode 100644 cypher/Metrics/Get_Outgoing_Typescript_Module_Dependencies.cypher delete mode 100644 cypher/Metrics/Set_Incoming_Java_Package_Dependencies.cypher delete mode 100644 cypher/Metrics/Set_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher delete mode 100644 cypher/Metrics/Set_Incoming_Typescript_Module_Dependencies.cypher delete mode 100644 cypher/Metrics/Set_Outgoing_Java_Package_Dependencies.cypher delete mode 100644 cypher/Metrics/Set_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher delete mode 100644 cypher/Metrics/Set_Outgoing_Typescript_Module_Dependencies.cypher delete mode 100644 cypher/Overview/Words_for_universal_Wordcloud.cypher delete mode 100644 cypher/Visibility/Global_relative_visibility_statistics_for_elements_for_Typescript.cypher delete mode 100644 cypher/Visibility/Global_relative_visibility_statistics_for_types.cypher delete mode 100644 cypher/Visibility/Relative_visibility_exported_elements_to_all_elements_per_module_for_Typescript.cypher delete mode 100644 cypher/Visibility/Relative_visibility_public_types_to_all_types_per_package.cypher delete mode 100644 domains/internal-dependencies/COPIED_FILES.md rename {cypher/Overview => domains/internal-dependencies/queries/exploration}/Words_for_git_author_Wordcloud_with_frequency.cypher (100%) delete mode 100644 jupyter/DependenciesGraphExplorationJava.ipynb delete mode 100644 jupyter/DependenciesGraphExplorationTypescript.ipynb delete mode 100644 jupyter/ObjectOrientedDesignMetricsJava.ipynb delete mode 100644 jupyter/ObjectOrientedDesignMetricsTypescript.ipynb delete mode 100644 jupyter/VisibilityMetricsJava.ipynb delete mode 100644 jupyter/VisibilityMetricsTypescript.ipynb delete mode 100644 jupyter/Wordcloud.ipynb delete mode 100755 scripts/reports/ObjectOrientedDesignMetricsCsv.sh delete mode 100755 scripts/reports/VisibilityMetricsCsv.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 44ee169be..1785bfb58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -534,11 +534,11 @@ For all details see: https://github.com/JohT/code-graph-analysis-pipeline/releas ### 📖 Jupyter Notebook Reports * [External Dependencies](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/external-dependencies-java/ExternalDependenciesJava.md) contains detailed information about external library usage ([Notebook](./domains/external-dependencies/explore/ExternalDependenciesJava.ipynb)). -* [Object Oriented Design Quality Metrics](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/object-oriented-design-metrics-java/ObjectOrientedDesignMetricsJava.md) is based on [OO Design Quality Metrics by Robert Martin](https://api.semanticscholar.org/CorpusID:18246616) ([Notebook](./jupyter/ObjectOrientedDesignMetricsJava.ipynb)). +* [Object Oriented Design Quality Metrics](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/object-oriented-design-metrics-java/ObjectOrientedDesignMetricsJava.md) is based on [OO Design Quality Metrics by Robert Martin](https://api.semanticscholar.org/CorpusID:18246616) ([Notebook](./domains/internal-dependencies/explore/ObjectOrientedDesignMetricsJava.ipynb)). * [Overview](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/overview-java/OverviewJava.md) contains overall statistics and details about methods and their complexity. ([Notebook](./jupyter/OverviewJava.ipynb)). * [Internal Dependencies](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/internal-dependencies-java/InternalDependenciesJava.md) is based on [Analyze java package metrics in a graph database](https://joht.github.io/johtizen/data/2023/04/21/java-package-metrics-analysis.html) and also includes cyclic dependencies ([Notebook](./domains/internal-dependencies/explore/InternalDependenciesJava.ipynb)). -* [Visibility Metrics](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/visibility-metrics-java/VisibilityMetricsJava.md) ([Notebook](./jupyter/VisibilityMetricsJava.ipynb)). -* [Wordcloud](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/wordcloud/Wordcloud.md) contains a visual representation of package and class names ([Notebook](./jupyter/Wordcloud.ipynb)). +* [Visibility Metrics](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/visibility-metrics-java/VisibilityMetricsJava.md) ([Notebook](./domains/internal-dependencies/explore/VisibilityMetricsJava.ipynb)). +* [Wordcloud](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/wordcloud/Wordcloud.md) contains a visual representation of package and class names ([Notebook](./domains/internal-dependencies/explore/Wordcloud.ipynb)). ### 📖 Graph Data Science Reports @@ -551,8 +551,8 @@ Here are some reports that utilize Neo4j's [Graph Data Science Library](https:// ### 📖 Other Reports * [External Dependencies (CSV)](./domains/external-dependencies/externalDependenciesCsv.sh) ([Example](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/external-dependencies-csv/External_package_usage_overall.csv)) -* [Object Oriented Design Metrics (CSV)](./scripts/reports/ObjectOrientedDesignMetricsCsv.sh) ([Example](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/object-oriented-design-metrics-csv/MainSequenceAbstractnessInstabilityDistanceJava.csv)) * [Overview (CSV)](./scripts/reports/OverviewCsv.sh) ([Example](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/overview-csv/Cyclomatic_Method_Complexity.csv)) * [Internal Dependencies - Cyclic (CSV)](./domains/internal-dependencies/internalDependenciesCsv.sh) ([Example](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/internal-dependencies-csv/Cyclic_Dependencies_Breakdown_Backward_Only.csv)) * [Internal Dependencies - Interface Segregation (CSV)](./domains/internal-dependencies/internalDependenciesCsv.sh) ([Example](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/internal-dependencies-csv/InterfaceSegregationCandidates.csv)) -* [Visibility Metrics (CSV)](./scripts/reports/VisibilityMetricsCsv.sh) ([Example](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/visibility-metrics-csv/RelativeVisibilityPerArtifact.csv)) +* [Object Oriented Design Metrics (CSV)](./domains/internal-dependencies/internalDependenciesCsv.sh) ([Example](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/object-oriented-design-metrics-csv/MainSequenceAbstractnessInstabilityDistanceJava.csv)) +* [Visibility Metrics (CSV)](./domains/internal-dependencies/internalDependenciesCsv.sh) ([Example](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/visibility-metrics-csv/RelativeVisibilityPerArtifact.csv)) diff --git a/COMMANDS.md b/COMMANDS.md index 366d3b9c7..fd355aab4 100644 --- a/COMMANDS.md +++ b/COMMANDS.md @@ -407,7 +407,7 @@ The script [executeJupyterNotebookReport.sh](./scripts/executeJupyterNotebookRep - data availability validation using [executeQueryFunctions.sh](#executequeryfunctionssh) - executing and converting the given Notebook using [executeJupyterNotebook.sh](#execute-a-notebook-with-executejupyternotebooksh) -Here is an example on how to run the report [Wordcloud.ipynb](./jupyter/Wordcloud.ipynb): +Here is an example on how to run the report [Wordcloud.ipynb](./domains/internal-dependencies/explore/Wordcloud.ipynb): ```shell ./scripts/executeJupyterNotebookReport.sh --jupyterNotebook Wordcloud.ipynb @@ -425,10 +425,10 @@ You can search the messages `Validation succeeded` or `Validation failed` inside [executeJupyterNotebook.sh](./scripts/executeJupyterNotebook.sh) executes a Jupyter Notebook in the command line and convert it to different formats like Markdown and PDF (optionally). It takes care of [setting up the environment](#manually-setup-the-environment-using-conda) and [uses nbconvert](#executing-jupyter-notebooks-with-nbconvert) to execute the notebook and convert it to other file formats under the hood. -Here is an example on how to use [executeJupyterNotebook.sh](./scripts/executeJupyterNotebook.sh) to for example run [Wordcloud.ipynb](./jupyter/Wordcloud.ipynb): +Here is an example on how to use [executeJupyterNotebook.sh](./scripts/executeJupyterNotebook.sh) to for example run [Wordcloud.ipynb](./domains/internal-dependencies/explore/Wordcloud.ipynb): ```shell -./scripts/executeJupyterNotebook.sh ./jupyter/Wordcloud.ipynb +./scripts/executeJupyterNotebook.sh ./domains/internal-dependencies/explore/Wordcloud.ipynb ``` ### Manually setup the environment using Conda diff --git a/README.md b/README.md index f1cd9abc2..e558079d8 100644 --- a/README.md +++ b/README.md @@ -51,10 +51,10 @@ Here is an overview of [Jupyter Notebooks](https://jupyter.org) reports from [co - [Internal Dependencies](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/internal-dependencies-java/InternalDependenciesJava.md) is based on [Analyze java package metrics in a graph database](https://joht.github.io/johtizen/data/2023/04/21/java-package-metrics-analysis.html) and also includes cyclic dependencies ([Notebook](./domains/internal-dependencies/explore/InternalDependenciesJava.ipynb)). - [Method Metrics](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/method-metrics-java/MethodMetricsJava.md) shows how the effective number of lines of code and the cyclomatic complexity are distributed across the methods in the code ([Notebook](./jupyter/MethodMetricsJava.ipynb)). - [Node Embeddings](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/node-embeddings-java/NodeEmbeddingsJava.md) shows how to generate node embeddings and to further reduce their dimensionality to be able to visualize them in a 2D plot ([Notebook](./jupyter/NodeEmbeddingsJava.ipynb)). -- [Object Oriented Design Quality Metrics](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/object-oriented-design-metrics-java/ObjectOrientedDesignMetricsJava.md) is based on [OO Design Quality Metrics by Robert Martin](https://api.semanticscholar.org/CorpusID:18246616) ([Notebook](./jupyter/ObjectOrientedDesignMetricsJava.ipynb)). +- [Object Oriented Design Quality Metrics](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/object-oriented-design-metrics-java/ObjectOrientedDesignMetricsJava.md) is based on [OO Design Quality Metrics by Robert Martin](https://api.semanticscholar.org/CorpusID:18246616) ([Notebook](./domains/internal-dependencies/explore/ObjectOrientedDesignMetricsJava.ipynb)). - [Overview](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/overview-java/OverviewJava.md) contains overall statistics and details about methods and their complexity. ([Notebook](./jupyter/OverviewJava.ipynb)). -- [Visibility Metrics](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/visibility-metrics-java/VisibilityMetricsJava.md) ([Notebook](./jupyter/VisibilityMetricsJava.ipynb)). -- [Wordcloud](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/wordcloud/Wordcloud.md) contains a visual representation of package and class names ([Notebook](./jupyter/Wordcloud.ipynb)). +- [Visibility Metrics](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/visibility-metrics-java/VisibilityMetricsJava.md) ([Notebook](./domains/internal-dependencies/explore/VisibilityMetricsJava.ipynb)). +- [Wordcloud](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/wordcloud/Wordcloud.md) contains a visual representation of package and class names ([Notebook](./domains/internal-dependencies/explore/Wordcloud.ipynb)). - [Java Archetypes Treemap](https://github.com/JohT/code-graph-analysis-examples/blob/main/analysis-results/AxonFramework/latest/anomaly-detection/JavaTreemap2ArchetypesOverviewPerDirectory.svg) ([Python Script](./domains/anomaly-detection/treemapVisualizations.py)) ### :blue_book: Graph Data Science Reports diff --git a/cypher/Metrics/Calculate_and_set_Abstractness_for_Java.cypher b/cypher/Metrics/Calculate_and_set_Abstractness_for_Java.cypher deleted file mode 100644 index d0c268190..000000000 --- a/cypher/Metrics/Calculate_and_set_Abstractness_for_Java.cypher +++ /dev/null @@ -1,28 +0,0 @@ -//Calculate and set Abstractness for Java Packages including Counts. Requires "Add_file_name and_extension.cypher". - -MATCH (package:Java:Package) -MATCH (artifact:Artifact)-[:CONTAINS]->(package) - WITH artifact.name AS artifactName - ,package - ,count{(package)-[:CONTAINS]->(:Type)} AS numberTypes - ,count{(package)-[:CONTAINS]->(:Class{abstract:true})} AS numberAbstractClasses - ,count{(package)-[:CONTAINS]->(:Annotation)} AS numberAnnotations - ,count{(package)-[:CONTAINS]->(:Interface)} AS numberInterfaces - WITH * - ,numberInterfaces + numberAnnotations + numberAbstractClasses AS numberAbstractTypes - ,numberInterfaces + numberAnnotations + (numberAbstractClasses * 0.7) AS weightedAbstractTypes - WITH * - ,toFloat(weightedAbstractTypes) / (numberTypes + 1E-38) AS abstractness - SET package.abstractness = abstractness - ,package.numberOfAbstractTypes = numberAbstractTypes - ,package.numberOfAbstractClasses = numberAbstractClasses - ,package.numberOfTypes = numberTypes -RETURN artifactName - ,package.fqn AS fullQualifiedPackageName - ,package.name AS packageName - ,abstractness - ,numberAbstractTypes - ,numberTypes - ,numberAbstractClasses - ,weightedAbstractTypes -ORDER BY abstractness ASC, numberTypes DESC \ No newline at end of file diff --git a/cypher/Metrics/Calculate_and_set_Abstractness_for_Java_including_Subpackages.cypher b/cypher/Metrics/Calculate_and_set_Abstractness_for_Java_including_Subpackages.cypher deleted file mode 100644 index 6958d9f3d..000000000 --- a/cypher/Metrics/Calculate_and_set_Abstractness_for_Java_including_Subpackages.cypher +++ /dev/null @@ -1,37 +0,0 @@ -//Calculate and set Abstractness for Java Packages including sub-packages. Requires "Add_file_name and_extension.cypher". - -MATCH path = (package:Java:Package)-[:CONTAINS*0..]->(subpackage:Java:Package) - WITH * - ,EXISTS{ - MATCH (package)<-[:CONTAINS]-(ancestor:Package)-[:CONTAINS]->(sibling:Package) - WHERE sibling <> package - } AS hasSiblingPackages - ,EXISTS{ (package)-[:CONTAINS]->(:Type) } AS containsTypes -WHERE hasSiblingPackages OR containsTypes -MATCH (artifact:Artifact)-[:CONTAINS]->(package) - WITH artifact.name AS artifactName - ,package - ,sum(subpackage.numberOfTypes) AS numberTypes - ,sum(subpackage.numberOfAbstractTypes) AS numberAbstractTypes - ,sum(subpackage.numberOfAbstractClasses) AS numberAbstractClasses - ,count(path) - 1 AS numberOfIncludedSubPackages - ,max(length(path)) AS maxSubpackageDepth - WITH * - // Calculate abstract classes out of abstract types and then add 70% of them back in (weighted) - ,numberAbstractTypes - (numberAbstractClasses * 0.3) AS weightedAbstractTypes - WITH * - ,toFloat(weightedAbstractTypes) / (numberTypes + 1E-38) AS abstractness - SET package.abstractnessIncludingSubpackages = abstractness - ,package.numberOfAbstractTypesIncludingSubpackages = numberAbstractTypes - ,package.numberOfTypesIncludingSubpackages = numberTypes -RETURN artifactName - ,package.fqn AS fullQualifiedPackageName - ,package.name AS packageName - ,abstractness - ,numberAbstractTypes - ,numberTypes - ,numberAbstractClasses - ,weightedAbstractTypes - ,numberOfIncludedSubPackages - ,maxSubpackageDepth -ORDER BY abstractness ASC, maxSubpackageDepth DESC, numberTypes DESC \ No newline at end of file diff --git a/cypher/Metrics/Calculate_and_set_Abstractness_for_Typescript.cypher b/cypher/Metrics/Calculate_and_set_Abstractness_for_Typescript.cypher deleted file mode 100644 index 2289a2626..000000000 --- a/cypher/Metrics/Calculate_and_set_Abstractness_for_Typescript.cypher +++ /dev/null @@ -1,29 +0,0 @@ -//Calculate and set Abstractness for Typescript Modules - -MATCH (module:TS:Module) -// Get the project of the external module if available -OPTIONAL MATCH (projectdir:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(module) - WITH reverse(split(reverse(projectdir.absoluteFileName), '/')[0]) AS projectName - ,module - ,count{(module)-[:EXPORTS]->(:TS)} AS numberTypes - ,count{(module)-[:EXPORTS]->(:Class{abstract:true})} AS numberAbstractClasses - ,count{(module)-[:EXPORTS]->(:TypeAlias)} AS numberTypeAliases - ,count{(module)-[:EXPORTS]->(:Interface)} AS numberInterfaces - WITH * - ,numberInterfaces + numberTypeAliases + numberAbstractClasses AS numberAbstractTypes - ,numberInterfaces + numberTypeAliases + (numberAbstractClasses * 0.7) AS weightedAbstractTypes - WITH * - ,toFloat(weightedAbstractTypes) / (numberTypes + 1E-38) AS abstractness - SET module.abstractness = abstractness - ,module.numberOfAbstractTypes = numberAbstractTypes - ,module.numberOfAbstractClasses = numberAbstractClasses - ,module.numberOfTypes = numberTypes -RETURN projectName - ,module.globalFqn AS fullQualifiedModuleName - ,module.name AS moduleName - ,abstractness - ,numberAbstractTypes - ,numberTypes - ,numberAbstractClasses - ,weightedAbstractTypes -ORDER BY abstractness ASC, numberTypes DESC \ No newline at end of file diff --git a/cypher/Metrics/Calculate_and_set_Instability_for_Java.cypher b/cypher/Metrics/Calculate_and_set_Instability_for_Java.cypher deleted file mode 100644 index 260b972c9..000000000 --- a/cypher/Metrics/Calculate_and_set_Instability_for_Java.cypher +++ /dev/null @@ -1,38 +0,0 @@ -// Calculate and set Instability for Java. Requires "Add_file_name and_extension.cypher". -// Instability = outgoing / (outgoing + incoming) Dependencies - - MATCH (p:Java:Package) -WHERE p.incomingDependencies > 0 - AND p.outgoingDependencies > 0 - WITH p - ,toFloat(p.outgoingDependencies) / (p.outgoingDependencies + p.incomingDependencies + 1E-38) as instability - ,toFloat(p.outgoingDependentTypes) / (p.outgoingDependentTypes + p.incomingDependentTypes + 1E-38) as instabilityTypes - ,toFloat(p.outgoingDependentInterfaces) / (p.outgoingDependentInterfaces + p.incomingDependentInterfaces + 1E-38) as instabilityInterfaces - ,toFloat(p.outgoingDependentPackages) / (p.outgoingDependentPackages + p.incomingDependentPackages + 1E-38) as instabilityPackages - ,toFloat(p.outgoingDependentArtifacts) / (p.outgoingDependentArtifacts + p.incomingDependentArtifacts + 1E-38) as instabilityArtifacts - SET p.instability = instability - ,p.instabilityTypes = instabilityTypes - ,p.instabilityInterfaces = instabilityInterfaces - ,p.instabilityPackages = instabilityPackages - ,p.instabilityArtifacts = instabilityArtifacts - WITH p - ,instability - ,instabilityTypes - ,instabilityInterfaces - ,instabilityPackages - ,instabilityArtifacts -MATCH (artifact:Artifact)-[:CONTAINS]->(p) -RETURN artifact.name AS artifactName - ,p.fqn AS fullQualifiedPackageName - ,p.name AS packageName - ,instability - ,instabilityTypes - ,instabilityInterfaces - ,instabilityPackages - ,instabilityArtifacts - ,p.outgoingDependencies, p.incomingDependencies - ,p.outgoingDependentTypes, p.incomingDependentTypes - ,p.outgoingDependentInterfaces, p.incomingDependentInterfaces - ,p.outgoingDependentPackages, p.incomingDependentPackages - ,p.outgoingDependentArtifacts, p.incomingDependentArtifacts -ORDER BY instability ASC, p.fqn ASC \ No newline at end of file diff --git a/cypher/Metrics/Calculate_and_set_Instability_for_Java_Including_Subpackages.cypher b/cypher/Metrics/Calculate_and_set_Instability_for_Java_Including_Subpackages.cypher deleted file mode 100644 index 3b3b45c11..000000000 --- a/cypher/Metrics/Calculate_and_set_Instability_for_Java_Including_Subpackages.cypher +++ /dev/null @@ -1,37 +0,0 @@ -// Calculate and set Instability = outgoing / (outgoing + incoming) Dependencies. Requires "Add_file_name and_extension.cypher". - - MATCH (p:Java:Package) - WHERE p.incomingDependenciesIncludingSubpackages > 0 - AND p.outgoingDependenciesIncludingSubpackages > 0 - WITH p - ,toFloat(p.outgoingDependenciesIncludingSubpackages) / (p.outgoingDependenciesIncludingSubpackages + p.incomingDependenciesIncludingSubpackages + 1E-38) as instability - ,toFloat(p.outgoingDependentTypesIncludingSubpackages) / (p.outgoingDependentTypesIncludingSubpackages + p.incomingDependentTypesIncludingSubpackages + 1E-38) as instabilityTypes - ,toFloat(p.outgoingDependentInterfacesIncludingSubpackages) / (p.outgoingDependentInterfacesIncludingSubpackages + p.incomingDependentInterfacesIncludingSubpackages + 1E-38) as instabilityInterfaces - ,toFloat(p.outgoingDependentPackagesIncludingSubpackages) / (p.outgoingDependentPackagesIncludingSubpackages + p.incomingDependentPackagesIncludingSubpackages + 1E-38) as instabilityPackages - ,toFloat(p.outgoingDependentArtifactsIncludingSubpackages) / (p.outgoingDependentArtifactsIncludingSubpackages + p.incomingDependentArtifactsIncludingSubpackages + 1E-38) as instabilityArtifacts - SET p.instabilityIncludingSubpackages = instability - ,p.instabilityTypesIncludingSubpackages = instabilityTypes - ,p.instabilityInterfacesIncludingSubpackages = instabilityInterfaces - ,p.instabilityPackagesIncludingSubpackages = instabilityPackages - ,p.instabilityArtifactsIncludingSubpackages = instabilityArtifacts - WITH p - ,instability - ,instabilityTypes - ,instabilityInterfaces - ,instabilityPackages - ,instabilityArtifacts - MATCH (artifact:Artifact)-[:CONTAINS]->(p) -RETURN artifact.name AS artifactName - ,p.fqn AS fullQualifiedPackageName - ,p.name AS packageName - ,instability - ,instabilityTypes - ,instabilityInterfaces - ,instabilityPackages - ,instabilityArtifacts - ,p.outgoingDependenciesIncludingSubpackages, p.incomingDependenciesIncludingSubpackages - ,p.outgoingDependentTypesIncludingSubpackages, p.incomingDependentTypesIncludingSubpackages - ,p.outgoingDependentInterfacesIncludingSubpackages, p.incomingDependentInterfacesIncludingSubpackages - ,p.outgoingDependentPackagesIncludingSubpackages, p.incomingDependentPackagesIncludingSubpackages - ,p.outgoingDependentArtifactsIncludingSubpackages, p.incomingDependentArtifactsIncludingSubpackages -ORDER BY instability ASC, p.fqn ASC \ No newline at end of file diff --git a/cypher/Metrics/Calculate_and_set_Instability_for_Typescript.cypher b/cypher/Metrics/Calculate_and_set_Instability_for_Typescript.cypher deleted file mode 100644 index 5c0e434a1..000000000 --- a/cypher/Metrics/Calculate_and_set_Instability_for_Typescript.cypher +++ /dev/null @@ -1,35 +0,0 @@ -// Calculate and set Instability = outgoing / (outgoing + incoming) Dependencies - - MATCH (module:TS:Module) -OPTIONAL MATCH (projectdir:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(module) - WITH module - ,reverse(split(reverse(projectdir.absoluteFileName), '/')[0]) AS projectName - ,toFloat(module.outgoingDependencies) / (module.outgoingDependencies + module.incomingDependencies + 1E-38) as instability - ,toFloat(module.outgoingDependentAbstractTypes) / (module.outgoingDependentAbstractTypes + module.incomingDependentAbstractTypes + 1E-38) as instabilityAbstractTypes - ,toFloat(module.outgoingDependentModules) / (module.outgoingDependentModules + module.incomingDependentModules + 1E-38) as instabilityModules - ,toFloat(module.outgoingDependentPackages) / (module.outgoingDependentPackages + module.incomingDependentPackages + 1E-38) as instabilityPackages - SET module.instability = instability - ,module.instabilityAbstractTypes = instabilityAbstractTypes - ,module.instabilityModules = instabilityModules - ,module.instabilityPackages = instabilityPackages - WITH module - ,projectName - ,instability - ,instabilityAbstractTypes - ,instabilityModules - ,instabilityPackages -WHERE module.incomingDependencies IS NOT NULL - AND module.outgoingDependencies IS NOT NULL -RETURN DISTINCT - projectName - ,module.globalFqn AS fullQualifiedModuleName - ,module.name AS moduleName - ,instability - ,instabilityAbstractTypes - ,instabilityModules - ,instabilityPackages - ,module.outgoingDependencies, module.incomingDependencies - ,module.outgoingDependentAbstractTypes, module.incomingDependentAbstractTypes - ,module.outgoingDependentModules, module.incomingDependentModules - ,module.outgoingDependentPackages, module.incomingDependentPackages -ORDER BY instability ASC, fullQualifiedModuleName ASC \ No newline at end of file diff --git a/cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java.cypher b/cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java.cypher deleted file mode 100644 index 118ad9249..000000000 --- a/cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java.cypher +++ /dev/null @@ -1,11 +0,0 @@ -// Calculate distance between abstractness and instability. Requires "Add_file_name and_extension.cypher". - -MATCH (artifact:Artifact)-[:CONTAINS]->(package:Java:Package) -RETURN artifact.name AS artifactName - ,package.fqn AS fullQualifiedName - ,package.name AS name - ,abs(package.abstractness + package.instability - 1) AS distance - ,package.abstractness AS abstractness - ,package.instability AS instability - ,package.numberOfTypes AS elementsCount - ORDER BY distance DESC, elementsCount DESC \ No newline at end of file diff --git a/cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java_including_subpackages.cypher b/cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java_including_subpackages.cypher deleted file mode 100644 index 754f539ae..000000000 --- a/cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java_including_subpackages.cypher +++ /dev/null @@ -1,14 +0,0 @@ -// Calculate distance between abstractness and instability including subpackages. Requires "Add_file_name and_extension.cypher". - - MATCH (artifact:Artifact)-[:CONTAINS]->(package:Java:Package) - WHERE package.abstractnessIncludingSubpackages IS NOT NULL - AND package.instabilityIncludingSubpackages IS NOT NULL - AND package.numberOfTypesIncludingSubpackages IS NOT NULL -RETURN artifact.name AS artifactName - ,package.fqn AS fullQualifiedName - ,package.name AS name - ,abs(package.abstractnessIncludingSubpackages + package.instabilityIncludingSubpackages - 1) AS distance - ,package.abstractnessIncludingSubpackages AS abstractness - ,package.instabilityIncludingSubpackages AS instability - ,package.numberOfTypesIncludingSubpackages AS elementsCount - ORDER BY distance DESC, elementsCount DESC \ No newline at end of file diff --git a/cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Typescript.cypher b/cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Typescript.cypher deleted file mode 100644 index 576d7f25d..000000000 --- a/cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Typescript.cypher +++ /dev/null @@ -1,12 +0,0 @@ -// Calculate distance between abstractness and instability for Typescript - -MATCH (module:TS:Module) -OPTIONAL MATCH (projectDirectory:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(module) -RETURN reverse(split(reverse(projectDirectory.absoluteFileName), '/')[0]) AS artifactName - ,module.globalFqn AS fullQualifiedName - ,module.localFqn AS name - ,abs(module.abstractness + module.instability - 1) AS distance - ,module.abstractness AS abstractness - ,module.instability AS instability - ,module.numberOfTypes AS elementsCount - ORDER BY distance DESC, elementsCount DESC \ No newline at end of file diff --git a/cypher/Metrics/Count_and_set_abstract_types.cypher b/cypher/Metrics/Count_and_set_abstract_types.cypher deleted file mode 100644 index d68b982d3..000000000 --- a/cypher/Metrics/Count_and_set_abstract_types.cypher +++ /dev/null @@ -1,54 +0,0 @@ -//Count and set abstract types - - MATCH (package:Package) -OPTIONAL MATCH (package)-[:CONTAINS]->(type:Type) - WITH package - ,COUNT(type) AS numberTypes -OPTIONAL MATCH (package)-[:CONTAINS]->(abstract:Class {abstract:true}) - WITH package - ,numberTypes - ,COUNT(abstract) AS numberAbstractClasses -OPTIONAL MATCH (package)-[:CONTAINS]->(enum:Enum) - WITH package - ,numberTypes - ,numberAbstractClasses - ,COUNT(enum) AS numberEnums -OPTIONAL MATCH (package)-[:CONTAINS]->(class:Class) - WITH package - ,numberTypes - ,numberAbstractClasses - ,numberEnums - ,COUNT(class) - numberAbstractClasses + numberEnums AS numberNonAbstractTypes -OPTIONAL MATCH (package)-[:CONTAINS]->(annotation:Annotation) - WITH package - ,numberTypes - ,numberAbstractClasses - ,numberEnums - ,numberNonAbstractTypes - ,COUNT(annotation) AS numberAnnotations -OPTIONAL MATCH (package)-[:CONTAINS]->(interface:Interface) - WITH package - ,numberTypes - ,numberAbstractClasses - ,numberEnums - ,numberNonAbstractTypes - ,numberAnnotations - ,COUNT(interface) AS numberInterfaces - ,COUNT(interface) + numberAbstractClasses + numberAnnotations AS numberAbstractTypes - SET package.numberTypes = numberTypes - ,package.numberNonAbstractTypes = numberNonAbstractTypes - ,package.numberAbstractTypes = numberAbstractTypes - ,package.numberAbstractClasses = numberAbstractClasses - ,package.numberInterfaces = numberInterfaces - ,package.numberAnnotations = numberAnnotations - ,package.numberEnums = numberEnums - RETURN package.fqn AS packageName - ,package.name - ,numberTypes - ,numberNonAbstractTypes - ,numberAbstractTypes - ,numberAbstractClasses - ,numberInterfaces - ,numberAnnotations - ,numberEnums -ORDER BY numberAbstractTypes DESC \ No newline at end of file diff --git a/cypher/Metrics/Get_Abstractness_for_Java.cypher b/cypher/Metrics/Get_Abstractness_for_Java.cypher deleted file mode 100644 index b76bc7100..000000000 --- a/cypher/Metrics/Get_Abstractness_for_Java.cypher +++ /dev/null @@ -1,12 +0,0 @@ -// Get Java Packages with the lowest abstractness first (if set before). Requires "Add_file_name and_extension.cypher". - -MATCH (package:Java:Package) -WHERE package.abstractness IS NOT NULL -MATCH (artifact:Artifact)-[:CONTAINS]->(package) -RETURN artifact.name AS artifactName - ,package.fqn AS fullQualifiedPackageName - ,package.name AS packageName - ,package.abstractness AS abstractness - ,package.numberOfAbstractTypes AS numberAbstractTypes - ,package.numberOfTypes AS numberTypes -ORDER BY abstractness ASC, numberTypes DESC \ No newline at end of file diff --git a/cypher/Metrics/Get_Abstractness_for_Java_including_Subpackages.cypher b/cypher/Metrics/Get_Abstractness_for_Java_including_Subpackages.cypher deleted file mode 100644 index 43ebce7ba..000000000 --- a/cypher/Metrics/Get_Abstractness_for_Java_including_Subpackages.cypher +++ /dev/null @@ -1,13 +0,0 @@ -// Get Java Packages including their sub packages with the lowest abstractness first (if set before). Requires "Add_file_name and_extension.cypher". - - MATCH path = (package:Java:Package)-[:CONTAINS*0..]->(subpackage:Java:Package) - WHERE package.abstractnessIncludingSubpackages IS NOT NULL - MATCH (artifact:Artifact)-[:CONTAINS]->(package) -RETURN artifact.name AS artifactName - ,package.fqn AS fullQualifiedPackageName - ,package.name AS packageName - ,package.abstractnessIncludingSubpackages AS abstractness - ,package.numberOfAbstractTypesIncludingSubpackages AS numberAbstractTypes - ,package.numberOfTypesIncludingSubpackages AS numberTypes - ,max(length(path)) AS maxSubpackageDepth -ORDER BY abstractness ASC, maxSubpackageDepth DESC, numberTypes DESC \ No newline at end of file diff --git a/cypher/Metrics/Get_Abstractness_for_Typescript.cypher b/cypher/Metrics/Get_Abstractness_for_Typescript.cypher deleted file mode 100644 index 4b65f48d1..000000000 --- a/cypher/Metrics/Get_Abstractness_for_Typescript.cypher +++ /dev/null @@ -1,12 +0,0 @@ -// Get Typscript Modules with the lowest abstractness first (if set before) - -MATCH (module:TS:Module) -WHERE module.abstractness IS NOT NULL -OPTIONAL MATCH (projectdir:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(module) -RETURN reverse(split(reverse(projectdir.absoluteFileName), '/')[0]) AS projectName - ,module.globalFqn AS fullQualifiedModuleName - ,module.name AS moduleName - ,module.abstractness AS abstractness - ,module.numberAbstractTypes AS numberAbstractTypes - ,module.numberTypes AS numberTypes -ORDER BY abstractness ASC, numberTypes DESC \ No newline at end of file diff --git a/cypher/Metrics/Get_Incoming_Java_Package_Dependencies.cypher b/cypher/Metrics/Get_Incoming_Java_Package_Dependencies.cypher deleted file mode 100644 index 135fa4f40..000000000 --- a/cypher/Metrics/Get_Incoming_Java_Package_Dependencies.cypher +++ /dev/null @@ -1,15 +0,0 @@ -// Get Java Packages with the most incoming dependencies first (if set before). Requires "Add_file_name and_extension.cypher". - -MATCH (p:Java:Package) -WHERE p.incomingDependencies IS NOT NULL -MATCH (artifact:Artifact)-[:CONTAINS]->(p) -RETURN artifact.name AS artifactName - ,p.fqn AS fullQualifiedPackageName - ,p.name AS packageName - ,p.incomingDependencies AS incomingDependencies - ,p.incomingDependenciesWeight AS incomingDependenciesWeight - ,p.incomingDependentTypes AS incomingDependentTypes - ,p.incomingDependentInterfaces AS incomingDependentInterfaces - ,p.incomingDependentPackages AS incomingDependentPackages - ,p.incomingDependentArtifacts AS incomingDependentArtifacts -ORDER BY incomingDependencies DESC, p.fqn ASC // package with most incoming dependencies first \ No newline at end of file diff --git a/cypher/Metrics/Get_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher b/cypher/Metrics/Get_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher deleted file mode 100644 index c44f03e38..000000000 --- a/cypher/Metrics/Get_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher +++ /dev/null @@ -1,15 +0,0 @@ -// Get Java Packages including their sub-packages with the most incoming dependencies first (if set before). Requires "Add_file_name and_extension.cypher". - -MATCH (p:Java:Package) -WHERE p.incomingDependenciesIncludingSubpackages IS NOT NULL -MATCH (artifact:Artifact)-[:CONTAINS]->(p) -RETURN artifact.name AS artifactName - ,p.fqn AS fullQualifiedPackageName - ,p.name AS packageName - ,p.incomingDependenciesIncludingSubpackages AS incomingDependencies - ,p.incomingDependenciesWeightIncludingSubpackages AS incomingDependenciesWeight - ,p.incomingDependentTypesIncludingSubpackages AS incomingDependentTypes - ,p.incomingDependentInterfacesIncludingSubpackages AS incomingDependentInterfaces - ,p.incomingDependentPackagesIncludingSubpackages AS incomingDependentPackages - ,p.incomingDependentArtifactsIncludingSubpackages AS incomingDependentArtifacts -ORDER BY incomingDependencies DESC, p.fqn ASC // package with most incoming dependencies first \ No newline at end of file diff --git a/cypher/Metrics/Get_Incoming_Typescript_Module_Dependencies.cypher b/cypher/Metrics/Get_Incoming_Typescript_Module_Dependencies.cypher deleted file mode 100644 index 2a2f4a93a..000000000 --- a/cypher/Metrics/Get_Incoming_Typescript_Module_Dependencies.cypher +++ /dev/null @@ -1,13 +0,0 @@ -// Get Typscript Modules with the most incoming dependencies first (if set before) - - MATCH (module:TS:Module) - WHERE module.incomingDependencies IS NOT NULL -RETURN module.globalFqn AS fullQualifiedModuleName - ,module.name AS moduleName - ,module.incomingDependencies AS incomingDependencies - ,module.incomingDependenciesWeight AS incomingDependenciesWeight - ,module.incomingDependentAbstractTypes AS incomingDependentAbstractTypes - ,module.incomingDependentAbstractTypeWeight AS incomingDependentAbstractTypeWeight - ,module.incomingDependentModules AS incomingDependentModules - ,module.incomingDependentPackages AS incomingDependentPackages -ORDER BY incomingDependencies DESC, fullQualifiedModuleName ASC \ No newline at end of file diff --git a/cypher/Metrics/Get_Instability_for_Java.cypher b/cypher/Metrics/Get_Instability_for_Java.cypher deleted file mode 100644 index b0706e248..000000000 --- a/cypher/Metrics/Get_Instability_for_Java.cypher +++ /dev/null @@ -1,20 +0,0 @@ -// Get Java Packages with the lowest Instability (outgoing / all dependencies) first (if set before). Requires "Add_file_name and_extension.cypher". -// Instability = outgoing / (outgoing + incoming) Dependencies - - MATCH (p:Java:Package) - WHERE p.instability IS NOT NULL -MATCH (artifact:Artifact)-[:CONTAINS]->(p) - RETURN artifact.name AS artifactName - ,p.fqn AS fullQualifiedPackageName - ,p.name AS packageName - ,p.instability AS instability - ,p.instabilityTypes AS instabilityTypes - ,p.instabilityInterfaces AS instabilityInterfaces - ,p.instabilityPackages AS instabilityPackages - ,p.instabilityArtifacts AS instabilityArtifacts - ,p.outgoingDependencies, p.incomingDependencies - ,p.outgoingDependentTypes, p.incomingDependentTypes - ,p.outgoingDependentInterfaces, p.incomingDependentInterfaces - ,p.outgoingDependentPackages, p.incomingDependentPackages - ,p.outgoingDependentArtifacts, p.incomingDependentArtifacts -ORDER BY instability ASC, p.fqn ASC \ No newline at end of file diff --git a/cypher/Metrics/Get_Instability_for_Java_Including_Subpackages.cypher b/cypher/Metrics/Get_Instability_for_Java_Including_Subpackages.cypher deleted file mode 100644 index 1dde8f731..000000000 --- a/cypher/Metrics/Get_Instability_for_Java_Including_Subpackages.cypher +++ /dev/null @@ -1,20 +0,0 @@ -// Get Java Packages including their sub packages with the lowest Instability. Requires "Add_file_name and_extension.cypher". -// Instability = outgoing / (outgoing + incoming) Dependencies - - MATCH (p:Java:Package) - WHERE p.instabilityIncludingSubpackages IS NOT NULL - MATCH (artifact:Artifact)-[:CONTAINS]->(p) -RETURN artifact.name AS artifactName - ,p.fqn AS fullQualifiedPackageName - ,p.name AS packageName - ,p.instabilityIncludingSubpackages AS instability - ,p.instabilityTypesIncludingSubpackages AS instabilityTypes - ,p.instabilityInterfacesIncludingSubpackages AS instabilityInterfaces - ,p.instabilityPackagesIncludingSubpackages AS instabilityPackages - ,p.instabilityArtifactsIncludingSubpackages AS instabilityArtifacts - ,p.outgoingDependenciesIncludingSubpackages, p.incomingDependenciesIncludingSubpackages - ,p.outgoingDependentTypesIncludingSubpackages, p.incomingDependentTypesIncludingSubpackages - ,p.outgoingDependentInterfacesIncludingSubpackages, p.incomingDependentInterfacesIncludingSubpackages - ,p.outgoingDependentPackagesIncludingSubpackages, p.incomingDependentPackagesIncludingSubpackages - ,p.outgoingDependentArtifactsIncludingSubpackages, p.incomingDependentArtifactsIncludingSubpackages -ORDER BY instability ASC, p.fqn ASC \ No newline at end of file diff --git a/cypher/Metrics/Get_Instability_for_Typescript.cypher b/cypher/Metrics/Get_Instability_for_Typescript.cypher deleted file mode 100644 index c8b21d2c7..000000000 --- a/cypher/Metrics/Get_Instability_for_Typescript.cypher +++ /dev/null @@ -1,17 +0,0 @@ -// Get Typscript Modules with the lowest Instability (outgoing / all dependencies) first (if set before) - - MATCH (module:TS:Module) - WHERE module.instability IS NOT NULL -OPTIONAL MATCH (projectdir:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(module) -RETURN reverse(split(reverse(projectdir.absoluteFileName), '/')[0]) AS projectName - ,module.globalFqn AS fullQualifiedModuleName - ,module.name AS moduleName - ,module.instability AS instability - ,module.instabilityAbstractTypes AS instabilityAbstractTypes - ,module.instabilityModules AS instabilityModules - ,module.instabilityPackages AS instabilityPackages - ,module.outgoingDependencies, module.incomingDependencies - ,module.outgoingDependentAbstractTypes, module.incomingDependentAbstractTypes - ,module.outgoingDependentModules, module.incomingDependentModules - ,module.outgoingDependentPackages, module.incomingDependentPackages -ORDER BY instability ASC, fullQualifiedModuleName ASC \ No newline at end of file diff --git a/cypher/Metrics/Get_Outgoing_Java_Package_Dependencies.cypher b/cypher/Metrics/Get_Outgoing_Java_Package_Dependencies.cypher deleted file mode 100644 index 516cbdf2b..000000000 --- a/cypher/Metrics/Get_Outgoing_Java_Package_Dependencies.cypher +++ /dev/null @@ -1,15 +0,0 @@ -// Get Java Packages with the most outgoing dependencies first (if set before). Requires "Add_file_name and_extension.cypher". - -MATCH (p:Java:Package) -WHERE p.outgoingDependencies IS NOT NULL -MATCH (artifact:Artifact)-[:CONTAINS]->(p) -RETURN artifact.name AS artifactName - ,p.fqn AS fullQualifiedPackageName - ,p.name AS packageName - ,p.outgoingDependencies AS outgoingDependencies - ,p.outgoingDependenciesWeight AS outgoingDependenciesWeight - ,p.outgoingDependentTypes AS outgoingDependentTypes - ,p.outgoingDependentInterfaces AS outgoingDependentInterfaces - ,p.outgoingDependentPackages AS outgoingDependentPackages - ,p.outgoingDependentArtifacts AS outgoingDependentArtifacts -ORDER BY outgoingDependencies DESC, p.fqn ASC // package with most incoming dependencies first \ No newline at end of file diff --git a/cypher/Metrics/Get_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher b/cypher/Metrics/Get_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher deleted file mode 100644 index a4fa01ca7..000000000 --- a/cypher/Metrics/Get_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher +++ /dev/null @@ -1,15 +0,0 @@ -// Get Java Packages including their sub packages with the most outgoing dependencies first (if set before). Requires "Add_file_name and_extension.cypher". - -MATCH (p:Java:Package) -WHERE p.outgoingDependenciesIncludingSubpackages IS NOT NULL -MATCH (artifact:Artifact)-[:CONTAINS]->(p) -RETURN artifact.name AS artifactName - ,p.fqn AS fullQualifiedPackageName - ,p.name AS packageName - ,p.outgoingDependenciesIncludingSubpackages AS outgoingDependencies - ,p.outgoingDependenciesWeightIncludingSubpackages AS outgoingDependenciesWeight - ,p.outgoingDependentTypesIncludingSubpackages AS outgoingDependentTypes - ,p.outgoingDependentInterfacesIncludingSubpackages AS outgoingDependentInterfaces - ,p.outgoingDependentPackagesIncludingSubpackages AS outgoingDependentPackages - ,p.outgoingDependentArtifactsIncludingSubpackages AS outgoingDependentArtifacts -ORDER BY outgoingDependencies DESC, p.fqn ASC // package with most incoming dependencies first \ No newline at end of file diff --git a/cypher/Metrics/Get_Outgoing_Typescript_Module_Dependencies.cypher b/cypher/Metrics/Get_Outgoing_Typescript_Module_Dependencies.cypher deleted file mode 100644 index 2fc0925c3..000000000 --- a/cypher/Metrics/Get_Outgoing_Typescript_Module_Dependencies.cypher +++ /dev/null @@ -1,13 +0,0 @@ -// Get Typscript Modules with the most outgoing dependencies first (if set before) - - MATCH (module:TS:Module) - WHERE module.outgoingDependencies IS NOT NULL -RETURN module.globalFqn AS fullQualifiedModuleName - ,module.name AS sourceName - ,module.outgoingDependencies AS outgoingDependencies - ,module.outgoingDependenciesWeight AS outgoingDependenciesWeight - ,module.outgoingDependentAbstractTypes AS outgoingDependentAbstractTypes - ,module.outgoingDependentAbstractTypeWeight AS outgoingDependentAbstractTypeWeight - ,module.outgoingDependentModules AS outgoingDependentModules - ,module.outgoingDependentPackages AS outgoingDependentPackages -ORDER BY outgoingDependencies DESC, fullQualifiedModuleName ASC \ No newline at end of file diff --git a/cypher/Metrics/Set_Incoming_Java_Package_Dependencies.cypher b/cypher/Metrics/Set_Incoming_Java_Package_Dependencies.cypher deleted file mode 100644 index 4caad9111..000000000 --- a/cypher/Metrics/Set_Incoming_Java_Package_Dependencies.cypher +++ /dev/null @@ -1,33 +0,0 @@ -// Set Incoming Package Dependencies. Requires "Add_file_name and_extension.cypher". - - MATCH (p:Java:Package) - MATCH (artifact:Artifact)-[:CONTAINS]->(p) -OPTIONAL MATCH (p)-[:CONTAINS]->(it:Java:Type)<-[r:DEPENDS_ON]-(et:Java:Type)<-[:CONTAINS]-(ep:Package)<-[:CONTAINS]-(ea:Artifact) -OPTIONAL MATCH (it)<-[:DEPENDS_ON]-(eti:Java:Type:Interface) - WHERE p <> ep - AND p.fqn <> ep.fqn - // AND p.incomingDependencies IS NULL // comment out to recalculate - WITH artifact.name AS artifactName - ,p - ,COUNT(et) AS incomingDependencies - ,SUM(r.weight) AS incomingDependenciesWeight - ,COUNT(DISTINCT et) AS incomingDependentTypes - ,COUNT(DISTINCT eti) AS incomingDependentInterfaces // also included in dependent types - ,COUNT(DISTINCT ep) AS incomingDependentPackages - ,COUNT(DISTINCT ea) - 1 AS incomingDependentArtifacts -ORDER BY incomingDependencies DESC, p.fqn ASC // package with most incoming dependencies first - SET p.incomingDependencies = incomingDependencies - ,p.incomingDependenciesWeight = incomingDependenciesWeight - ,p.incomingDependentTypes = incomingDependentTypes - ,p.incomingDependentInterfaces = incomingDependentInterfaces - ,p.incomingDependentPackages = incomingDependentPackages - ,p.incomingDependentArtifacts = incomingDependentArtifacts - RETURN artifactName - ,p.fqn AS fullQualifiedPackageName - ,p.name AS packageName - ,incomingDependencies - ,incomingDependenciesWeight - ,incomingDependentTypes - ,incomingDependentInterfaces - ,incomingDependentPackages - ,incomingDependentArtifacts diff --git a/cypher/Metrics/Set_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher b/cypher/Metrics/Set_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher deleted file mode 100644 index 5661a4a53..000000000 --- a/cypher/Metrics/Set_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher +++ /dev/null @@ -1,40 +0,0 @@ -// Set Incoming Package Dependencies including sub-packages. Requires "Add_file_name and_extension.cypher". - - MATCH (p:Java:Package) - WITH * - ,EXISTS{ - MATCH (p)<-[:CONTAINS]-(ancestor:Package)-[:CONTAINS]->(sibling:Package) - WHERE sibling <> p - } AS hasSiblingPackages - ,EXISTS{(p)-[:CONTAINS]->(:Type)} AS containsTypes - WHERE hasSiblingPackages OR containsTypes - MATCH (artifact:Artifact)-[:CONTAINS]->(p) -OPTIONAL MATCH (p)-[:CONTAINS*0..]->(sp:Package)-[:CONTAINS]->(st:Java:Type)<-[r:DEPENDS_ON]-(et:Java:Type)<-[:CONTAINS]-(ep:Package)<-[:CONTAINS]-(ea:Artifact) - WHERE NOT ep.fqn starts with p.fqn + '.' - AND ep.fqn <> p.fqn - // AND p.incomingDependenciesIncludingSubpackages IS NULL // comment out to recalculate -OPTIONAL MATCH (st)<-[:DEPENDS_ON]-(ei:Java:Type:Interface) - WITH artifact.name AS artifactName - ,p - ,COUNT(et) AS incomingDependencies - ,SUM(r.weight) AS incomingDependenciesWeight - ,COUNT(DISTINCT et) AS incomingDependentTypes - ,COUNT(DISTINCT ei) AS incomingDependentInterfaces // also included in dependent types - ,COUNT(DISTINCT ep) AS incomingDependentPackages - ,COUNT(DISTINCT ea) - 1 AS incomingDependentArtifacts -ORDER BY incomingDependencies DESC, p.fqn ASC // package with most incoming dependencies first - SET p.incomingDependenciesIncludingSubpackages = incomingDependencies - ,p.incomingDependenciesWeightIncludingSubpackages = incomingDependenciesWeight - ,p.incomingDependentTypesIncludingSubpackages = incomingDependentTypes - ,p.incomingDependentInterfacesIncludingSubpackages = incomingDependentInterfaces - ,p.incomingDependentPackagesIncludingSubpackages = incomingDependentPackages - ,p.incomingDependentArtifactsIncludingSubpackages = incomingDependentArtifacts - RETURN artifactName - ,p.fqn AS fullQualifiedPackageName - ,p.name AS packageName - ,incomingDependencies - ,incomingDependenciesWeight - ,incomingDependentTypes - ,incomingDependentInterfaces - ,incomingDependentPackages - ,incomingDependentArtifacts \ No newline at end of file diff --git a/cypher/Metrics/Set_Incoming_Typescript_Module_Dependencies.cypher b/cypher/Metrics/Set_Incoming_Typescript_Module_Dependencies.cypher deleted file mode 100644 index 0b1fa54f8..000000000 --- a/cypher/Metrics/Set_Incoming_Typescript_Module_Dependencies.cypher +++ /dev/null @@ -1,34 +0,0 @@ -// Set incoming Typscript Module dependencies - -// Get the top level dependency between a Typescript module and other modules that uses it - MATCH (source:TS:Module) -OPTIONAL MATCH (source)<-[moduleDependency:DEPENDS_ON]-(target:TS:Module) - WHERE source <> target -// Get the project of the external module if available -OPTIONAL MATCH (projectdir:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(target) -// Aggregate all gathered information for each (grouped by) source module - WITH source - ,collect(DISTINCT projectdir.absoluteFileName) AS projectNames - ,count(DISTINCT target.globalFqn) AS externalModuleCount - ,sum(moduleDependency.declarationCount) AS declarationCount - ,sum(moduleDependency.abstractTypeCount) AS abstractTypeCount - ,sum(moduleDependency.cardinality) AS totalCardinality - ,sum(moduleDependency.abstractTypeCardinality) AS abstractTypeCardinality - ,collect(DISTINCT target.globalFqn)[0..4] AS externalModuleExamples - SET source.incomingDependencies = declarationCount - ,source.incomingDependenciesWeight = totalCardinality - ,source.incomingDependentAbstractTypes = abstractTypeCount - ,source.incomingDependentAbstractTypeWeight = abstractTypeCardinality - ,source.incomingDependentModules = externalModuleCount - ,source.incomingDependentPackages = size(projectNames) -RETURN source.globalFqn AS fullQualifiedModuleName - ,source.name AS moduleName - ,declarationCount AS incomingDependencies - ,totalCardinality AS incomingDependenciesWeight - ,abstractTypeCount AS incomingDependentAbstractTypes - ,abstractTypeCardinality AS incomingDependentAbstractTypeWeight - ,externalModuleCount AS incomingDependentModules - ,size(projectNames) AS incomingDependentPackages - ,externalModuleExamples - ,projectNames -ORDER BY incomingDependencies DESC, fullQualifiedModuleName ASC // modules with most incoming dependencies first diff --git a/cypher/Metrics/Set_Outgoing_Java_Package_Dependencies.cypher b/cypher/Metrics/Set_Outgoing_Java_Package_Dependencies.cypher deleted file mode 100644 index 6ffa456e8..000000000 --- a/cypher/Metrics/Set_Outgoing_Java_Package_Dependencies.cypher +++ /dev/null @@ -1,33 +0,0 @@ -//Set Outgoing Package Dependencies. Requires "Add_file_name and_extension.cypher". - - MATCH (p:Java:Package) - MATCH (artifact:Artifact)-[:CONTAINS]->(p) -OPTIONAL MATCH (p)-[:CONTAINS]->(it:Java:Type)-[r:DEPENDS_ON]->(et:Java:Type)<-[:CONTAINS]-(ep:Package)<-[:CONTAINS]-(ea:Artifact) -OPTIONAL MATCH (it)-[:DEPENDS_ON]->(eti:Java:Type:Interface) - WHERE p <> ep - AND p.fqn <> ep.fqn - // AND p.incomingDependencies IS NULL // comment out to recalculate - WITH artifact.name AS artifactName - ,p - ,COUNT(et) AS outgoingDependencies - ,SUM(r.weight) AS outgoingDependenciesWeight - ,COUNT(DISTINCT et) AS outgoingDependentTypes - ,COUNT(DISTINCT eti) AS outgoingDependentInterfaces // also included in dependent types - ,COUNT(DISTINCT ep) AS outgoingDependentPackages - ,COUNT(DISTINCT ea) -1 AS outgoingDependentArtifacts -ORDER BY outgoingDependencies DESC, p.fqn ASC // package with most incoming dependencies first - SET p.outgoingDependencies = outgoingDependencies - ,p.outgoingDependenciesWeight = outgoingDependenciesWeight - ,p.outgoingDependentTypes = outgoingDependentTypes - ,p.outgoingDependentInterfaces = outgoingDependentInterfaces - ,p.outgoingDependentPackages = outgoingDependentPackages - ,p.outgoingDependentArtifacts = outgoingDependentArtifacts - RETURN artifactName - ,p.fqn AS fullQualifiedPackageName - ,p.name AS packageName - ,outgoingDependencies - ,outgoingDependenciesWeight - ,outgoingDependentTypes - ,outgoingDependentInterfaces - ,outgoingDependentPackages - ,outgoingDependentArtifacts diff --git a/cypher/Metrics/Set_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher b/cypher/Metrics/Set_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher deleted file mode 100644 index e1a9f2112..000000000 --- a/cypher/Metrics/Set_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher +++ /dev/null @@ -1,40 +0,0 @@ -// Set Outgoing Package Dependencies including sub-packages. Requires "Add_file_name and_extension.cypher". - - MATCH (p:Java:Package) - WITH * - ,EXISTS{ - MATCH (p)<-[:CONTAINS]-(ancestor:Package)-[:CONTAINS]->(sibling:Package) - WHERE sibling <> p - } AS hasSiblingPackages - ,EXISTS{(p)-[:CONTAINS]->(:Type)} AS containsTypes - WHERE hasSiblingPackages OR containsTypes - MATCH (artifact:Artifact)-[:CONTAINS]->(p) -OPTIONAL MATCH (p)-[:CONTAINS*0..]->(sp:Package)-[:CONTAINS]->(st:Java:Type)-[r:DEPENDS_ON]->(et:Java:Type)<-[:CONTAINS]-(ep:Package)<-[:CONTAINS]-(ea:Artifact) - WHERE NOT ep.fqn starts with p.fqn + '.' - AND ep.fqn <> p.fqn - // AND p.outgoingDependenciesIncludingSubpackages IS NULL // comment out to recalculate -OPTIONAL MATCH (st)<-[:DEPENDS_ON]-(ei:Java:Type:Interface) - WITH artifact.name AS artifactName - ,p - ,COUNT(et) AS outgoingDependencies - ,SUM(r.weight) AS outgoingDependenciesWeight - ,COUNT(DISTINCT et) AS outgoingDependentTypes - ,COUNT(DISTINCT ei) AS outgoingDependentInterfaces // also included in dependent types - ,COUNT(DISTINCT ep) AS outgoingDependentPackages - ,COUNT(DISTINCT ea) - 1 AS outgoingDependentArtifacts -ORDER BY outgoingDependencies DESC, p.fqn ASC // package with most incoming dependencies first - SET p.outgoingDependenciesIncludingSubpackages = outgoingDependencies - ,p.outgoingDependenciesWeightIncludingSubpackages = outgoingDependenciesWeight - ,p.outgoingDependentTypesIncludingSubpackages = outgoingDependentTypes - ,p.outgoingDependentInterfacesIncludingSubpackages = outgoingDependentInterfaces - ,p.outgoingDependentPackagesIncludingSubpackages = outgoingDependentPackages - ,p.outgoingDependentArtifactsIncludingSubpackages = outgoingDependentArtifacts - RETURN artifactName - ,p.fqn AS fullQualifiedPackageName - ,p.name AS packageName - ,outgoingDependencies - ,outgoingDependenciesWeight - ,outgoingDependentTypes - ,outgoingDependentInterfaces - ,outgoingDependentPackages - ,outgoingDependentArtifacts \ No newline at end of file diff --git a/cypher/Metrics/Set_Outgoing_Typescript_Module_Dependencies.cypher b/cypher/Metrics/Set_Outgoing_Typescript_Module_Dependencies.cypher deleted file mode 100644 index f4279e813..000000000 --- a/cypher/Metrics/Set_Outgoing_Typescript_Module_Dependencies.cypher +++ /dev/null @@ -1,34 +0,0 @@ -// Set outgoing Typscript Module dependencies - -// Get the top level dependency between a Typescript module and an external modules it uses - MATCH (source:TS:Module) -OPTIONAL MATCH (source)-[moduleDependency:DEPENDS_ON]->(target:ExternalModule) - WHERE NOT EXISTS {(target)-[:IS_IMPLEMENTED_IN]->(source)} -// Get the project of the external module if available -OPTIONAL MATCH (projectdir:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(:TS:Module)<-[:IS_IMPLEMENTED_IN]-(target) -// Aggregate all gathered information for each (grouped by) source module - WITH source - ,collect(DISTINCT projectdir.absoluteFileName) AS projectNames - ,count(DISTINCT target.globalFqn) AS externalModuleCount - ,sum(moduleDependency.declarationCount) AS declarationCount - ,sum(moduleDependency.abstractTypeCount) AS abstractTypeCount - ,sum(moduleDependency.cardinality) AS totalCardinality - ,sum(moduleDependency.abstractTypeCardinality) AS abstractTypeCardinality - ,collect(DISTINCT target.globalFqn)[0..4] AS externalModuleExamples - SET source.outgoingDependencies = declarationCount - ,source.outgoingDependenciesWeight = totalCardinality - ,source.outgoingDependentAbstractTypes = abstractTypeCount - ,source.outgoingDependentAbstractTypeWeight = abstractTypeCardinality - ,source.outgoingDependentModules = externalModuleCount - ,source.outgoingDependentPackages = size(projectNames) -RETURN source.globalFqn AS fullQualifiedModuleName - ,source.name AS moduleName - ,declarationCount AS outgoingDependencies - ,totalCardinality AS outgoingDependenciesWeight - ,abstractTypeCount AS outgoingDependentAbstractTypes - ,abstractTypeCardinality AS outgoingDependentAbstractTypeWeight - ,externalModuleCount AS outgoingDependentModules - ,size(projectNames) AS outgoingDependentPackages - ,externalModuleExamples - ,projectNames -ORDER BY outgoingDependencies DESC, fullQualifiedModuleName ASC diff --git a/cypher/Overview/Words_for_universal_Wordcloud.cypher b/cypher/Overview/Words_for_universal_Wordcloud.cypher deleted file mode 100644 index 0f51bd6d7..000000000 --- a/cypher/Overview/Words_for_universal_Wordcloud.cypher +++ /dev/null @@ -1,17 +0,0 @@ -// Words for universal Wordcloud - -MATCH (named:!Key&!Primitive&!PrimitiveType&!Void&!JavaType&!ResolvedDuplicateType&!ExternalType&!Git) -WHERE named.name > '' - AND named.name <> 'package-info' - AND named.name <> '' - AND named.name <> '' - WITH apoc.text.replace(named.name, '(? 1 -RETURN word -// ,count(*) as numberOfAppearances -//ORDER BY numberOfAppearances DESC, word \ No newline at end of file diff --git a/cypher/Visibility/Global_relative_visibility_statistics_for_elements_for_Typescript.cypher b/cypher/Visibility/Global_relative_visibility_statistics_for_elements_for_Typescript.cypher deleted file mode 100644 index c8370b8de..000000000 --- a/cypher/Visibility/Global_relative_visibility_statistics_for_elements_for_Typescript.cypher +++ /dev/null @@ -1,39 +0,0 @@ -// Global relative visibility statistics for elements for Typescript - - MATCH (project:Directory)<-[:HAS_ROOT]-(:Project)-[:CONTAINS]->(module:TS:Module) - MATCH (module)-[:DECLARES]->(anyElement:TS) -OPTIONAL MATCH (module)-[:EXPORTS]->(exportedElement:TS) - WITH project.absoluteFileName AS projectPath - ,module - ,COUNT(DISTINCT exportedElement) AS exportedElements - ,COUNT(DISTINCT anyElement) AS allElements - WITH projectPath - ,module - ,exportedElements - ,allElements - ,toFloat(exportedElements) / allElements AS relativeVisibility - WITH projectPath - ,SUM(exportedElements) AS exported - ,SUM(allElements) AS all - ,AVG(relativeVisibility) AS average - ,MIN(relativeVisibility) AS min - ,MAX(relativeVisibility) AS max - ,percentileCont(relativeVisibility, 0.25) AS percentile25 - ,percentileCont(relativeVisibility, 0.5) AS percentile50 - ,percentileCont(relativeVisibility, 0.75) AS percentile75 - ,percentileCont(relativeVisibility, 0.90) AS percentile90 - ,percentileCont(relativeVisibility, 0.95) AS percentile95 - ,percentileCont(relativeVisibility, 0.99) AS percentile99 -RETURN projectPath - ,all - ,exported - ,min - ,max - ,average - ,percentile25 - ,percentile50 - ,percentile75 - ,percentile90 - ,percentile95 - ,percentile99 -ORDER BY projectPath \ No newline at end of file diff --git a/cypher/Visibility/Global_relative_visibility_statistics_for_types.cypher b/cypher/Visibility/Global_relative_visibility_statistics_for_types.cypher deleted file mode 100644 index e85a71da3..000000000 --- a/cypher/Visibility/Global_relative_visibility_statistics_for_types.cypher +++ /dev/null @@ -1,35 +0,0 @@ -// Global relative visibility statistics for types. Requires "Add_file_name and_extension.cypher". - - MATCH (artifact:Artifact)-[:CONTAINS]->(package:Package) - MATCH (package)-[:CONTAINS]->(anyType:Type) -OPTIONAL MATCH (package)-[:CONTAINS]->(publicType:Type{visibility:"public"}) - WITH artifact.name AS artifact - ,package - ,COUNT(DISTINCT publicType) AS publicTypes - ,COUNT(DISTINCT anyType) AS allTypes - WITH artifact - ,package - ,publicTypes - ,allTypes - ,toFloat(publicTypes) / allTypes AS relativeVisibility - WITH artifact - ,SUM(publicTypes) AS public - ,SUM(allTypes) AS all - ,AVG(relativeVisibility) AS average - ,MIN(relativeVisibility) AS min - ,MAX(relativeVisibility) AS max - ,percentileCont(relativeVisibility, 0.25) AS percentile25 - ,percentileCont(relativeVisibility, 0.5) AS percentile50 - ,percentileCont(relativeVisibility, 0.75) AS percentile75 - ,percentileCont(relativeVisibility, 0.90) AS percentile90 -RETURN artifact - ,all - ,public - ,min - ,max - ,average - ,percentile25 - ,percentile50 - ,percentile75 - ,percentile90 -ORDER BY artifact \ No newline at end of file diff --git a/cypher/Visibility/Relative_visibility_exported_elements_to_all_elements_per_module_for_Typescript.cypher b/cypher/Visibility/Relative_visibility_exported_elements_to_all_elements_per_module_for_Typescript.cypher deleted file mode 100644 index 161e21273..000000000 --- a/cypher/Visibility/Relative_visibility_exported_elements_to_all_elements_per_module_for_Typescript.cypher +++ /dev/null @@ -1,23 +0,0 @@ -// Relative visibility: exported elements to all elements per module - - MATCH (project:Directory)<-[:HAS_ROOT]-(:Project)-[:CONTAINS]->(module:TS:Module) - MATCH (module)-[:DECLARES]->(moduleElement:TS) -// Check if element is not only declared but also exported. -// Only EXPORTS refers to re-exported elements. -OPTIONAL MATCH (module)-[export:EXPORTS]->(moduleElement) - WITH project.absoluteFileName AS projectPath - ,module - ,count(DISTINCT export) AS exportedElements - ,count(DISTINCT moduleElement) AS allElements - WITH projectPath - ,module - ,exportedElements - ,allElements - ,toFloat(exportedElements) / allElements AS relativeVisibility -RETURN projectPath - ,replace(module.fileName, './', '') AS modulePath - ,module.name AS moduleName - ,exportedElements - ,allElements - ,relativeVisibility -ORDER BY relativeVisibility DESC, allElements DESC, projectPath ASC, moduleName ASC \ No newline at end of file diff --git a/cypher/Visibility/Relative_visibility_public_types_to_all_types_per_package.cypher b/cypher/Visibility/Relative_visibility_public_types_to_all_types_per_package.cypher deleted file mode 100644 index 009a555a3..000000000 --- a/cypher/Visibility/Relative_visibility_public_types_to_all_types_per_package.cypher +++ /dev/null @@ -1,21 +0,0 @@ -// Relative visibility: public types to all types per package. Requires "Add_file_name and_extension.cypher". - - MATCH (artifact:Artifact)-[:CONTAINS]->(package:Package) - MATCH (package)-[:CONTAINS]->(anyType:Type) -OPTIONAL MATCH (package)-[:CONTAINS]->(publicType:Type{visibility:"public"}) - WITH artifact.name AS artifactName - ,package - ,COUNT(DISTINCT publicType) AS publicTypes - ,COUNT(DISTINCT anyType) AS allTypes - WITH artifactName - ,package - ,publicTypes - ,allTypes - ,toFloat(publicTypes) / allTypes AS relativeVisibility -RETURN artifactName - ,package.fqn AS fullQualifiedPackageName - ,package.name AS packageName - ,publicTypes - ,allTypes - ,relativeVisibility -ORDER BY relativeVisibility DESC, allTypes DESC, artifactName ASC, packageName ASC \ No newline at end of file diff --git a/domains/internal-dependencies/COPIED_FILES.md b/domains/internal-dependencies/COPIED_FILES.md deleted file mode 100644 index fe31e1283..000000000 --- a/domains/internal-dependencies/COPIED_FILES.md +++ /dev/null @@ -1,175 +0,0 @@ -# Copied Files Tracking - -This document maps every original file that was copied into this domain to its copy location. -It exists to support a future deprecation follow-up task that will remove or migrate the originals -once this domain is the canonical implementation. - -> **Breaking change notice:** Output directories have changed. See the README for the new structure under `reports/internal-dependencies/`. -> When the old scripts in `scripts/reports/` are eventually removed, a **major version bump** is required. - ---- - -## Cypher Queries - -### Internal Dependencies (14 files) - -| Original | Copy | -|----------|------| -| `cypher/Internal_Dependencies/Candidates_for_Interface_Segregation.cypher` | `queries/internal-dependencies/Candidates_for_Interface_Segregation.cypher` | -| `cypher/Internal_Dependencies/Get_file_distance_as_shortest_contains_path_for_dependencies.cypher` | `queries/internal-dependencies/Get_file_distance_as_shortest_contains_path_for_dependencies.cypher` | -| `cypher/Internal_Dependencies/How_many_classes_compared_to_all_existing_in_the_same_package_are_used_by_dependent_packages_across_different_artifacts.cypher` | `queries/internal-dependencies/How_many_classes_compared_to_all_existing_in_the_same_package_are_used_by_dependent_packages_across_different_artifacts.cypher` | -| `cypher/Internal_Dependencies/How_many_elements_compared_to_all_existing_are_used_by_dependent_modules_for_Typescript.cypher` | `queries/internal-dependencies/How_many_elements_compared_to_all_existing_are_used_by_dependent_modules_for_Typescript.cypher` | -| `cypher/Internal_Dependencies/How_many_packages_compared_to_all_existing_are_used_by_dependent_artifacts.cypher` | `queries/internal-dependencies/How_many_packages_compared_to_all_existing_are_used_by_dependent_artifacts.cypher` | -| `cypher/Internal_Dependencies/Inter_scan_and_project_dependencies_of_Typescript_modules.cypher` | `queries/internal-dependencies/Inter_scan_and_project_dependencies_of_Typescript_modules.cypher` | -| `cypher/Internal_Dependencies/Java_Artifact_build_levels_for_graphviz.cypher` | `queries/internal-dependencies/Java_Artifact_build_levels_for_graphviz.cypher` | -| `cypher/Internal_Dependencies/List_all_Java_artifacts.cypher` | `queries/internal-dependencies/List_all_Java_artifacts.cypher` | -| `cypher/Internal_Dependencies/List_all_Typescript_modules.cypher` | `queries/internal-dependencies/List_all_Typescript_modules.cypher` | -| `cypher/Internal_Dependencies/List_elements_that_are_used_by_many_different_modules_for_Typescript.cypher` | `queries/internal-dependencies/List_elements_that_are_used_by_many_different_modules_for_Typescript.cypher` | -| `cypher/Internal_Dependencies/List_types_that_are_used_by_many_different_packages.cypher` | `queries/internal-dependencies/List_types_that_are_used_by_many_different_packages.cypher` | -| `cypher/Internal_Dependencies/NPM_Package_build_levels_for_graphviz.cypher` | `queries/internal-dependencies/NPM_Package_build_levels_for_graphviz.cypher` | -| `cypher/Internal_Dependencies/Set_file_distance_as_shortest_contains_path_for_dependencies.cypher` | `queries/internal-dependencies/Set_file_distance_as_shortest_contains_path_for_dependencies.cypher` | -| `cypher/Internal_Dependencies/Typescript_Module_build_levels_for_graphviz.cypher` | `queries/internal-dependencies/Typescript_Module_build_levels_for_graphviz.cypher` | - -### Cyclic Dependencies (7 of 9 files) - -Excluded: `Cyclic_Dependencies_Concatenated.cypher` and `Cyclic_Dependencies_as_Nodes.cypher` — unreferenced by any script or notebook. - -| Original | Copy | -|----------|------| -| `cypher/Cyclic_Dependencies/Cyclic_Dependencies.cypher` | `queries/cyclic-dependencies/Cyclic_Dependencies.cypher` | -| `cypher/Cyclic_Dependencies/Cyclic_Dependencies_between_Artifacts_as_unwinded_List.cypher` | `queries/cyclic-dependencies/Cyclic_Dependencies_between_Artifacts_as_unwinded_List.cypher` | -| `cypher/Cyclic_Dependencies/Cyclic_Dependencies_Breakdown_Backward_Only_for_Typescript.cypher` | `queries/cyclic-dependencies/Cyclic_Dependencies_Breakdown_Backward_Only_for_Typescript.cypher` | -| `cypher/Cyclic_Dependencies/Cyclic_Dependencies_Breakdown_Backward_Only.cypher` | `queries/cyclic-dependencies/Cyclic_Dependencies_Breakdown_Backward_Only.cypher` | -| `cypher/Cyclic_Dependencies/Cyclic_Dependencies_Breakdown_for_Typescript.cypher` | `queries/cyclic-dependencies/Cyclic_Dependencies_Breakdown_for_Typescript.cypher` | -| `cypher/Cyclic_Dependencies/Cyclic_Dependencies_Breakdown.cypher` | `queries/cyclic-dependencies/Cyclic_Dependencies_Breakdown.cypher` | -| `cypher/Cyclic_Dependencies/Cyclic_Dependencies_for_Typescript.cypher` | `queries/cyclic-dependencies/Cyclic_Dependencies_for_Typescript.cypher` | - -### Path Finding (15 files) - -| Original | Copy | -|----------|------| -| `cypher/Path_Finding/Path_Finding_1_Create_Projection.cypher` | `queries/path-finding/Path_Finding_1_Create_Projection.cypher` | -| `cypher/Path_Finding/Path_Finding_2_Estimate_Memory.cypher` | `queries/path-finding/Path_Finding_2_Estimate_Memory.cypher` | -| `cypher/Path_Finding/Path_Finding_3_Depth_First_Search_Path.cypher` | `queries/path-finding/Path_Finding_3_Depth_First_Search_Path.cypher` | -| `cypher/Path_Finding/Path_Finding_4_Breadth_First_Search_Path.cypher` | `queries/path-finding/Path_Finding_4_Breadth_First_Search_Path.cypher` | -| `cypher/Path_Finding/Path_Finding_5_All_pairs_shortest_path_distribution_overall.cypher` | `queries/path-finding/Path_Finding_5_All_pairs_shortest_path_distribution_overall.cypher` | -| `cypher/Path_Finding/Path_Finding_5_All_pairs_shortest_path_distribution_per_project.cypher` | `queries/path-finding/Path_Finding_5_All_pairs_shortest_path_distribution_per_project.cypher` | -| `cypher/Path_Finding/Path_Finding_5_All_pairs_shortest_path_examples.cypher` | `queries/path-finding/Path_Finding_5_All_pairs_shortest_path_examples.cypher` | -| `cypher/Path_Finding/Path_Finding_6_Longest_paths_contributors_for_graphviz.cypher` | `queries/path-finding/Path_Finding_6_Longest_paths_contributors_for_graphviz.cypher` | -| `cypher/Path_Finding/Path_Finding_6_Longest_paths_distribution_overall.cypher` | `queries/path-finding/Path_Finding_6_Longest_paths_distribution_overall.cypher` | -| `cypher/Path_Finding/Path_Finding_6_Longest_paths_distribution_per_project.cypher` | `queries/path-finding/Path_Finding_6_Longest_paths_distribution_per_project.cypher` | -| `cypher/Path_Finding/Path_Finding_6_Longest_paths_examples.cypher` | `queries/path-finding/Path_Finding_6_Longest_paths_examples.cypher` | -| `cypher/Path_Finding/Path_Finding_6_Longest_paths_for_graphviz.cypher` | `queries/path-finding/Path_Finding_6_Longest_paths_for_graphviz.cypher` | -| `cypher/Path_Finding/Set_Parameters.cypher` | `queries/path-finding/Set_Parameters.cypher` | -| `cypher/Path_Finding/Set_Parameters_NonDevNpmPackage.cypher` | `queries/path-finding/Set_Parameters_NonDevNpmPackage.cypher` | -| `cypher/Path_Finding/Set_Parameters_Typescript_Module.cypher` | `queries/path-finding/Set_Parameters_Typescript_Module.cypher` | - -### Topological Sort (5 files) - -| Original | Copy | -|----------|------| -| `cypher/Topological_Sort/Set_Parameters.cypher` | `queries/topological-sort/Set_Parameters.cypher` | -| `cypher/Topological_Sort/Topological_Sort_Exists.cypher` | `queries/topological-sort/Topological_Sort_Exists.cypher` | -| `cypher/Topological_Sort/Topological_Sort_List.cypher` | `queries/topological-sort/Topological_Sort_List.cypher` | -| `cypher/Topological_Sort/Topological_Sort_Query.cypher` | `queries/topological-sort/Topological_Sort_Query.cypher` | -| `cypher/Topological_Sort/Topological_Sort_Write.cypher` | `queries/topological-sort/Topological_Sort_Write.cypher` | - -### Exploration Queries (3 files — not executed by CSV entry point) - -| Original | Copy | -|----------|------| -| `cypher/Artifact_Dependencies/Artifacts_with_duplicate_packages.cypher` | `queries/exploration/Artifacts_with_duplicate_packages.cypher` | -| `cypher/Java/Annotated_code_elements.cypher` | `queries/exploration/Annotated_code_elements.cypher` | -| `cypher/Overview/Words_for_universal_Wordcloud.cypher` | `queries/exploration/Words_for_universal_Wordcloud.cypher` | - -### Object-Oriented Design Metrics (28 files) - -Queries compute Instability, Abstractness, and Distance from Main Sequence for Java packages (with and without sub-packages) and TypeScript modules — based on the patterns in `ObjectOrientedDesignMetricsCsv.sh` and the `ObjectOrientedDesignMetricsJava/Typescript.ipynb` notebooks. - -| Original | Copy | -|----------|------| -| `cypher/Metrics/Count_and_set_abstract_types.cypher` | `queries/object-oriented-design-metrics/Count_and_set_abstract_types.cypher` | -| `cypher/Metrics/Get_Incoming_Java_Package_Dependencies.cypher` | `queries/object-oriented-design-metrics/Get_Incoming_Java_Package_Dependencies.cypher` | -| `cypher/Metrics/Set_Incoming_Java_Package_Dependencies.cypher` | `queries/object-oriented-design-metrics/Set_Incoming_Java_Package_Dependencies.cypher` | -| `cypher/Metrics/Get_Outgoing_Java_Package_Dependencies.cypher` | `queries/object-oriented-design-metrics/Get_Outgoing_Java_Package_Dependencies.cypher` | -| `cypher/Metrics/Set_Outgoing_Java_Package_Dependencies.cypher` | `queries/object-oriented-design-metrics/Set_Outgoing_Java_Package_Dependencies.cypher` | -| `cypher/Metrics/Get_Instability_for_Java.cypher` | `queries/object-oriented-design-metrics/Get_Instability_for_Java.cypher` | -| `cypher/Metrics/Calculate_and_set_Instability_for_Java.cypher` | `queries/object-oriented-design-metrics/Calculate_and_set_Instability_for_Java.cypher` | -| `cypher/Metrics/Get_Abstractness_for_Java.cypher` | `queries/object-oriented-design-metrics/Get_Abstractness_for_Java.cypher` | -| `cypher/Metrics/Calculate_and_set_Abstractness_for_Java.cypher` | `queries/object-oriented-design-metrics/Calculate_and_set_Abstractness_for_Java.cypher` | -| `cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java.cypher` | `queries/object-oriented-design-metrics/Calculate_distance_between_abstractness_and_instability_for_Java.cypher` | -| `cypher/Metrics/Get_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher` | `queries/object-oriented-design-metrics/Get_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher` | -| `cypher/Metrics/Set_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher` | `queries/object-oriented-design-metrics/Set_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher` | -| `cypher/Metrics/Get_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher` | `queries/object-oriented-design-metrics/Get_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher` | -| `cypher/Metrics/Set_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher` | `queries/object-oriented-design-metrics/Set_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher` | -| `cypher/Metrics/Get_Instability_for_Java_Including_Subpackages.cypher` | `queries/object-oriented-design-metrics/Get_Instability_for_Java_Including_Subpackages.cypher` | -| `cypher/Metrics/Calculate_and_set_Instability_for_Java_Including_Subpackages.cypher` | `queries/object-oriented-design-metrics/Calculate_and_set_Instability_for_Java_Including_Subpackages.cypher` | -| `cypher/Metrics/Get_Abstractness_for_Java_including_Subpackages.cypher` | `queries/object-oriented-design-metrics/Get_Abstractness_for_Java_including_Subpackages.cypher` | -| `cypher/Metrics/Calculate_and_set_Abstractness_for_Java_including_Subpackages.cypher` | `queries/object-oriented-design-metrics/Calculate_and_set_Abstractness_for_Java_including_Subpackages.cypher` | -| `cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java_including_subpackages.cypher` | `queries/object-oriented-design-metrics/Calculate_distance_between_abstractness_and_instability_for_Java_including_subpackages.cypher` | -| `cypher/Metrics/Get_Incoming_Typescript_Module_Dependencies.cypher` | `queries/object-oriented-design-metrics/Get_Incoming_Typescript_Module_Dependencies.cypher` | -| `cypher/Metrics/Set_Incoming_Typescript_Module_Dependencies.cypher` | `queries/object-oriented-design-metrics/Set_Incoming_Typescript_Module_Dependencies.cypher` | -| `cypher/Metrics/Get_Outgoing_Typescript_Module_Dependencies.cypher` | `queries/object-oriented-design-metrics/Get_Outgoing_Typescript_Module_Dependencies.cypher` | -| `cypher/Metrics/Set_Outgoing_Typescript_Module_Dependencies.cypher` | `queries/object-oriented-design-metrics/Set_Outgoing_Typescript_Module_Dependencies.cypher` | -| `cypher/Metrics/Get_Instability_for_Typescript.cypher` | `queries/object-oriented-design-metrics/Get_Instability_for_Typescript.cypher` | -| `cypher/Metrics/Calculate_and_set_Instability_for_Typescript.cypher` | `queries/object-oriented-design-metrics/Calculate_and_set_Instability_for_Typescript.cypher` | -| `cypher/Metrics/Get_Abstractness_for_Typescript.cypher` | `queries/object-oriented-design-metrics/Get_Abstractness_for_Typescript.cypher` | -| `cypher/Metrics/Calculate_and_set_Abstractness_for_Typescript.cypher` | `queries/object-oriented-design-metrics/Calculate_and_set_Abstractness_for_Typescript.cypher` | -| `cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Typescript.cypher` | `queries/object-oriented-design-metrics/Calculate_distance_between_abstractness_and_instability_for_Typescript.cypher` | - -### Visibility Metrics (4 files) - -| Original | Copy | -|----------|------| -| `cypher/Visibility/Global_relative_visibility_statistics_for_types.cypher` | `queries/visibility/Global_relative_visibility_statistics_for_types.cypher` | -| `cypher/Visibility/Relative_visibility_public_types_to_all_types_per_package.cypher` | `queries/visibility/Relative_visibility_public_types_to_all_types_per_package.cypher` | -| `cypher/Visibility/Global_relative_visibility_statistics_for_elements_for_Typescript.cypher` | `queries/visibility/Global_relative_visibility_statistics_for_elements_for_Typescript.cypher` | -| `cypher/Visibility/Relative_visibility_exported_elements_to_all_elements_per_module_for_Typescript.cypher` | `queries/visibility/Relative_visibility_exported_elements_to_all_elements_per_module_for_Typescript.cypher` | - ---- - -## Jupyter Notebooks (11 files) - -| Original | Copy | Metadata Change | -|----------|------|-----------------| -| `jupyter/InternalDependenciesJava.ipynb` | `explore/InternalDependenciesJava.ipynb` | `ValidateJavaInternalDependencies` → `ValidateAlwaysFalse` | -| `jupyter/InternalDependenciesTypescript.ipynb` | `explore/InternalDependenciesTypescript.ipynb` | `ValidateTypescriptModuleDependencies` → `ValidateAlwaysFalse` | -| `jupyter/PathFindingJava.ipynb` | `explore/PathFindingJava.ipynb` | `ValidateJavaPackageDependencies` → `ValidateAlwaysFalse` | -| `jupyter/PathFindingTypescript.ipynb` | `explore/PathFindingTypescript.ipynb` | `ValidateTypescriptModuleDependencies` → `ValidateAlwaysFalse` | -| `jupyter/DependenciesGraphExplorationJava.ipynb` | `explore/DependenciesGraphExplorationJava.ipynb` | Already `ValidateAlwaysFalse` — no change | -| `jupyter/DependenciesGraphExplorationTypescript.ipynb` | `explore/DependenciesGraphExplorationTypescript.ipynb` | Already `ValidateAlwaysFalse` — no change | -| `jupyter/ObjectOrientedDesignMetricsJava.ipynb` | `explore/ObjectOrientedDesignMetricsJava.ipynb` | `ValidateJavaPackageDependencies` → `ValidateAlwaysFalse` | -| `jupyter/ObjectOrientedDesignMetricsTypescript.ipynb` | `explore/ObjectOrientedDesignMetricsTypescript.ipynb` | `ValidateTypescriptModuleDependencies` → `ValidateAlwaysFalse` | -| `jupyter/VisibilityMetricsJava.ipynb` | `explore/VisibilityMetricsJava.ipynb` | `ValidateJavaTypes` → `ValidateAlwaysFalse` | -| `jupyter/VisibilityMetricsTypescript.ipynb` | `explore/VisibilityMetricsTypescript.ipynb` | `ValidateTypescriptModuleDependencies` → `ValidateAlwaysFalse` | -| `jupyter/Wordcloud.ipynb` | `explore/Wordcloud.ipynb` | Validation key set to `ValidateAlwaysFalse` | - -**Note on `Wordcloud.ipynb`**: Only the "Wordcloud of names in code" section is replicated as the automated `wordcloudChart.py` script. The "Wordcloud of git authors" section is explore-only and is not included in any automated report. - ---- - -## Scripts Referenced but NOT Copied (Central Pipeline) - -These scripts are sourced from the central `scripts/` directory and are not duplicated: - -| Script | Used By | -|--------|---------| -| `scripts/executeQueryFunctions.sh` | All entry point scripts | -| `scripts/projectionFunctions.sh` | CSV, Visualization entry points | -| `scripts/cleanupAfterReportGeneration.sh` | CSV, Python, Visualization, Markdown scripts | -| `scripts/visualization/visualizeQueryResults.sh` | Graph visualization script | -| `scripts/markdown/embedMarkdownIncludes.sh` | Markdown summary script | - ---- - -## Old Scripts to Deprecate (Follow-up Task) - -Once this domain is the canonical implementation, the following scripts in `scripts/reports/` can be deprecated: - -| Old Script | Replacement | -|-----------|-------------| -| `scripts/reports/InternalDependenciesCsv.sh` | `domains/internal-dependencies/internalDependenciesCsv.sh` | -| `scripts/reports/PathFindingCsv.sh` | `domains/internal-dependencies/internalDependenciesCsv.sh` | -| `scripts/reports/TopologicalSortCsv.sh` | `domains/internal-dependencies/internalDependenciesCsv.sh` | -| `scripts/reports/InternalDependenciesVisualization.sh` | `domains/internal-dependencies/graphs/internalDependenciesGraphs.sh` | -| `scripts/reports/PathFindingVisualization.sh` | `domains/internal-dependencies/graphs/internalDependenciesGraphs.sh` | diff --git a/domains/internal-dependencies/explore/InternalDependenciesJava.ipynb b/domains/internal-dependencies/explore/InternalDependenciesJava.ipynb index 97c140ab1..cc29aed67 100644 --- a/domains/internal-dependencies/explore/InternalDependenciesJava.ipynb +++ b/domains/internal-dependencies/explore/InternalDependenciesJava.ipynb @@ -144,7 +144,7 @@ "metadata": {}, "outputs": [], "source": [ - "artifacts = query_cypher_to_data_frame(\"../cypher/Internal_Dependencies/List_all_Java_artifacts.cypher\")" + "artifacts = query_cypher_to_data_frame(\"../queries/internal-dependencies/List_all_Java_artifacts.cypher\")" ] }, { @@ -352,7 +352,7 @@ }, "outputs": [], "source": [ - "cyclic_dependencies = query_cypher_to_data_frame(\"../cypher/Cyclic_Dependencies/Cyclic_Dependencies.cypher\")\n", + "cyclic_dependencies = query_cypher_to_data_frame(\"../queries/cyclic-dependencies/Cyclic_Dependencies.cypher\")\n", "cyclic_dependencies.head(40)" ] }, @@ -380,7 +380,7 @@ "metadata": {}, "outputs": [], "source": [ - "cyclic_dependencies_breakdown = query_cypher_to_data_frame(\"../cypher/Cyclic_Dependencies/Cyclic_Dependencies_Breakdown.cypher\",limit=40)\n", + "cyclic_dependencies_breakdown = query_cypher_to_data_frame(\"../queries/cyclic-dependencies/Cyclic_Dependencies_Breakdown.cypher\",limit=40)\n", "cyclic_dependencies_breakdown" ] }, @@ -404,7 +404,7 @@ "metadata": {}, "outputs": [], "source": [ - "cyclic_dependencies_breakdown_backward = query_cypher_to_data_frame(\"../cypher/Cyclic_Dependencies/Cyclic_Dependencies_Breakdown_Backward_Only.cypher\",limit=40)\n", + "cyclic_dependencies_breakdown_backward = query_cypher_to_data_frame(\"../queries/cyclic-dependencies/Cyclic_Dependencies_Breakdown_Backward_Only.cypher\",limit=40)\n", "cyclic_dependencies_breakdown_backward" ] }, @@ -454,7 +454,7 @@ }, "outputs": [], "source": [ - "interface_segregation_candidates=query_cypher_to_data_frame(\"../cypher/Internal_Dependencies/Candidates_for_Interface_Segregation.cypher\", limit=40)\n", + "interface_segregation_candidates=query_cypher_to_data_frame(\"../queries/internal-dependencies/Candidates_for_Interface_Segregation.cypher\", limit=40)\n", "interface_segregation_candidates" ] }, @@ -487,7 +487,7 @@ }, "outputs": [], "source": [ - "types_used_by_many_packages=query_cypher_to_data_frame(\"../cypher/Internal_Dependencies/List_types_that_are_used_by_many_different_packages.cypher\", limit=40)\n", + "types_used_by_many_packages=query_cypher_to_data_frame(\"../queries/internal-dependencies/List_types_that_are_used_by_many_different_packages.cypher\", limit=40)\n", "types_used_by_many_packages" ] }, @@ -512,7 +512,7 @@ }, "outputs": [], "source": [ - "used_packages_of_dependent_artifact=query_cypher_to_data_frame(\"../cypher/Internal_Dependencies/How_many_packages_compared_to_all_existing_are_used_by_dependent_artifacts.cypher\",limit=30)\n", + "used_packages_of_dependent_artifact=query_cypher_to_data_frame(\"../queries/internal-dependencies/How_many_packages_compared_to_all_existing_are_used_by_dependent_artifacts.cypher\",limit=30)\n", "used_packages_of_dependent_artifact" ] }, @@ -536,7 +536,7 @@ }, "outputs": [], "source": [ - "used_types_of_dependent_artifact=query_cypher_to_data_frame(\"../cypher/Internal_Dependencies/How_many_classes_compared_to_all_existing_in_the_same_package_are_used_by_dependent_packages_across_different_artifacts.cypher\", limit=30)\n", + "used_types_of_dependent_artifact=query_cypher_to_data_frame(\"../queries/internal-dependencies/How_many_classes_compared_to_all_existing_in_the_same_package_are_used_by_dependent_packages_across_different_artifacts.cypher\", limit=30)\n", "used_types_of_dependent_artifact" ] }, @@ -561,7 +561,7 @@ "metadata": {}, "outputs": [], "source": [ - "duplicate_package_names_across_artifacts=query_cypher_to_data_frame(\"../cypher/Artifact_Dependencies/Artifacts_with_duplicate_packages.cypher\", limit=30)\n", + "duplicate_package_names_across_artifacts=query_cypher_to_data_frame(\"../queries/exploration/Artifacts_with_duplicate_packages.cypher\", limit=30)\n", "duplicate_package_names_across_artifacts" ] }, @@ -582,7 +582,7 @@ "metadata": {}, "outputs": [], "source": [ - "annotated_elements=query_cypher_to_data_frame(\"../cypher/Java/Annotated_code_elements.cypher\", limit=30)\n", + "annotated_elements=query_cypher_to_data_frame(\"../queries/exploration/Annotated_code_elements.cypher\", limit=30)\n", "annotated_elements" ] }, @@ -603,8 +603,8 @@ "metadata": {}, "outputs": [], "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Internal_Dependencies/Get_file_distance_as_shortest_contains_path_for_dependencies.cypher\",\n", - " \"../cypher/Internal_Dependencies/Set_file_distance_as_shortest_contains_path_for_dependencies.cypher\", limit=20)" + "query_first_non_empty_cypher_to_data_frame(\"../queries/internal-dependencies/Get_file_distance_as_shortest_contains_path_for_dependencies.cypher\",\n", + " \"../queries/internal-dependencies/Set_file_distance_as_shortest_contains_path_for_dependencies.cypher\", limit=20)" ] } ], diff --git a/domains/internal-dependencies/explore/InternalDependenciesTypescript.ipynb b/domains/internal-dependencies/explore/InternalDependenciesTypescript.ipynb index b8bf1d72b..06784b256 100644 --- a/domains/internal-dependencies/explore/InternalDependenciesTypescript.ipynb +++ b/domains/internal-dependencies/explore/InternalDependenciesTypescript.ipynb @@ -144,7 +144,7 @@ "metadata": {}, "outputs": [], "source": [ - "internalModules = query_cypher_to_data_frame(\"../cypher/Internal_Dependencies/List_all_Typescript_modules.cypher\")" + "internalModules = query_cypher_to_data_frame(\"../queries/internal-dependencies/List_all_Typescript_modules.cypher\")" ] }, { @@ -314,7 +314,7 @@ }, "outputs": [], "source": [ - "cyclic_dependencies = query_cypher_to_data_frame(\"../cypher/Cyclic_Dependencies/Cyclic_Dependencies_for_Typescript.cypher\")\n", + "cyclic_dependencies = query_cypher_to_data_frame(\"../queries/cyclic-dependencies/Cyclic_Dependencies_for_Typescript.cypher\")\n", "cyclic_dependencies.head(40)" ] }, @@ -342,7 +342,7 @@ "metadata": {}, "outputs": [], "source": [ - "cyclic_dependencies_breakdown = query_cypher_to_data_frame(\"../cypher/Cyclic_Dependencies/Cyclic_Dependencies_Breakdown_for_Typescript.cypher\",limit=40)\n", + "cyclic_dependencies_breakdown = query_cypher_to_data_frame(\"../queries/cyclic-dependencies/Cyclic_Dependencies_Breakdown_for_Typescript.cypher\",limit=40)\n", "cyclic_dependencies_breakdown" ] }, @@ -366,7 +366,7 @@ "metadata": {}, "outputs": [], "source": [ - "cyclic_dependencies_breakdown_backward = query_cypher_to_data_frame(\"../cypher/Cyclic_Dependencies/Cyclic_Dependencies_Breakdown_Backward_Only_for_Typescript.cypher\",limit=40)\n", + "cyclic_dependencies_breakdown_backward = query_cypher_to_data_frame(\"../queries/cyclic-dependencies/Cyclic_Dependencies_Breakdown_Backward_Only_for_Typescript.cypher\",limit=40)\n", "cyclic_dependencies_breakdown_backward" ] }, @@ -399,7 +399,7 @@ }, "outputs": [], "source": [ - "elements_used_by_many_modules=query_cypher_to_data_frame(\"../cypher/Internal_Dependencies/List_elements_that_are_used_by_many_different_modules_for_Typescript.cypher\", limit=40)\n", + "elements_used_by_many_modules=query_cypher_to_data_frame(\"../queries/internal-dependencies/List_elements_that_are_used_by_many_different_modules_for_Typescript.cypher\", limit=40)\n", "elements_used_by_many_modules" ] }, @@ -424,7 +424,7 @@ }, "outputs": [], "source": [ - "used_packages_of_dependent_artifact=query_cypher_to_data_frame(\"../cypher/Internal_Dependencies/How_many_elements_compared_to_all_existing_are_used_by_dependent_modules_for_Typescript.cypher\",limit=30)\n", + "used_packages_of_dependent_artifact=query_cypher_to_data_frame(\"../queries/internal-dependencies/How_many_elements_compared_to_all_existing_are_used_by_dependent_modules_for_Typescript.cypher\",limit=30)\n", "used_packages_of_dependent_artifact" ] }, @@ -445,8 +445,8 @@ "metadata": {}, "outputs": [], "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Internal_Dependencies/Get_file_distance_as_shortest_contains_path_for_dependencies.cypher\",\n", - " \"../cypher/Internal_Dependencies/Set_file_distance_as_shortest_contains_path_for_dependencies.cypher\", limit=20)" + "query_first_non_empty_cypher_to_data_frame(\"../queries/internal-dependencies/Get_file_distance_as_shortest_contains_path_for_dependencies.cypher\",\n", + " \"../queries/internal-dependencies/Set_file_distance_as_shortest_contains_path_for_dependencies.cypher\", limit=20)" ] } ], diff --git a/domains/internal-dependencies/explore/ObjectOrientedDesignMetricsJava.ipynb b/domains/internal-dependencies/explore/ObjectOrientedDesignMetricsJava.ipynb index bb600956f..f278d9f12 100644 --- a/domains/internal-dependencies/explore/ObjectOrientedDesignMetricsJava.ipynb +++ b/domains/internal-dependencies/explore/ObjectOrientedDesignMetricsJava.ipynb @@ -151,8 +151,8 @@ }, "outputs": [], "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Incoming_Java_Package_Dependencies.cypher\",\n", - " \"../cypher/Metrics/Set_Incoming_Java_Package_Dependencies.cypher\", limit=20)" + "query_first_non_empty_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Get_Incoming_Java_Package_Dependencies.cypher\",\n", + " \"../queries/object-oriented-design-metrics/Set_Incoming_Java_Package_Dependencies.cypher\", limit=20)" ] }, { @@ -172,8 +172,8 @@ "metadata": {}, "outputs": [], "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher\",\n", - " \"../cypher/Metrics/Set_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher\", limit=20)" + "query_first_non_empty_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Get_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher\",\n", + " \"../queries/object-oriented-design-metrics/Set_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher\", limit=20)" ] }, { @@ -210,8 +210,8 @@ "metadata": {}, "outputs": [], "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Outgoing_Java_Package_Dependencies.cypher\",\n", - " \"../cypher/Metrics/Set_Outgoing_Java_Package_Dependencies.cypher\", limit=20)" + "query_first_non_empty_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Get_Outgoing_Java_Package_Dependencies.cypher\",\n", + " \"../queries/object-oriented-design-metrics/Set_Outgoing_Java_Package_Dependencies.cypher\", limit=20)" ] }, { @@ -232,8 +232,8 @@ "metadata": {}, "outputs": [], "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher\",\n", - " \"../cypher/Metrics/Set_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher\", limit=20)" + "query_first_non_empty_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Get_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher\",\n", + " \"../queries/object-oriented-design-metrics/Set_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher\", limit=20)" ] }, { @@ -273,8 +273,8 @@ "metadata": {}, "outputs": [], "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Instability_for_Java.cypher\",\n", - " \"../cypher/Metrics/Calculate_and_set_Instability_for_Java.cypher\", limit=20)" + "query_first_non_empty_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Get_Instability_for_Java.cypher\",\n", + " \"../queries/object-oriented-design-metrics/Calculate_and_set_Instability_for_Java.cypher\", limit=20)" ] }, { @@ -295,8 +295,8 @@ "metadata": {}, "outputs": [], "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Instability_for_Java_Including_Subpackages.cypher\",\n", - " \"../cypher/Metrics/Calculate_and_set_Instability_for_Java_Including_Subpackages.cypher\", limit=20)" + "query_first_non_empty_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Get_Instability_for_Java_Including_Subpackages.cypher\",\n", + " \"../queries/object-oriented-design-metrics/Calculate_and_set_Instability_for_Java_Including_Subpackages.cypher\", limit=20)" ] }, { @@ -334,8 +334,8 @@ "metadata": {}, "outputs": [], "source": [ - "abstractness = query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Abstractness_for_Java.cypher\",\n", - " \"../cypher/Metrics/Calculate_and_set_Abstractness_for_Java.cypher\")\n", + "abstractness = query_first_non_empty_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Get_Abstractness_for_Java.cypher\",\n", + " \"../queries/object-oriented-design-metrics/Calculate_and_set_Abstractness_for_Java.cypher\")\n", "abstractness.head(30)" ] }, @@ -377,8 +377,8 @@ "metadata": {}, "outputs": [], "source": [ - "abstractnessIncludingSubpackages = query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Abstractness_for_Java_including_Subpackages.cypher\",\n", - " \"../cypher/Metrics/Calculate_and_set_Abstractness_for_Java_including_Subpackages.cypher\")\n", + "abstractnessIncludingSubpackages = query_first_non_empty_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Get_Abstractness_for_Java_including_Subpackages.cypher\",\n", + " \"../queries/object-oriented-design-metrics/Calculate_and_set_Abstractness_for_Java_including_Subpackages.cypher\")\n", "abstractnessIncludingSubpackages.head(30)" ] }, @@ -426,7 +426,7 @@ "metadata": {}, "outputs": [], "source": [ - "instabilityPerAbstractness = query_cypher_to_data_frame(\"../cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java.cypher\")\n", + "instabilityPerAbstractness = query_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Calculate_distance_between_abstractness_and_instability_for_Java.cypher\")\n", "instabilityPerAbstractness.head(30)" ] }, @@ -447,7 +447,7 @@ "metadata": {}, "outputs": [], "source": [ - "instabilityPerAbstractnessIncludingSubpackages = query_cypher_to_data_frame(\"../cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java_including_subpackages.cypher\")\n", + "instabilityPerAbstractnessIncludingSubpackages = query_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Calculate_distance_between_abstractness_and_instability_for_Java_including_subpackages.cypher\")\n", "instabilityPerAbstractnessIncludingSubpackages.head(30)" ] }, diff --git a/domains/internal-dependencies/explore/ObjectOrientedDesignMetricsTypescript.ipynb b/domains/internal-dependencies/explore/ObjectOrientedDesignMetricsTypescript.ipynb index 83d723e3a..5aabfb451 100644 --- a/domains/internal-dependencies/explore/ObjectOrientedDesignMetricsTypescript.ipynb +++ b/domains/internal-dependencies/explore/ObjectOrientedDesignMetricsTypescript.ipynb @@ -149,8 +149,8 @@ "metadata": {}, "outputs": [], "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Incoming_Typescript_Module_Dependencies.cypher\",\n", - " \"../cypher/Metrics/Set_Incoming_Typescript_Module_Dependencies.cypher\", limit=20)" + "query_first_non_empty_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Get_Incoming_Typescript_Module_Dependencies.cypher\",\n", + " \"../queries/object-oriented-design-metrics/Set_Incoming_Typescript_Module_Dependencies.cypher\", limit=20)" ] }, { @@ -187,8 +187,8 @@ "metadata": {}, "outputs": [], "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Outgoing_Typescript_Module_Dependencies.cypher\",\n", - " \"../cypher/Metrics/Set_Outgoing_Typescript_Module_Dependencies.cypher\", limit=20)" + "query_first_non_empty_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Get_Outgoing_Typescript_Module_Dependencies.cypher\",\n", + " \"../queries/object-oriented-design-metrics/Set_Outgoing_Typescript_Module_Dependencies.cypher\", limit=20)" ] }, { @@ -228,8 +228,8 @@ "metadata": {}, "outputs": [], "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Instability_for_Typescript.cypher\",\n", - " \"../cypher/Metrics/Calculate_and_set_Instability_for_Typescript.cypher\", limit=20)" + "query_first_non_empty_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Get_Instability_for_Typescript.cypher\",\n", + " \"../queries/object-oriented-design-metrics/Calculate_and_set_Instability_for_Typescript.cypher\", limit=20)" ] }, { @@ -267,8 +267,8 @@ "metadata": {}, "outputs": [], "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Abstractness_for_Typescript.cypher\",\n", - " \"../cypher/Metrics/Calculate_and_set_Abstractness_for_Typescript.cypher\", limit=20)" + "query_first_non_empty_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Get_Abstractness_for_Typescript.cypher\",\n", + " \"../queries/object-oriented-design-metrics/Calculate_and_set_Abstractness_for_Typescript.cypher\", limit=20)" ] }, { @@ -301,7 +301,7 @@ "metadata": {}, "outputs": [], "source": [ - "instabilityPerAbstractnessTypescript = query_cypher_to_data_frame(\"../cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Typescript.cypher\")\n", + "instabilityPerAbstractnessTypescript = query_cypher_to_data_frame(\"../queries/object-oriented-design-metrics/Calculate_distance_between_abstractness_and_instability_for_Typescript.cypher\")\n", "instabilityPerAbstractnessTypescript.head(30)" ] }, diff --git a/domains/internal-dependencies/explore/PathFindingJava.ipynb b/domains/internal-dependencies/explore/PathFindingJava.ipynb index ce8275721..5cbf5ff83 100644 --- a/domains/internal-dependencies/explore/PathFindingJava.ipynb +++ b/domains/internal-dependencies/explore/PathFindingJava.ipynb @@ -221,15 +221,15 @@ " The number of the dimensions and therefore size of the resulting array of floating point numbers\n", " \"\"\"\n", " \n", - " is_data_missing=query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_0_Check_Projectable.cypher\", parameters).empty\n", + " is_data_missing=query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_0_Check_Projectable.cypher\", parameters).empty\n", " if is_data_missing: return False\n", "\n", - " query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_1_Delete_Projection.cypher\", parameters)\n", - " query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_2_Delete_Subgraph.cypher\", parameters)\n", + " query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_1_Delete_Projection.cypher\", parameters)\n", + " query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_2_Delete_Subgraph.cypher\", parameters)\n", " # To exclude the direction of the relationships use the following line to create the projection:\n", - " # query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_4_Create_Undirected_Projection.cypher\", parameters)\n", - " query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_3_Create_Projection.cypher\", parameters)\n", - " query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_5_Create_Subgraph.cypher\", parameters)\n", + " # query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_4_Create_Undirected_Projection.cypher\", parameters)\n", + " query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_3_Create_Projection.cypher\", parameters)\n", + " query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_5_Create_Subgraph.cypher\", parameters)\n", " return True" ] }, @@ -652,7 +652,7 @@ "outputs": [], "source": [ "print(\"Projection data available: \" + str(is_package_data_available))\n", - "package_projection_statistics=query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_12_Get_Projection_Statistics.cypher\", package_path_finding_parameters)\n", + "package_projection_statistics=query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_12_Get_Projection_Statistics.cypher\", package_path_finding_parameters)\n", "package_projection_statistics" ] }, @@ -674,7 +674,7 @@ "outputs": [], "source": [ "# Execute algorithm \"All pairs shortest path\" and query overall and artifact specific results\n", - "all_pairs_shortest_paths_distribution_per_artifact=query_if_data_available(is_package_data_available, \"../cypher/Path_Finding/Path_Finding_5_All_pairs_shortest_path_distribution_per_project.cypher\", package_path_finding_parameters)" + "all_pairs_shortest_paths_distribution_per_artifact=query_if_data_available(is_package_data_available, \"../queries/path-finding/Path_Finding_5_All_pairs_shortest_path_distribution_per_project.cypher\", package_path_finding_parameters)" ] }, { @@ -939,7 +939,7 @@ "outputs": [], "source": [ "# Execute algorithm \"longest path (for directed acyclic graphs)\" and query overall and artifact specific results\n", - "longest_paths_distribution_per_artifact=query_if_data_available(is_package_data_available, \"../cypher/Path_Finding/Path_Finding_6_Longest_paths_distribution_per_project.cypher\", package_path_finding_parameters)" + "longest_paths_distribution_per_artifact=query_if_data_available(is_package_data_available, \"../queries/path-finding/Path_Finding_6_Longest_paths_distribution_per_project.cypher\", package_path_finding_parameters)" ] }, { @@ -1247,7 +1247,7 @@ "outputs": [], "source": [ "print(\"Projection data available: \" + str(is_artifact_data_available))\n", - "artifact_projection_statistics=query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_12_Get_Projection_Statistics.cypher\", artifact_path_finding_parameters)\n", + "artifact_projection_statistics=query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_12_Get_Projection_Statistics.cypher\", artifact_path_finding_parameters)\n", "artifact_projection_statistics" ] }, @@ -1269,7 +1269,7 @@ "outputs": [], "source": [ "# Execute algorithm \"All pairs shortest path\" and query overall and artifact specific results\n", - "all_pairs_shortest_paths_distribution_for_artifacts=query_if_data_available(is_artifact_data_available, \"../cypher/Path_Finding/Path_Finding_5_All_pairs_shortest_path_distribution_per_project.cypher\", artifact_path_finding_parameters)" + "all_pairs_shortest_paths_distribution_for_artifacts=query_if_data_available(is_artifact_data_available, \"../queries/path-finding/Path_Finding_5_All_pairs_shortest_path_distribution_per_project.cypher\", artifact_path_finding_parameters)" ] }, { @@ -1377,7 +1377,7 @@ "outputs": [], "source": [ "# Execute algorithm \"longest path (for directed acyclic graphs)\" and query overall and artifact specific results\n", - "longest_artifact_paths_distribution=query_if_data_available(is_artifact_data_available, \"../cypher/Path_Finding/Path_Finding_6_Longest_paths_distribution_per_project.cypher\", artifact_path_finding_parameters)" + "longest_artifact_paths_distribution=query_if_data_available(is_artifact_data_available, \"../queries/path-finding/Path_Finding_6_Longest_paths_distribution_per_project.cypher\", artifact_path_finding_parameters)" ] }, { diff --git a/domains/internal-dependencies/explore/PathFindingTypescript.ipynb b/domains/internal-dependencies/explore/PathFindingTypescript.ipynb index 59bdf77fe..1349390b6 100644 --- a/domains/internal-dependencies/explore/PathFindingTypescript.ipynb +++ b/domains/internal-dependencies/explore/PathFindingTypescript.ipynb @@ -221,15 +221,15 @@ " The number of the dimensions and therefore size of the resulting array of floating point numbers\n", " \"\"\"\n", " \n", - " is_data_missing=query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_0_Check_Projectable.cypher\", parameters).empty\n", + " is_data_missing=query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_0_Check_Projectable.cypher\", parameters).empty\n", " if is_data_missing: return False\n", "\n", - " query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_1_Delete_Projection.cypher\", parameters)\n", - " query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_2_Delete_Subgraph.cypher\", parameters)\n", + " query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_1_Delete_Projection.cypher\", parameters)\n", + " query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_2_Delete_Subgraph.cypher\", parameters)\n", " # To exclude the direction of the relationships use the following line to create the projection:\n", - " # query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_4_Create_Undirected_Projection.cypher\", parameters)\n", - " query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_3_Create_Projection.cypher\", parameters)\n", - " query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_5_Create_Subgraph.cypher\", parameters)\n", + " # query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_4_Create_Undirected_Projection.cypher\", parameters)\n", + " query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_3_Create_Projection.cypher\", parameters)\n", + " query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_5_Create_Subgraph.cypher\", parameters)\n", " return True" ] }, @@ -735,7 +735,7 @@ "outputs": [], "source": [ "print(\"Projection data available: \" + str(is_module_data_available))\n", - "module_projection_statistics=query_cypher_to_data_frame(\"../cypher/Dependencies_Projection/Dependencies_12_Get_Projection_Statistics.cypher\", module_path_finding_parameters)\n", + "module_projection_statistics=query_cypher_to_data_frame(\"../../../cypher/Dependencies_Projection/Dependencies_12_Get_Projection_Statistics.cypher\", module_path_finding_parameters)\n", "module_projection_statistics" ] }, @@ -757,7 +757,7 @@ "outputs": [], "source": [ "# Execute algorithm \"All pairs shortest path\" and query overall and project specific results\n", - "all_pairs_shortest_paths_distribution_per_project_and_root_project=query_if_data_available(is_module_data_available, \"../cypher/Path_Finding/Path_Finding_5_All_pairs_shortest_path_distribution_per_project.cypher\", module_path_finding_parameters)" + "all_pairs_shortest_paths_distribution_per_project_and_root_project=query_if_data_available(is_module_data_available, \"../queries/path-finding/Path_Finding_5_All_pairs_shortest_path_distribution_per_project.cypher\", module_path_finding_parameters)" ] }, { @@ -1159,7 +1159,7 @@ "outputs": [], "source": [ "# Execute algorithm \"longest path (for directed acyclic graphs)\" and query overall and project specific results\n", - "longest_paths_distribution_per_project=query_if_data_available(is_module_data_available, \"../cypher/Path_Finding/Path_Finding_6_Longest_paths_distribution_per_project.cypher\", module_path_finding_parameters)" + "longest_paths_distribution_per_project=query_if_data_available(is_module_data_available, \"../queries/path-finding/Path_Finding_6_Longest_paths_distribution_per_project.cypher\", module_path_finding_parameters)" ] }, { diff --git a/domains/internal-dependencies/explore/VisibilityMetricsJava.ipynb b/domains/internal-dependencies/explore/VisibilityMetricsJava.ipynb index 6285bf595..56aaa5b81 100644 --- a/domains/internal-dependencies/explore/VisibilityMetricsJava.ipynb +++ b/domains/internal-dependencies/explore/VisibilityMetricsJava.ipynb @@ -177,7 +177,7 @@ "source": [ "# Query the visibility statistics per artifact (all packages aggregated)\n", "# The results Will be used in multiple tables below.\n", - "relative_visibility_per_artifact_aggregated=query_cypher_to_data_frame(\"../cypher/Visibility/Global_relative_visibility_statistics_for_types.cypher\")" + "relative_visibility_per_artifact_aggregated=query_cypher_to_data_frame(\"../queries/visibility/Global_relative_visibility_statistics_for_types.cypher\")" ] }, { @@ -320,7 +320,7 @@ "source": [ "# Query the visibility statistics per package and artifact (all types aggregated)\n", "# The results Will be used in multiple tables below.\n", - "relative_visibility_per_package=query_cypher_to_data_frame(\"../cypher/Visibility/Relative_visibility_public_types_to_all_types_per_package.cypher\")" + "relative_visibility_per_package=query_cypher_to_data_frame(\"../queries/visibility/Relative_visibility_public_types_to_all_types_per_package.cypher\")" ] }, { diff --git a/domains/internal-dependencies/explore/VisibilityMetricsTypescript.ipynb b/domains/internal-dependencies/explore/VisibilityMetricsTypescript.ipynb index eb4d0cf65..064d288a1 100644 --- a/domains/internal-dependencies/explore/VisibilityMetricsTypescript.ipynb +++ b/domains/internal-dependencies/explore/VisibilityMetricsTypescript.ipynb @@ -185,7 +185,7 @@ "source": [ "# Query the visibility statistics per project (all modules aggregated)\n", "# The results will be used in multiple tables below.\n", - "relative_visibility_per_project_aggregated=query_cypher_to_data_frame(\"../cypher/Visibility/Global_relative_visibility_statistics_for_elements_for_Typescript.cypher\")" + "relative_visibility_per_project_aggregated=query_cypher_to_data_frame(\"../queries/visibility/Global_relative_visibility_statistics_for_elements_for_Typescript.cypher\")" ] }, { @@ -328,7 +328,7 @@ "source": [ "# Query the visibility statistics per module and project (all elements aggregated)\n", "# The results will be used in multiple tables below.\n", - "relative_visibility_per_module=query_cypher_to_data_frame(\"../cypher/Visibility/Relative_visibility_exported_elements_to_all_elements_per_module_for_Typescript.cypher\")" + "relative_visibility_per_module=query_cypher_to_data_frame(\"../queries/visibility/Relative_visibility_exported_elements_to_all_elements_per_module_for_Typescript.cypher\")" ] }, { diff --git a/domains/internal-dependencies/explore/Wordcloud.ipynb b/domains/internal-dependencies/explore/Wordcloud.ipynb index 8b9011e83..1e10b6ef7 100644 --- a/domains/internal-dependencies/explore/Wordcloud.ipynb +++ b/domains/internal-dependencies/explore/Wordcloud.ipynb @@ -211,7 +211,7 @@ "outputs": [], "source": [ "# Query data from graph database\n", - "words = query_cypher_to_data_frame(\"../cypher/Overview/Words_for_universal_Wordcloud.cypher\")\n", + "words = query_cypher_to_data_frame(\"../queries/exploration/Words_for_universal_Wordcloud.cypher\")\n", "words.head(10)" ] }, @@ -241,7 +241,7 @@ "outputs": [], "source": [ "# Query data from graph database\n", - "git_author_words_with_frequency = query_cypher_to_data_frame(\"../cypher/Overview/Words_for_git_author_Wordcloud_with_frequency.cypher\")\n", + "git_author_words_with_frequency = query_cypher_to_data_frame(\"../queries/exploration/Words_for_git_author_Wordcloud_with_frequency.cypher\")\n", "git_author_words_with_frequency.head(10)" ] }, diff --git a/cypher/Overview/Words_for_git_author_Wordcloud_with_frequency.cypher b/domains/internal-dependencies/queries/exploration/Words_for_git_author_Wordcloud_with_frequency.cypher similarity index 100% rename from cypher/Overview/Words_for_git_author_Wordcloud_with_frequency.cypher rename to domains/internal-dependencies/queries/exploration/Words_for_git_author_Wordcloud_with_frequency.cypher diff --git a/jupyter/DependenciesGraphExplorationJava.ipynb b/jupyter/DependenciesGraphExplorationJava.ipynb deleted file mode 100644 index 2a2be55db..000000000 --- a/jupyter/DependenciesGraphExplorationJava.ipynb +++ /dev/null @@ -1,312 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "2f0eabc4", - "metadata": {}, - "source": [ - "## Artifact Dependencies\n", - "\n", - "This report shows graph visualization(s) using JavaScript and might not be exportable to some document formats and are meant for exploration and interactive use. The graph visualization is implemented using the [neovis.js](https://github.com/neo4j-contrib/neovis.js) library. Visualizations with GraphViz turned out to be more effective, so this is not used in the final report, but the code is still available in this Jupyter notebook.\n", - "\n", - "### References\n", - "\n", - "- [neovis.js (GitHub)](https://github.com/neo4j-contrib/neovis.js)\n", - "- [vis-network (GitHub)](https://github.com/visjs/vis-network)\n", - "- [vis network documentation](https://visjs.github.io/vis-network/docs/network)\n", - "- [Neo4j Graph Algorithms Jupyter Notebooks (GitHub)](https://github.com/neo4j-graph-analytics/graph-algorithms-notebooks)\n", - "- [Neo4j Graph Data Science Topological Sort](https://neo4j.com/docs/graph-data-science/current/algorithms/alpha/topological-sort)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8678cc2d", - "metadata": {}, - "outputs": [], - "source": [ - "import os\n", - "from neo4j import GraphDatabase\n", - "from IPython.core.display import Javascript, HTML\n", - "import json" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "437937a1", - "metadata": {}, - "outputs": [], - "source": [ - "# Please set the environment variable \"NEO4J_INITIAL_PASSWORD\" in your shell \n", - "# before starting jupyter notebook to provide the password for the user \"neo4j\". \n", - "# It is not recommended to hardcode the password into jupyter notebook for security reasons.\n", - "\n", - "neo4jUri = \"bolt://localhost:7687\"\n", - "neo4jUser = \"neo4j\"\n", - "neo4jPassword = os.environ.get(\"NEO4J_INITIAL_PASSWORD\")\n", - "\n", - "# Create the database driver to validate the connection\n", - "with GraphDatabase.driver(uri=neo4jUri, auth=(neo4jUser, neo4jPassword)) as driver:\n", - " driver.verify_connectivity()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7f8435ee", - "metadata": {}, - "outputs": [], - "source": [ - "def neo4j_server_configuration(password, uri=\"bolt://localhost:7687\", user=\"neo4j\"):\n", - " return {\n", - " \"neo4j\": {\n", - " \"serverUrl\": uri,\n", - " \"serverUser\": user,\n", - " \"serverPassword\": password\n", - " }\n", - " }" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3dd385c7", - "metadata": {}, - "outputs": [], - "source": [ - "def visualization_configuration(node_distance: int = 200):\n", - " return {\n", - " \"visConfig\": {\n", - " \"nodes\": {\n", - " \"shape\": \"hexagon\",\n", - " \"shadow\": False,\n", - " \"font\": {\n", - " \"strokeWidth\": 4,\n", - " \"strokeColor\": \"#F2F2FF\",\n", - " \"size\": 12\n", - " },\n", - " \"size\": 22,\n", - " \"borderWidth\": 2,\n", - " \"widthConstraint\": {\n", - " \"maximum\": 60\n", - " }\n", - " },\n", - " \"edges\": {\n", - " \"arrows\": {\n", - " \"to\": { \n", - " \"enabled\": True,\n", - " \"scaleFactor\": 0.3\n", - " }\n", - " },\n", - " \"scaling\": {\n", - " \"max\": 6\n", - " }\n", - " },\n", - " \"physics\": {\n", - " \"hierarchicalRepulsion\": {\n", - " \"nodeDistance\": node_distance, # 120\n", - " \"centralGravity\": 0.2, # 0.0\n", - " \"springLength\": 100, # 100\n", - " \"springConstant\": 0.02, # 0.01\n", - " \"damping\": 0.09, # 0.09\n", - " \"avoidOverlap\": 0.9 # 0\n", - " },\n", - " \"solver\": \"hierarchicalRepulsion\" # barnesHut\n", - " },\n", - " \"layout\": {\n", - " \"hierarchical\": {\n", - " \"enabled\": True,\n", - " \"sortMethod\": \"directed\"\n", - " }\n", - " }\n", - " }\n", - " }" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5f15d92e", - "metadata": {}, - "outputs": [], - "source": [ - "cssTemplate = \"\"\"\n", - ".graph-visualization {\n", - " width: 660px;\n", - " height: 660px;\n", - " border: 1px solid lightgray;\n", - "}\n", - "div.vis-tooltip {\n", - " font-size: 6px;\n", - "}\n", - "\"\"\"\n", - "\n", - "# Use JavaScript library neovis.js to render the graph into the HTML above\n", - "javascriptTemplate = \"\"\"\n", - "function draw(NeoVis) {\n", - " configuration.labels[NeoVis.NEOVIS_DEFAULT_CONFIG] = {\n", - " [NeoVis.NEOVIS_ADVANCED_CONFIG]: {\n", - " function: {\n", - " title: NeoVis.objectToTitleHtml // Show all node properties in the tooltip\n", - " }\n", - " }\n", - " }\n", - " configuration.relationships[NeoVis.NEOVIS_DEFAULT_CONFIG] = {\n", - " [NeoVis.NEOVIS_ADVANCED_CONFIG]: {\n", - " function: {\n", - " title: NeoVis.objectToTitleHtml // Show all relationship properties in the tooltip\n", - " }\n", - " }\n", - " }\n", - " console.debug(configuration)\n", - " const neoViz = new NeoVis.default(configuration);\n", - " neoViz.render();\n", - "}\n", - "\n", - "// Use JavaScript library neovis.js to render the graph into the HTML above\n", - "requirejs(['https://unpkg.com/neovis.js@2.1.0'], function(NeoVis){ \n", - " draw(NeoVis);\n", - "}, function (err) {\n", - " throw new Error(\"Failed to load NeoVis:\" + err);\n", - "});\n", - "\"\"\"\n", - "\n", - "htmlTemplate=\"\"\"\n", - "\n", - "\n", - "\n", - " Jupyter Notebook embedded neovis.js visualization\n", - " \n", - "\n", - "\n", - "
\n", - " \n", - "\n", - "\n", - "\"\"\"" - ] - }, - { - "cell_type": "markdown", - "id": "112ee31b", - "metadata": {}, - "source": [ - "## Dependencies Hierarchy\n", - "\n", - "The following hierarchical graphs shows dependencies with the most used and shared elements at the bottom and the ones that use the most dependencies on top. The visualization is limited to the first 20 nodes and their direct dependency ordered descending by their layer (\"maxDistanceFromSource\"). \n", - "\n", - "For the whole list of topologically sorted elements including the hierarchical layer see the detailed report `TopologicalSorted....csv`. It is for example helpful to find out in which order Artifacts need to be build/assembled in case of breaking changes." - ] - }, - { - "cell_type": "markdown", - "id": "cb500716", - "metadata": {}, - "source": [ - "### Hierarchical Java Artifact Dependencies\n", - "\n", - "The following Graph shows up to 60 Java Artifact dependencies in hierarchical form sorted by their topology." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "923e8a0a", - "metadata": {}, - "outputs": [], - "source": [ - "def java_artifact_query_configuration():\n", - " query = \"\"\"\n", - " MATCH (artifact:Java:Artifact:Archive)-[dependency:DEPENDS_ON]->(dependent:Java:Artifact:Archive)\n", - " WHERE artifact.maxDistanceFromSource IS NOT NULL\n", - " AND dependent.maxDistanceFromSource > artifact.maxDistanceFromSource\n", - " RETURN artifact, dependency, dependent\n", - " ORDER BY artifact.maxDistanceFromSource DESC\n", - " ,artifact.maxDistanceFromSource ASC\n", - " ,artifact.topologicalSortIndex ASC\n", - " ,dependent.topologicalSortIndex ASC\n", - " LIMIT 20 \n", - " \"\"\"\n", - " \n", - " return {\n", - " \"initialCypher\": query,\n", - " \"labels\": {\n", - " \"Artifact\": {\n", - " \"label\": \"name\"\n", - " },\n", - " },\n", - " \"relationships\": {\n", - " \"DEPENDS_ON\": {\n", - " \"value\": \"weight\",\n", - " \"label\": False\n", - " }\n", - " }\n", - " }" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "48cd3f44", - "metadata": {}, - "outputs": [], - "source": [ - "htmlElement = {\"containerId\": \"graph-visualization-java-artifacts\"}\n", - "serverConfiguration = neo4j_server_configuration(uri=neo4jUri, user=neo4jUser,password=neo4jPassword)\n", - "\n", - "# Assemble the neovis.js configuration by joining the different parts of it\n", - "graphVisualizationConfiguration = {**htmlElement, **visualization_configuration(), **serverConfiguration, **java_artifact_query_configuration()}\n", - "\n", - "# Assemble the HTML by including CSS and Javascript\n", - "jsonConfiguration = json.dumps(graphVisualizationConfiguration)\n", - "javascriptContent=\"configuration=\" + jsonConfiguration +\"; \" + javascriptTemplate\n", - "htmlContent = htmlTemplate.format(script=javascriptContent, css=cssTemplate, containerId=htmlElement[\"containerId\"])\n", - "\n", - "# Display the HTML\n", - "display(HTML(htmlContent))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "35a24daa", - "metadata": {}, - "outputs": [], - "source": [ - "import time\n", - "time.sleep(6)" - ] - } - ], - "metadata": { - "authors": [ - { - "name": "JohT" - } - ], - "code_graph_analysis_pipeline_data_validation": "ValidateAlwaysFalse", - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.9" - }, - "title": "Neo4j Java Code-Structure Graph" - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/jupyter/DependenciesGraphExplorationTypescript.ipynb b/jupyter/DependenciesGraphExplorationTypescript.ipynb deleted file mode 100644 index 6569d4f00..000000000 --- a/jupyter/DependenciesGraphExplorationTypescript.ipynb +++ /dev/null @@ -1,314 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "2f0eabc4", - "metadata": {}, - "source": [ - "## Artifact Dependencies\n", - "\n", - "This report shows graph visualization(s) using JavaScript and might not be exportable to some document formats and are meant for exploration and interactive use. The graph visualization is implemented using the [neovis.js](https://github.com/neo4j-contrib/neovis.js) library. Visualizations with GraphViz turned out to be more effective, so this is not used in the final report, but the code is still available in this Jupyter notebook.\n", - "\n", - "### References\n", - "\n", - "- [neovis.js (GitHub)](https://github.com/neo4j-contrib/neovis.js)\n", - "- [vis-network (GitHub)](https://github.com/visjs/vis-network)\n", - "- [vis network documentation](https://visjs.github.io/vis-network/docs/network)\n", - "- [Neo4j Graph Algorithms Jupyter Notebooks (GitHub)](https://github.com/neo4j-graph-analytics/graph-algorithms-notebooks)\n", - "- [Neo4j Graph Data Science Topological Sort](https://neo4j.com/docs/graph-data-science/current/algorithms/alpha/topological-sort)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8678cc2d", - "metadata": {}, - "outputs": [], - "source": [ - "import os\n", - "from neo4j import GraphDatabase\n", - "from IPython.core.display import Javascript, HTML\n", - "import json" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "437937a1", - "metadata": {}, - "outputs": [], - "source": [ - "# Please set the environment variable \"NEO4J_INITIAL_PASSWORD\" in your shell \n", - "# before starting jupyter notebook to provide the password for the user \"neo4j\". \n", - "# It is not recommended to hardcode the password into jupyter notebook for security reasons.\n", - "\n", - "neo4jUri = \"bolt://localhost:7687\"\n", - "neo4jUser = \"neo4j\"\n", - "neo4jPassword = os.environ.get(\"NEO4J_INITIAL_PASSWORD\")\n", - "\n", - "# Create the database driver to validate the connection\n", - "with GraphDatabase.driver(uri=neo4jUri, auth=(neo4jUser, neo4jPassword)) as driver:\n", - " driver.verify_connectivity()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7f8435ee", - "metadata": {}, - "outputs": [], - "source": [ - "def neo4j_server_configuration(password, uri=\"bolt://localhost:7687\", user=\"neo4j\"):\n", - " return {\n", - " \"neo4j\": {\n", - " \"serverUrl\": uri,\n", - " \"serverUser\": user,\n", - " \"serverPassword\": password\n", - " }\n", - " }" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3dd385c7", - "metadata": {}, - "outputs": [], - "source": [ - "def visualization_configuration(node_distance: int = 200):\n", - " return {\n", - " \"visConfig\": {\n", - " \"nodes\": {\n", - " \"shape\": \"hexagon\",\n", - " \"shadow\": False,\n", - " \"font\": {\n", - " \"strokeWidth\": 4,\n", - " \"strokeColor\": \"#F2F2FF\",\n", - " \"size\": 12\n", - " },\n", - " \"size\": 22,\n", - " \"borderWidth\": 2,\n", - " \"widthConstraint\": {\n", - " \"maximum\": 60\n", - " }\n", - " },\n", - " \"edges\": {\n", - " \"arrows\": {\n", - " \"to\": { \n", - " \"enabled\": True,\n", - " \"scaleFactor\": 0.3\n", - " }\n", - " },\n", - " \"scaling\": {\n", - " \"max\": 6\n", - " }\n", - " },\n", - " \"physics\": {\n", - " \"hierarchicalRepulsion\": {\n", - " \"nodeDistance\": node_distance, # 120\n", - " \"centralGravity\": 0.2, # 0.0\n", - " \"springLength\": 100, # 100\n", - " \"springConstant\": 0.02, # 0.01\n", - " \"damping\": 0.09, # 0.09\n", - " \"avoidOverlap\": 0.9 # 0\n", - " },\n", - " \"solver\": \"hierarchicalRepulsion\" # barnesHut\n", - " },\n", - " \"layout\": {\n", - " \"hierarchical\": {\n", - " \"enabled\": True,\n", - " \"sortMethod\": \"directed\"\n", - " }\n", - " }\n", - " }\n", - " }" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5f15d92e", - "metadata": {}, - "outputs": [], - "source": [ - "cssTemplate = \"\"\"\n", - ".graph-visualization {\n", - " width: 660px;\n", - " height: 660px;\n", - " border: 1px solid lightgray;\n", - "}\n", - "div.vis-tooltip {\n", - " font-size: 6px;\n", - "}\n", - "\"\"\"\n", - "\n", - "# Use JavaScript library neovis.js to render the graph into the HTML above\n", - "javascriptTemplate = \"\"\"\n", - "function draw(NeoVis) {\n", - " configuration.labels[NeoVis.NEOVIS_DEFAULT_CONFIG] = {\n", - " [NeoVis.NEOVIS_ADVANCED_CONFIG]: {\n", - " function: {\n", - " title: NeoVis.objectToTitleHtml // Show all node properties in the tooltip\n", - " }\n", - " }\n", - " }\n", - " configuration.relationships[NeoVis.NEOVIS_DEFAULT_CONFIG] = {\n", - " [NeoVis.NEOVIS_ADVANCED_CONFIG]: {\n", - " function: {\n", - " title: NeoVis.objectToTitleHtml // Show all relationship properties in the tooltip\n", - " }\n", - " }\n", - " }\n", - " console.debug(configuration)\n", - " const neoViz = new NeoVis.default(configuration);\n", - " neoViz.render();\n", - "}\n", - "\n", - "// Use JavaScript library neovis.js to render the graph into the HTML above\n", - "requirejs(['https://unpkg.com/neovis.js@2.1.0'], function(NeoVis){ \n", - " draw(NeoVis);\n", - "}, function (err) {\n", - " throw new Error(\"Failed to load NeoVis:\" + err);\n", - "});\n", - "\"\"\"\n", - "\n", - "htmlTemplate=\"\"\"\n", - "\n", - "\n", - "\n", - " Jupyter Notebook embedded neovis.js visualization\n", - " \n", - "\n", - "\n", - "
\n", - " \n", - "\n", - "\n", - "\"\"\"" - ] - }, - { - "cell_type": "markdown", - "id": "112ee31b", - "metadata": {}, - "source": [ - "## Dependencies Hierarchy\n", - "\n", - "The following hierarchical graphs shows dependencies with the most used and shared elements at the bottom and the ones that use the most dependencies on top. The visualization is limited to the first 20 nodes and their direct dependency ordered descending by their layer (\"maxDistanceFromSource\"). \n", - "\n", - "For the whole list of topologically sorted elements including the hierarchical layer see the detailed report `TopologicalSorted....csv`. It is for example helpful to find out in which order Artifacts need to be build/assembled in case of breaking changes." - ] - }, - { - "cell_type": "markdown", - "id": "7a97adb1", - "metadata": {}, - "source": [ - "### Hierarchical Typescript Module Dependencies\n", - "\n", - "The following Graph shows up to 20 Typescript Module dependencies in hierarchical form sorted by their topology." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5c344092", - "metadata": {}, - "outputs": [], - "source": [ - "def typescript_module_query_configuration():\n", - " query = \"\"\"\n", - " MATCH (module:TS:Module)-[dependency:DEPENDS_ON]->(dependent:TS:Module)\n", - " WHERE module.maxDistanceFromSource IS NOT NULL\n", - " AND dependent.maxDistanceFromSource > module.maxDistanceFromSource\n", - " RETURN module, dependency, dependent\n", - " ORDER BY module.maxDistanceFromSource DESC\n", - " ,module.maxDistanceFromSource ASC\n", - " ,module.topologicalSortIndex ASC\n", - " ,dependent.topologicalSortIndex ASC\n", - " LIMIT 20 \n", - " \"\"\"\n", - " return {\n", - " \"initialCypher\": query,\n", - " \"defaultLabelConfig\": {\n", - " \"label\": \"name\"\n", - " },\n", - " \"labels\": {\n", - " \"File\": {\n", - " \"label\": \"name\"\n", - " }\n", - " },\n", - " \"relationships\": {\n", - " \"DEPENDS_ON\": {\n", - " \"value\": \"cardinality\",\n", - " \"label\": False\n", - " }\n", - " }\n", - " }" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "dcc6fe3d", - "metadata": {}, - "outputs": [], - "source": [ - "htmlElement = {\"containerId\": \"graph-visualization-typescript-modules\"}\n", - "serverConfiguration = neo4j_server_configuration(uri=neo4jUri, user=neo4jUser,password=neo4jPassword)\n", - "\n", - "# Assemble the neovis.js configuration by joining the different parts of it\n", - "graphVisualizationConfiguration = {**htmlElement, **visualization_configuration(), **serverConfiguration, **typescript_module_query_configuration()}\n", - "\n", - "# Assemble the HTML by including CSS and Javascript\n", - "jsonConfiguration = json.dumps(graphVisualizationConfiguration)\n", - "javascriptContent=\"configuration=\" + jsonConfiguration +\"; \" + javascriptTemplate\n", - "htmlContent = htmlTemplate.format(script=javascriptContent, css=cssTemplate, containerId=htmlElement[\"containerId\"])\n", - "\n", - "# Display the HTML\n", - "display(HTML(htmlContent))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "35a24daa", - "metadata": {}, - "outputs": [], - "source": [ - "import time\n", - "time.sleep(6)" - ] - } - ], - "metadata": { - "authors": [ - { - "name": "JohT" - } - ], - "code_graph_analysis_pipeline_data_validation": "ValidateAlwaysFalse", - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.9" - }, - "title": "Neo4j Typescript Code-Structure Graph" - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/jupyter/ObjectOrientedDesignMetricsJava.ipynb b/jupyter/ObjectOrientedDesignMetricsJava.ipynb deleted file mode 100644 index 1f1320523..000000000 --- a/jupyter/ObjectOrientedDesignMetricsJava.ipynb +++ /dev/null @@ -1,655 +0,0 @@ -{ - "cells": [ - { - "attachments": {}, - "cell_type": "markdown", - "id": "2f0eabc4", - "metadata": {}, - "source": [ - "# Object Oriented Design Quality Metrics\n", - "
\n", - "\n", - "### References\n", - "- [Analyze java package metrics in a graph database](https://joht.github.io/johtizen/data/2023/04/21/java-package-metrics-analysis.html)\n", - "- [Calculate metrics](https://101.jqassistant.org/calculate-metrics/index.html)\n", - "- [jqassistant](https://jqassistant.org)\n", - "- [notebook walks through examples for integrating various packages with Neo4j](https://nicolewhite.github.io/neo4j-jupyter/hello-world.html)\n", - "- [OO Design Quality Metrics](https://api.semanticscholar.org/CorpusID:18246616)\n", - "- [A Validation of Martin's Metric](https://www.researchgate.net/publication/31598248_A_Validation_of_Martin's_Metric)\n", - "- [Neo4j Python Driver](https://neo4j.com/docs/api/python-driver/current)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4191f259", - "metadata": {}, - "outputs": [], - "source": [ - "import os\n", - "import pandas as pd\n", - "import matplotlib.pyplot as plot\n", - "from neo4j import GraphDatabase" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1c5dab37", - "metadata": {}, - "outputs": [], - "source": [ - "# Please set the environment variable \"NEO4J_INITIAL_PASSWORD\" in your shell \n", - "# before starting jupyter notebook to provide the password for the user \"neo4j\". \n", - "# It is not recommended to hardcode the password into jupyter notebook for security reasons.\n", - "\n", - "driver = GraphDatabase.driver(uri=\"bolt://localhost:7687\", auth=(\"neo4j\", os.environ.get(\"NEO4J_INITIAL_PASSWORD\")))\n", - "driver.verify_connectivity()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c1db254b", - "metadata": {}, - "outputs": [], - "source": [ - "def get_cypher_query_from_file(cypher_file_name : str):\n", - " with open(cypher_file_name) as file:\n", - " return ' '.join(file.readlines())\n", - "\n", - "\n", - "def query_cypher_to_data_frame(filename : str, limit: int = -1):\n", - " \"\"\"\n", - " Execute the Cypher query of the given file and returns the result.\n", - " filename : str : The name of the file containing the Cypher query\n", - " limit : int : The optional limit of rows to optimize the query. Default = -1 = no limit\n", - " \"\"\"\n", - " cypher_query = get_cypher_query_from_file(filename)\n", - " if limit > 0:\n", - " cypher_query = \"{query}\\nLIMIT {row_limit}\".format(query = cypher_query, row_limit = limit)\n", - " records, summary, keys = driver.execute_query(cypher_query)\n", - " return pd.DataFrame([r.values() for r in records], columns=keys)\n", - "\n", - "\n", - "def query_first_non_empty_cypher_to_data_frame(*filenames : str, limit: int = -1):\n", - " \"\"\"\n", - " Executes the Cypher queries of the given files and returns the first result that is not empty.\n", - " If all given file names result in empty results, the last (empty) result will be returned.\n", - " By additionally specifying \"limit=\" the \"LIMIT\" keyword will appended to query so that only the first results get returned.\n", - " \"\"\" \n", - " result=pd.DataFrame()\n", - " for filename in filenames:\n", - " result=query_cypher_to_data_frame(filename, limit)\n", - " if not result.empty:\n", - " return result\n", - " return result" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "da9e8edb", - "metadata": {}, - "outputs": [], - "source": [ - "#The following cell uses the build-in %html \"magic\" to override the CSS style for tables to a much smaller size.\n", - "#This is especially needed for PDF export of tables with multiple columns." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "9deaabce", - "metadata": {}, - "outputs": [], - "source": [ - "%%html\n", - "" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "bbb51c78", - "metadata": {}, - "source": [ - "## Incoming Dependencies\n", - "\n", - "Incoming dependencies are also denoted as \"Fan-in\", \"Afferent Coupling\" or \"in-degree\".\n", - "These are the ones that use the listed package. \n", - " \n", - "If these packages get changed, the incoming dependencies might be affected by the change. The more incoming dependencies, the harder it gets to change the code without the need to adapt the dependent code (“rigid code”). Even worse, it might affect the behavior of the dependent code in an unwanted way (“fragile code”).\n", - "\n", - "Since Java Packages are organized hierarchically, incoming dependencies can be count for every package in isolation or by including all of its sub-packages. The latter one is done without top level packages like for example \"org\" or \"org.company\" by assuring that only packages are considered that have other packages or types in the same hierarchy level (\"siblings\")." - ] - }, - { - "cell_type": "markdown", - "id": "b637f8c8", - "metadata": {}, - "source": [ - "#### Table 1a\n", - "- Show the top 20 Java Packages with the most incoming dependencies\n", - "- Set the \"incomingDependencies\" properties on Package nodes." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "9a0a15be", - "metadata": { - "scrolled": true - }, - "outputs": [], - "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Incoming_Java_Package_Dependencies.cypher\",\n", - " \"../cypher/Metrics/Set_Incoming_Java_Package_Dependencies.cypher\", limit=20)" - ] - }, - { - "cell_type": "markdown", - "id": "eb555676", - "metadata": {}, - "source": [ - "#### Table 1b\n", - "- Show the top 20 Java Packages including their sub-packages with the most incoming dependencies\n", - "- Set the property \"incomingDependenciesIncludingSubpackages\" on Package nodes." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "458104c5", - "metadata": {}, - "outputs": [], - "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher\",\n", - " \"../cypher/Metrics/Set_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher\", limit=20)" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "82e9f74c", - "metadata": {}, - "source": [ - "## Outgoing Dependencies\n", - "\n", - "Outgoing dependencies are also denoted as \"Fan-out\", \"Efferent Coupling\" or \"out-degree\".\n", - "These are the ones that are used by the listed package. \n", - "\n", - "Code from other packages and libraries you’re depending on (outgoing) might change over time. The more outgoing changes, the more likely and frequently code changes are needed. This involves time and effort which can be reduced by automation of tests and version updates. Automated tests are crucial to reveal updates, that change the behavior of the code unexpectedly (“fragile code”). As soon as more effort is required, keeping up becomes difficult (“rigid code”). Not being able to use a newer version might not only restrict features, it can get problematic if there are security issues. This might force you to take “fast but ugly” solutions into account which further increases technical dept.\n", - "\n", - "Since Java Packages are organized hierarchically, outgoing dependencies can be count for every package in isolation or by including all of its sub-packages. The latter one is done without top level packages like for example \"org\" or \"org.company\" by assuring that only packages are considered that have other packages or types in the same hierarchy level (\"siblings\")." - ] - }, - { - "cell_type": "markdown", - "id": "8cebfec5", - "metadata": {}, - "source": [ - "#### Table 2a\n", - "\n", - "- Show the top 20 Java Packages with the most outgoing dependencies\n", - "- Set the \"outgoingDependencies\" properties on Package nodes." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a2ec92ab", - "metadata": {}, - "outputs": [], - "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Outgoing_Java_Package_Dependencies.cypher\",\n", - " \"../cypher/Metrics/Set_Outgoing_Java_Package_Dependencies.cypher\", limit=20)" - ] - }, - { - "cell_type": "markdown", - "id": "894b413c", - "metadata": {}, - "source": [ - "#### Table 2b\n", - "\n", - "- Show the top 20 Java Packages including their sub-packages with the most outgoing dependencies\n", - "- Set the property \"outgoingDependenciesIncludingSubpackages\" on Package nodes." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ecd5c9c7", - "metadata": {}, - "outputs": [], - "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher\",\n", - " \"../cypher/Metrics/Set_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher\", limit=20)" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "22f8959e", - "metadata": {}, - "source": [ - "## Instability\n", - "\n", - "$$ Instability = \\frac{Outgoing\\:Dependencies}{Outgoing\\:Dependencies + Incoming\\:Dependencies} $$\n", - "\n", - "*Instability* is expressed as the ratio of the number of outgoing dependencies of a module (i.e., the number of packages that depend on it) to the total number of dependencies (i.e., the sum of incoming and outgoing dependencies).\n", - "\n", - "Small values near zero indicate low *Instability*. With no outgoing but some incoming dependencies the Instability is zero which is denoted as maximally stable. Such code units are more rigid and difficult to change without impacting other parts of the system. If they are changed less because of that, they are considered stable.\n", - "\n", - "Conversely, high values approaching one indicate high *Instability*. With some outgoing dependencies but no incoming ones the *Instability* is denoted as maximally unstable. Such code units are easier to change without affecting other modules, making them more flexible and less prone to cascading changes throughout the system. If they are changed more often because of that, they are considered unstable.\n", - "\n", - "Since Java Packages are organized hierarchically, *Instability* can be calculated for every package in isolation or by including all of its sub-packages. " - ] - }, - { - "cell_type": "markdown", - "id": "fafd1840", - "metadata": {}, - "source": [ - "#### Table 3a\n", - "\n", - "- Show the top 20 Java Packages with the lowest *Instability*\n", - "- Set the property \"instability\" on Package nodes. " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5fb9f58e", - "metadata": {}, - "outputs": [], - "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Instability_for_Java.cypher\",\n", - " \"../cypher/Metrics/Calculate_and_set_Instability_for_Java.cypher\", limit=20)" - ] - }, - { - "cell_type": "markdown", - "id": "f8888a60", - "metadata": {}, - "source": [ - "#### Table 3b\n", - "\n", - "- Show the top 20 Java Packages including their sub-packages with the lowest *Instability*\n", - "- Set the property \"instabilityIncludingSubpackages\" on Package nodes. " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1b07a29f", - "metadata": {}, - "outputs": [], - "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Instability_for_Java_Including_Subpackages.cypher\",\n", - " \"../cypher/Metrics/Calculate_and_set_Instability_for_Java_Including_Subpackages.cypher\", limit=20)" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "f9eb4c6f", - "metadata": {}, - "source": [ - "## Abstractness\n", - "\n", - "$$ Abstractness = \\frac{abstract\\:classes\\:in\\:category}{total\\:number\\:of\\:classes\\:in\\:category} $$\n", - "\n", - "Package *Abstractness* is expressed as the ratio of the number of abstract classes and interfaces to the total number of classes of a package.\n", - "\n", - "Zero *Abstractness* means that there are no abstract types or interfaces in the package. On the other hand, a value of one means that there are only abstract types.\n", - "\n", - "Since Java Packages are organized hierarchically, *Abstractness* can be calculated for every package in isolation or by including all of its sub-packages. " - ] - }, - { - "cell_type": "markdown", - "id": "6932b105", - "metadata": {}, - "source": [ - "#### Table 4a\n", - "\n", - "- Show the top 30 packages with the lowest *Abstractness*\n", - "- Set the property \"abstractness\" on Package nodes. " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2076d515", - "metadata": {}, - "outputs": [], - "source": [ - "abstractness = query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Abstractness_for_Java.cypher\",\n", - " \"../cypher/Metrics/Calculate_and_set_Abstractness_for_Java.cypher\")\n", - "abstractness.head(30)" - ] - }, - { - "cell_type": "markdown", - "id": "e4e93e7b", - "metadata": {}, - "source": [ - "#### Table 4b\n", - "\n", - "- Show the top 30 packages with the highest *Abstractness* and number of Java Types" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2ba8b673", - "metadata": {}, - "outputs": [], - "source": [ - "abstractness.sort_values(by=['abstractness', 'numberTypes'], ascending=[False, False]).head(30)" - ] - }, - { - "cell_type": "markdown", - "id": "48f5f33a", - "metadata": {}, - "source": [ - "#### Table 4c\n", - "\n", - "- Show the top 30 packages including their sub-packages with the highest package depth and lowest *Abstractness*\n", - "- Set the property \"abstractnessIncludingSubpackages\" on Package nodes. " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "dca8ff56", - "metadata": {}, - "outputs": [], - "source": [ - "abstractnessIncludingSubpackages = query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Abstractness_for_Java_including_Subpackages.cypher\",\n", - " \"../cypher/Metrics/Calculate_and_set_Abstractness_for_Java_including_Subpackages.cypher\")\n", - "abstractnessIncludingSubpackages.head(30)" - ] - }, - { - "cell_type": "markdown", - "id": "d4f38108", - "metadata": {}, - "source": [ - "#### Table 4d\n", - "\n", - "- Show the top 30 packages including their sub-packages with the highest package depth and highest *Abstractness*" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d5ad5e36", - "metadata": {}, - "outputs": [], - "source": [ - "abstractnessIncludingSubpackages.sort_values(by=['abstractness', 'maxSubpackageDepth', 'numberTypes'], ascending=[False, False, False]).head(30)" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "e10154bb", - "metadata": {}, - "source": [ - "## Distance from the main sequence\n", - "\n", - "The *main sequence* is a imaginary line that represents a good compromise between *Abstractness* and *Instability*. A high distance to this line may indicate problems. For example is very *stable* (rigid) code with low abstractness hard to change.\n", - "\n", - "Read more details on that in [OO Design Quality Metrics](https://api.semanticscholar.org/CorpusID:18246616) and [Calculate metrics](https://101.jqassistant.org/calculate-metrics/index.html).\n", - "\n", - "#### Table 5a\n", - "\n", - "- Show the top 30 packages with the highest distance from the \"main sequence\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f8513ef8", - "metadata": {}, - "outputs": [], - "source": [ - "instabilityPerAbstractness = query_cypher_to_data_frame(\"../cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java.cypher\")\n", - "instabilityPerAbstractness.head(30)" - ] - }, - { - "cell_type": "markdown", - "id": "d0b12ad3", - "metadata": {}, - "source": [ - "#### Table 5b\n", - "\n", - "- Show the top 30 packages including their sub-packages with the highest distance from the \"main sequence\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d5408c28", - "metadata": {}, - "outputs": [], - "source": [ - "instabilityPerAbstractnessIncludingSubpackages = query_cypher_to_data_frame(\"../cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java_including_subpackages.cypher\")\n", - "instabilityPerAbstractnessIncludingSubpackages.head(30)" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "149fc732", - "metadata": {}, - "source": [ - "### *Abstractness* vs. *Instability* Plot with \"Main Sequence\" line as reference\n", - "\n", - "- Plot *Abstractness* vs. *Instability* of all packages\n", - "- Draw the \"main sequence\" as dashed green diagonal line \n", - "- Scale the packages by the number of types they contain\n", - "- Color the packages by their distance to the \"main sequence\" (blue=near, red=far)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1fbbad97", - "metadata": {}, - "outputs": [], - "source": [ - "# Function that returns the number of past (index smaller than given index) rows \n", - "# with the same value in columnName1 and columnName2\n", - "# If there was a row with the same columnName1 and columnName2 values\n", - "# def countPastEntriesWithSameValues(dataFrame, index, columnName1, columnName2):\n", - "# columnValue1 = dataFrame[columnName1][index]\n", - "# columnValue2 = dataFrame[columnName2][index]\n", - "# return len(dataFrame[\n", - "# (dataFrame.index.isin(range(0, index + 1))) & \n", - "# (dataFrame[columnName1]==columnValue1) & \n", - "# (dataFrame[columnName2]==columnValue2)\n", - "# ]) - 1" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "48edf0ac", - "metadata": {}, - "outputs": [], - "source": [ - "def annotate_plot(data_frame: pd.DataFrame, index: int):\n", - " \"\"\"\n", - " Annotates the data points identified by the \"index\" in the plot of the \"data_frame\" \n", - " \"\"\"\n", - " x_position = data_frame.abstractness[index].item()\n", - " y_position = data_frame.instability[index].item()\n", - " artifact_name = data_frame.artifactName[index].item()\n", - " package_name = data_frame.name[index].item()\n", - "\n", - " label_box=dict(boxstyle=\"round4,pad=0.5\", fc=\"w\", alpha=0.8)\n", - " plot.annotate(artifact_name + '\\n' + package_name\n", - " ,xy=(x_position, y_position)\n", - " ,xycoords='data'\n", - " ,xytext=(20, 0)\n", - " ,textcoords='offset points'\n", - " ,size=6\n", - " ,bbox=label_box\n", - " ,arrowprops=dict(arrowstyle=\"-|>\", mutation_scale=10, color=\"black\")\n", - " )\n", - "\n", - "def index_of_sorted(data_frame: pd.DataFrame, highest: list[str] = []):\n", - " \"\"\"\n", - " Sorts the \"data_frame\" by columns 'abstractness','instability','elementsCount', 'artifactName'\n", - " and returns the index of the first row.\n", - " Columns that are contained in the list of strings parameter \"highest\" will be sorted descending.\n", - " \"\"\"\n", - " by = ['abstractness','instability','elementsCount','artifactName']\n", - " ascending = [('abstractness' not in highest), ('instability' not in highest), False, True]\n", - " return data_frame.sort_values(by=by, ascending=ascending).head(1).index\n", - "\n", - "def index_of_highest_property(data_frame: pd.DataFrame, highest: str):\n", - " \"\"\"\n", - " Sorts the \"data_frame\" by the property given in input parameter \"highest\" descending\n", - " and returns the index of the first row.\n", - " \"\"\"\n", - " by = [highest,'artifactName']\n", - " ascending = [False, True]\n", - " return data_frame.sort_values(by=by, ascending=ascending).head(1).index" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "cd8489ca", - "metadata": {}, - "outputs": [], - "source": [ - "from matplotlib.colors import LinearSegmentedColormap\n", - "\n", - "def plot_instability_per_abstractness_with_main_sequence(data_frame: pd.DataFrame, subtitle: str = ''):\n", - " \"\"\"\n", - " Prints the so called \"Main Sequence\" as green dotted diagonal line as a reference.\n", - " On top of that every Java Package is plotted as a data point:\n", - " - The X-axis is the \"Abstractness\" where 0 = all classes to 1 = all interfaces and abstract classes\n", - " - The Y-axis is the \"Instability\" where 0 = stable (many incoming dependencies) and 1 instable (no incoming dependencies)\n", - " - The size reflects the number of contained Java Types\n", - " - The color reflects the distance to the \"Main Sequence\"\n", - " \"\"\"\n", - " \n", - " colormap=LinearSegmentedColormap.from_list('rg',[\"green\", \"gold\", \"orangered\", \"red\"], N=256) \n", - " marker_scales_bounded=data_frame.elementsCount.clip(lower=2, upper=300) * 0.7\n", - "\n", - " plot.scatter(\n", - " data_frame.abstractness, # x axis shows abstractness\n", - " data_frame.instability, # y axis shows instability\n", - " s=marker_scales_bounded, # scale depends on number of contained types\n", - " c=data_frame.distance, # color depends on distance to the main sequence\n", - " cmap=colormap, #'bwr' # colormap that prints high values in red and lower values in blue\n", - " alpha=0.5,\n", - " )\n", - " # green \"main sequence\" line\n", - " plot.plot([0,1], [1,0], c='lightgreen', linestyle='dashed') \n", - "\n", - " # Annotate largest package\n", - " annotate_plot(data_frame, index_of_highest_property(data_frame, highest='elementsCount'))\n", - " # Annotate largest package with the highest abstractness and instability\n", - " annotate_plot(data_frame, index_of_sorted(data_frame, highest=['abstractness','instability']))\n", - " # Annotate largest package with the lowest abstractness and highest instability\n", - " annotate_plot(data_frame, index_of_sorted(data_frame, highest=['instability']))\n", - " # Annotate largest package with the lowest abstractness and lowest instability\n", - " annotate_plot(data_frame, index_of_sorted(data_frame, highest=[]))\n", - " # Annotate largest package with the highest abstractness and lowest instability\n", - " annotate_plot(data_frame, index_of_sorted(data_frame, highest=['abstractness']))\n", - " # Annotate largest packages with the highest abstractness and instability near 0.5% \n", - " annotation_index = index_of_sorted(highest=['abstractness', 'instability'], data_frame=data_frame.query('abstractness <= 0.4 & instability <= 0.4'))\n", - " annotate_plot(data_frame, annotation_index)\n", - "\n", - " plot.title('Abstractness vs. Instability (\"Main Sequence\")\\n' + subtitle)\n", - " plot.xlabel('Abstractness')\n", - " plot.ylabel('Instability')\n", - " plot.show()\n" - ] - }, - { - "cell_type": "markdown", - "id": "e9a98a47", - "metadata": {}, - "source": [ - "#### Figure 5a - Packages without their sub-packages" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7c7e474d", - "metadata": {}, - "outputs": [], - "source": [ - "if not instabilityPerAbstractness.empty:\n", - " plot_instability_per_abstractness_with_main_sequence(instabilityPerAbstractness, 'Packages without their sub-packages')" - ] - }, - { - "cell_type": "markdown", - "id": "a0f207bb", - "metadata": {}, - "source": [ - "#### Figure 5b - Packages including their sub-packages" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "37552b01", - "metadata": {}, - "outputs": [], - "source": [ - "if not instabilityPerAbstractnessIncludingSubpackages.empty:\n", - " plot_instability_per_abstractness_with_main_sequence(instabilityPerAbstractnessIncludingSubpackages, 'Packages including their sub-packages')" - ] - } - ], - "metadata": { - "authors": [ - { - "name": "JohT" - } - ], - "code_graph_analysis_pipeline_data_validation": "ValidateJavaPackageDependencies", - "kernelspec": { - "display_name": "codegraph", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.9" - }, - "title": "Object Oriented Design Quality Metrics for Java with Neo4j" - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/jupyter/ObjectOrientedDesignMetricsTypescript.ipynb b/jupyter/ObjectOrientedDesignMetricsTypescript.ipynb deleted file mode 100644 index 9c381210d..000000000 --- a/jupyter/ObjectOrientedDesignMetricsTypescript.ipynb +++ /dev/null @@ -1,490 +0,0 @@ -{ - "cells": [ - { - "attachments": {}, - "cell_type": "markdown", - "id": "2f0eabc4", - "metadata": {}, - "source": [ - "# Object Oriented Design Quality Metrics\n", - "
\n", - "\n", - "### References\n", - "- [Analyze java package metrics in a graph database](https://joht.github.io/johtizen/data/2023/04/21/java-package-metrics-analysis.html)\n", - "- [Calculate metrics](https://101.jqassistant.org/calculate-metrics/index.html)\n", - "- [jqassistant](https://jqassistant.org)\n", - "- [notebook walks through examples for integrating various packages with Neo4j](https://nicolewhite.github.io/neo4j-jupyter/hello-world.html)\n", - "- [OO Design Quality Metrics](https://api.semanticscholar.org/CorpusID:18246616)\n", - "- [A Validation of Martin's Metric](https://www.researchgate.net/publication/31598248_A_Validation_of_Martin's_Metric)\n", - "- [Neo4j Python Driver](https://neo4j.com/docs/api/python-driver/current)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4191f259", - "metadata": {}, - "outputs": [], - "source": [ - "import os\n", - "import pandas as pd\n", - "import matplotlib.pyplot as plot\n", - "from neo4j import GraphDatabase" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1c5dab37", - "metadata": {}, - "outputs": [], - "source": [ - "# Please set the environment variable \"NEO4J_INITIAL_PASSWORD\" in your shell \n", - "# before starting jupyter notebook to provide the password for the user \"neo4j\". \n", - "# It is not recommended to hardcode the password into jupyter notebook for security reasons.\n", - "\n", - "driver = GraphDatabase.driver(uri=\"bolt://localhost:7687\", auth=(\"neo4j\", os.environ.get(\"NEO4J_INITIAL_PASSWORD\")))\n", - "driver.verify_connectivity()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c1db254b", - "metadata": {}, - "outputs": [], - "source": [ - "def get_cypher_query_from_file(cypher_file_name : str):\n", - " with open(cypher_file_name) as file:\n", - " return ' '.join(file.readlines())\n", - "\n", - "\n", - "def query_cypher_to_data_frame(filename : str, limit: int = -1):\n", - " \"\"\"\n", - " Execute the Cypher query of the given file and returns the result.\n", - " filename : str : The name of the file containing the Cypher query\n", - " limit : int : The optional limit of rows to optimize the query. Default = -1 = no limit\n", - " \"\"\"\n", - " cypher_query = get_cypher_query_from_file(filename)\n", - " if limit > 0:\n", - " cypher_query = \"{query}\\nLIMIT {row_limit}\".format(query = cypher_query, row_limit = limit)\n", - " records, summary, keys = driver.execute_query(cypher_query)\n", - " return pd.DataFrame([r.values() for r in records], columns=keys)\n", - "\n", - "\n", - "def query_first_non_empty_cypher_to_data_frame(*filenames : str, limit: int = -1):\n", - " \"\"\"\n", - " Executes the Cypher queries of the given files and returns the first result that is not empty.\n", - " If all given file names result in empty results, the last (empty) result will be returned.\n", - " By additionally specifying \"limit=\" the \"LIMIT\" keyword will appended to query so that only the first results get returned.\n", - " \"\"\" \n", - " result=pd.DataFrame()\n", - " for filename in filenames:\n", - " result=query_cypher_to_data_frame(filename, limit)\n", - " if not result.empty:\n", - " return result\n", - " return result" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "da9e8edb", - "metadata": {}, - "outputs": [], - "source": [ - "#The following cell uses the build-in %html \"magic\" to override the CSS style for tables to a much smaller size.\n", - "#This is especially needed for PDF export of tables with multiple columns." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "9deaabce", - "metadata": {}, - "outputs": [], - "source": [ - "%%html\n", - "" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "bbb51c78", - "metadata": {}, - "source": [ - "## Incoming Dependencies\n", - "\n", - "Incoming dependencies are also denoted as \"Fan-in\", \"Afferent Coupling\" or \"in-degree\".\n", - "These are the ones that use the listed package. \n", - " \n", - "If these packages get changed, the incoming dependencies might be affected by the change. The more incoming dependencies, the harder it gets to change the code without the need to adapt the dependent code (“rigid code”). Even worse, it might affect the behavior of the dependent code in an unwanted way (“fragile code”).\n", - "\n", - "Since Java Packages are organized hierarchically, incoming dependencies can be count for every package in isolation or by including all of its sub-packages. The latter one is done without top level packages like for example \"org\" or \"org.company\" by assuring that only packages are considered that have other packages or types in the same hierarchy level (\"siblings\")." - ] - }, - { - "cell_type": "markdown", - "id": "b27f225d", - "metadata": {}, - "source": [ - "#### Table 1a\n", - "- Show the top 20 Typescript modules with the most incoming dependencies\n", - "- Set the property \"incomingDependencies\" on Module nodes if not already done." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "98974b46", - "metadata": {}, - "outputs": [], - "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Incoming_Typescript_Module_Dependencies.cypher\",\n", - " \"../cypher/Metrics/Set_Incoming_Typescript_Module_Dependencies.cypher\", limit=20)" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "82e9f74c", - "metadata": {}, - "source": [ - "## Outgoing Dependencies\n", - "\n", - "Outgoing dependencies are also denoted as \"Fan-out\", \"Efferent Coupling\" or \"out-degree\".\n", - "These are the ones that are used by the listed package. \n", - "\n", - "Code from other packages and libraries you’re depending on (outgoing) might change over time. The more outgoing changes, the more likely and frequently code changes are needed. This involves time and effort which can be reduced by automation of tests and version updates. Automated tests are crucial to reveal updates, that change the behavior of the code unexpectedly (“fragile code”). As soon as more effort is required, keeping up becomes difficult (“rigid code”). Not being able to use a newer version might not only restrict features, it can get problematic if there are security issues. This might force you to take “fast but ugly” solutions into account which further increases technical dept.\n", - "\n", - "Since Java Packages are organized hierarchically, outgoing dependencies can be count for every package in isolation or by including all of its sub-packages. The latter one is done without top level packages like for example \"org\" or \"org.company\" by assuring that only packages are considered that have other packages or types in the same hierarchy level (\"siblings\")." - ] - }, - { - "cell_type": "markdown", - "id": "747cb31d", - "metadata": {}, - "source": [ - "#### Table 2a\n", - "\n", - "- Show the top 20 Typescript modules with the most outgoing dependencies\n", - "- Set the \"outgoingDependencies\" properties on Module nodes if not already done" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1be12a2e", - "metadata": {}, - "outputs": [], - "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Outgoing_Typescript_Module_Dependencies.cypher\",\n", - " \"../cypher/Metrics/Set_Outgoing_Typescript_Module_Dependencies.cypher\", limit=20)" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "22f8959e", - "metadata": {}, - "source": [ - "## Instability\n", - "\n", - "$$ Instability = \\frac{Outgoing\\:Dependencies}{Outgoing\\:Dependencies + Incoming\\:Dependencies} $$\n", - "\n", - "*Instability* is expressed as the ratio of the number of outgoing dependencies of a module (i.e., the number of packages that depend on it) to the total number of dependencies (i.e., the sum of incoming and outgoing dependencies).\n", - "\n", - "Small values near zero indicate low *Instability*. With no outgoing but some incoming dependencies the Instability is zero which is denoted as maximally stable. Such code units are more rigid and difficult to change without impacting other parts of the system. If they are changed less because of that, they are considered stable.\n", - "\n", - "Conversely, high values approaching one indicate high *Instability*. With some outgoing dependencies but no incoming ones the *Instability* is denoted as maximally unstable. Such code units are easier to change without affecting other modules, making them more flexible and less prone to cascading changes throughout the system. If they are changed more often because of that, they are considered unstable.\n", - "\n", - "Since Java Packages are organized hierarchically, *Instability* can be calculated for every package in isolation or by including all of its sub-packages. " - ] - }, - { - "cell_type": "markdown", - "id": "17c081d0", - "metadata": {}, - "source": [ - "#### Table 3a\n", - "\n", - "- Show the top 20 Typescript modules with the lowest *Instability*\n", - "- Set the property \"instability\" on Module nodes if not already done" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "77862c9e", - "metadata": {}, - "outputs": [], - "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Instability_for_Typescript.cypher\",\n", - " \"../cypher/Metrics/Calculate_and_set_Instability_for_Typescript.cypher\", limit=20)" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "f9eb4c6f", - "metadata": {}, - "source": [ - "## Abstractness\n", - "\n", - "$$ Abstractness = \\frac{abstract\\:classes\\:in\\:category}{total\\:number\\:of\\:classes\\:in\\:category} $$\n", - "\n", - "Package *Abstractness* is expressed as the ratio of the number of abstract classes and interfaces to the total number of classes of a package.\n", - "\n", - "Zero *Abstractness* means that there are no abstract types or interfaces in the package. On the other hand, a value of one means that there are only abstract types.\n", - "\n", - "Since Java Packages are organized hierarchically, *Abstractness* can be calculated for every package in isolation or by including all of its sub-packages. " - ] - }, - { - "cell_type": "markdown", - "id": "6f95770e", - "metadata": {}, - "source": [ - "#### Table 4a\n", - "\n", - "- Show the top 30 Typescript modules with the lowest *Abstractness*\n", - "- Set the property \"abstractness\" on Module nodes if not already done." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "65c36080", - "metadata": {}, - "outputs": [], - "source": [ - "query_first_non_empty_cypher_to_data_frame(\"../cypher/Metrics/Get_Abstractness_for_Typescript.cypher\",\n", - " \"../cypher/Metrics/Calculate_and_set_Abstractness_for_Typescript.cypher\", limit=20)" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "e10154bb", - "metadata": {}, - "source": [ - "## Distance from the main sequence\n", - "\n", - "The *main sequence* is a imaginary line that represents a good compromise between *Abstractness* and *Instability*. A high distance to this line may indicate problems. For example is very *stable* (rigid) code with low abstractness hard to change.\n", - "\n", - "Read more details on that in [OO Design Quality Metrics](https://api.semanticscholar.org/CorpusID:18246616) and [Calculate metrics](https://101.jqassistant.org/calculate-metrics/index.html)." - ] - }, - { - "cell_type": "markdown", - "id": "c4fdbb1d", - "metadata": {}, - "source": [ - "#### Table 5a\n", - "\n", - "- Show the top 30 Typescript modules with the highest distance from the \"main sequence\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0a1d2d24", - "metadata": {}, - "outputs": [], - "source": [ - "instabilityPerAbstractnessTypescript = query_cypher_to_data_frame(\"../cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Typescript.cypher\")\n", - "instabilityPerAbstractnessTypescript.head(30)" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "149fc732", - "metadata": {}, - "source": [ - "### *Abstractness* vs. *Instability* Plot with \"Main Sequence\" line as reference\n", - "\n", - "- Plot *Abstractness* vs. *Instability* of all packages\n", - "- Draw the \"main sequence\" as dashed green diagonal line \n", - "- Scale the packages by the number of types they contain\n", - "- Color the packages by their distance to the \"main sequence\" (blue=near, red=far)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1fbbad97", - "metadata": {}, - "outputs": [], - "source": [ - "# Function that returns the number of past (index smaller than given index) rows \n", - "# with the same value in columnName1 and columnName2\n", - "# If there was a row with the same columnName1 and columnName2 values\n", - "# def countPastEntriesWithSameValues(dataFrame, index, columnName1, columnName2):\n", - "# columnValue1 = dataFrame[columnName1][index]\n", - "# columnValue2 = dataFrame[columnName2][index]\n", - "# return len(dataFrame[\n", - "# (dataFrame.index.isin(range(0, index + 1))) & \n", - "# (dataFrame[columnName1]==columnValue1) & \n", - "# (dataFrame[columnName2]==columnValue2)\n", - "# ]) - 1" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "48edf0ac", - "metadata": {}, - "outputs": [], - "source": [ - "def annotate_plot(data_frame: pd.DataFrame, index: int):\n", - " \"\"\"\n", - " Annotates the data points identified by the \"index\" in the plot of the \"data_frame\" \n", - " \"\"\"\n", - " x_position = data_frame.abstractness[index].item()\n", - " y_position = data_frame.instability[index].item()\n", - " artifact_name = data_frame.artifactName[index].item()\n", - " package_name = data_frame.name[index].item()\n", - "\n", - " label_box=dict(boxstyle=\"round4,pad=0.5\", fc=\"w\", alpha=0.8)\n", - " plot.annotate(artifact_name + '\\n' + package_name\n", - " ,xy=(x_position, y_position)\n", - " ,xycoords='data'\n", - " ,xytext=(20, 0)\n", - " ,textcoords='offset points'\n", - " ,size=6\n", - " ,bbox=label_box\n", - " ,arrowprops=dict(arrowstyle=\"-|>\", mutation_scale=10, color=\"black\")\n", - " )\n", - "\n", - "def index_of_sorted(data_frame: pd.DataFrame, highest: list[str] = []):\n", - " \"\"\"\n", - " Sorts the \"data_frame\" by columns 'abstractness','instability','elementsCount', 'artifactName'\n", - " and returns the index of the first row.\n", - " Columns that are contained in the list of strings parameter \"highest\" will be sorted descending.\n", - " \"\"\"\n", - " by = ['abstractness','instability','elementsCount','artifactName']\n", - " ascending = [('abstractness' not in highest), ('instability' not in highest), False, True]\n", - " return data_frame.sort_values(by=by, ascending=ascending).head(1).index\n", - "\n", - "def index_of_highest_property(data_frame: pd.DataFrame, highest: str):\n", - " \"\"\"\n", - " Sorts the \"data_frame\" by the property given in input parameter \"highest\" descending\n", - " and returns the index of the first row.\n", - " \"\"\"\n", - " by = [highest,'artifactName']\n", - " ascending = [False, True]\n", - " return data_frame.sort_values(by=by, ascending=ascending).head(1).index" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "cd8489ca", - "metadata": {}, - "outputs": [], - "source": [ - "from matplotlib.colors import LinearSegmentedColormap\n", - "\n", - "def plot_instability_per_abstractness_with_main_sequence(data_frame: pd.DataFrame, subtitle: str = ''):\n", - " \"\"\"\n", - " Prints the so called \"Main Sequence\" as green dotted diagonal line as a reference.\n", - " On top of that every Java Package is plotted as a data point:\n", - " - The X-axis is the \"Abstractness\" where 0 = all classes to 1 = all interfaces and abstract classes\n", - " - The Y-axis is the \"Instability\" where 0 = stable (many incoming dependencies) and 1 instable (no incoming dependencies)\n", - " - The size reflects the number of contained Java Types\n", - " - The color reflects the distance to the \"Main Sequence\"\n", - " \"\"\"\n", - " \n", - " colormap=LinearSegmentedColormap.from_list('rg',[\"green\", \"gold\", \"orangered\", \"red\"], N=256) \n", - " marker_scales_bounded=data_frame.elementsCount.clip(lower=2, upper=300) * 0.7\n", - "\n", - " plot.scatter(\n", - " data_frame.abstractness, # x axis shows abstractness\n", - " data_frame.instability, # y axis shows instability\n", - " s=marker_scales_bounded, # scale depends on number of contained types\n", - " c=data_frame.distance, # color depends on distance to the main sequence\n", - " cmap=colormap, #'bwr' # colormap that prints high values in red and lower values in blue\n", - " alpha=0.5,\n", - " )\n", - " # green \"main sequence\" line\n", - " plot.plot([0,1], [1,0], c='lightgreen', linestyle='dashed') \n", - "\n", - " # Annotate largest package\n", - " annotate_plot(data_frame, index_of_highest_property(data_frame, highest='elementsCount'))\n", - " # Annotate largest package with the highest abstractness and instability\n", - " annotate_plot(data_frame, index_of_sorted(data_frame, highest=['abstractness','instability']))\n", - " # Annotate largest package with the lowest abstractness and highest instability\n", - " annotate_plot(data_frame, index_of_sorted(data_frame, highest=['instability']))\n", - " # Annotate largest package with the lowest abstractness and lowest instability\n", - " annotate_plot(data_frame, index_of_sorted(data_frame, highest=[]))\n", - " # Annotate largest package with the highest abstractness and lowest instability\n", - " annotate_plot(data_frame, index_of_sorted(data_frame, highest=['abstractness']))\n", - " # Annotate largest packages with the highest abstractness and instability near 0.5% \n", - " annotation_index = index_of_sorted(highest=['abstractness', 'instability'], data_frame=data_frame.query('abstractness <= 0.4 & instability <= 0.4'))\n", - " annotate_plot(data_frame, annotation_index)\n", - "\n", - " plot.title('Abstractness vs. Instability (\"Main Sequence\")\\n' + subtitle)\n", - " plot.xlabel('Abstractness')\n", - " plot.ylabel('Instability')\n", - " plot.show()\n" - ] - }, - { - "cell_type": "markdown", - "id": "c7499522", - "metadata": {}, - "source": [ - "#### Figure 5a - Typescript Modules" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "02763566", - "metadata": {}, - "outputs": [], - "source": [ - "if not instabilityPerAbstractnessTypescript.empty:\n", - " plot_instability_per_abstractness_with_main_sequence(instabilityPerAbstractnessTypescript, 'Typescript modules')" - ] - } - ], - "metadata": { - "authors": [ - { - "name": "JohT" - } - ], - "code_graph_analysis_pipeline_data_validation": "ValidateTypescriptModuleDependencies", - "kernelspec": { - "display_name": "codegraph", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.9" - }, - "title": "Object Oriented Design Quality Metrics for Java with Neo4j" - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/jupyter/VisibilityMetricsJava.ipynb b/jupyter/VisibilityMetricsJava.ipynb deleted file mode 100644 index 9f0530869..000000000 --- a/jupyter/VisibilityMetricsJava.ipynb +++ /dev/null @@ -1,436 +0,0 @@ -{ - "cells": [ - { - "attachments": {}, - "cell_type": "markdown", - "id": "2f0eabc4", - "metadata": {}, - "source": [ - "# Visibility Metrics for Java\n", - "
\n", - "\n", - "### References\n", - "- [Visibility Metrics and the Importance of Hiding Things](https://dzone.com/articles/visibility-metrics-and-the-importance-of-hiding-th)\n", - "- [Calculate metrics](https://101.jqassistant.org/calculate-metrics/index.html)\n", - "- [Controlling Access to Members of a Class](https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)\n", - "- [Neo4j Python Driver](https://neo4j.com/docs/api/python-driver/current)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4191f259", - "metadata": {}, - "outputs": [], - "source": [ - "import os\n", - "import pandas as pd\n", - "import matplotlib.pyplot as plot\n", - "from neo4j import GraphDatabase" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "acf605be", - "metadata": {}, - "outputs": [], - "source": [ - "#The following cell uses the build-in %html \"magic\" to override the CSS style for tables to a much smaller size.\n", - "#This is especially needed for PDF export of tables with multiple columns." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3cc19954", - "metadata": {}, - "outputs": [], - "source": [ - "%%html\n", - "" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "33c356d7", - "metadata": {}, - "outputs": [], - "source": [ - "# Main Colormap\n", - "main_color_map = 'nipy_spectral'" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1c5dab37", - "metadata": {}, - "outputs": [], - "source": [ - "# Please set the environment variable \"NEO4J_INITIAL_PASSWORD\" in your shell \n", - "# before starting jupyter notebook to provide the password for the user \"neo4j\". \n", - "# It is not recommended to hardcode the password into jupyter notebook for security reasons.\n", - "\n", - "driver = GraphDatabase.driver(uri=\"bolt://localhost:7687\", auth=(\"neo4j\", os.environ.get(\"NEO4J_INITIAL_PASSWORD\")))\n", - "driver.verify_connectivity()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c1db254b", - "metadata": {}, - "outputs": [], - "source": [ - "def get_cypher_query_from_file(cypher_file_name : str):\n", - " with open(cypher_file_name) as file:\n", - " return ' '.join(file.readlines())\n", - "\n", - "\n", - "def query_cypher_to_data_frame(filename):\n", - " records, summary, keys = driver.execute_query(get_cypher_query_from_file(filename))\n", - " return pd.DataFrame([r.values() for r in records], columns=keys)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bcb3049f", - "metadata": {}, - "outputs": [], - "source": [ - "#The following cell uses the build-in %html \"magic\" to override the CSS style for tables to a much smaller size.\n", - "#This is especially needed for PDF export of tables with multiple columns." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d31581da", - "metadata": {}, - "outputs": [], - "source": [ - "%%html\n", - "" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "d7cfd862", - "metadata": {}, - "source": [ - "## Relative Visibility Of Types\n", - "\n", - "A Java class or interface may be declared with the modifier public, in which case it is visible to all classes everywhere. If a class or interface has no modifier (the default, also known as package-private), it is visible only within its own package.\n", - "\n", - "The relative visibility is the number of inner components that are visible outside (public) divided by the number of all types:\n", - "\n", - "$$ relative visibility = \\frac{public\\:types}{all\\:types} $$\n", - "\n", - "Using package protected types is one of many ways to improve encapsulation and implementation detail hiding.\n", - "\n", - "### How to apply the results\n", - "\n", - "The relative visibility is between zero (all types are package protected) and one (all types are public). A value lower than one means that there are types that are declared package protected. The lower the value is, the better implementation details are hidden. \n", - "\n", - "Non public classes can't be accessed from another package so they can be changed without affecting code in other packages. They clearly indicate functionality that only belongs to one package. This also motivates to use more classes and to split up code into smaller pieces with a single responsibility and reason to change." - ] - }, - { - "cell_type": "markdown", - "id": "c9536fd9", - "metadata": {}, - "source": [ - "### Table 1a - Top 40 artifacts with lowest median of package protection encapsulation\n", - "\n", - "This table shows the relative visibility statistics aggregated for all packages per artifact and focusses on artifacts with many packages and hardly any package protected types (lowest median, high visibility). Package protected types would help to improve encapsulation.\n", - "\n", - "Only the top 40 entries are shown. The whole table can be found in the following CSV report: \n", - "`Global_relative_visibility_statistics_for_types`" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "68ed42d0", - "metadata": {}, - "outputs": [], - "source": [ - "# Query the visibility statistics per artifact (all packages aggregated)\n", - "# The results Will be used in multiple tables below.\n", - "relative_visibility_per_artifact_aggregated=query_cypher_to_data_frame(\"../cypher/Visibility/Global_relative_visibility_statistics_for_types.cypher\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "fa634a4e", - "metadata": { - "scrolled": true - }, - "outputs": [], - "source": [ - "# Sort by the \"percentile50\" (median) and \"all\" (number of packages in the artifact) descending\n", - "relative_visibility_statistics_highest_median=relative_visibility_per_artifact_aggregated.sort_values(by=['percentile50', 'all'], ascending=[False, False])\n", - "\n", - "# Reset the index (row numbering starting at 0 and increasing by 1)\n", - "relative_visibility_statistics_highest_median=relative_visibility_statistics_highest_median.reset_index(drop=True)\n", - "\n", - "relative_visibility_statistics_highest_median.head(40)" - ] - }, - { - "cell_type": "markdown", - "id": "1b84fd51", - "metadata": {}, - "source": [ - "### Table 1b - Top 40 artifacts with highest median of package protection encapsulation\n", - "\n", - "This table shows the relative visibility statistics aggregated for all packages per artifact and focusses on artifacts with many packages and the highest median of package protected types (low visibility). Package protected types help to improve encapsulation.\n", - "\n", - "Only the top 40 entries are shown. The whole table can be found in the following CSV report: \n", - "`Global_relative_visibility_statistics_for_types`" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "dc59a07d", - "metadata": {}, - "outputs": [], - "source": [ - "# Sort by the \"percentile50\" (median) ascending and \"all\" (number of packages in the artifact) descending\n", - "relative_visibility_statistics_lowest_median=relative_visibility_per_artifact_aggregated.sort_values(by=['percentile50', 'all'], ascending=[True, False])\n", - "\n", - "# Reset the index (row numbering starting at 0 and increasing by 1)\n", - "relative_visibility_statistics_lowest_median=relative_visibility_statistics_lowest_median.reset_index(drop=True)\n", - "\n", - "relative_visibility_statistics_lowest_median.head(40)" - ] - }, - { - "cell_type": "markdown", - "id": "5196ecc2", - "metadata": {}, - "source": [ - "### Table 1 Chart 1 - Relative visibility in artifacts" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f467a8dd", - "metadata": {}, - "outputs": [], - "source": [ - "plot.figure();\n", - "fig, axes = plot.subplots(nrows=3, ncols=1, sharex=True)\n", - "\n", - "number_of_packages_grid_ticks=[1, 2, 5, 10, 20, 50, 100, 200, 500, 1_000, 2_000, 5_000, 10_000]\n", - "\n", - "relative_visibility_per_artifact_aggregated.plot(\n", - " ax=axes[0],\n", - " kind='scatter',\n", - " title='Relative visibility in artifacts (75% percentile)', \n", - " x='percentile75',\n", - " y='all',\n", - " grid=True,\n", - " logy=True,\n", - " yticks=number_of_packages_grid_ticks,\n", - " xlabel='relative visibility',\n", - " ylabel='number of packages',\n", - " cmap=main_color_map,\n", - " figsize=(10,4),\n", - ")\n", - "relative_visibility_per_artifact_aggregated.plot(\n", - " ax=axes[1],\n", - " kind='scatter',\n", - " title='Relative visibility in artifacts (50% percentile)', \n", - " x='percentile50',\n", - " y='all',\n", - " grid=True,\n", - " logy=True,\n", - " yticks=number_of_packages_grid_ticks,\n", - " xlabel='relative visibility',\n", - " ylabel='number of packages',\n", - " cmap=main_color_map,\n", - " figsize=(10,4),\n", - ")\n", - "relative_visibility_per_artifact_aggregated.plot(\n", - " ax=axes[2],\n", - " kind='scatter',\n", - " title='Relative visibility in artifacts (25% percentile)', \n", - " x='percentile25',\n", - " y='all',\n", - " grid=True,\n", - " logy=True,\n", - " yticks=number_of_packages_grid_ticks,\n", - " xlabel='relative visibility',\n", - " ylabel='number of packages',\n", - " cmap=main_color_map,\n", - " figsize=(10,10),\n", - ")\n", - "axes[0].grid(color = 'grey', linestyle = '-', linewidth = 0.2)\n", - "axes[1].grid(color = 'grey', linestyle = '-', linewidth = 0.2)\n", - "axes[2].grid(color = 'grey', linestyle = '-', linewidth = 0.2)\n", - "plot.show()" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "3f59da8d", - "metadata": {}, - "source": [ - "### Table 2a - Top 40 packages with the highest visibility and lowest encapsulation\n", - "\n", - "This table shows the relative visibility statistics per packages and artifact and focusses on packages with many types, hardly any package protected ones and therefore the highest relative visibility (lowest encapsulation). Package protected types would help to improve encapsulation.\n", - "\n", - "Only the top 40 entries are shown. The whole table can be found in the following CSV report: \n", - "`Relative_visibility_public_types_to_all_types_per_package`" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6e91c8c5", - "metadata": { - "scrolled": true - }, - "outputs": [], - "source": [ - "# Query the visibility statistics per package and artifact (all types aggregated)\n", - "# The results Will be used in multiple tables below.\n", - "relative_visibility_per_package=query_cypher_to_data_frame(\"../cypher/Visibility/Relative_visibility_public_types_to_all_types_per_package.cypher\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "48f7f2d2", - "metadata": {}, - "outputs": [], - "source": [ - "# Sort by the \"relativeVisibility\" and \"allTypes\" (number of types in the package) descending\n", - "highest_relative_visibility_packages=relative_visibility_per_package.sort_values(by=['relativeVisibility', 'allTypes'], ascending=[False, False])\n", - "\n", - "# Reset the index (row numbering starting at 0 and increasing by 1)\n", - "highest_relative_visibility_packages=highest_relative_visibility_packages.reset_index(drop=True)\n", - "\n", - "highest_relative_visibility_packages.head(40)" - ] - }, - { - "cell_type": "markdown", - "id": "c6786ef1", - "metadata": {}, - "source": [ - "### Table 2b - Top 40 packages with the lowest visibility and highest encapsulation\n", - "\n", - "This table shows the relative visibility statistics per packages and artifact and focusses on packages with many types, many package protected ones and therefore the lowest relative visibility (highest encapsulation). Package protected types help to improve encapsulation. Zero percent visibility and therefore packages with no public visible type are suspicious to be dead code.\n", - "\n", - "Only the top 40 entries are shown. The whole table can be found in the following CSV report: \n", - "`Relative_visibility_public_types_to_all_types_per_package`" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "48c20ca4", - "metadata": {}, - "outputs": [], - "source": [ - "# Sort by the \"relativeVisibility\" ascending and \"allTypes\" (number of types in the package) descending\n", - "lowest_relative_visibility_packages=relative_visibility_per_package.sort_values(by=['relativeVisibility', 'allTypes'], ascending=[True, False])\n", - "\n", - "# Reset the index (row numbering starting at 0 and increasing by 1)\n", - "lowest_relative_visibility_packages=lowest_relative_visibility_packages.reset_index(drop=True)\n", - "\n", - "lowest_relative_visibility_packages.head(40)" - ] - }, - { - "cell_type": "markdown", - "id": "8ff237fd", - "metadata": {}, - "source": [ - "### Table 2 Chart 1 - Relative visibility of packages" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "98b12846", - "metadata": {}, - "outputs": [], - "source": [ - "plot.figure();\n", - "\n", - "number_of_types_grid_ticks=[1, 2, 5, 10, 20, 50, 100, 200, 500, 1_000, 2_000, 5_000, 10_000]\n", - "\n", - "relative_visibility_per_package.plot(\n", - " kind='scatter',\n", - " title='Relative visibility of packages', \n", - " x='relativeVisibility',\n", - " y='allTypes',\n", - " grid=True,\n", - " logy=True,\n", - " yticks=number_of_types_grid_ticks,\n", - " xlabel='relative visibility',\n", - " ylabel='number of types',\n", - " cmap=main_color_map,\n", - " figsize=(10,4),\n", - ")\n", - "\n", - "plot.show()" - ] - } - ], - "metadata": { - "authors": [ - { - "name": "JohT" - } - ], - "code_graph_analysis_pipeline_data_validation": "ValidateJavaTypes", - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - }, - "title": "Visibility Metrics for Java" - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/jupyter/VisibilityMetricsTypescript.ipynb b/jupyter/VisibilityMetricsTypescript.ipynb deleted file mode 100644 index badfd1111..000000000 --- a/jupyter/VisibilityMetricsTypescript.ipynb +++ /dev/null @@ -1,444 +0,0 @@ -{ - "cells": [ - { - "attachments": {}, - "cell_type": "markdown", - "id": "2f0eabc4", - "metadata": {}, - "source": [ - "# Visibility Metrics for Typescript\n", - "
\n", - "\n", - "### References\n", - "- [Visibility Metrics and the Importance of Hiding Things](https://dzone.com/articles/visibility-metrics-and-the-importance-of-hiding-th)\n", - "- [Calculate metrics](https://101.jqassistant.org/calculate-metrics/index.html)\n", - "- [Controlling Access to Members of a Class](https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)\n", - "- [Neo4j Python Driver](https://neo4j.com/docs/api/python-driver/current)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4191f259", - "metadata": {}, - "outputs": [], - "source": [ - "import os\n", - "import pandas as pd\n", - "import matplotlib.pyplot as plot\n", - "from neo4j import GraphDatabase" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "acf605be", - "metadata": {}, - "outputs": [], - "source": [ - "#The following cell uses the build-in %html \"magic\" to override the CSS style for tables to a much smaller size.\n", - "#This is especially needed for PDF export of tables with multiple columns." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3cc19954", - "metadata": {}, - "outputs": [], - "source": [ - "%%html\n", - "" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "33c356d7", - "metadata": {}, - "outputs": [], - "source": [ - "# Main Colormap\n", - "main_color_map = 'nipy_spectral'" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1c5dab37", - "metadata": {}, - "outputs": [], - "source": [ - "# Please set the environment variable \"NEO4J_INITIAL_PASSWORD\" in your shell \n", - "# before starting jupyter notebook to provide the password for the user \"neo4j\". \n", - "# It is not recommended to hardcode the password into jupyter notebook for security reasons.\n", - "\n", - "driver = GraphDatabase.driver(uri=\"bolt://localhost:7687\", auth=(\"neo4j\", os.environ.get(\"NEO4J_INITIAL_PASSWORD\")))\n", - "driver.verify_connectivity()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c1db254b", - "metadata": {}, - "outputs": [], - "source": [ - "def get_cypher_query_from_file(cypher_file_name):\n", - " with open(cypher_file_name) as file:\n", - " return ' '.join(file.readlines())\n", - " \n", - "\n", - "def query_cypher_to_data_frame(filename):\n", - " records, summary, keys = driver.execute_query(get_cypher_query_from_file(filename))\n", - " return pd.DataFrame([r.values() for r in records], columns=keys)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "59310f6f", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bcb3049f", - "metadata": {}, - "outputs": [], - "source": [ - "#The following cell uses the build-in %html \"magic\" to override the CSS style for tables to a much smaller size.\n", - "#This is especially needed for PDF export of tables with multiple columns." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d31581da", - "metadata": {}, - "outputs": [], - "source": [ - "%%html\n", - "" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "d7cfd862", - "metadata": {}, - "source": [ - "## Relative Visibility Of Elements\n", - "\n", - "A Typescript element (variable, function, class, ...) may be exported in which case it is visible and can be imported everywhere (if there are no other rules defined). If there is no \"export\" keyword and the element (variable, function, class, ...) is only declared, then it is only visible within the file or module.\n", - "\n", - "The relative visibility is the number of inner components that are visible outside (exported) divided by the number of all components:\n", - "\n", - "$$ relative visibility = \\frac{exported\\:elements}{all\\:declared\\:elements} $$\n", - "\n", - "Using directories with an index file as a module and exporting only the elements (variables, function, classes, ...) that the caller of the module should use is a good way to improve encapsulation and implementation detail hiding.\n", - "\n", - "### How to apply the results\n", - "\n", - "The relative visibility is between zero (no element is exported) and one (all elements are exported). A value lower than one means that there are elements that are not exported. The lower the value is, the better the encapsulation and the better the implementation details are hidden. \n", - "\n", - "Non exported elements can't be accessed from another modules so they can be changed without affecting code in other modules. They clearly indicate functionality that only belongs to one modules. This also motivates to split up code into smaller pieces with a dedicated reason to change (single responsibility)." - ] - }, - { - "cell_type": "markdown", - "id": "c9536fd9", - "metadata": {}, - "source": [ - "### Table 1a - Top 40 projects with lowest median of module encapsulation\n", - "\n", - "This table shows the relative visibility statistics aggregated for all modules per project and focusses on projects with many modules and hardly any non-exported elements (lowest median, high visibility). Module directories with an index file and intentional exporting helps to improve encapsulation.\n", - "\n", - "Only the top 40 entries are shown. The whole table can be found in the following CSV report: \n", - "`Global_relative_visibility_statistics_for_elements_for_Typescript`" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "68ed42d0", - "metadata": {}, - "outputs": [], - "source": [ - "# Query the visibility statistics per project (all modules aggregated)\n", - "# The results will be used in multiple tables below.\n", - "relative_visibility_per_project_aggregated=query_cypher_to_data_frame(\"../cypher/Visibility/Global_relative_visibility_statistics_for_elements_for_Typescript.cypher\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "fa634a4e", - "metadata": { - "scrolled": true - }, - "outputs": [], - "source": [ - "# Sort by the \"percentile50\" (median) and \"all\" (number of modules in the project) descending\n", - "relative_visibility_statistics_highest_median=relative_visibility_per_project_aggregated.sort_values(by=['percentile50', 'all'], ascending=[False, False])\n", - "\n", - "# Reset the index (row numbering starting at 0 and increasing by 1)\n", - "relative_visibility_statistics_highest_median=relative_visibility_statistics_highest_median.reset_index(drop=True)\n", - "\n", - "relative_visibility_statistics_highest_median.head(40)" - ] - }, - { - "cell_type": "markdown", - "id": "1b84fd51", - "metadata": {}, - "source": [ - "### Table 1b - Top 40 projects with highest median of module encapsulation\n", - "\n", - "This table shows the relative visibility statistics aggregated for all modules per project and focusses on project with many modules and the highest median of non-exported elements (variables, functions, classes, ...) (low visibility). Module directories with an index file and intentional exporting helps to improve encapsulation.\n", - "\n", - "Only the top 40 entries are shown. The whole table can be found in the following CSV report: \n", - "`Global_relative_visibility_statistics_for_elements_for_Typescript`" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "dc59a07d", - "metadata": {}, - "outputs": [], - "source": [ - "# Sort by the \"percentile50\" (median) ascending and \"all\" (number of packages in the artifact) descending\n", - "relative_visibility_statistics_lowest_median=relative_visibility_per_project_aggregated.sort_values(by=['percentile50', 'all'], ascending=[True, False])\n", - "\n", - "# Reset the index (row numbering starting at 0 and increasing by 1)\n", - "relative_visibility_statistics_lowest_median=relative_visibility_statistics_lowest_median.reset_index(drop=True)\n", - "\n", - "relative_visibility_statistics_lowest_median.head(40)" - ] - }, - { - "cell_type": "markdown", - "id": "5196ecc2", - "metadata": {}, - "source": [ - "### Table 1 Chart 1 - Relative visibility in projects" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f467a8dd", - "metadata": {}, - "outputs": [], - "source": [ - "plot.figure();\n", - "fig, axes = plot.subplots(nrows=3, ncols=1, sharex=True)\n", - "\n", - "number_of_modules_grid_ticks=[1, 2, 5, 10, 20, 50, 100, 200, 500, 1_000, 2_000, 5_000, 10_000]\n", - "\n", - "relative_visibility_per_project_aggregated.plot(\n", - " ax=axes[0],\n", - " kind='scatter',\n", - " title='Relative visibility in projects (75% percentile)', \n", - " x='percentile75',\n", - " y='all',\n", - " grid=True,\n", - " logy=True,\n", - " yticks=number_of_modules_grid_ticks,\n", - " xlabel='relative visibility',\n", - " ylabel='number of modules',\n", - " cmap=main_color_map,\n", - " figsize=(10,4),\n", - ")\n", - "relative_visibility_per_project_aggregated.plot(\n", - " ax=axes[1],\n", - " kind='scatter',\n", - " title='Relative visibility in projects (50% percentile)', \n", - " x='percentile50',\n", - " y='all',\n", - " grid=True,\n", - " logy=True,\n", - " yticks=number_of_modules_grid_ticks,\n", - " xlabel='relative visibility',\n", - " ylabel='number of modules',\n", - " cmap=main_color_map,\n", - " figsize=(10,4),\n", - ")\n", - "relative_visibility_per_project_aggregated.plot(\n", - " ax=axes[2],\n", - " kind='scatter',\n", - " title='Relative visibility in artifacts (25% percentile)', \n", - " x='percentile25',\n", - " y='all',\n", - " grid=True,\n", - " logy=True,\n", - " yticks=number_of_modules_grid_ticks,\n", - " xlabel='relative visibility',\n", - " ylabel='number of packages',\n", - " cmap=main_color_map,\n", - " figsize=(10,10),\n", - ")\n", - "axes[0].grid(color = 'grey', linestyle = '-', linewidth = 0.2)\n", - "axes[1].grid(color = 'grey', linestyle = '-', linewidth = 0.2)\n", - "axes[2].grid(color = 'grey', linestyle = '-', linewidth = 0.2)\n", - "plot.show()" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "3f59da8d", - "metadata": {}, - "source": [ - "### Table 2a - Top 40 modules with the highest visibility and lowest encapsulation\n", - "\n", - "This table shows the relative visibility statistics per module and project and focusses on modules with many elements (variables, functions, classes, ...), hardly any non-exported ones and therefore the highest relative visibility (lowest encapsulation). Module directories with an index file and intentional exporting helps to improve encapsulation.\n", - "\n", - "Only the top 40 entries are shown. The whole table can be found in the following CSV report: \n", - "`Relative_visibility_exported_elements_to_all_elements_per_module_for_Typescript`" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6e91c8c5", - "metadata": { - "scrolled": true - }, - "outputs": [], - "source": [ - "# Query the visibility statistics per module and project (all elements aggregated)\n", - "# The results will be used in multiple tables below.\n", - "relative_visibility_per_module=query_cypher_to_data_frame(\"../cypher/Visibility/Relative_visibility_exported_elements_to_all_elements_per_module_for_Typescript.cypher\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "48f7f2d2", - "metadata": {}, - "outputs": [], - "source": [ - "# Sort by the \"relativeVisibility\" and \"allElements\" (number of elements in the module) descending\n", - "highest_relative_visibility_module=relative_visibility_per_module.sort_values(by=['relativeVisibility', 'allElements'], ascending=[False, False])\n", - "\n", - "# Reset the index (row numbering starting at 0 and increasing by 1)\n", - "highest_relative_visibility_module=highest_relative_visibility_module.reset_index(drop=True)\n", - "\n", - "highest_relative_visibility_module.head(40)" - ] - }, - { - "cell_type": "markdown", - "id": "c6786ef1", - "metadata": {}, - "source": [ - "### Table 2b - Top 40 modules with the lowest visibility and highest encapsulation\n", - "\n", - "This table shows the relative visibility statistics per modules and project and focusses on modules with many elements (variables, functions, classes, ...), many non-exported ones and therefore the lowest relative visibility (highest encapsulation). Non-exported elements help to improve encapsulation. Zero percent visibility and therefore modules with no exported elements are suspicious to contain dead code.\n", - "\n", - "Only the top 40 entries are shown. The whole table can be found in the following CSV report: \n", - "`Relative_visibility_public_types_to_all_types_per_package`" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "48c20ca4", - "metadata": {}, - "outputs": [], - "source": [ - "# Sort by the \"relativeVisibility\" ascending and \"allTypes\" (number of types in the package) descending\n", - "lowest_relative_visibility_modules=relative_visibility_per_module.sort_values(by=['relativeVisibility', 'allElements'], ascending=[True, False])\n", - "\n", - "# Reset the index (row numbering starting at 0 and increasing by 1)\n", - "lowest_relative_visibility_modules=lowest_relative_visibility_modules.reset_index(drop=True)\n", - "\n", - "lowest_relative_visibility_modules.head(40)" - ] - }, - { - "cell_type": "markdown", - "id": "8ff237fd", - "metadata": {}, - "source": [ - "### Table 2 Chart 1 - Relative visibility of modules" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "98b12846", - "metadata": {}, - "outputs": [], - "source": [ - "plot.figure();\n", - "\n", - "number_of_types_grid_ticks=[1, 2, 5, 10, 20, 50, 100, 200, 500, 1_000, 2_000, 5_000, 10_000]\n", - "\n", - "relative_visibility_per_module.plot(\n", - " kind='scatter',\n", - " title='Relative visibility of modules', \n", - " x='relativeVisibility',\n", - " y='allElements',\n", - " grid=True,\n", - " logy=True,\n", - " yticks=number_of_types_grid_ticks,\n", - " xlabel='relative visibility',\n", - " ylabel='number of elements',\n", - " cmap=main_color_map,\n", - " figsize=(10,4),\n", - ")\n", - "\n", - "plot.show()" - ] - } - ], - "metadata": { - "authors": [ - { - "name": "JohT" - } - ], - "code_graph_analysis_pipeline_data_validation": "ValidateTypescriptModuleDependencies", - "kernelspec": { - "display_name": "codegraph", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.9" - }, - "title": "Visibility Metrics for Typescript" - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/jupyter/Wordcloud.ipynb b/jupyter/Wordcloud.ipynb deleted file mode 100644 index 7c0330e40..000000000 --- a/jupyter/Wordcloud.ipynb +++ /dev/null @@ -1,286 +0,0 @@ -{ - "cells": [ - { - "attachments": {}, - "cell_type": "markdown", - "id": "2f0eabc4", - "metadata": {}, - "source": [ - "# Wordcloud\n", - "
\n", - "\n", - "### References\n", - "- [jqassistant](https://jqassistant.org)\n", - "- [py2neo](https://py2neo.org/2021.1/)" - ] - }, - { - "cell_type": "code", - "execution_count": 247, - "id": "4191f259", - "metadata": {}, - "outputs": [], - "source": [ - "import os\n", - "import pandas as pd\n", - "import matplotlib.pyplot as plot\n", - "import typing as typ\n", - "from neo4j import GraphDatabase\n", - "from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator" - ] - }, - { - "cell_type": "code", - "execution_count": 248, - "id": "1c5dab37", - "metadata": {}, - "outputs": [], - "source": [ - "# Please set the environment variable \"NEO4J_INITIAL_PASSWORD\" in your shell \n", - "# before starting jupyter notebook to provide the password for the user \"neo4j\". \n", - "# It is not recommended to hardcode the password into jupyter notebook for security reasons.\n", - "\n", - "driver = GraphDatabase.driver(uri=\"bolt://localhost:7687\", auth=(\"neo4j\", os.environ.get(\"NEO4J_INITIAL_PASSWORD\")))\n", - "driver.verify_connectivity()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c1db254b", - "metadata": {}, - "outputs": [], - "source": [ - "def get_cypher_query_from_file(filename):\n", - " with open(filename) as file:\n", - " return ' '.join(file.readlines())\n", - "\n", - "\n", - "def query_cypher_to_data_frame(filename: str, parameters_: typ.Optional[typ.Dict[str, typ.Any]] = None):\n", - " records, summary, keys = driver.execute_query(get_cypher_query_from_file(filename),parameters_=parameters_)\n", - " return pd.DataFrame([r.values() for r in records], columns=keys)" - ] - }, - { - "cell_type": "code", - "execution_count": 251, - "id": "da9e8edb", - "metadata": {}, - "outputs": [], - "source": [ - "#The following cell uses the build-in %html \"magic\" to override the CSS style for tables to a much smaller size.\n", - "#This is especially needed for PDF export of tables with multiple columns." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "9deaabce", - "metadata": {}, - "outputs": [], - "source": [ - "%%html\n", - "" - ] - }, - { - "cell_type": "code", - "execution_count": 253, - "id": "c2496caf", - "metadata": {}, - "outputs": [], - "source": [ - "# Main Colormap\n", - "main_color_map = 'nipy_spectral'" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "97cf6afa", - "metadata": {}, - "source": [ - "## Word Cloud" - ] - }, - { - "cell_type": "code", - "execution_count": 254, - "id": "82b46521", - "metadata": {}, - "outputs": [], - "source": [ - "customized_stop_words = STOPWORDS.union([\n", - " 'builder', 'exception', 'abstract', 'helper', 'util', 'callback', 'factory', 'result',\n", - " 'handler', 'type', 'module', 'name', 'parameter', 'lambda', 'access', 'create', 'message', \n", - " 'ts', 'js', 'tsx', 'jsx', 'css', 'htm', 'html', 'props', 'use', 'id', 'ref', 'hook', 'event', \n", - " 'span', 'data', 'context', 'form', 'get', 'set', 'object', 'null', 'new', 'plugin', 'package', \n", - " 'types', 'dom', 'static', 'view', 'link', 'build', 'element', 'impl', 'function', 'test', \n", - " 'dev', 'event', 'mock', 'error', 'input', 'sdk', 'api', 'item', 'end', 'value', 'param', 'start'\n", - "])" - ] - }, - { - "cell_type": "code", - "execution_count": 255, - "id": "d2016fd0", - "metadata": {}, - "outputs": [], - "source": [ - "def plot_word_cloud_from_text(words: pd.DataFrame, title: str):\n", - " \n", - " # Join all words into one text separated by spaces\n", - " text = \" \".join(word for word in words.word)\n", - " number_of_words=len(words.word)\n", - " print(\"There are {} words in the dataset for the plot titled '{}'.\".format(number_of_words, title))\n", - "\n", - " if number_of_words <= 0:\n", - " return\n", - "\n", - " wordcloud = WordCloud(\n", - " width=800, \n", - " height=800,\n", - " max_words=600, \n", - " stopwords=customized_stop_words,\n", - " collocations=False,\n", - " background_color='white', \n", - " colormap='viridis'\n", - " ).generate(text)\n", - "\n", - " # Plot the word cloud\n", - " plot.figure(figsize=(15,15))\n", - " plot.imshow(wordcloud, interpolation='bilinear')\n", - " plot.axis(\"off\")\n", - " plot.title(title)\n", - " plot.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 256, - "id": "9fbf37ac", - "metadata": {}, - "outputs": [], - "source": [ - "def plot_word_cloud_with_frequency(words_with_frequency: pd.DataFrame, title: str):\n", - " \n", - " if words_with_frequency.empty:\n", - " return\n", - " \n", - " # Expects the first column of the DataFrame to contain the words/text and the second column to contain the count/frequency.\n", - " words_with_frequency_dict=words_with_frequency.set_index(words_with_frequency.columns[0]).to_dict()[words_with_frequency.columns[1]]\n", - " wordcloud = WordCloud(\n", - " width=800, \n", - " height=800,\n", - " max_words=600, \n", - " stopwords=customized_stop_words,\n", - " collocations=False,\n", - " background_color='white', \n", - " colormap='viridis'\n", - " ).generate_from_frequencies(words_with_frequency_dict)\n", - "\n", - " # Plot the word cloud\n", - " plot.figure(figsize=(15,15))\n", - " plot.imshow(wordcloud, interpolation='bilinear')\n", - " plot.axis(\"off\")\n", - " plot.title(title)\n", - " plot.show()" - ] - }, - { - "cell_type": "markdown", - "id": "58dd502f", - "metadata": {}, - "source": [ - "## WordCloud of names in code" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0ed729e3", - "metadata": {}, - "outputs": [], - "source": [ - "# Query data from graph database\n", - "words = query_cypher_to_data_frame(\"../cypher/Overview/Words_for_universal_Wordcloud.cypher\")\n", - "words.head(10)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b26bfe71", - "metadata": {}, - "outputs": [], - "source": [ - "plot_word_cloud_from_text(words=words, title='Wordcloud of names in code')" - ] - }, - { - "cell_type": "markdown", - "id": "9624f5ea", - "metadata": {}, - "source": [ - "## WordCloud of git authors" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b8ae94a2", - "metadata": {}, - "outputs": [], - "source": [ - "# Query data from graph database\n", - "git_author_words_with_frequency = query_cypher_to_data_frame(\"../cypher/Overview/Words_for_git_author_Wordcloud_with_frequency.cypher\")\n", - "git_author_words_with_frequency.head(10)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c1a81f62", - "metadata": {}, - "outputs": [], - "source": [ - "plot_word_cloud_with_frequency(git_author_words_with_frequency, 'Wordcloud of git authors (using frequency)')" - ] - } - ], - "metadata": { - "authors": [ - { - "name": "JohT" - } - ], - "kernelspec": { - "display_name": "codegraph", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.9" - }, - "title": "Object Oriented Design Quality Metrics for Java with Neo4j" - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/scripts/reports/ObjectOrientedDesignMetricsCsv.sh b/scripts/reports/ObjectOrientedDesignMetricsCsv.sh deleted file mode 100755 index c07029f68..000000000 --- a/scripts/reports/ObjectOrientedDesignMetricsCsv.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env bash - -# Executes "Metrics" Cypher queries to get the "object-oriented-design-metrics-csv" CSV reports. -# It contains lists of e.g. incoming and outgoing package dependencies, -# abstractness, instability and the distance to the so called "main sequence". - -# Requires executeQueryFunctions.sh, cleanupAfterReportGeneration.sh - -# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands) -set -o errexit -o pipefail - -# Overrideable Constants (defaults also defined in sub scripts) -REPORTS_DIRECTORY=${REPORTS_DIRECTORY:-"reports"} - -## Get this "scripts/reports" directory if not already set -# Even if $BASH_SOURCE is made for Bourne-like shells it is also supported by others and therefore here the preferred solution. -# CDPATH reduces the scope of the cd command to potentially prevent unintended directory changes. -# This way non-standard tools like readlink aren't needed. -REPORTS_SCRIPT_DIR=${REPORTS_SCRIPT_DIR:-$( CDPATH=. cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P )} -echo "ObjectOrientedDesignMetricsCsv: REPORTS_SCRIPT_DIR=${REPORTS_SCRIPT_DIR}" - -# Get the "scripts" directory by taking the path of this script and going one directory up. -SCRIPTS_DIR=${SCRIPTS_DIR:-"${REPORTS_SCRIPT_DIR}/.."} # Repository directory containing the shell scripts -echo "ObjectOrientedDesignMetricsCsv SCRIPTS_DIR=${SCRIPTS_DIR}" - -# Get the "cypher" directory by taking the path of this script and going two directory up and then to "cypher". -CYPHER_DIR=${CYPHER_DIR:-"${REPORTS_SCRIPT_DIR}/../../cypher"} -echo "ObjectOrientedDesignMetricsCsv CYPHER_DIR=${CYPHER_DIR}" - -# Define functions to execute cypher queries from within a given file -source "${SCRIPTS_DIR}/executeQueryFunctions.sh" - -# Create report directory -REPORT_NAME="object-oriented-design-metrics-csv" -FULL_REPORT_DIRECTORY="${REPORTS_DIRECTORY}/${REPORT_NAME}" -mkdir -p "${FULL_REPORT_DIRECTORY}" - -# Local Constants -METRICS_CYPHER_DIR="${CYPHER_DIR}/Metrics" - -# Java Packages only without sub-packages -echo "ObjectOrientedDesignMetricsCsv: $(date +'%Y-%m-%dT%H:%M:%S%z') Processing Java packages without sub-packages..." -execute_cypher_queries_until_results "${METRICS_CYPHER_DIR}/Get_Incoming_Java_Package_Dependencies.cypher" \ - "${METRICS_CYPHER_DIR}/Set_Incoming_Java_Package_Dependencies.cypher" \ - > "${FULL_REPORT_DIRECTORY}/IncomingPackageDependenciesJava.csv" -execute_cypher_queries_until_results "${METRICS_CYPHER_DIR}/Get_Outgoing_Java_Package_Dependencies.cypher" \ - "${METRICS_CYPHER_DIR}/Set_Outgoing_Java_Package_Dependencies.cypher" \ - > "${FULL_REPORT_DIRECTORY}/OutgoingPackageDependenciesJava.csv" -execute_cypher "${METRICS_CYPHER_DIR}/Calculate_and_set_Instability_for_Java.cypher" > "${FULL_REPORT_DIRECTORY}/InstabilityJava.csv" -execute_cypher "${METRICS_CYPHER_DIR}/Calculate_and_set_Abstractness_for_Java.cypher" > "${FULL_REPORT_DIRECTORY}/AbstractnessJava.csv" -execute_cypher "${METRICS_CYPHER_DIR}/Calculate_distance_between_abstractness_and_instability_for_Java.cypher" > "${FULL_REPORT_DIRECTORY}/MainSequenceAbstractnessInstabilityDistanceJava.csv" - -# Java Packages including sub-packages (overlapping/redundant) -# Since Java Packages are organized hierarchically, -# incoming dependencies can also be calculated by including all of their sub-packages. -# Top level packages like for example "org" and "org.company" are left out -# by assuring that only those packages are considered, -# that have other packages or types in the same hierarchy level ("siblings"). -echo "ObjectOrientedDesignMetricsCsv: $(date +'%Y-%m-%dT%H:%M:%S%z') Processing packages including sub-packages..." -execute_cypher_queries_until_results "${METRICS_CYPHER_DIR}/Get_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher" \ - "${METRICS_CYPHER_DIR}/Set_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher" \ - > "${FULL_REPORT_DIRECTORY}/IncomingPackageDependenciesIncludingSubpackagesJava.csv" -execute_cypher_queries_until_results "${METRICS_CYPHER_DIR}/Get_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher" \ - "${METRICS_CYPHER_DIR}/Set_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher" \ - > "${FULL_REPORT_DIRECTORY}/OutgoingPackageDependenciesIncludingSubpackagesJava.csv" -execute_cypher "${METRICS_CYPHER_DIR}/Calculate_and_set_Instability_for_Java_Including_Subpackages.cypher" > "${FULL_REPORT_DIRECTORY}/InstabilityIncludingSubpackagesJava.csv" -execute_cypher "${METRICS_CYPHER_DIR}/Calculate_and_set_Abstractness_for_Java_including_Subpackages.cypher" > "${FULL_REPORT_DIRECTORY}/AbstractnessIncludingSubpackagesJava.csv" -execute_cypher "${METRICS_CYPHER_DIR}/Calculate_distance_between_abstractness_and_instability_for_Java_including_subpackages.cypher" > "${FULL_REPORT_DIRECTORY}/MainSequenceAbstractnessInstabilityDistanceIncludingSubpackagesJava.csv" - -# Typescript Modules -echo "ObjectOrientedDesignMetricsCsv: $(date +'%Y-%m-%dT%H:%M:%S%z') Processing Typescript modules..." -execute_cypher_queries_until_results "${METRICS_CYPHER_DIR}/Get_Incoming_Typescript_Module_Dependencies.cypher" \ - "${METRICS_CYPHER_DIR}/Set_Incoming_Typescript_Module_Dependencies.cypher" \ - > "${FULL_REPORT_DIRECTORY}/IncomingPackageDependenciesTypescript.csv" -execute_cypher_queries_until_results "${METRICS_CYPHER_DIR}/Get_Outgoing_Typescript_Module_Dependencies.cypher" \ - "${METRICS_CYPHER_DIR}/Set_Outgoing_Typescript_Module_Dependencies.cypher" \ - > "${FULL_REPORT_DIRECTORY}/OutgoingPackageDependenciesTypescript.csv" -execute_cypher "${METRICS_CYPHER_DIR}/Calculate_and_set_Instability_for_Typescript.cypher" > "${FULL_REPORT_DIRECTORY}/InstabilityTypescript.csv" -execute_cypher "${METRICS_CYPHER_DIR}/Calculate_and_set_Abstractness_for_Typescript.cypher" > "${FULL_REPORT_DIRECTORY}/AbstractnessTypescript.csv" -execute_cypher "${METRICS_CYPHER_DIR}/Calculate_distance_between_abstractness_and_instability_for_Typescript.cypher" > "${FULL_REPORT_DIRECTORY}/MainSequenceAbstractnessInstabilityDistanceTypescript.csv" - -# Clean-up after report generation. Empty reports will be deleted. -source "${SCRIPTS_DIR}/cleanupAfterReportGeneration.sh" "${FULL_REPORT_DIRECTORY}" - -echo "ObjectOrientedDesignMetricsCsv: $(date +'%Y-%m-%dT%H:%M:%S%z') Successfully finished." \ No newline at end of file diff --git a/scripts/reports/VisibilityMetricsCsv.sh b/scripts/reports/VisibilityMetricsCsv.sh deleted file mode 100755 index 9f95b3512..000000000 --- a/scripts/reports/VisibilityMetricsCsv.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bash - -# Executes "Visibility" Cypher queries to get the "visibility-metrics-csv" CSV reports. -# It contains lists of packages with their relative visibility (public types divided by all types) -# as well as the global statistics for every artifact. - -# Requires executeQueryFunctions.sh, cleanupAfterReportGeneration.sh - -# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands) -set -o errexit -o pipefail - -# Overrideable Constants (defaults also defined in sub scripts) -REPORTS_DIRECTORY=${REPORTS_DIRECTORY:-"reports"} - -## Get this "scripts/reports" directory if not already set -# Even if $BASH_SOURCE is made for Bourne-like shells it is also supported by others and therefore here the preferred solution. -# CDPATH reduces the scope of the cd command to potentially prevent unintended directory changes. -# This way non-standard tools like readlink aren't needed. -REPORTS_SCRIPT_DIR=${REPORTS_SCRIPT_DIR:-$( CDPATH=. cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P )} -echo "VisibilityMetricsCsv: REPORTS_SCRIPT_DIR=${REPORTS_SCRIPT_DIR}" - -# Get the "scripts" directory by taking the path of this script and going one directory up. -SCRIPTS_DIR=${SCRIPTS_DIR:-"${REPORTS_SCRIPT_DIR}/.."} # Repository directory containing the shell scripts -echo "VisibilityMetricsCsv: SCRIPTS_DIR=${SCRIPTS_DIR}" - -# Get the "cypher" directory by taking the path of this script and going two directory up and then to "cypher". -CYPHER_DIR=${CYPHER_DIR:-"${REPORTS_SCRIPT_DIR}/../../cypher"} -echo "VisibilityMetricsCsv CYPHER_DIR=${CYPHER_DIR}" - -# Define functions to execute cypher queries from within a given file -source "${SCRIPTS_DIR}/executeQueryFunctions.sh" - -# Create report directory -REPORT_NAME="visibility-metrics-csv" -FULL_REPORT_DIRECTORY="${REPORTS_DIRECTORY}/${REPORT_NAME}" -mkdir -p "${FULL_REPORT_DIRECTORY}" - -# Local Constants -VISIBILITY_CYPHER_DIR="${CYPHER_DIR}/Visibility" - -# For Java -execute_cypher "${VISIBILITY_CYPHER_DIR}/Global_relative_visibility_statistics_for_types.cypher" > "${FULL_REPORT_DIRECTORY}/RelativeVisibilityPerArtifact.csv" -execute_cypher "${VISIBILITY_CYPHER_DIR}/Relative_visibility_public_types_to_all_types_per_package.cypher" > "${FULL_REPORT_DIRECTORY}/RelativeVisibilityPerPackage.csv" - -# For TypeScript -execute_cypher "${VISIBILITY_CYPHER_DIR}/Global_relative_visibility_statistics_for_elements_for_Typescript.cypher" > "${FULL_REPORT_DIRECTORY}/RelativeVisibilityPerTypescriptProject.csv" -execute_cypher "${VISIBILITY_CYPHER_DIR}/Relative_visibility_exported_elements_to_all_elements_per_module_for_Typescript.cypher" > "${FULL_REPORT_DIRECTORY}/RelativeVisibilityPerTypescriptModule.csv" - -# Clean-up after report generation. Empty reports will be deleted. -source "${SCRIPTS_DIR}/cleanupAfterReportGeneration.sh" "${FULL_REPORT_DIRECTORY}" \ No newline at end of file From d507b6a57df88aa6c9de5317b6ae5c8de06284d2 Mon Sep 17 00:00:00 2001 From: JohT <7671054+JohT@users.noreply.github.com> Date: Sat, 25 Apr 2026 14:25:32 +0200 Subject: [PATCH 2/2] Move enrichment for dependencies into dedicated folder --- ...script_external_module_dependencies.cypher | 0 ...script_internal_module_dependencies.cypher | 0 ...va_Package_DEPENDS_ON_relationships.cypher | 0 ...va_Package_DEPENDS_ON_relationships.cypher | 0 ..._to_Package_DEPENDS_ON_Relationship.cypher | 0 ...ava_Package_DEPENDS_ON_Relationship.cypher | 0 .../Set_Dependency_Degree.cypher | 0 .../Set_Dependency_Degree_Rank.cypher | 0 ..._Incoming_Java_Package_Dependencies.cypher | 33 ++++++++++++++++++ ...va_Package_Method_Call_Dependencies.cypher | 0 ...Set_Incoming_Java_Type_Dependencies.cypher | 0 ...ming_Typescript_Module_Dependencies.cypher | 34 +++++++++++++++++++ ..._Outgoing_Java_Package_Dependencies.cypher | 33 ++++++++++++++++++ ...va_Package_Method_Call_Dependencies.cypher | 0 ...Set_Outgoing_Java_Type_Dependencies.cypher | 0 ...oing_Typescript_Module_Dependencies.cypher | 34 +++++++++++++++++++ .../internal-dependencies/PREREQUISITES.md | 2 +- scripts/prepareAnalysis.sh | 31 ++++++++--------- 18 files changed, 150 insertions(+), 17 deletions(-) rename cypher/{DependsOn_Relationship_Weights => Dependency_Enrichment}/Add_fine_grained_weights_for_Typescript_external_module_dependencies.cypher (100%) rename cypher/{DependsOn_Relationship_Weights => Dependency_Enrichment}/Add_fine_grained_weights_for_Typescript_internal_module_dependencies.cypher (100%) rename cypher/{DependsOn_Relationship_Weights => Dependency_Enrichment}/Add_weight10PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher (100%) rename cypher/{DependsOn_Relationship_Weights => Dependency_Enrichment}/Add_weight25PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher (100%) rename cypher/{DependsOn_Relationship_Weights => Dependency_Enrichment}/Add_weight_property_for_Java_Interface_Dependencies_to_Package_DEPENDS_ON_Relationship.cypher (100%) rename cypher/{DependsOn_Relationship_Weights => Dependency_Enrichment}/Add_weight_property_to_Java_Package_DEPENDS_ON_Relationship.cypher (100%) rename cypher/{Metrics => Dependency_Enrichment}/Set_Dependency_Degree.cypher (100%) rename cypher/{Metrics => Dependency_Enrichment}/Set_Dependency_Degree_Rank.cypher (100%) create mode 100644 cypher/Dependency_Enrichment/Set_Incoming_Java_Package_Dependencies.cypher rename cypher/{Metrics => Dependency_Enrichment}/Set_Incoming_Java_Package_Method_Call_Dependencies.cypher (100%) rename cypher/{Metrics => Dependency_Enrichment}/Set_Incoming_Java_Type_Dependencies.cypher (100%) create mode 100644 cypher/Dependency_Enrichment/Set_Incoming_Typescript_Module_Dependencies.cypher create mode 100644 cypher/Dependency_Enrichment/Set_Outgoing_Java_Package_Dependencies.cypher rename cypher/{Metrics => Dependency_Enrichment}/Set_Outgoing_Java_Package_Method_Call_Dependencies.cypher (100%) rename cypher/{Metrics => Dependency_Enrichment}/Set_Outgoing_Java_Type_Dependencies.cypher (100%) create mode 100644 cypher/Dependency_Enrichment/Set_Outgoing_Typescript_Module_Dependencies.cypher diff --git a/cypher/DependsOn_Relationship_Weights/Add_fine_grained_weights_for_Typescript_external_module_dependencies.cypher b/cypher/Dependency_Enrichment/Add_fine_grained_weights_for_Typescript_external_module_dependencies.cypher similarity index 100% rename from cypher/DependsOn_Relationship_Weights/Add_fine_grained_weights_for_Typescript_external_module_dependencies.cypher rename to cypher/Dependency_Enrichment/Add_fine_grained_weights_for_Typescript_external_module_dependencies.cypher diff --git a/cypher/DependsOn_Relationship_Weights/Add_fine_grained_weights_for_Typescript_internal_module_dependencies.cypher b/cypher/Dependency_Enrichment/Add_fine_grained_weights_for_Typescript_internal_module_dependencies.cypher similarity index 100% rename from cypher/DependsOn_Relationship_Weights/Add_fine_grained_weights_for_Typescript_internal_module_dependencies.cypher rename to cypher/Dependency_Enrichment/Add_fine_grained_weights_for_Typescript_internal_module_dependencies.cypher diff --git a/cypher/DependsOn_Relationship_Weights/Add_weight10PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher b/cypher/Dependency_Enrichment/Add_weight10PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher similarity index 100% rename from cypher/DependsOn_Relationship_Weights/Add_weight10PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher rename to cypher/Dependency_Enrichment/Add_weight10PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher diff --git a/cypher/DependsOn_Relationship_Weights/Add_weight25PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher b/cypher/Dependency_Enrichment/Add_weight25PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher similarity index 100% rename from cypher/DependsOn_Relationship_Weights/Add_weight25PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher rename to cypher/Dependency_Enrichment/Add_weight25PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher diff --git a/cypher/DependsOn_Relationship_Weights/Add_weight_property_for_Java_Interface_Dependencies_to_Package_DEPENDS_ON_Relationship.cypher b/cypher/Dependency_Enrichment/Add_weight_property_for_Java_Interface_Dependencies_to_Package_DEPENDS_ON_Relationship.cypher similarity index 100% rename from cypher/DependsOn_Relationship_Weights/Add_weight_property_for_Java_Interface_Dependencies_to_Package_DEPENDS_ON_Relationship.cypher rename to cypher/Dependency_Enrichment/Add_weight_property_for_Java_Interface_Dependencies_to_Package_DEPENDS_ON_Relationship.cypher diff --git a/cypher/DependsOn_Relationship_Weights/Add_weight_property_to_Java_Package_DEPENDS_ON_Relationship.cypher b/cypher/Dependency_Enrichment/Add_weight_property_to_Java_Package_DEPENDS_ON_Relationship.cypher similarity index 100% rename from cypher/DependsOn_Relationship_Weights/Add_weight_property_to_Java_Package_DEPENDS_ON_Relationship.cypher rename to cypher/Dependency_Enrichment/Add_weight_property_to_Java_Package_DEPENDS_ON_Relationship.cypher diff --git a/cypher/Metrics/Set_Dependency_Degree.cypher b/cypher/Dependency_Enrichment/Set_Dependency_Degree.cypher similarity index 100% rename from cypher/Metrics/Set_Dependency_Degree.cypher rename to cypher/Dependency_Enrichment/Set_Dependency_Degree.cypher diff --git a/cypher/Metrics/Set_Dependency_Degree_Rank.cypher b/cypher/Dependency_Enrichment/Set_Dependency_Degree_Rank.cypher similarity index 100% rename from cypher/Metrics/Set_Dependency_Degree_Rank.cypher rename to cypher/Dependency_Enrichment/Set_Dependency_Degree_Rank.cypher diff --git a/cypher/Dependency_Enrichment/Set_Incoming_Java_Package_Dependencies.cypher b/cypher/Dependency_Enrichment/Set_Incoming_Java_Package_Dependencies.cypher new file mode 100644 index 000000000..4caad9111 --- /dev/null +++ b/cypher/Dependency_Enrichment/Set_Incoming_Java_Package_Dependencies.cypher @@ -0,0 +1,33 @@ +// Set Incoming Package Dependencies. Requires "Add_file_name and_extension.cypher". + + MATCH (p:Java:Package) + MATCH (artifact:Artifact)-[:CONTAINS]->(p) +OPTIONAL MATCH (p)-[:CONTAINS]->(it:Java:Type)<-[r:DEPENDS_ON]-(et:Java:Type)<-[:CONTAINS]-(ep:Package)<-[:CONTAINS]-(ea:Artifact) +OPTIONAL MATCH (it)<-[:DEPENDS_ON]-(eti:Java:Type:Interface) + WHERE p <> ep + AND p.fqn <> ep.fqn + // AND p.incomingDependencies IS NULL // comment out to recalculate + WITH artifact.name AS artifactName + ,p + ,COUNT(et) AS incomingDependencies + ,SUM(r.weight) AS incomingDependenciesWeight + ,COUNT(DISTINCT et) AS incomingDependentTypes + ,COUNT(DISTINCT eti) AS incomingDependentInterfaces // also included in dependent types + ,COUNT(DISTINCT ep) AS incomingDependentPackages + ,COUNT(DISTINCT ea) - 1 AS incomingDependentArtifacts +ORDER BY incomingDependencies DESC, p.fqn ASC // package with most incoming dependencies first + SET p.incomingDependencies = incomingDependencies + ,p.incomingDependenciesWeight = incomingDependenciesWeight + ,p.incomingDependentTypes = incomingDependentTypes + ,p.incomingDependentInterfaces = incomingDependentInterfaces + ,p.incomingDependentPackages = incomingDependentPackages + ,p.incomingDependentArtifacts = incomingDependentArtifacts + RETURN artifactName + ,p.fqn AS fullQualifiedPackageName + ,p.name AS packageName + ,incomingDependencies + ,incomingDependenciesWeight + ,incomingDependentTypes + ,incomingDependentInterfaces + ,incomingDependentPackages + ,incomingDependentArtifacts diff --git a/cypher/Metrics/Set_Incoming_Java_Package_Method_Call_Dependencies.cypher b/cypher/Dependency_Enrichment/Set_Incoming_Java_Package_Method_Call_Dependencies.cypher similarity index 100% rename from cypher/Metrics/Set_Incoming_Java_Package_Method_Call_Dependencies.cypher rename to cypher/Dependency_Enrichment/Set_Incoming_Java_Package_Method_Call_Dependencies.cypher diff --git a/cypher/Metrics/Set_Incoming_Java_Type_Dependencies.cypher b/cypher/Dependency_Enrichment/Set_Incoming_Java_Type_Dependencies.cypher similarity index 100% rename from cypher/Metrics/Set_Incoming_Java_Type_Dependencies.cypher rename to cypher/Dependency_Enrichment/Set_Incoming_Java_Type_Dependencies.cypher diff --git a/cypher/Dependency_Enrichment/Set_Incoming_Typescript_Module_Dependencies.cypher b/cypher/Dependency_Enrichment/Set_Incoming_Typescript_Module_Dependencies.cypher new file mode 100644 index 000000000..8e19c62da --- /dev/null +++ b/cypher/Dependency_Enrichment/Set_Incoming_Typescript_Module_Dependencies.cypher @@ -0,0 +1,34 @@ +// Set incoming Typescript Module dependencies + +// Get the top level dependency between a Typescript module and other modules that uses it + MATCH (source:TS:Module) +OPTIONAL MATCH (source)<-[moduleDependency:DEPENDS_ON]-(target:TS:Module) + WHERE source <> target +// Get the project of the external module if available +OPTIONAL MATCH (projectdir:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(target) +// Aggregate all gathered information for each (grouped by) source module + WITH source + ,collect(DISTINCT projectdir.absoluteFileName) AS projectNames + ,count(DISTINCT target.globalFqn) AS externalModuleCount + ,sum(moduleDependency.declarationCount) AS declarationCount + ,sum(moduleDependency.abstractTypeCount) AS abstractTypeCount + ,sum(moduleDependency.cardinality) AS totalCardinality + ,sum(moduleDependency.abstractTypeCardinality) AS abstractTypeCardinality + ,collect(DISTINCT target.globalFqn)[0..4] AS externalModuleExamples + SET source.incomingDependencies = declarationCount + ,source.incomingDependenciesWeight = totalCardinality + ,source.incomingDependentAbstractTypes = abstractTypeCount + ,source.incomingDependentAbstractTypeWeight = abstractTypeCardinality + ,source.incomingDependentModules = externalModuleCount + ,source.incomingDependentPackages = size(projectNames) +RETURN source.globalFqn AS fullQualifiedModuleName + ,source.name AS moduleName + ,declarationCount AS incomingDependencies + ,totalCardinality AS incomingDependenciesWeight + ,abstractTypeCount AS incomingDependentAbstractTypes + ,abstractTypeCardinality AS incomingDependentAbstractTypeWeight + ,externalModuleCount AS incomingDependentModules + ,size(projectNames) AS incomingDependentPackages + ,externalModuleExamples + ,projectNames +ORDER BY incomingDependencies DESC, fullQualifiedModuleName ASC // modules with most incoming dependencies first diff --git a/cypher/Dependency_Enrichment/Set_Outgoing_Java_Package_Dependencies.cypher b/cypher/Dependency_Enrichment/Set_Outgoing_Java_Package_Dependencies.cypher new file mode 100644 index 000000000..6ffa456e8 --- /dev/null +++ b/cypher/Dependency_Enrichment/Set_Outgoing_Java_Package_Dependencies.cypher @@ -0,0 +1,33 @@ +//Set Outgoing Package Dependencies. Requires "Add_file_name and_extension.cypher". + + MATCH (p:Java:Package) + MATCH (artifact:Artifact)-[:CONTAINS]->(p) +OPTIONAL MATCH (p)-[:CONTAINS]->(it:Java:Type)-[r:DEPENDS_ON]->(et:Java:Type)<-[:CONTAINS]-(ep:Package)<-[:CONTAINS]-(ea:Artifact) +OPTIONAL MATCH (it)-[:DEPENDS_ON]->(eti:Java:Type:Interface) + WHERE p <> ep + AND p.fqn <> ep.fqn + // AND p.incomingDependencies IS NULL // comment out to recalculate + WITH artifact.name AS artifactName + ,p + ,COUNT(et) AS outgoingDependencies + ,SUM(r.weight) AS outgoingDependenciesWeight + ,COUNT(DISTINCT et) AS outgoingDependentTypes + ,COUNT(DISTINCT eti) AS outgoingDependentInterfaces // also included in dependent types + ,COUNT(DISTINCT ep) AS outgoingDependentPackages + ,COUNT(DISTINCT ea) -1 AS outgoingDependentArtifacts +ORDER BY outgoingDependencies DESC, p.fqn ASC // package with most incoming dependencies first + SET p.outgoingDependencies = outgoingDependencies + ,p.outgoingDependenciesWeight = outgoingDependenciesWeight + ,p.outgoingDependentTypes = outgoingDependentTypes + ,p.outgoingDependentInterfaces = outgoingDependentInterfaces + ,p.outgoingDependentPackages = outgoingDependentPackages + ,p.outgoingDependentArtifacts = outgoingDependentArtifacts + RETURN artifactName + ,p.fqn AS fullQualifiedPackageName + ,p.name AS packageName + ,outgoingDependencies + ,outgoingDependenciesWeight + ,outgoingDependentTypes + ,outgoingDependentInterfaces + ,outgoingDependentPackages + ,outgoingDependentArtifacts diff --git a/cypher/Metrics/Set_Outgoing_Java_Package_Method_Call_Dependencies.cypher b/cypher/Dependency_Enrichment/Set_Outgoing_Java_Package_Method_Call_Dependencies.cypher similarity index 100% rename from cypher/Metrics/Set_Outgoing_Java_Package_Method_Call_Dependencies.cypher rename to cypher/Dependency_Enrichment/Set_Outgoing_Java_Package_Method_Call_Dependencies.cypher diff --git a/cypher/Metrics/Set_Outgoing_Java_Type_Dependencies.cypher b/cypher/Dependency_Enrichment/Set_Outgoing_Java_Type_Dependencies.cypher similarity index 100% rename from cypher/Metrics/Set_Outgoing_Java_Type_Dependencies.cypher rename to cypher/Dependency_Enrichment/Set_Outgoing_Java_Type_Dependencies.cypher diff --git a/cypher/Dependency_Enrichment/Set_Outgoing_Typescript_Module_Dependencies.cypher b/cypher/Dependency_Enrichment/Set_Outgoing_Typescript_Module_Dependencies.cypher new file mode 100644 index 000000000..d8c0bb9ca --- /dev/null +++ b/cypher/Dependency_Enrichment/Set_Outgoing_Typescript_Module_Dependencies.cypher @@ -0,0 +1,34 @@ +// Set outgoing Typescript Module dependencies + +// Get the top level dependency between a Typescript module and an external modules it uses + MATCH (source:TS:Module) +OPTIONAL MATCH (source)-[moduleDependency:DEPENDS_ON]->(target:ExternalModule) + WHERE NOT EXISTS {(target)-[:IS_IMPLEMENTED_IN]->(source)} +// Get the project of the external module if available +OPTIONAL MATCH (projectdir:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(:TS:Module)<-[:IS_IMPLEMENTED_IN]-(target) +// Aggregate all gathered information for each (grouped by) source module + WITH source + ,collect(DISTINCT projectdir.absoluteFileName) AS projectNames + ,count(DISTINCT target.globalFqn) AS externalModuleCount + ,sum(moduleDependency.declarationCount) AS declarationCount + ,sum(moduleDependency.abstractTypeCount) AS abstractTypeCount + ,sum(moduleDependency.cardinality) AS totalCardinality + ,sum(moduleDependency.abstractTypeCardinality) AS abstractTypeCardinality + ,collect(DISTINCT target.globalFqn)[0..4] AS externalModuleExamples + SET source.outgoingDependencies = declarationCount + ,source.outgoingDependenciesWeight = totalCardinality + ,source.outgoingDependentAbstractTypes = abstractTypeCount + ,source.outgoingDependentAbstractTypeWeight = abstractTypeCardinality + ,source.outgoingDependentModules = externalModuleCount + ,source.outgoingDependentPackages = size(projectNames) +RETURN source.globalFqn AS fullQualifiedModuleName + ,source.name AS moduleName + ,declarationCount AS outgoingDependencies + ,totalCardinality AS outgoingDependenciesWeight + ,abstractTypeCount AS outgoingDependentAbstractTypes + ,abstractTypeCardinality AS outgoingDependentAbstractTypeWeight + ,externalModuleCount AS outgoingDependentModules + ,size(projectNames) AS outgoingDependentPackages + ,externalModuleExamples + ,projectNames +ORDER BY outgoingDependencies DESC, fullQualifiedModuleName ASC diff --git a/domains/internal-dependencies/PREREQUISITES.md b/domains/internal-dependencies/PREREQUISITES.md index a5a22a0da..4aaca1480 100644 --- a/domains/internal-dependencies/PREREQUISITES.md +++ b/domains/internal-dependencies/PREREQUISITES.md @@ -46,7 +46,7 @@ The following weight properties must exist on `DEPENDS_ON` relationships: | `weightInterfaces` | Dependency weight counting only interface types | | `weight25PercentInterfaces` | Blended weight: 75% class + 25% interface weight | -**Cypher source:** [`cypher/DependsOn_Relationship_Weights/`](../../cypher/DependsOn_Relationship_Weights/) +**Cypher source:** [`cypher/Dependency_Enrichment/`](../../cypher/Dependency_Enrichment/) --- diff --git a/scripts/prepareAnalysis.sh b/scripts/prepareAnalysis.sh index 206e978d9..06da37f9c 100644 --- a/scripts/prepareAnalysis.sh +++ b/scripts/prepareAnalysis.sh @@ -34,8 +34,7 @@ source "${SCRIPTS_DIR}/executeQueryFunctions.sh" source "${SCRIPTS_DIR}/parseCsvFunctions.sh" # Local Constants -DEPENDS_ON_CYPHER_DIR="$CYPHER_DIR/DependsOn_Relationship_Weights" -METRICS_CYPHER_DIR="$CYPHER_DIR/Metrics" +DEPENDENCY_ENRICHMENT_CYPHER_DIR="$CYPHER_DIR/Dependency_Enrichment" JAVA_CYPHER_DIR="$CYPHER_DIR/Java" ARTIFACT_DEPENDENCIES_CYPHER_DIR="$CYPHER_DIR/Artifact_Dependencies" TYPES_CYPHER_DIR="$CYPHER_DIR/Types" @@ -108,26 +107,26 @@ if ! is_csv_column_greater_zero "${dataVerificationResult}" "typescriptModuleDep fi # Preparation - Add weights to Java Package DEPENDS_ON relationships -execute_cypher_summarized "${DEPENDS_ON_CYPHER_DIR}/Add_weight_property_for_Java_Interface_Dependencies_to_Package_DEPENDS_ON_Relationship.cypher" -execute_cypher_summarized "${DEPENDS_ON_CYPHER_DIR}/Add_weight_property_to_Java_Package_DEPENDS_ON_Relationship.cypher" -execute_cypher_summarized "${DEPENDS_ON_CYPHER_DIR}/Add_weight25PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher" -execute_cypher_summarized "${DEPENDS_ON_CYPHER_DIR}/Add_weight10PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Add_weight_property_for_Java_Interface_Dependencies_to_Package_DEPENDS_ON_Relationship.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Add_weight_property_to_Java_Package_DEPENDS_ON_Relationship.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Add_weight25PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Add_weight10PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher" # Preparation - Add weights to Typescript Module DEPENDS_ON relationships -execute_cypher_summarized "${DEPENDS_ON_CYPHER_DIR}/Add_fine_grained_weights_for_Typescript_external_module_dependencies.cypher" -execute_cypher_summarized "${DEPENDS_ON_CYPHER_DIR}/Add_fine_grained_weights_for_Typescript_internal_module_dependencies.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Add_fine_grained_weights_for_Typescript_external_module_dependencies.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Add_fine_grained_weights_for_Typescript_internal_module_dependencies.cypher" # Preparation - Add Typescript Module node properties "incomingDependencies" and "outgoingDependencies" -execute_cypher_summarized "${METRICS_CYPHER_DIR}/Set_Incoming_Typescript_Module_Dependencies.cypher" -execute_cypher_summarized "${METRICS_CYPHER_DIR}/Set_Outgoing_Typescript_Module_Dependencies.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Set_Incoming_Typescript_Module_Dependencies.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Set_Outgoing_Typescript_Module_Dependencies.cypher" # Preparation - Add Java Package node properties "incomingDependencies" and "outgoingDependencies" -execute_cypher_summarized "${METRICS_CYPHER_DIR}/Set_Incoming_Java_Package_Dependencies.cypher" -execute_cypher_summarized "${METRICS_CYPHER_DIR}/Set_Outgoing_Java_Package_Dependencies.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Set_Incoming_Java_Package_Dependencies.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Set_Outgoing_Java_Package_Dependencies.cypher" # Preparation - Language agnostic node properties "dependencyDegree", "dependencyDegreeWeighted", "dependencyDegreeRank" -execute_cypher_summarized "${METRICS_CYPHER_DIR}/Set_Dependency_Degree.cypher" -execute_cypher_summarized "${METRICS_CYPHER_DIR}/Set_Dependency_Degree_Rank.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Set_Dependency_Degree.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Set_Dependency_Degree_Rank.cypher" # Preparation - Add Java Method node property "declaringType" execute_cypher "${TYPES_CYPHER_DIR}/Set_declaring_type_on_method_nodes.cypher" @@ -149,7 +148,7 @@ execute_cypher_summarized "${ARTIFACT_DEPENDENCIES_CYPHER_DIR}/Outgoing_Java_Art execute_cypher_summarized "${ARTIFACT_DEPENDENCIES_CYPHER_DIR}/Set_maven_artifact_version.cypher" # Preparation - Add Java Type node properties "incomingDependencies" and "outgoingDependencies" -execute_cypher_summarized "${METRICS_CYPHER_DIR}/Set_Incoming_Java_Type_Dependencies.cypher" -execute_cypher_summarized "${METRICS_CYPHER_DIR}/Set_Outgoing_Java_Type_Dependencies.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Set_Incoming_Java_Type_Dependencies.cypher" +execute_cypher_summarized "${DEPENDENCY_ENRICHMENT_CYPHER_DIR}/Set_Outgoing_Java_Type_Dependencies.cypher" echo "prepareAnalysis: Preparation successful" \ No newline at end of file