├── .github ├── pull_request_template.md └── workflows │ ├── internal-check-links-in-documentation.yml │ ├── internal-check-renovate-config.yml │ ├── internal-cypher-reference-documentation.yml │ ├── internal-environment-variables-reference-documentation.yml │ ├── internal-java-code-analysis.yml │ ├── internal-scripts-reference-documentation.yml │ ├── internal-typescript-code-analysis.yml │ └── public-analyze-code-graph.yml ├── .nvmrc ├── CHANGELOG.md ├── COMMANDS.md ├── GETTING_STARTED.md ├── INTEGRATION.md ├── LICENSE ├── README.md ├── cypher ├── Artifact_Dependencies │ ├── Artifacts_with_dependencies_to_other_artifacts.cypher │ ├── Artifacts_with_duplicate_packages.cypher │ ├── Incoming_Java_Artifact_Dependencies.cypher │ ├── Most_used_internal_dependencies_acreoss_artifacts.cypher │ ├── Outgoing_Java_Artifact_Dependencies.cypher │ ├── Set_maven_artifact_version.cypher │ ├── Set_number_of_Java_packages_and_types_on_artifacts.cypher │ ├── Usage_and_spread_of_internal_artifact_dependencies.cypher │ └── Usage_and_spread_of_internal_artifact_dependents.cypher ├── CYPHER.md ├── Centrality │ ├── Centrality_10a_Bridges_Estimate.cypher │ ├── Centrality_10d_Bridges_Stream.cypher │ ├── Centrality_10e_Bridges_Write.cypher │ ├── Centrality_1a_List_TopPercentile.cypher │ ├── Centrality_1b_List_TopPercent.cypher │ ├── Centrality_1c_Label_Delete.cypher │ ├── Centrality_1d_Label_Add.cypher │ ├── Centrality_2a_Page_Rank_Estimate.cypher │ ├── Centrality_2b_Page_Rank_Statistics.cypher │ ├── Centrality_3c_Page_Rank_Mutate.cypher │ ├── Centrality_3d_Page_Rank_Stream.cypher │ ├── Centrality_3e_Page_Rank_Write.cypher │ ├── Centrality_4a_Article_Rank_Estimate.cypher │ ├── Centrality_4b_Article_Rank_Statistics.cypher │ ├── Centrality_4c_Article_Rank_Mutate.cypher │ ├── Centrality_4d_Article_Rank_Stream.cypher │ ├── Centrality_4e_Article_Rank_Write.cypher │ ├── Centrality_5a_Betweeness_Estimate.cypher │ ├── Centrality_5b_Betweeness_Statistics.cypher │ ├── Centrality_5c_Betweeness_Mutate.cypher │ ├── Centrality_5d_Betweeness_Stream.cypher │ ├── Centrality_5e_Betweeness_Write.cypher │ ├── Centrality_6a_Cost_effective_Lazy_Forward_CELF_Estimate.cypher │ ├── Centrality_6b_Cost_effective_Lazy_Forward_CELF_Statistics.cypher │ ├── Centrality_6c_Cost_effective_Lazy_Forward_CELF_Mutate.cypher │ ├── Centrality_6d_Cost_effective_Lazy_Forward_CELF_Stream.cypher │ ├── Centrality_6e_Cost_effective_Lazy_Forward_CELF_Write.cypher │ ├── Centrality_7b_Harmonic_Closeness_Statistics.cypher │ ├── Centrality_7c_Harmonic_Closeness_Mutate.cypher │ ├── Centrality_7d_Harmonic_Closeness_Stream.cypher │ ├── Centrality_7e_Harmonic_Closeness_Write.cypher │ ├── Centrality_8b_Closeness_Statistics.cypher │ ├── Centrality_8c_Closeness_Mutate.cypher │ ├── Centrality_8d_Closeness_Stream.cypher │ ├── Centrality_8e_Closeness_Write.cypher │ ├── Centrality_90_Summary.cypher │ ├── Centrality_9a_Hyperlink_Induced_Topic_Search_HITS_Estimate.cypher │ ├── Centrality_9b_Hyperlink_Induced_Topic_Search_HITS_Statistics.cypher │ ├── Centrality_9c_Hyperlink_Induced_Topic_Search_HITS_Mutate.cypher │ ├── Centrality_9d_Hyperlink_Induced_Topic_Search_HITS_Stream.cypher │ ├── Centrality_9d_Hyperlink_Induced_Topic_Search_HITS_Stream_Mutated.cypher │ ├── Centrality_9e_Hyperlink_Induced_Topic_Search_HITS_Write.cypher │ └── Set_Parameters.cypher ├── Community_Detection │ ├── Community_Detection_10a_LocalClusteringCoefficient_Estimate.cypher │ ├── Community_Detection_10b_LocalClusteringCoefficient_Statistics.cypher │ ├── Community_Detection_10c_LocalClusteringCoefficient_Mutate.cypher │ ├── Community_Detection_10d_LocalClusteringCoefficient_Stream.cypher │ ├── Community_Detection_10d_LocalClusteringCoefficient_Stream_Aggregated.cypher │ ├── Community_Detection_10e_LocalClusteringCoefficient_Write.cypher │ ├── Community_Detection_1a_Louvain_Estimate.cypher │ ├── Community_Detection_1b_Louvain_Statistics.cypher │ ├── Community_Detection_1c_Louvain_Mutate.cypher │ ├── Community_Detection_1d_Louvain_Stream.cypher │ ├── Community_Detection_1d_Stream_Intermediate_Mutated.cypher │ ├── Community_Detection_1e_Louvain_Write_intermediateLouvainCommunityId.cypher │ ├── Community_Detection_1e_Louvain_Write_louvainCommunityId.cypher │ ├── Community_Detection_2a_Leiden_Estimate.cypher │ ├── Community_Detection_2b_Leiden_Statistics.cypher │ ├── Community_Detection_2c_Leiden_Mutate.cypher │ ├── Community_Detection_2d_Leiden_Stream.cypher │ ├── Community_Detection_2d_Leiden_Write_Node_Property.cypher │ ├── Community_Detection_3a_WeaklyConnectedComponents_Estimate.cypher │ ├── Community_Detection_3b_WeaklyConnectedComponents_Statistics.cypher │ ├── Community_Detection_3c_WeaklyConnectedComponents_Mutate.cypher │ ├── Community_Detection_3d_WeaklyConnectedComponents_Stream.cypher │ ├── Community_Detection_3e_WeaklyConnectedComponents_Write.cypher │ ├── Community_Detection_4a_Label_Propagation_Estimate.cypher │ ├── Community_Detection_4b_Label_Propagation_Statistics.cypher │ ├── Community_Detection_4c_Label_Propagation_Mutate.cypher │ ├── Community_Detection_4d_Label_Propagation_Stream.cypher │ ├── Community_Detection_4e_Label_Propagation_Write.cypher │ ├── Community_Detection_5a_K_Core_Decomposition_Estimate.cypher │ ├── Community_Detection_5b_K_Core_Decomposition_Statistics.cypher │ ├── Community_Detection_5c_K_Core_Decomposition_Mutate.cypher │ ├── Community_Detection_5d_K_Core_Decomposition_Stream.cypher │ ├── Community_Detection_5e_K_Core_Decomposition_Write.cypher │ ├── Community_Detection_6a_Approximate_Maximum_k_cut_Estimate.cypher │ ├── Community_Detection_6c_Approximate_Maximum_k_cut_Mutate.cypher │ ├── Community_Detection_6d_Approximate_Maximum_k_cut_Stream.cypher │ ├── Community_Detection_7d_Modularity.cypher │ ├── Community_Detection_7d_Modularity_Members.cypher │ ├── Community_Detection_7e_Write_Modularity.cypher │ ├── Community_Detection_8d_Conductance.cypher │ ├── Community_Detection_8d_Conductance_Members.cypher │ ├── Community_Detection_9_Community_Metrics.cypher │ ├── Community_Detection_Summary.cypher │ ├── Compare_Louvain_vs_Leiden_Results.cypher │ ├── Get_all_Packages_with_a_Community_Detection_Label.cypher │ ├── Set_Parameters.cypher │ ├── Type_communities_that_span_the_most_packages.cypher │ ├── Type_communities_that_span_the_most_packages_with_type_statistics.cypher │ ├── Type_communities_with_few_members_in_foreign_packages.cypher │ ├── Which_package_community_spans_multiple_artifacts.cypher │ ├── Which_package_community_spans_several_artifacts_and_how_are_the_packages_distributed.cypher │ └── Which_type_community_spans_several_artifacts_and_how_are_the_types_distributed.cypher ├── Count_nodes_and_relationships.cypher ├── Create_Java_Type_index_for_full_qualified_name.cypher ├── Create_Typescript_index_for_full_qualified_name.cypher ├── Create_Typescript_index_for_name.cypher ├── Cyclic_Dependencies │ ├── Cyclic_Dependencies.cypher │ ├── Cyclic_Dependencies_Breakdown.cypher │ ├── Cyclic_Dependencies_Breakdown_Backward_Only.cypher │ ├── Cyclic_Dependencies_Breakdown_Backward_Only_for_Typescript.cypher │ ├── Cyclic_Dependencies_Breakdown_for_Typescript.cypher │ ├── Cyclic_Dependencies_Concatenated.cypher │ ├── Cyclic_Dependencies_as_Nodes.cypher │ ├── Cyclic_Dependencies_between_Artifacts_as_unwinded_List.cypher │ └── Cyclic_Dependencies_for_Typescript.cypher ├── Data_verification_DEPENDS_ON_relationships.cypher ├── Dependencies_Projection │ ├── Dependencies_0_Check_Projectable.cypher │ ├── Dependencies_0_Prepare_Projection.cypher │ ├── Dependencies_0_Verify_Projectable.cypher │ ├── Dependencies_10_Delete_Label.cypher │ ├── Dependencies_11_Add_Label.cypher │ ├── Dependencies_12_Get_Projection_Statistics.cypher │ ├── Dependencies_1_Delete_Projection.cypher │ ├── Dependencies_2_Delete_Subgraph.cypher │ ├── Dependencies_3_Create_Projection.cypher │ ├── Dependencies_3b_Create_Multi_Relationship_Projection.cypher │ ├── Dependencies_3c_Create_Java_Type_Projection.cypher │ ├── Dependencies_3d_Create_Java_Method_Projection.cypher │ ├── Dependencies_4_Create_Undirected_Projection.cypher │ ├── Dependencies_4c_Create_Undirected_Java_Type_Projection.cypher │ ├── Dependencies_5_Create_Subgraph.cypher │ ├── Dependencies_6_Check_Projection_Nodes.cypher │ ├── Dependencies_7_Check_Projection_Relationships.cypher │ ├── Dependencies_8_Stream_Mutated.cypher │ ├── Dependencies_8_Stream_Mutated_Extended.cypher │ ├── Dependencies_8_Stream_Mutated_Grouped.cypher │ ├── Dependencies_8_Stream_Mutated_Value_Descending.cypher │ ├── Dependencies_9_Write_Mutated.cypher │ └── Set_Parameters.cypher ├── DependsOn_Relationship_Weights │ ├── Add_fine_grained_weights_for_Typescript_external_module_dependencies.cypher │ ├── Add_fine_grained_weights_for_Typescript_internal_module_dependencies.cypher │ ├── Add_weight10PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher │ ├── Add_weight25PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher │ ├── Add_weight_property_for_Java_Interface_Dependencies_to_Package_DEPENDS_ON_Relationship.cypher │ └── Add_weight_property_to_Java_Package_DEPENDS_ON_Relationship.cypher ├── Exploration │ ├── Explore_DEPENDS_ON_relationships.cypher │ ├── Explore_ExternalDeclaration.cypher │ ├── Explore_Module_outgoing_dependencies.cypher │ ├── Explore_Typescript_elements_with_same_globalFqn.cypher │ ├── Explore_Typescript_modules_overview.cypher │ ├── Explore_Typescript_modules_per_symboltype.cypher │ ├── Explore_Typescript_projects.cypher │ ├── Explore_common_globalfqn_prefix.cypher │ ├── Explore_degree_schema.cypher │ ├── Explore_external_Typescript_dependencies.cypher │ ├── Explore_node_properties.cypher │ └── Explore_node_relationships.cypher ├── Export_the_whole_database_as_CSV.cypher ├── External_Dependencies │ ├── External_module_usage_overall_for_Typescript.cypher │ ├── External_module_usage_per_internal_module_aggregated_for_Typescript.cypher │ ├── External_module_usage_per_internal_module_distribution_for_Typescript.cypher │ ├── External_module_usage_per_internal_module_sorted_for_Typescript.cypher │ ├── External_module_usage_spread_for_Typescript.cypher │ ├── External_namespace_usage_overall_for_Typescript.cypher │ ├── External_namespace_usage_per_internal_module_sorted_for_Typescript.cypher │ ├── External_namespace_usage_spread_for_Typescript.cypher │ ├── External_package_levels.cypher │ ├── External_package_name_elements.cypher │ ├── External_package_usage_overall.cypher │ ├── External_package_usage_per_artifact.cypher │ ├── External_package_usage_per_artifact_and_external_package.cypher │ ├── External_package_usage_per_artifact_and_package.cypher │ ├── External_package_usage_per_artifact_and_package_with_annotations.cypher │ ├── External_package_usage_per_artifact_distribution.cypher │ ├── External_package_usage_per_artifact_package_aggregated.cypher │ ├── External_package_usage_per_artifact_sorted.cypher │ ├── External_package_usage_per_artifact_sorted_top.cypher │ ├── External_package_usage_per_internal_package_count.cypher │ ├── External_package_usage_per_type.cypher │ ├── External_package_usage_per_type_distribution_with_annotations.cypher │ ├── External_package_usage_spread.cypher │ ├── External_second_level_package_usage_overall.cypher │ ├── External_second_level_package_usage_per_artifact_and_external_package.cypher │ ├── External_second_level_package_usage_spread.cypher │ ├── External_types_per_artifact_using_requires.cypher │ ├── Label_external_types_and_annotations.cypher │ ├── List_external_Java_types_used.cypher │ ├── List_external_modules_resolved_to_internal_ones_for_Typescript.cypher │ ├── Maven_POMs_and_their_declared_dependencies.cypher │ ├── Package_json_dependencies_by_package.cypher │ ├── Package_json_dependencies_combinations.cypher │ ├── Package_json_dependencies_combinations_with_versions.cypher │ ├── Package_json_dependencies_occurrence.cypher │ └── Remove_external_type_and_annotation_labels.cypher ├── General_Enrichment │ └── Add_file_name and_extension.cypher ├── GitLog │ ├── Add_CHANGED_TOGETHER_WITH_relationships_to_code_files.cypher │ ├── Add_CHANGED_TOGETHER_WITH_relationships_to_git_files.cypher │ ├── Add_HAS_PARENT_relationships_to_commits.cypher │ ├── Add_RESOLVES_TO_relationships_to_git_files_for_Java.cypher │ ├── Add_RESOLVES_TO_relationships_to_git_files_for_Typescript.cypher │ ├── Create_git_repository_node.cypher │ ├── Delete_git_log_data.cypher │ ├── Delete_plain_git_directory_file_nodes.cypher │ ├── Import_aggregated_git_log_csv_data.cypher │ ├── Import_git_log_csv_data.cypher │ ├── Index_absolute_file_name.cypher │ ├── Index_author_name.cypher │ ├── Index_change_span_year.cypher │ ├── Index_commit_hash.cypher │ ├── Index_commit_parent.cypher │ ├── Index_commit_sha.cypher │ ├── Index_file_name.cypher │ ├── Index_file_relative_path.cypher │ ├── List_ambiguous_git_files.cypher │ ├── List_git_file_directories_with_commit_statistics.cypher │ ├── List_git_files_by_resolved_label_and_extension.cypher │ ├── List_git_files_per_commit_distribution.cypher │ ├── List_git_files_that_were_changed_together.cypher │ ├── List_git_files_that_were_changed_together_all_in_one.cypher │ ├── List_git_files_that_were_changed_together_with_another_file.cypher │ ├── List_git_files_that_were_changed_together_with_another_file_all_in_one.cypher │ ├── List_git_files_with_commit_statistics_by_author.cypher │ ├── List_pairwise_changed_files_with_dependencies.cypher │ ├── List_unresolved_git_files.cypher │ ├── Set_number_of_aggregated_git_commits.cypher │ ├── Set_number_of_git_log_commits.cypher │ ├── Set_number_of_git_plugin_commits.cypher │ ├── Verify_code_to_git_file_unambiguous.cypher │ └── Verify_git_to_code_file_unambiguous.cypher ├── Internal_Dependencies │ ├── Candidates_for_Interface_Segregation.cypher │ ├── Get_file_distance_as_shortest_contains_path_for_dependencies.cypher │ ├── How_many_classes_compared_to_all_existing_in_the_same_package_are_used_by_dependent_packages_across_different_artifacts.cypher │ ├── How_many_elements_compared_to_all_existing_are_used_by_dependent_modules_for_Typescript.cypher │ ├── How_many_packages_compared_to_all_existing_are_used_by_dependent_artifacts.cypher │ ├── Inter_scan_and_project_dependencies_of_Typescript_modules.cypher │ ├── Java_Artifact_build_levels_for_graphviz.cypher │ ├── List_all_Java_artifacts.cypher │ ├── List_all_Typescript_modules.cypher │ ├── List_elements_that_are_used_by_many_different_modules_for_Typescript.cypher │ ├── List_types_that_are_used_by_many_different_packages.cypher │ ├── Set_file_distance_as_shortest_contains_path_for_dependencies.cypher │ └── Typescript_Module_build_levels_for_graphviz.cypher ├── Java │ ├── Annotated_code_elements.cypher │ ├── Annotated_code_elements_per_artifact.cypher │ ├── Get_all_declared_and_inherited_methods_of_a_type.cypher │ ├── JakartaEE_REST_Annotations.cypher │ ├── JakartaEE_REST_Annotations_Nodes.cypher │ ├── Java_Reflection_usage.cypher │ ├── Java_Reflection_usage_detailed.cypher │ ├── Java_deprecated_element_usage.cypher │ ├── Java_deprecated_element_usage_detailed.cypher │ └── Spring_Web_Request_Annotations.cypher ├── Metrics │ ├── Calculate_and_set_Abstractness_for_Java.cypher │ ├── Calculate_and_set_Abstractness_for_Java_including_Subpackages.cypher │ ├── Calculate_and_set_Abstractness_for_Typescript.cypher │ ├── Calculate_and_set_Instability_for_Java.cypher │ ├── Calculate_and_set_Instability_for_Java_Including_Subpackages.cypher │ ├── Calculate_and_set_Instability_for_Typescript.cypher │ ├── Calculate_distance_between_abstractness_and_instability_for_Java.cypher │ ├── Calculate_distance_between_abstractness_and_instability_for_Java_including_subpackages.cypher │ ├── Calculate_distance_between_abstractness_and_instability_for_Typescript.cypher │ ├── Clear_all_metrics.cypher │ ├── Count_and_set_abstract_types.cypher │ ├── Get_Abstractness_for_Java.cypher │ ├── Get_Abstractness_for_Java_including_Subpackages.cypher │ ├── Get_Abstractness_for_Typescript.cypher │ ├── Get_Incoming_Java_Package_Dependencies.cypher │ ├── Get_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher │ ├── Get_Incoming_Typescript_Module_Dependencies.cypher │ ├── Get_Instability_for_Java.cypher │ ├── Get_Instability_for_Java_Including_Subpackages.cypher │ ├── Get_Instability_for_Typescript.cypher │ ├── Get_Outgoing_Java_Package_Dependencies.cypher │ ├── Get_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher │ ├── Get_Outgoing_Typescript_Module_Dependencies.cypher │ ├── Incoming_Class_Dependencies.cypher │ ├── Incoming_Class_Method_Call_Dependencies.cypher │ ├── Incoming_Package_Dependencies.cypher │ ├── Incoming_Package_Dependencies_Including_Subpackages.cypher │ ├── Incoming_Package_Method_Call_Dependencies.cypher │ ├── Outgoing_Class_Dependencies.cypher │ ├── Outgoing_Class_Method_Call_Dependencies.cypher │ ├── Outgoing_Package_Dependencies.cypher │ ├── Outgoing_Package_Dependencies_Including_Subpackages.cypher │ ├── Outgoing_Package_Method_Call_Dependencies.cypher │ ├── Set_Incoming_Java_Package_Dependencies.cypher │ ├── Set_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher │ ├── Set_Incoming_Java_Package_Method_Call_Dependencies.cypher │ ├── Set_Incoming_Java_Type_Dependencies.cypher │ ├── Set_Incoming_Typescript_Module_Dependencies.cypher │ ├── Set_Outgoing_Java_Package_Dependencies.cypher │ ├── Set_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher │ ├── Set_Outgoing_Java_Package_Method_Call_Dependencies.cypher │ ├── Set_Outgoing_Java_Type_Dependencies.cypher │ └── Set_Outgoing_Typescript_Module_Dependencies.cypher ├── Miscellaneous │ ├── Adding_the_artifact_name_temporarily_to_a_new_virtual_node_using_APOC.cypher │ ├── Adding_the_artifact_name_temporarily_to_the_Package_node_using_map_projection.cypher │ ├── Extract_Custom_Manifest_Entries.cypher │ ├── Get_Awesome_Procedures_On_Cypher_APOC_Version.cypher │ ├── Get_Graph_Data_Science_Library_Version.cypher │ ├── Get_Graph_Data_Science_System_Information.cypher │ └── Set_artifactName_property_on_every_Package_node.cypher ├── Node_Embeddings │ ├── Node_Embeddings_0a_Query_Calculated.cypher │ ├── Node_Embeddings_1a_Fast_Random_Projection_Estimate.cypher │ ├── Node_Embeddings_1b_Fast_Random_Projection_Statistics.cypher │ ├── Node_Embeddings_1c_Fast_Random_Projection_Mutate.cypher │ ├── Node_Embeddings_1d_Fast_Random_Projection_Stream.cypher │ ├── Node_Embeddings_1e_Fast_Random_Projection_Write.cypher │ ├── Node_Embeddings_2a_Hash_GNN_Estimate.cypher │ ├── Node_Embeddings_2c_Hash_GNN_Mutate.cypher │ ├── Node_Embeddings_2d_Hash_GNN_Stream.cypher │ ├── Node_Embeddings_3a_Node2Vec_Estimate.cypher │ ├── Node_Embeddings_3c_Node2Vec_Mutate.cypher │ ├── Node_Embeddings_3d_Node2Vec_Stream.cypher │ ├── Node_Embeddings_3e_Node2Vec_Write.cypher │ └── Set_Parameters.cypher ├── Overview │ ├── Cyclomatic_Method_Complexity_Distribution.cypher │ ├── Effective_Method_Line_Count_Distribution.cypher │ ├── Effective_lines_of_method_code_per_package.cypher │ ├── Effective_lines_of_method_code_per_type.cypher │ ├── Node_label_combination_count.cypher │ ├── Node_label_count.cypher │ ├── Node_labels_and_their_relationships.cypher │ ├── Number_of_elements_per_module_for_Typescript.cypher │ ├── Number_of_packages_per_artifact.cypher │ ├── Number_of_types_per_artifact.cypher │ ├── Overview_size.cypher │ ├── Overview_size_for_Typescript.cypher │ ├── Relationship_type_count.cypher │ ├── Words_for_Wordcloud.cypher │ ├── Words_for_git_author_Wordcloud_with_frequency.cypher │ └── Words_for_universal_Wordcloud.cypher ├── Path_Finding │ ├── Path_Finding_1_Create_Projection.cypher │ ├── Path_Finding_2_Estimate_Memory.cypher │ ├── Path_Finding_3_Depth_First_Search_Path.cypher │ ├── Path_Finding_4_Breadth_First_Search_Path.cypher │ ├── Path_Finding_5_All_pairs_shortest_path_distribution_overall.cypher │ ├── Path_Finding_5_All_pairs_shortest_path_distribution_per_project.cypher │ ├── Path_Finding_5_All_pairs_shortest_path_examples.cypher │ ├── Path_Finding_6_Longest_paths_contributors_for_graphviz.cypher │ ├── Path_Finding_6_Longest_paths_distribution_overall.cypher │ ├── Path_Finding_6_Longest_paths_distribution_per_project.cypher │ ├── Path_Finding_6_Longest_paths_examples.cypher │ ├── Path_Finding_6_Longest_paths_for_graphviz.cypher │ └── Set_Parameters.cypher ├── Similarity │ ├── Set_Parameters.cypher │ ├── Similarity_1a_Estimate.cypher │ ├── Similarity_1b_Statistics.cypher │ ├── Similarity_1c_Mutate.cypher │ ├── Similarity_1d_Stream_Mutated.cypher │ ├── Similarity_1e_Stream.cypher │ ├── Similarity_1f_Delete_Relationships.cypher │ ├── Similarity_1g_Write_Mutated.cypher │ ├── Similarity_1h_Write.cypher │ └── Similarity_1i_Write_Node_Properties.cypher ├── Topological_Sort │ ├── Set_Parameters.cypher │ ├── Topological_Sort_List.cypher │ ├── Topological_Sort_Query.cypher │ └── Topological_Sort_Write.cypher ├── Types │ ├── Label_base_java_types.cypher │ ├── Label_buildin_java_types.cypher │ ├── Label_resolved_duplicate_types.cypher │ ├── Remove_extended_type_labels.cypher │ └── Set_declaring_type_on_method_nodes.cypher ├── Typescript_Enrichment │ ├── Add_DEPENDS_ON_relationship_to_resolved_modules.cypher │ ├── Add_IS_IMPLEMENTED_IN_relationship_for_matching_declarations.cypher │ ├── Add_IS_IMPLEMENTED_IN_relationship_for_matching_modules.cypher │ ├── Add_module_properties.cypher │ ├── Add_name_to_property_on_projects.cypher │ ├── Add_name_to_property_on_scan_nodes.cypher │ ├── Add_namespace_property_on_nodes_from_linked_npm_packages.cypher │ ├── Count_internal_modules_resolving_external_ones.cypher │ ├── Index_module_name.cypher │ ├── Link_external_modules_to_corresponding_npm_dependency.cypher │ ├── Link_npm_dependencies_to_npm_packages.cypher │ ├── Link_projects_to_npm_packages.cypher │ ├── Mark_test_modules.cypher │ ├── Remove_duplicate_CONTAINS_relations_between_files.cypher │ ├── Set_localRootPath_for_modules.cypher │ └── Verify_projects_linked_to_npm_packages.cypher ├── Validation │ ├── ValidateGitHistory.cypher │ ├── ValidateJavaArtifactDependencies.cypher │ ├── ValidateJavaExternalDependencies.cypher │ ├── ValidateJavaInternalDependencies.cypher │ ├── ValidateJavaMethods.cypher │ ├── ValidateJavaPackageDependencies.cypher │ ├── ValidateJavaTypes.cypher │ └── ValidateTypescriptModuleDependencies.cypher └── Visibility │ ├── Global_relative_visibility_statistics_for_elements_for_Typescript.cypher │ ├── Global_relative_visibility_statistics_for_types.cypher │ ├── Relative_visibility_exported_elements_to_all_elements_per_module_for_Typescript.cypher │ └── Relative_visibility_public_types_to_all_types_per_package.cypher ├── graph-visualization ├── .nvmrc ├── DEPRECATED.md ├── README.md ├── index.css ├── java-artifact-dependencies │ ├── graphVisualizationJavaArtifactDependencies.html │ └── graphVisualizationJavaArtifactDependencies.js ├── package-lock.json ├── package.json ├── renderVisualizations.js ├── typescript-module-dependencies │ ├── graphVisualizationTypescriptModuleDependencies.html │ └── graphVisualizationTypescriptModuleDependencies.js ├── vis-configuration-presets.js └── visualization-pagination.js ├── images ├── DALL-E-Mini-Graph-Pipeline-Logo-2.png └── DALL-E-Mini-Graph-Pipeline-Logo.png ├── init.sh ├── jupyter ├── DependenciesGraphJava.ipynb ├── DependenciesGraphTypescript.ipynb ├── ExternalDependenciesJava.ipynb ├── ExternalDependenciesTypescript.ipynb ├── GitHistoryGeneral.ipynb ├── InternalDependenciesJava.ipynb ├── InternalDependenciesTypescript.ipynb ├── MethodMetricsJava.ipynb ├── NodeEmbeddingsJava.ipynb ├── NodeEmbeddingsTypescript.ipynb ├── ObjectOrientedDesignMetricsJava.ipynb ├── ObjectOrientedDesignMetricsTypescript.ipynb ├── OverviewGeneral.ipynb ├── OverviewJava.ipynb ├── OverviewTypescript.ipynb ├── PathFindingJava.ipynb ├── PathFindingTypescript.ipynb ├── VisibilityMetricsJava.ipynb ├── VisibilityMetricsTypescript.ipynb ├── Wordcloud.ipynb └── environment.yml ├── markdown-lint-check-config.json ├── renovate-presets ├── README.md └── code-graph-analysis-workflow-latest-digest.json5 ├── renovate.json └── scripts ├── ENVIRONMENT_VARIABLES.md ├── SCRIPTS.md ├── activateCondaEnvironment.sh ├── analysis └── analyze.sh ├── cleanupAfterReportGeneration.sh ├── configuration ├── template-neo4j-low-memory.conf ├── template-neo4j-remote-jqassistant-continue-on-error.yaml ├── template-neo4j-remote-jqassistant.yaml ├── template-neo4j-v4-low-memory.conf ├── template-neo4j-v4.conf ├── template-neo4j.conf ├── template-neo4jv4-jqassistant.yaml ├── template-neo4jv5-jqassistant-continue-on-error.yaml └── template-neo4jv5-jqassistant.yaml ├── copyPackageJsonFiles.sh ├── createAggregatedGitLogCsv.sh ├── createGitLogCsv.sh ├── detectChangedFiles.sh ├── documentation ├── appendEnvironmentVariables.sh ├── generateCypherReference.sh ├── generateEnvironmentVariableReference.sh └── generateScriptReference.sh ├── download.sh ├── downloadMavenArtifact.sh ├── downloader ├── downloadAntDesign.sh ├── downloadAxonFramework.sh ├── downloadReactRouter.sh └── downloadTypescriptProject.sh ├── examples ├── analyzeAntDesign.sh ├── analyzeAxonFramework.sh ├── analyzeReactRouter.sh └── detectLatestGitTag.sh ├── executeJupyterNotebook.sh ├── executeJupyterNotebookReport.sh ├── executeQuery.sh ├── executeQueryFunctions.sh ├── findPathsToScan.sh ├── importGit.sh ├── operatingSystemFunctions.sh ├── parseCsvFunctions.sh ├── patches └── @jqassistant+ts-lce+1.2.0.patch ├── prepareAnalysis.sh ├── profiles ├── Default.sh ├── Neo4j-latest-continue-on-scan-errors.sh ├── Neo4j-latest-low-memory.sh ├── Neo4j-latest.sh ├── Neo4jv4-low-memory.sh ├── Neo4jv4.sh ├── Neo4jv5-continue-on-scan-errors.sh ├── Neo4jv5-low-memory.sh └── Neo4jv5.sh ├── projectionFunctions.sh ├── reports ├── ArtifactDependenciesCsv.sh ├── CentralityCsv.sh ├── CommunityCsv.sh ├── ExternalDependenciesCsv.sh ├── GitHistoryCsv.sh ├── GraphVisualization.sh ├── InternalDependenciesCsv.sh ├── InternalDependenciesVisualization.sh ├── JavaCsv.sh ├── NodeEmbeddingsCsv.sh ├── ObjectOrientedDesignMetricsCsv.sh ├── OverviewCsv.sh ├── PathFindingCsv.sh ├── PathFindingVisualization.sh ├── SimilarityCsv.sh ├── TopologicalSortCsv.sh ├── VisibilityMetricsCsv.sh └── compilations │ ├── AllReports.sh │ ├── CsvReports.sh │ ├── DatabaseCsvExportReports.sh │ ├── JupyterReports.sh │ └── VisualizationReports.sh ├── resetAndScan.sh ├── resetAndScanChanged.sh ├── runTests.sh ├── scanTypescript.sh ├── setupJQAssistant.sh ├── setupNeo4j.sh ├── setupNeo4jInitialPassword.sh ├── sortOutExternalJavaJarFiles.sh ├── startNeo4j.sh ├── stopNeo4j.sh ├── testDetectChangedFiles.sh ├── visualization ├── convertQueryResultCsvToGraphVizDotFile.sh ├── templates │ └── default.template.gv └── visualizeQueryResults.sh └── waitForNeo4jHttpFunctions.sh /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### 🚀 Feature 2 | 3 | - 4 | 5 | ### ⚙️ Optimization 6 | 7 | - 8 | 9 | ### 🛠 Fix 10 | 11 | - 12 | 13 | ### 📖 Documentation 14 | 15 | - -------------------------------------------------------------------------------- /.github/workflows/internal-check-renovate-config.yml: -------------------------------------------------------------------------------- 1 | name: Check Renovate Configuration 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | # Only watch root level Renovate configuration changes 8 | paths: 9 | - 'renovate.json*' 10 | - 'renovate-presets/**' 11 | - '.github/workflows/internal-check-renovate-config.yml' # or when this file changed 12 | 13 | jobs: 14 | reports: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Checkout GIT Repository 18 | uses: actions/checkout@v4 19 | 20 | - name: Setup node.js 21 | uses: actions/setup-node@v4 22 | with: 23 | node-version-file: '.nvmrc' 24 | 25 | - name: Get the list of all renovate presets and the main renovate configuration 26 | id: set-renovate-config-files 27 | run: | 28 | echo "RENOVATE_CONFIG_FILES=$(find renovate-presets -type f -name '*.json' -o -name '*.json5') renovate.json" >> $GITHUB_ENV 29 | 30 | - name: Run renovate-config-validator 31 | run: npx --yes --package renovate@39.264.1 -- renovate-config-validator ${{ env.RENOVATE_CONFIG_FILES }} 32 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 23.11.1 -------------------------------------------------------------------------------- /cypher/Artifact_Dependencies/Artifacts_with_duplicate_packages.cypher: -------------------------------------------------------------------------------- 1 | // Artifacts with the same full qualified package name (duplicate packages). These can lead to confusion and provide access to package protected classes to another artifact that might not be intended. Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (artifact:Artifact)-[:CONTAINS]->(package:Package) 4 | WHERE EXISTS ((package)-[:CONTAINS]->(:Type)) 5 | WITH package.fqn AS packageName 6 | ,artifact.name as artifactName 7 | WITH packageName 8 | ,collect(DISTINCT artifactName) AS artifactNames 9 | ,count(*) AS duplicates 10 | WHERE duplicates > 1 11 | RETURN packageName, duplicates, artifactNames 12 | ORDER BY duplicates DESCENDING -------------------------------------------------------------------------------- /cypher/Artifact_Dependencies/Incoming_Java_Artifact_Dependencies.cypher: -------------------------------------------------------------------------------- 1 | // Incoming Artifact Dependencies 2 | 3 | MATCH (a:Java:Artifact:Archive) 4 | OPTIONAL MATCH (a)<-[r:DEPENDS_ON]-(ea:Artifact:Archive) 5 | WHERE a.fileName <> ea.fileName 6 | WITH a 7 | ,COUNT(ea) AS incomingDependencies 8 | ,SUM(r.weight) AS incomingDependenciesWeight 9 | SET a.incomingDependencies = incomingDependencies 10 | ,a.incomingDependenciesWeight = incomingDependenciesWeight 11 | RETURN a.fileName 12 | ,incomingDependencies 13 | ,incomingDependenciesWeight -------------------------------------------------------------------------------- /cypher/Artifact_Dependencies/Outgoing_Java_Artifact_Dependencies.cypher: -------------------------------------------------------------------------------- 1 | // Outgoing Artifact Dependencies 2 | 3 | MATCH (a:Java:Artifact:Archive) 4 | OPTIONAL MATCH (a)-[r:DEPENDS_ON]->(ea:Artifact:Archive) 5 | WHERE a.fileName <> ea.fileName 6 | WITH a 7 | ,COUNT(ea) AS outgoingDependencies 8 | ,SUM(r.weight) AS outgoingDependenciesWeight 9 | SET a.outgoingDependencies = outgoingDependencies 10 | ,a.outgoingDependenciesWeight = outgoingDependenciesWeight 11 | RETURN a.fileName 12 | ,outgoingDependencies 13 | ,outgoingDependenciesWeight -------------------------------------------------------------------------------- /cypher/Artifact_Dependencies/Set_maven_artifact_version.cypher: -------------------------------------------------------------------------------- 1 | // Set property "version" on Artifact nodes to what is specified in the Maven POM 2 | 3 | MATCH (artifact:Java:Artifact)-[:CONTAINS]-(pom:Maven:Pom) 4 | MATCH (pom)-[:HAS_ROOT_ELEMENT]->(pomProject:Element{name:'project'}) 5 | OPTIONAL MATCH (pomProject)-[:HAS_ELEMENT]->(:Element{name:'version'})-[:HAS_TEXT]->(versionValue:Text) 6 | OPTIONAL MATCH (pomProject)-[:HAS_ELEMENT]->(:Element{name:'parent'}) 7 | -[:HAS_ELEMENT]->(:Element{name:'version'})-[:HAS_TEXT]->(parentVersionValue:Text) 8 | WITH *, artifact, coalesce(versionValue.value, parentVersionValue.value) AS versionNumber 9 | WHERE versionNumber IS NOT NULL 10 | SET artifact.version = versionNumber 11 | RETURN count(DISTINCT artifact.fileName) AS numberOfUpdatedArtifacts 12 | // Debugging 13 | // RETURN artifact.name, versionNumber, versionValue.value, parentVersionValue.value 14 | // LIMIT 25 -------------------------------------------------------------------------------- /cypher/Artifact_Dependencies/Set_number_of_Java_packages_and_types_on_artifacts.cypher: -------------------------------------------------------------------------------- 1 | // Set number of Java packages and types on artifacts 2 | 3 | MATCH (artifact:Java:Artifact)-[:CONTAINS]->(package:Java:Package) 4 | MATCH (package)-[:CONTAINS]->(type:Type) 5 | WITH artifact 6 | ,COUNT(DISTINCT package.fqn) AS numberOfPackages 7 | ,COUNT(DISTINCT type.fqn) AS numberOfTypes 8 | SET artifact.numberOfPackages = numberOfPackages 9 | ,artifact.numberOfTypes = numberOfTypes 10 | RETURN artifact.fileName 11 | ,numberOfPackages 12 | ,numberOfTypes 13 | ORDER BY artifact.fileName -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_10a_Bridges_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 10a Bridges Estimate 2 | 3 | CALL gds.bridges.stream.estimate($dependencies_projection + '-cleaned', {}) 4 | YIELD nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView 5 | RETURN nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_10e_Bridges_Write.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 10e Bridges Stream - Write Relationship Property "isBridge" 2 | 3 | CALL gds.bridges.stream($dependencies_projection + '-cleaned') 4 | // The field "remainingSizes" is only needed until https://github.com/neo4j/graph-data-science/issues/354 is resolved. 5 | YIELD from, to, remainingSizes 6 | WITH gds.util.asNode(from) AS fromMember 7 | ,gds.util.asNode(to) AS toMember 8 | MATCH (fromMember)-[dependency:DEPENDS_ON]-(toMember) 9 | SET dependency.isBridge = true 10 | RETURN count(*) AS numberOfBridges -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_1a_List_TopPercentile.cypher: -------------------------------------------------------------------------------- 1 | // List the top centrality nodes with a 99.5 percentile or higher 2 | 3 | MATCH (member) 4 | WHERE $dependencies_projection_node IN LABELS(member) 5 | AND member[$dependencies_projection_write_property] IS NOT NULL 6 | WITH count(DISTINCT member) AS memberCount 7 | ,percentileDisc(member[$dependencies_projection_write_property], 0.995) AS centralityPercentile995 8 | ,collect(DISTINCT member) AS members 9 | UNWIND members AS member 10 | WITH memberCount 11 | ,centralityPercentile995 12 | ,member 13 | ORDER BY member[$dependencies_projection_write_property] DESCENDING 14 | WHERE member[$dependencies_projection_write_property] >= centralityPercentile995 15 | WITH memberCount 16 | ,centralityPercentile995 17 | ,max(member[$dependencies_projection_write_property]) AS maxCentrality 18 | ,collect(DISTINCT member) AS topMembers 19 | RETURN memberCount 20 | ,maxCentrality 21 | ,centralityPercentile995 22 | ,topMembers -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_1b_List_TopPercent.cypher: -------------------------------------------------------------------------------- 1 | // List the top 2% nodes with the highest centrality score. 2 | 3 | MATCH (member) 4 | WHERE $dependencies_projection_node IN labels(member) 5 | AND member[$dependencies_projection_write_property] IS NOT NULL 6 | WITH toInteger(toFloat(count(DISTINCT member)) * 0.02) AS memberCount2Percent 7 | ,collect(DISTINCT member) AS members 8 | UNWIND members AS member 9 | WITH memberCount2Percent, member 10 | ORDER BY member[$dependencies_projection_write_property] DESCENDING 11 | WITH memberCount2Percent, collect(DISTINCT member)[0..memberCount2Percent] AS topMembers 12 | RETURN memberCount2Percent, topMembers -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_1c_Label_Delete.cypher: -------------------------------------------------------------------------------- 1 | // Centrality Label Delete 2 | 3 | CALL db.labels() YIELD label 4 | WHERE label = 'Mark4Top' + apoc.text.capitalize($dependencies_projection_write_property) 5 | WITH collect(label) AS selectedLabels 6 | MATCH (member) 7 | WHERE $dependencies_projection_node IN LABELS(member) 8 | AND member[$dependencies_projection_write_property] IS NOT NULL 9 | WITH collect(member) AS members, selectedLabels 10 | CALL apoc.create.removeLabels(members, selectedLabels) YIELD node 11 | RETURN COUNT(node) AS nodesCount; -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_1d_Label_Add.cypher: -------------------------------------------------------------------------------- 1 | // Centrality Add label to the top 2% nodes with the highest centrality score 2 | 3 | MATCH (member) 4 | WHERE $dependencies_projection_node IN labels(member) 5 | AND member[$dependencies_projection_write_property] IS NOT NULL 6 | WITH toInteger(toFloat(count(DISTINCT member)) * 0.02) AS memberCount2Percent 7 | ,collect(DISTINCT member) AS members 8 | UNWIND members AS member 9 | WITH memberCount2Percent, member 10 | ORDER BY member[$dependencies_projection_write_property] DESCENDING 11 | WITH memberCount2Percent 12 | ,collect(DISTINCT member)[0..memberCount2Percent] AS topMembers 13 | ,'Mark4Top' + apoc.text.capitalize($dependencies_projection_write_property) AS labelName 14 | UNWIND topMembers AS topMember 15 | CALL apoc.create.addLabels(topMember, [labelName]) YIELD node 16 | RETURN count(node) AS nodesCount -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_2a_Page_Rank_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 2a Page Rank Estimate Memory 2 | 3 | CALL gds.pageRank.write.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | writeProperty: $dependencies_projection_write_property 6 | ,maxIterations: 50 7 | ,dampingFactor: 0.85 8 | ,tolerance: 0.00000001 9 | ,relationshipWeightProperty: CASE $dependencies_projection_weight_property WHEN '' THEN null ELSE $dependencies_projection_weight_property END 10 | ,scaler: "L1Norm" 11 | }) 12 | YIELD nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView 13 | RETURN nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_2b_Page_Rank_Statistics.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 2b Page Rank Statistics 2 | 3 | CALL gds.pageRank.stats( 4 | $dependencies_projection + '-cleaned', { 5 | maxIterations: 50 6 | ,dampingFactor: 0.85 7 | ,tolerance: 0.00000001 8 | ,relationshipWeightProperty: CASE $dependencies_projection_weight_property WHEN '' THEN null ELSE $dependencies_projection_weight_property END 9 | ,scaler: "L1Norm" 10 | }) 11 | YIELD ranIterations 12 | ,didConverge 13 | ,preProcessingMillis 14 | ,computeMillis 15 | ,postProcessingMillis 16 | ,centralityDistribution 17 | RETURN ranIterations 18 | ,didConverge 19 | ,preProcessingMillis 20 | ,computeMillis 21 | ,postProcessingMillis 22 | ,centralityDistribution.min 23 | ,centralityDistribution.mean 24 | ,centralityDistribution.max 25 | ,centralityDistribution.p50 26 | ,centralityDistribution.p75 27 | ,centralityDistribution.p90 28 | ,centralityDistribution.p95 29 | ,centralityDistribution.p99 -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_3d_Page_Rank_Stream.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 3d Page Rank Stream 2 | 3 | CALL gds.pageRank.stream( 4 | $dependencies_projection + '-cleaned', { 5 | maxIterations: 50 6 | ,dampingFactor: 0.85 7 | ,tolerance: 0.00000001 8 | ,relationshipWeightProperty: CASE $dependencies_projection_weight_property WHEN '' THEN null ELSE $dependencies_projection_weight_property END 9 | ,scaler: "L2Norm" 10 | }) 11 | YIELD nodeId, score 12 | WITH gds.util.asNode(nodeId) AS member, score 13 | RETURN coalesce(member.fqn, member.fileName, member.name) AS memberName 14 | ,score 15 | ,member.incomingDependencies AS incomingDependencies 16 | ,member.outgoingDependencies AS outgoingDependencies 17 | ORDER BY score DESC, memberName ASC -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_3e_Page_Rank_Write.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 3e Page Rank Write 2 | 3 | CALL gds.pageRank.write( 4 | $dependencies_projection + '-cleaned', { 5 | maxIterations: 50 6 | ,dampingFactor: 0.85 7 | ,tolerance: 0.00000001 8 | ,relationshipWeightProperty: CASE $dependencies_projection_weight_property WHEN '' THEN null ELSE $dependencies_projection_weight_property END 9 | ,scaler: "L2Norm" 10 | ,writeProperty: $dependencies_projection_write_property 11 | }) 12 | YIELD nodePropertiesWritten 13 | ,ranIterations 14 | ,didConverge 15 | ,preProcessingMillis 16 | ,computeMillis 17 | ,postProcessingMillis 18 | ,writeMillis 19 | ,centralityDistribution 20 | RETURN nodePropertiesWritten 21 | ,ranIterations 22 | ,didConverge 23 | ,preProcessingMillis 24 | ,computeMillis 25 | ,postProcessingMillis 26 | ,writeMillis 27 | ,centralityDistribution.min 28 | ,centralityDistribution.mean 29 | ,centralityDistribution.max 30 | ,centralityDistribution.p50 31 | ,centralityDistribution.p75 32 | ,centralityDistribution.p90 33 | ,centralityDistribution.p95 34 | ,centralityDistribution.p99 -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_4a_Article_Rank_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 4a Article Rank Estimate Memory 2 | 3 | CALL gds.articleRank.write.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | writeProperty: $dependencies_projection_write_property 6 | ,maxIterations: 30 7 | ,dampingFactor: 0.85 8 | ,tolerance: 0.00000001 9 | ,relationshipWeightProperty: CASE $dependencies_projection_weight_property WHEN '' THEN null ELSE $dependencies_projection_weight_property END 10 | ,scaler: "L1Norm" 11 | }) 12 | YIELD nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView 13 | RETURN nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_4b_Article_Rank_Statistics.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 4b Article Rank Statistics 2 | 3 | CALL gds.articleRank.stats( 4 | $dependencies_projection + '-cleaned', { 5 | maxIterations: 30 6 | ,dampingFactor: 0.85 7 | ,tolerance: 0.00000001 8 | ,relationshipWeightProperty: CASE $dependencies_projection_weight_property WHEN '' THEN null ELSE $dependencies_projection_weight_property END 9 | ,scaler: "L1Norm" 10 | }) 11 | YIELD ranIterations 12 | ,didConverge 13 | ,preProcessingMillis 14 | ,computeMillis 15 | ,postProcessingMillis 16 | ,centralityDistribution 17 | RETURN ranIterations 18 | ,didConverge 19 | ,preProcessingMillis 20 | ,computeMillis 21 | ,postProcessingMillis 22 | ,centralityDistribution.min 23 | ,centralityDistribution.mean 24 | ,centralityDistribution.max 25 | ,centralityDistribution.p50 26 | ,centralityDistribution.p75 27 | ,centralityDistribution.p90 28 | ,centralityDistribution.p95 29 | ,centralityDistribution.p99 -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_4d_Article_Rank_Stream.cypher: -------------------------------------------------------------------------------- 1 | //Centrality 4d Article Rank Stream 2 | 3 | CALL gds.articleRank.stream( 4 | $dependencies_projection + '-cleaned', { 5 | maxIterations: 30 6 | ,dampingFactor: 0.85 7 | ,tolerance: 0.00000001 8 | ,relationshipWeightProperty: CASE $dependencies_projection_weight_property WHEN '' THEN null ELSE $dependencies_projection_weight_property END 9 | ,scaler: "L2Norm" 10 | }) 11 | YIELD nodeId, score 12 | WITH gds.util.asNode(nodeId) AS member, score 13 | RETURN coalesce(member.fqn, member.fileName, member.name) AS memberName 14 | ,score 15 | ,member.incomingDependencies AS incomingDependencies 16 | ,member.outgoingDependencies AS outgoingDependencies 17 | ORDER BY score DESC, memberName ASC -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_4e_Article_Rank_Write.cypher: -------------------------------------------------------------------------------- 1 | //Centrality 4e Article Rank Write 2 | 3 | CALL gds.articleRank.write( 4 | $dependencies_projection + '-cleaned', { 5 | maxIterations: 50 6 | ,dampingFactor: 0.85 7 | ,tolerance: 0.00000001 8 | ,relationshipWeightProperty: CASE $dependencies_projection_weight_property WHEN '' THEN null ELSE $dependencies_projection_weight_property END 9 | ,scaler: "L2Norm" 10 | ,writeProperty: $dependencies_projection_write_property 11 | }) 12 | YIELD nodePropertiesWritten 13 | ,ranIterations 14 | ,didConverge 15 | ,preProcessingMillis 16 | ,computeMillis 17 | ,postProcessingMillis 18 | ,writeMillis 19 | ,centralityDistribution 20 | RETURN nodePropertiesWritten 21 | ,ranIterations 22 | ,didConverge 23 | ,preProcessingMillis 24 | ,computeMillis 25 | ,postProcessingMillis 26 | ,writeMillis 27 | ,centralityDistribution.min 28 | ,centralityDistribution.mean 29 | ,centralityDistribution.max 30 | ,centralityDistribution.p50 31 | ,centralityDistribution.p75 32 | ,centralityDistribution.p90 33 | ,centralityDistribution.p95 34 | ,centralityDistribution.p99 -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_5a_Betweeness_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 5a Betweeness Estimate 2 | 3 | CALL gds.betweenness.write.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: CASE $dependencies_projection_weight_property WHEN '' THEN null ELSE $dependencies_projection_weight_property END 6 | ,writeProperty: $dependencies_projection_write_property 7 | }) 8 | YIELD nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView 9 | RETURN nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_5b_Betweeness_Statistics.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 5b Betweeness Statistics 2 | 3 | CALL gds.betweenness.stats( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: CASE $dependencies_projection_weight_property WHEN '' THEN null ELSE $dependencies_projection_weight_property END 6 | }) 7 | YIELD preProcessingMillis 8 | ,computeMillis 9 | ,postProcessingMillis 10 | ,centralityDistribution 11 | RETURN preProcessingMillis 12 | ,computeMillis 13 | ,postProcessingMillis 14 | ,centralityDistribution.min 15 | ,centralityDistribution.mean 16 | ,centralityDistribution.max 17 | ,centralityDistribution.p50 18 | ,centralityDistribution.p75 19 | ,centralityDistribution.p90 20 | ,centralityDistribution.p95 21 | ,centralityDistribution.p99 -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_5c_Betweeness_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 5c Betweeness Mutate 2 | 3 | CALL gds.betweenness.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: CASE $dependencies_projection_weight_property WHEN '' THEN null ELSE $dependencies_projection_weight_property END 6 | ,mutateProperty: $dependencies_projection_write_property 7 | }) 8 | YIELD nodePropertiesWritten 9 | ,preProcessingMillis 10 | ,computeMillis 11 | ,mutateMillis 12 | ,postProcessingMillis 13 | ,centralityDistribution 14 | RETURN nodePropertiesWritten 15 | ,preProcessingMillis 16 | ,computeMillis 17 | ,mutateMillis 18 | ,postProcessingMillis 19 | ,centralityDistribution.min 20 | ,centralityDistribution.mean 21 | ,centralityDistribution.max 22 | ,centralityDistribution.p50 23 | ,centralityDistribution.p75 24 | ,centralityDistribution.p90 25 | ,centralityDistribution.p95 26 | ,centralityDistribution.p99 27 | ,centralityDistribution.p999 -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_5d_Betweeness_Stream.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 5d Betweeness Stream 2 | 3 | CALL gds.betweenness.stream( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: CASE $dependencies_projection_weight_property WHEN '' THEN null ELSE $dependencies_projection_weight_property END 6 | }) 7 | YIELD nodeId, score 8 | WITH gds.util.asNode(nodeId) AS member, score 9 | RETURN coalesce(member.fqn, member.fileName, member.name) AS memberName 10 | ,score 11 | ,member.incomingDependencies AS incomingDependencies 12 | ,member.outgoingDependencies AS outgoingDependencies 13 | ORDER BY score DESC, memberName ASC -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_5e_Betweeness_Write.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 5e Betweeness Write 2 | 3 | CALL gds.betweenness.write( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: CASE $dependencies_projection_weight_property WHEN '' THEN null ELSE $dependencies_projection_weight_property END 6 | ,writeProperty: $dependencies_projection_write_property 7 | }) 8 | YIELD nodePropertiesWritten 9 | ,preProcessingMillis 10 | ,computeMillis 11 | ,postProcessingMillis 12 | ,writeMillis 13 | ,centralityDistribution 14 | RETURN nodePropertiesWritten 15 | ,preProcessingMillis 16 | ,computeMillis 17 | ,postProcessingMillis 18 | ,writeMillis 19 | ,centralityDistribution.min 20 | ,centralityDistribution.mean 21 | ,centralityDistribution.max 22 | ,centralityDistribution.p50 23 | ,centralityDistribution.p75 24 | ,centralityDistribution.p90 25 | ,centralityDistribution.p95 26 | ,centralityDistribution.p99 -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_6a_Cost_effective_Lazy_Forward_CELF_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 6a Cost-effective Lazy Forward (CELF) Estimate 2 | 3 | CALL gds.influenceMaximization.celf.write.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | seedSetSize: 5 6 | ,writeProperty: $dependencies_projection_write_property 7 | }) 8 | YIELD nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView 9 | RETURN nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_6b_Cost_effective_Lazy_Forward_CELF_Statistics.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 6b Cost-effective Lazy Forward (CELF) Statistics 2 | 3 | CALL gds.influenceMaximization.celf.stats( 4 | $dependencies_projection + '-cleaned', { 5 | seedSetSize: 5 6 | }) 7 | YIELD computeMillis 8 | ,totalSpread 9 | ,nodeCount 10 | RETURN computeMillis 11 | ,totalSpread 12 | ,nodeCount -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_6c_Cost_effective_Lazy_Forward_CELF_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 6c Cost-effective Lazy Forward (CELF) Mutate 2 | 3 | CALL gds.influenceMaximization.celf.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | seedSetSize: 5 6 | ,mutateProperty: $dependencies_projection_write_property 7 | }) 8 | YIELD nodePropertiesWritten 9 | ,nodeCount 10 | ,totalSpread 11 | ,computeMillis 12 | ,mutateMillis 13 | RETURN nodePropertiesWritten 14 | ,nodeCount 15 | ,totalSpread 16 | ,computeMillis 17 | ,mutateMillis -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_6d_Cost_effective_Lazy_Forward_CELF_Stream.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 6d Cost-effective Lazy Forward (CELF) Stream 2 | 3 | CALL gds.influenceMaximization.celf.stream( 4 | $dependencies_projection + '-cleaned', { 5 | seedSetSize: 5 6 | }) 7 | YIELD nodeId, spread 8 | WITH gds.util.asNode(nodeId) AS member, spread 9 | RETURN coalesce(member.fqn, member.fileName, member.name) AS memberName 10 | ,spread 11 | ,member.incomingDependencies AS incomingDependencies 12 | ,member.outgoingDependencies AS outgoingDependencies 13 | ORDER BY spread DESC, memberName ASC -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_6e_Cost_effective_Lazy_Forward_CELF_Write.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 6e Cost-effective Lazy Forward (CELF) Write 2 | 3 | CALL gds.influenceMaximization.celf.write( 4 | $dependencies_projection + '-cleaned', { 5 | seedSetSize: 5 6 | ,writeProperty: $dependencies_projection_write_property 7 | }) 8 | YIELD writeMillis 9 | ,nodePropertiesWritten 10 | ,computeMillis 11 | ,totalSpread 12 | ,nodeCount 13 | RETURN writeMillis 14 | ,nodePropertiesWritten 15 | ,computeMillis 16 | ,totalSpread 17 | ,nodeCount -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_7b_Harmonic_Closeness_Statistics.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 7b Harmonic Closeness Statistics 2 | 3 | CALL gds.closeness.harmonic.stats( 4 | $dependencies_projection + '-cleaned', {}) 5 | YIELD preProcessingMillis 6 | ,computeMillis 7 | ,postProcessingMillis 8 | ,centralityDistribution 9 | RETURN preProcessingMillis 10 | ,computeMillis 11 | ,postProcessingMillis 12 | ,centralityDistribution.min 13 | ,centralityDistribution.mean 14 | ,centralityDistribution.max 15 | ,centralityDistribution.p50 16 | ,centralityDistribution.p75 17 | ,centralityDistribution.p90 18 | ,centralityDistribution.p95 19 | ,centralityDistribution.p99 -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_7c_Harmonic_Closeness_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 7c Harmonic Closeness Mutate 2 | 3 | CALL gds.closeness.harmonic.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | mutateProperty: $dependencies_projection_write_property 6 | }) 7 | YIELD nodePropertiesWritten 8 | ,preProcessingMillis 9 | ,computeMillis 10 | ,mutateMillis 11 | ,postProcessingMillis 12 | ,centralityDistribution 13 | RETURN nodePropertiesWritten 14 | ,preProcessingMillis 15 | ,computeMillis 16 | ,mutateMillis 17 | ,postProcessingMillis 18 | ,centralityDistribution.min 19 | ,centralityDistribution.mean 20 | ,centralityDistribution.max 21 | ,centralityDistribution.p50 22 | ,centralityDistribution.p75 23 | ,centralityDistribution.p90 24 | ,centralityDistribution.p95 25 | ,centralityDistribution.p99 26 | ,centralityDistribution.p999 -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_7d_Harmonic_Closeness_Stream.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 7a Harmonic Closeness Stream 2 | 3 | CALL gds.closeness.harmonic.stream($dependencies_projection + '-cleaned', {}) 4 | YIELD nodeId, centrality 5 | WITH gds.util.asNode(nodeId) AS member, centrality 6 | RETURN coalesce(member.fqn, member.fileName, member.name) AS memberName 7 | ,centrality 8 | ,member.incomingDependencies AS incomingDependencies 9 | ,member.outgoingDependencies AS outgoingDependencies 10 | ORDER BY centrality DESC, memberName ASC -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_7e_Harmonic_Closeness_Write.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 7d Harmonic Closeness Write 2 | 3 | CALL gds.closeness.harmonic.write( 4 | $dependencies_projection + '-cleaned', { 5 | writeProperty: $dependencies_projection_write_property 6 | }) 7 | YIELD nodes 8 | ,preProcessingMillis 9 | ,computeMillis 10 | ,writeMillis 11 | ,writeProperty 12 | ,centralityDistribution 13 | RETURN nodes 14 | ,preProcessingMillis 15 | ,computeMillis 16 | ,writeMillis 17 | ,writeProperty 18 | ,centralityDistribution.min 19 | ,centralityDistribution.mean 20 | ,centralityDistribution.max 21 | ,centralityDistribution.p50 22 | ,centralityDistribution.p75 23 | ,centralityDistribution.p90 24 | ,centralityDistribution.p95 25 | ,centralityDistribution.p99 -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_8b_Closeness_Statistics.cypher: -------------------------------------------------------------------------------- 1 | //Centrality 8b Closeness Statistics 2 | 3 | CALL gds.closeness.stats( 4 | $dependencies_projection + '-cleaned', { 5 | useWassermanFaust: true 6 | }) 7 | YIELD preProcessingMillis 8 | ,computeMillis 9 | ,postProcessingMillis 10 | ,centralityDistribution 11 | RETURN preProcessingMillis 12 | ,computeMillis 13 | ,postProcessingMillis 14 | ,centralityDistribution.min 15 | ,centralityDistribution.mean 16 | ,centralityDistribution.max 17 | ,centralityDistribution.p50 18 | ,centralityDistribution.p75 19 | ,centralityDistribution.p90 20 | ,centralityDistribution.p95 21 | ,centralityDistribution.p99 -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_8c_Closeness_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 8c Closeness Mutate 2 | 3 | CALL gds.closeness.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | useWassermanFaust: true 6 | ,mutateProperty: $dependencies_projection_write_property 7 | }) 8 | YIELD nodePropertiesWritten 9 | ,preProcessingMillis 10 | ,computeMillis 11 | ,mutateMillis 12 | ,postProcessingMillis 13 | ,centralityDistribution 14 | RETURN nodePropertiesWritten 15 | ,preProcessingMillis 16 | ,computeMillis 17 | ,mutateMillis 18 | ,postProcessingMillis 19 | ,centralityDistribution.min 20 | ,centralityDistribution.mean 21 | ,centralityDistribution.max 22 | ,centralityDistribution.p50 23 | ,centralityDistribution.p75 24 | ,centralityDistribution.p90 25 | ,centralityDistribution.p95 26 | ,centralityDistribution.p99 27 | ,centralityDistribution.p999 -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_8d_Closeness_Stream.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 8c Closeness Stream 2 | 3 | CALL gds.closeness.stream( 4 | $dependencies_projection + '-cleaned', { 5 | useWassermanFaust: true 6 | }) 7 | YIELD nodeId, score 8 | WITH gds.util.asNode(nodeId) AS member, score 9 | RETURN coalesce(member.fqn, member.fileName, member.name) AS memberName 10 | ,score 11 | ,member.incomingDependencies AS incomingDependencies 12 | ,member.outgoingDependencies AS outgoingDependencies 13 | ORDER BY score DESC, memberName ASC -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_8e_Closeness_Write.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 8d Closeness Write 2 | 3 | CALL gds.closeness.write( 4 | $dependencies_projection + '-cleaned', { 5 | useWassermanFaust: true 6 | ,writeProperty: $dependencies_projection_write_property 7 | }) 8 | YIELD nodePropertiesWritten 9 | ,preProcessingMillis 10 | ,computeMillis 11 | ,postProcessingMillis 12 | ,writeMillis 13 | ,writeProperty 14 | ,centralityDistribution 15 | RETURN nodePropertiesWritten 16 | ,preProcessingMillis 17 | ,computeMillis 18 | ,postProcessingMillis 19 | ,writeMillis 20 | ,writeProperty 21 | ,centralityDistribution.min 22 | ,centralityDistribution.mean 23 | ,centralityDistribution.max 24 | ,centralityDistribution.p50 25 | ,centralityDistribution.p75 26 | ,centralityDistribution.p90 27 | ,centralityDistribution.p95 28 | ,centralityDistribution.p99 -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_90_Summary.cypher: -------------------------------------------------------------------------------- 1 | // Centrality Summary. Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (codeUnit) 4 | WHERE (codeUnit.incomingDependencies > 0 OR codeUnit.outgoingDependencies > 0) 5 | AND $dependencies_projection_node IN LABELS(codeUnit) 6 | RETURN coalesce(codeUnit.fqn, codeUnit.fileName, codeUnit.signature, codeUnit.name) AS name 7 | ,codeUnit.name AS shortName 8 | ,codeUnit.centralityPageRank AS pageRank 9 | ,codeUnit.centralityArticleRank AS articleRank 10 | ,codeUnit.centralityBetweenness AS betweenness 11 | ,codeUnit.centralityCostEffectiveLazyForward AS costEffectiveLazyForward 12 | ,codeUnit.centralityHarmonic AS harmonicCloseness 13 | ,codeUnit.centralityCloseness AS closeness 14 | ,codeUnit.centralityHyperlinkInducedTopicSearchAuthority AS hyperlinkInducedTopicSearchAuthority 15 | ,codeUnit.centralityHyperlinkInducedTopicSearchHub AS hyperlinkInducedTopicSearchHub 16 | ,codeUnit.incomingDependencies AS incomingDependencies 17 | ,codeUnit.outgoingDependencies AS outgoingDependencies -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_9a_Hyperlink_Induced_Topic_Search_HITS_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 9a Hyperlink-Induced Topic Search (HITS) Memory Estimation 2 | 3 | CALL gds.hits.write.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | hitsIterations: 20 6 | ,authProperty: $dependencies_projection_write_property + 'Authority' 7 | ,hubProperty: $dependencies_projection_write_property + 'Hub' 8 | }) 9 | YIELD nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView 10 | RETURN nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_9b_Hyperlink_Induced_Topic_Search_HITS_Statistics.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 9b Hyperlink-Induced Topic Search (HITS) Statistics 2 | 3 | CALL gds.hits.stats( 4 | $dependencies_projection + '-cleaned', { 5 | hitsIterations: 20 6 | }) 7 | YIELD ranIterations, didConverge, preProcessingMillis, computeMillis 8 | RETURN ranIterations, didConverge, preProcessingMillis, computeMillis -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_9c_Hyperlink_Induced_Topic_Search_HITS_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 9c Hyperlink-Induced Topic Search (HITS) Mutate 2 | 3 | CALL gds.hits.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | hitsIterations: 20 6 | ,authProperty: $dependencies_projection_write_property + 'Authority' 7 | ,hubProperty: $dependencies_projection_write_property + 'Hub' 8 | }) 9 | YIELD nodePropertiesWritten 10 | ,didConverge 11 | ,ranIterations 12 | ,preProcessingMillis 13 | ,computeMillis 14 | ,mutateMillis 15 | RETURN nodePropertiesWritten 16 | ,didConverge 17 | ,ranIterations 18 | ,preProcessingMillis 19 | ,computeMillis 20 | ,mutateMillis -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_9d_Hyperlink_Induced_Topic_Search_HITS_Stream.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 9d Hyperlink-Induced Topic Search (HITS) Stream 2 | 3 | CALL gds.hits.stream( 4 | $dependencies_projection + '-cleaned', { 5 | hitsIterations: 20 6 | }) 7 | YIELD nodeId, values 8 | WITH gds.util.asNode(nodeId) AS member, values 9 | RETURN coalesce(member.fqn, member.fileName, member.name) AS memberName 10 | ,values.auth AS authority 11 | ,values.hub AS hub 12 | ,member.incomingDependencies AS incomingDependencies 13 | ,member.outgoingDependencies AS outgoingDependencies 14 | ORDER BY values.auth DESC, memberName ASC -------------------------------------------------------------------------------- /cypher/Centrality/Centrality_9e_Hyperlink_Induced_Topic_Search_HITS_Write.cypher: -------------------------------------------------------------------------------- 1 | // Centrality 9e Hyperlink-Induced Topic Search (HITS) Write 2 | 3 | CALL gds.hits.write( 4 | $dependencies_projection + '-cleaned', { 5 | hitsIterations: 20 6 | ,authProperty: $dependencies_projection_write_property + 'Authority' 7 | ,hubProperty: $dependencies_projection_write_property + 'Hub' 8 | }) 9 | YIELD nodePropertiesWritten, ranIterations, didConverge, preProcessingMillis, computeMillis, writeMillis 10 | RETURN nodePropertiesWritten, ranIterations, didConverge, preProcessingMillis, computeMillis, writeMillis -------------------------------------------------------------------------------- /cypher/Centrality/Set_Parameters.cypher: -------------------------------------------------------------------------------- 1 | // Example on how to set the parameters for centrality in this case for Packages and PageRank 2 | 3 | :params { 4 | "dependencies_projection": "package-centrality", 5 | "dependencies_projection_node": "Package", 6 | "dependencies_projection_weight_property": "weight25PercentInterfaces", 7 | "dependencies_projection_write_property": "centralityPageRank", 8 | } -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_10a_LocalClusteringCoefficient_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection - Local Clustering Coefficient - Estimate 2 | 3 | CALL gds.localClusteringCoefficient.write.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | writeProperty: $dependencies_projection_write_property 6 | }) 7 | YIELD requiredMemory 8 | ,nodeCount 9 | ,relationshipCount 10 | ,bytesMin 11 | ,bytesMax 12 | ,heapPercentageMin 13 | ,heapPercentageMax 14 | ,treeView 15 | ,mapView 16 | RETURN requiredMemory 17 | ,nodeCount 18 | ,relationshipCount 19 | ,bytesMin 20 | ,bytesMax 21 | ,heapPercentageMin 22 | ,heapPercentageMax 23 | ,treeView -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_10b_LocalClusteringCoefficient_Statistics.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection - Local Clustering Coefficient - Statistics 2 | 3 | CALL gds.localClusteringCoefficient.stats( 4 | $dependencies_projection + '-cleaned', { 5 | }) 6 | YIELD averageClusteringCoefficient, nodeCount, preProcessingMillis, computeMillis, postProcessingMillis 7 | RETURN averageClusteringCoefficient, nodeCount, preProcessingMillis, computeMillis, postProcessingMillis -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_10c_LocalClusteringCoefficient_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection - Local Clustering Coefficient - Mutate 2 | 3 | CALL gds.localClusteringCoefficient.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | mutateProperty: $dependencies_projection_write_property 6 | }) 7 | YIELD averageClusteringCoefficient, nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, postProcessingMillis, mutateMillis 8 | RETURN averageClusteringCoefficient, nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, postProcessingMillis, mutateMillis -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_10d_LocalClusteringCoefficient_Stream.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection - Local Clustering Coefficient - Stream 2 | 3 | CALL gds.localClusteringCoefficient.stream( 4 | $dependencies_projection + '-cleaned', { 5 | }) 6 | YIELD nodeId, localClusteringCoefficient 7 | WITH gds.util.asNode(nodeId) AS member 8 | ,localClusteringCoefficient 9 | WITH coalesce(member.fqn, member.fileName, member.name) AS memberName 10 | ,localClusteringCoefficient 11 | RETURN localClusteringCoefficient 12 | ,memberName 13 | ORDER BY localClusteringCoefficient DESC, memberName ASC -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_10d_LocalClusteringCoefficient_Stream_Aggregated.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection - Local Clustering Coefficient - Stream Aggregated 2 | 3 | CALL gds.localClusteringCoefficient.stream( 4 | $dependencies_projection + '-cleaned', { 5 | }) 6 | YIELD nodeId, localClusteringCoefficient 7 | WITH gds.util.asNode(nodeId) AS member 8 | ,localClusteringCoefficient 9 | WITH coalesce(member.fqn, member.fileName, member.name) AS memberName 10 | ,localClusteringCoefficient 11 | WITH round(localClusteringCoefficient, 2) AS localClusteringCoefficient 12 | ,collect(DISTINCT memberName)[0..9] AS memberNameExamples 13 | ,count(DISTINCT memberName) AS memberCount 14 | RETURN localClusteringCoefficient 15 | ,memberCount 16 | ,memberNameExamples 17 | ORDER BY localClusteringCoefficient DESC, memberCount DESC -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_10e_LocalClusteringCoefficient_Write.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection - Local Clustering Coefficient - Write 2 | 3 | CALL gds.localClusteringCoefficient.write( 4 | $dependencies_projection + '-cleaned', { 5 | writeProperty: $dependencies_projection_write_property 6 | }) 7 | YIELD averageClusteringCoefficient, nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, postProcessingMillis, writeMillis 8 | RETURN averageClusteringCoefficient, nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, postProcessingMillis, writeMillis -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_1a_Louvain_Estimate.cypher: -------------------------------------------------------------------------------- 1 | //Community Detection Louvain Estimate Memory 2 | 3 | CALL gds.louvain.write.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | tolerance: 0.00001, 6 | relationshipWeightProperty: $dependencies_projection_weight_property, 7 | writeProperty: $dependencies_projection_write_property, 8 | includeIntermediateCommunities: true 9 | }) 10 | YIELD nodeCount 11 | ,relationshipCount 12 | ,bytesMin 13 | ,bytesMax 14 | ,heapPercentageMin 15 | ,heapPercentageMax 16 | ,treeView 17 | RETURN nodeCount 18 | ,relationshipCount 19 | ,bytesMin 20 | ,bytesMax 21 | ,heapPercentageMin 22 | ,heapPercentageMax 23 | ,treeView -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_1b_Louvain_Statistics.cypher: -------------------------------------------------------------------------------- 1 | //Community Detection Louvain Statistics 2 | 3 | CALL gds.louvain.stats( 4 | $dependencies_projection + '-cleaned', { 5 | tolerance: 0.00001, 6 | relationshipWeightProperty: $dependencies_projection_weight_property, 7 | includeIntermediateCommunities: true 8 | }) 9 | YIELD communityCount 10 | ,ranLevels 11 | ,modularity 12 | ,modularities 13 | ,communityDistribution 14 | RETURN communityCount 15 | ,ranLevels 16 | ,modularity 17 | ,modularities 18 | ,communityDistribution.min 19 | ,communityDistribution.mean 20 | ,communityDistribution.max 21 | ,communityDistribution.p50 22 | ,communityDistribution.p75 23 | ,communityDistribution.p90 24 | ,communityDistribution.p95 25 | ,communityDistribution.p99 26 | ,communityDistribution.p999 -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_1d_Louvain_Stream.cypher: -------------------------------------------------------------------------------- 1 | //Community Detection Louvain Stream 2 | 3 | CALL gds.louvain.stream( 4 | $dependencies_projection + '-cleaned', { 5 | tolerance: 0.00001, 6 | includeIntermediateCommunities: true, 7 | relationshipWeightProperty: $dependencies_projection_weight_property 8 | }) 9 | YIELD nodeId, communityId, intermediateCommunityIds 10 | WITH communityId 11 | ,intermediateCommunityIds 12 | ,gds.util.asNode(nodeId) AS member 13 | WITH communityId 14 | ,intermediateCommunityIds 15 | ,member 16 | ,coalesce(member.fqn, member.fileName, member.name) AS memberName 17 | WITH communityId 18 | ,intermediateCommunityIds 19 | ,count(DISTINCT member) AS memberCount 20 | ,collect(DISTINCT memberName) AS memberNames 21 | RETURN intermediateCommunityIds[0] AS firstCommunityId 22 | ,communityId AS finalCommunityId 23 | ,memberCount 24 | ,memberNames 25 | ,intermediateCommunityIds 26 | ORDER BY memberCount DESC, communityId ASC -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_1d_Stream_Intermediate_Mutated.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Stream Intermediate Mutated for hierarchical algorithmns (Louvain, Leiden) 2 | 3 | CALL gds.graph.nodeProperty.stream( 4 | $dependencies_projection + '-cleaned' 5 | ,$dependencies_projection_write_property 6 | ) 7 | YIELD nodeId, propertyValue 8 | WITH gds.util.asNode(nodeId) AS member 9 | ,propertyValue AS intermediateCommunityIds 10 | WITH member 11 | ,intermediateCommunityIds 12 | ,coalesce(member.fqn, member.fileName, member.name) AS memberName 13 | WITH intermediateCommunityIds 14 | ,count(DISTINCT member) AS memberCount 15 | ,collect(DISTINCT memberName) AS memberNames 16 | RETURN intermediateCommunityIds[0] AS firstCommunityId 17 | ,last(intermediateCommunityIds) AS communityId 18 | ,intermediateCommunityIds 19 | ,memberCount 20 | ,memberNames 21 | ORDER BY memberCount DESC, communityId ASC -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_2a_Leiden_Estimate.cypher: -------------------------------------------------------------------------------- 1 | //Community Detection Leiden Estimate Memory 2 | 3 | CALL gds.leiden.write.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | gamma: toFloat($dependencies_leiden_gamma), 6 | theta: 0.001, 7 | tolerance: 0.0000001, 8 | consecutiveIds: true, 9 | relationshipWeightProperty: $dependencies_projection_weight_property, 10 | writeProperty: $dependencies_projection_write_property 11 | }) 12 | YIELD nodeCount 13 | ,relationshipCount 14 | ,bytesMin 15 | ,bytesMax 16 | ,heapPercentageMin 17 | ,heapPercentageMax 18 | ,treeView 19 | RETURN nodeCount 20 | ,relationshipCount 21 | ,bytesMin 22 | ,bytesMax 23 | ,heapPercentageMin 24 | ,heapPercentageMax 25 | ,treeView -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_2b_Leiden_Statistics.cypher: -------------------------------------------------------------------------------- 1 | //Community Detection Leiden Statistics 2 | 3 | CALL gds.leiden.stats( 4 | $dependencies_projection + '-cleaned', { 5 | gamma: toFloat($dependencies_leiden_gamma), 6 | theta: 0.001, 7 | tolerance: 0.0000001, 8 | includeIntermediateCommunities: true, 9 | relationshipWeightProperty: $dependencies_projection_weight_property 10 | }) 11 | YIELD communityCount 12 | ,ranLevels 13 | ,modularity 14 | ,modularities 15 | ,communityDistribution 16 | RETURN communityCount 17 | ,ranLevels 18 | ,modularity 19 | ,modularities 20 | ,communityDistribution.min 21 | ,communityDistribution.mean 22 | ,communityDistribution.max 23 | ,communityDistribution.p50 24 | ,communityDistribution.p75 25 | ,communityDistribution.p90 26 | ,communityDistribution.p95 27 | ,communityDistribution.p99 28 | ,communityDistribution.p999 -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_2d_Leiden_Stream.cypher: -------------------------------------------------------------------------------- 1 | //Community Detection Leiden Stream 2 | 3 | CALL gds.leiden.stream( 4 | $dependencies_projection + '-cleaned', { 5 | gamma: toFloat($dependencies_leiden_gamma), 6 | theta: 0.001, 7 | tolerance: 0.0000001, 8 | includeIntermediateCommunities: true, 9 | relationshipWeightProperty: $dependencies_projection_weight_property 10 | }) 11 | YIELD nodeId, communityId, intermediateCommunityIds 12 | WITH communityId 13 | ,intermediateCommunityIds 14 | ,gds.util.asNode(nodeId) AS member 15 | WITH communityId 16 | ,intermediateCommunityIds 17 | ,member 18 | ,coalesce(member.fqn, member.fileName, member.name) AS memberName 19 | WITH communityId 20 | ,intermediateCommunityIds 21 | ,count(DISTINCT member) AS memberCount 22 | ,collect(DISTINCT memberName) AS memberNames 23 | RETURN intermediateCommunityIds[0] AS firstCommunityId 24 | ,communityId AS finalCommunityId 25 | ,memberCount 26 | ,memberNames 27 | ,intermediateCommunityIds 28 | ORDER BY memberCount DESC, communityId ASC -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_3a_WeaklyConnectedComponents_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Label Propagation Estimate 2 | 3 | CALL gds.labelPropagation.write.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,writeProperty: $dependencies_projection_write_property 7 | ,consecutiveIds: true 8 | }) 9 | YIELD requiredMemory 10 | ,nodeCount 11 | ,relationshipCount 12 | ,bytesMin 13 | ,bytesMax 14 | ,heapPercentageMin 15 | ,heapPercentageMax 16 | ,treeView 17 | ,mapView 18 | RETURN requiredMemory 19 | ,nodeCount 20 | ,relationshipCount 21 | ,bytesMin 22 | ,bytesMax 23 | ,heapPercentageMin 24 | ,heapPercentageMax 25 | ,treeView 26 | //,mapView //doesn't work on Windows with git bash jq version jq-1.7-dirty -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_3b_WeaklyConnectedComponents_Statistics.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Weakly Connected Components Statistics 2 | 3 | CALL gds.wcc.stats( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,consecutiveIds: true 7 | }) 8 | YIELD componentCount 9 | ,preProcessingMillis 10 | ,computeMillis 11 | ,postProcessingMillis 12 | ,componentDistribution 13 | RETURN componentCount 14 | ,preProcessingMillis 15 | ,computeMillis 16 | ,postProcessingMillis 17 | ,componentDistribution.min 18 | ,componentDistribution.mean 19 | ,componentDistribution.max 20 | ,componentDistribution.p50 21 | ,componentDistribution.p75 22 | ,componentDistribution.p90 23 | ,componentDistribution.p95 24 | ,componentDistribution.p99 25 | ,componentDistribution.p999 -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_3c_WeaklyConnectedComponents_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Weakly Connected Components Mutate 2 | 3 | CALL gds.wcc.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,mutateProperty: $dependencies_projection_write_property 7 | ,consecutiveIds: true 8 | }) 9 | YIELD componentCount 10 | ,nodePropertiesWritten 11 | ,preProcessingMillis 12 | ,computeMillis 13 | ,mutateMillis 14 | ,postProcessingMillis 15 | ,componentDistribution 16 | RETURN componentCount 17 | ,nodePropertiesWritten 18 | ,preProcessingMillis 19 | ,computeMillis 20 | ,mutateMillis 21 | ,postProcessingMillis 22 | ,componentDistribution.min 23 | ,componentDistribution.mean 24 | ,componentDistribution.max 25 | ,componentDistribution.p50 26 | ,componentDistribution.p75 27 | ,componentDistribution.p90 28 | ,componentDistribution.p95 29 | ,componentDistribution.p99 30 | ,componentDistribution.p999 -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_3d_WeaklyConnectedComponents_Stream.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Weakly Connected Components Stream 2 | 3 | CALL gds.wcc.stream( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property, 6 | consecutiveIds: true 7 | }) 8 | YIELD nodeId, componentId 9 | WITH componentId 10 | ,gds.util.asNode(nodeId) AS member 11 | WITH componentId 12 | ,member 13 | ,coalesce(member.fqn, member.fileName, member.name) AS memberName 14 | WITH componentId 15 | ,count(DISTINCT member) AS memberCount 16 | ,collect(DISTINCT memberName) AS memberNames 17 | RETURN componentId 18 | ,memberCount 19 | ,memberNames 20 | ORDER BY memberCount DESC, componentId ASC -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_3e_WeaklyConnectedComponents_Write.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Weakly Connected Components write node property communityWeaklyConnectedComponentId 2 | 3 | CALL gds.wcc.write( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,consecutiveIds: true 7 | ,writeProperty: 'communityWeaklyConnectedComponentId' 8 | }) 9 | YIELD componentCount 10 | ,preProcessingMillis 11 | ,computeMillis 12 | ,writeMillis 13 | ,postProcessingMillis 14 | ,nodePropertiesWritten 15 | ,componentDistribution 16 | RETURN componentCount 17 | ,preProcessingMillis 18 | ,computeMillis 19 | ,writeMillis 20 | ,postProcessingMillis 21 | ,nodePropertiesWritten 22 | ,componentDistribution.min 23 | ,componentDistribution.mean 24 | ,componentDistribution.max 25 | ,componentDistribution.p50 26 | ,componentDistribution.p75 27 | ,componentDistribution.p90 28 | ,componentDistribution.p95 29 | ,componentDistribution.p99 30 | ,componentDistribution.p999 -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_4a_Label_Propagation_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Label Propagation Estimate 2 | 3 | CALL gds.labelPropagation.write.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,writeProperty: $dependencies_projection_write_property 7 | ,consecutiveIds: true 8 | }) 9 | YIELD requiredMemory 10 | ,nodeCount 11 | ,relationshipCount 12 | ,bytesMin 13 | ,bytesMax 14 | ,heapPercentageMin 15 | ,heapPercentageMax 16 | ,treeView 17 | ,mapView 18 | RETURN requiredMemory 19 | ,nodeCount 20 | ,relationshipCount 21 | ,bytesMin 22 | ,bytesMax 23 | ,heapPercentageMin 24 | ,heapPercentageMax 25 | ,treeView 26 | //,mapView //doesn't work on Windows with git bash jq version jq-1.7-dirty -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_4b_Label_Propagation_Statistics.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Label Propagation Statistics 2 | 3 | CALL gds.labelPropagation.stats( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,consecutiveIds: true 7 | }) 8 | YIELD communityCount 9 | ,ranIterations 10 | ,didConverge 11 | ,preProcessingMillis 12 | ,computeMillis 13 | ,postProcessingMillis 14 | ,communityDistribution 15 | RETURN communityCount 16 | ,ranIterations 17 | ,didConverge 18 | ,preProcessingMillis 19 | ,computeMillis 20 | ,postProcessingMillis 21 | ,communityDistribution.min 22 | ,communityDistribution.mean 23 | ,communityDistribution.max 24 | ,communityDistribution.p50 25 | ,communityDistribution.p75 26 | ,communityDistribution.p90 27 | ,communityDistribution.p95 28 | ,communityDistribution.p99 29 | ,communityDistribution.p999 -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_4c_Label_Propagation_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Label Propagation Mutate 2 | 3 | CALL gds.labelPropagation.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,mutateProperty: $dependencies_projection_write_property 7 | ,consecutiveIds: true 8 | }) 9 | YIELD ranIterations 10 | ,didConverge 11 | ,communityCount 12 | ,preProcessingMillis 13 | ,computeMillis 14 | ,mutateMillis 15 | ,postProcessingMillis 16 | ,nodePropertiesWritten 17 | ,communityDistribution 18 | RETURN ranIterations 19 | ,didConverge 20 | ,communityCount 21 | ,preProcessingMillis 22 | ,computeMillis 23 | ,mutateMillis 24 | ,postProcessingMillis 25 | ,nodePropertiesWritten 26 | ,communityDistribution.min 27 | ,communityDistribution.mean 28 | ,communityDistribution.max 29 | ,communityDistribution.p50 30 | ,communityDistribution.p75 31 | ,communityDistribution.p90 32 | ,communityDistribution.p95 33 | ,communityDistribution.p99 34 | ,communityDistribution.p999 -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_4d_Label_Propagation_Stream.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Label Propagation Stream 2 | 3 | CALL gds.labelPropagation.stream( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,consecutiveIds: true 7 | }) 8 | YIELD nodeId, communityId 9 | WITH communityId 10 | ,gds.util.asNode(nodeId) AS member 11 | WITH communityId 12 | ,member 13 | ,coalesce(member.fqn, member.fileName, member.name) AS memberName 14 | WITH communityId 15 | ,count(DISTINCT member) AS memberCount 16 | ,collect(DISTINCT memberName) AS memberNames 17 | RETURN communityId 18 | ,memberCount 19 | ,memberNames 20 | ORDER BY memberCount DESC, communityId ASC -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_4e_Label_Propagation_Write.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Label Propagation write node property communityLabelPropagationId 2 | 3 | CALL gds.labelPropagation.write( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,consecutiveIds: true 7 | ,writeProperty: 'communityLabelPropagationId' 8 | }) 9 | YIELD ranIterations 10 | ,didConverge 11 | ,communityCount 12 | ,preProcessingMillis 13 | ,computeMillis 14 | ,writeMillis 15 | ,postProcessingMillis 16 | ,nodePropertiesWritten 17 | ,communityDistribution 18 | RETURN ranIterations 19 | ,didConverge 20 | ,communityCount 21 | ,preProcessingMillis 22 | ,computeMillis 23 | ,writeMillis 24 | ,postProcessingMillis 25 | ,nodePropertiesWritten 26 | ,communityDistribution.min 27 | ,communityDistribution.mean 28 | ,communityDistribution.max 29 | ,communityDistribution.p50 30 | ,communityDistribution.p75 31 | ,communityDistribution.p90 32 | ,communityDistribution.p95 33 | ,communityDistribution.p99 34 | ,communityDistribution.p999 -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_5a_K_Core_Decomposition_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection K-Core Decomposition Estimate 2 | 3 | CALL gds.kcore.write.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | writeProperty: $dependencies_projection_write_property 6 | }) 7 | YIELD requiredMemory 8 | ,nodeCount 9 | ,relationshipCount 10 | ,bytesMin 11 | ,bytesMax 12 | ,heapPercentageMin 13 | ,heapPercentageMax 14 | ,treeView 15 | ,mapView 16 | RETURN requiredMemory 17 | ,nodeCount 18 | ,relationshipCount 19 | ,bytesMin 20 | ,bytesMax 21 | ,heapPercentageMin 22 | ,heapPercentageMax 23 | ,treeView 24 | //,mapView //doesn't work on Windows with git bash jq version jq-1.7-dirty -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_5b_K_Core_Decomposition_Statistics.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection K-Core Decomposition Statistics 2 | 3 | CALL gds.kcore.stats( 4 | $dependencies_projection + '-cleaned', { 5 | }) 6 | YIELD degeneracy, preProcessingMillis, computeMillis, postProcessingMillis 7 | RETURN degeneracy, preProcessingMillis, computeMillis, postProcessingMillis -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_5c_K_Core_Decomposition_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection K-Core Decomposition Mutate 2 | 3 | CALL gds.kcore.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | mutateProperty: $dependencies_projection_write_property 6 | }) 7 | YIELD degeneracy, nodePropertiesWritten, preProcessingMillis, computeMillis, postProcessingMillis, mutateMillis 8 | RETURN degeneracy, nodePropertiesWritten, preProcessingMillis, computeMillis, postProcessingMillis, mutateMillis -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_5d_K_Core_Decomposition_Stream.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection K-Core Decomposition Stream 2 | 3 | CALL gds.kcore.stream( 4 | $dependencies_projection + '-cleaned', { 5 | }) 6 | YIELD nodeId, coreValue 7 | WITH gds.util.asNode(nodeId) AS member 8 | ,coreValue 9 | WITH member 10 | ,coalesce(member.fqn, member.fileName, member.name) AS memberName 11 | ,coreValue 12 | WITH count(DISTINCT member) AS memberCount 13 | ,collect(DISTINCT memberName) AS memberNames 14 | ,coreValue 15 | RETURN memberCount 16 | ,coreValue 17 | ,memberNames 18 | ORDER BY memberCount DESC, coreValue ASC -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_5e_K_Core_Decomposition_Write.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection K-Core Decomposition write node property communitykCoreDecompositionValue 2 | 3 | CALL gds.kcore.write( 4 | $dependencies_projection + '-cleaned', { 5 | writeProperty: $dependencies_projection_write_property 6 | }) 7 | YIELD degeneracy 8 | ,preProcessingMillis 9 | ,computeMillis 10 | ,writeMillis 11 | ,postProcessingMillis 12 | ,nodePropertiesWritten 13 | RETURN degeneracy 14 | ,preProcessingMillis 15 | ,computeMillis 16 | ,writeMillis 17 | ,postProcessingMillis 18 | ,nodePropertiesWritten -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_6a_Approximate_Maximum_k_cut_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Approximate Maximum k-cut Estimate 2 | 3 | CALL gds.maxkcut.mutate.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,mutateProperty: $dependencies_projection_write_property 7 | ,k: toInteger($dependencies_maxkcut) 8 | }) 9 | YIELD requiredMemory 10 | ,nodeCount 11 | ,relationshipCount 12 | ,bytesMin 13 | ,bytesMax 14 | ,heapPercentageMin 15 | ,heapPercentageMax 16 | ,treeView 17 | ,mapView 18 | RETURN requiredMemory 19 | ,nodeCount 20 | ,relationshipCount 21 | ,bytesMin 22 | ,bytesMax 23 | ,heapPercentageMin 24 | ,heapPercentageMax 25 | ,treeView 26 | //,mapView //doesn't work on Windows with git bash jq version jq-1.7-dirty -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_6c_Approximate_Maximum_k_cut_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Approximate Maximum k-cut Mutate 2 | 3 | CALL gds.maxkcut.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,mutateProperty: $dependencies_projection_write_property 7 | ,k: toInteger($dependencies_maxkcut) 8 | }) 9 | YIELD cutCost, nodePropertiesWritten, preProcessingMillis, computeMillis, postProcessingMillis, mutateMillis 10 | RETURN cutCost, nodePropertiesWritten, preProcessingMillis, computeMillis, postProcessingMillis, mutateMillis -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_6d_Approximate_Maximum_k_cut_Stream.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Approximate Maximum k-cut Stream 2 | 3 | CALL gds.maxkcut.stream( 4 | $dependencies_projection + '-cleaned', { 5 | }) 6 | YIELD nodeId, communityId 7 | WITH gds.util.asNode(nodeId) AS member 8 | ,communityId 9 | WITH member 10 | ,coalesce(member.fqn, member.fileName, member.name) AS memberName 11 | ,communityId 12 | WITH communityId 13 | ,count(DISTINCT member) AS memberCount 14 | ,collect(DISTINCT memberName) AS memberNames 15 | RETURN communityId 16 | ,memberCount 17 | ,memberNames 18 | ORDER BY memberCount DESC, communityId ASC -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_7d_Modularity.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Modularity 2 | 3 | CALL gds.modularity.stream( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,communityProperty: $dependencies_projection_write_property 7 | }) 8 | YIELD communityId, modularity 9 | RETURN communityId, modularity 10 | ORDER BY communityId ASCENDING -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_7e_Write_Modularity.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Modularity Write 2 | 3 | CALL gds.modularity.stream( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,communityProperty: $dependencies_projection_write_property 7 | }) 8 | YIELD communityId, modularity 9 | WITH collect({communityId: communityId, modularity: modularity}) AS modularities 10 | MATCH (member) 11 | WHERE member[$dependencies_projection_write_property] IS NOT NULL 12 | AND $dependencies_projection_node IN LABELS(member) 13 | WITH modularities 14 | ,member 15 | ,reduce(memberModularity = 0, modularity IN modularities | 16 | CASE modularity.communityId WHEN member[$dependencies_projection_write_property] THEN modularity.modularity 17 | ELSE memberModularity END) AS memberModularity 18 | CALL apoc.create.setProperty(member, $dependencies_projection_write_property + 'Modularity', memberModularity) 19 | YIELD node 20 | RETURN count(DISTINCT node) AS writtenModularityNodes -------------------------------------------------------------------------------- /cypher/Community_Detection/Community_Detection_8d_Conductance.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Conductance 2 | 3 | CALL gds.conductance.stream( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,communityProperty: $dependencies_projection_write_property 7 | }) 8 | YIELD community, conductance 9 | RETURN community, conductance 10 | ORDER BY community ASCENDING -------------------------------------------------------------------------------- /cypher/Community_Detection/Compare_Louvain_vs_Leiden_Results.cypher: -------------------------------------------------------------------------------- 1 | // Compare Louvain vs. Leiden Community Detection Results. Variables: dependencies_projection_node (e.g. "Artifact", "Package", "Type"). Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (member) 4 | WHERE $dependencies_projection_node IN LABELS(member) 5 | AND member.louvainCommunityId IS NOT NULL 6 | AND member.leidenCommunityId IS NOT NULL 7 | WITH member.communityLouvainId AS louvainCommunityId 8 | ,member.communityLeidenId AS leidenCommunityId 9 | ,coalesce(member.fqn, member.fileName, member.signature, member.name) AS memberName 10 | ,member.name AS shortMemberName 11 | WITH louvainCommunityId 12 | ,leidenCommunityId 13 | ,collect(DISTINCT shortMemberName) AS shortMemberNames 14 | ,count(DISTINCT memberName) AS memberCount 15 | ,collect(DISTINCT memberName) AS memberNames 16 | RETURN louvainCommunityId 17 | ,leidenCommunityId 18 | ,memberCount 19 | ,shortMemberNames 20 | ,memberNames 21 | ORDER BY louvainCommunityId ASC, memberCount DESC -------------------------------------------------------------------------------- /cypher/Community_Detection/Get_all_Packages_with_a_Community_Detection_Label.cypher: -------------------------------------------------------------------------------- 1 | // Get all Packages with a Community Detection Label 2 | MATCH (package:Package) 3 | WHERE any(label IN labels(package) WHERE label CONTAINS 'Community') 4 | RETURN DISTINCT package; -------------------------------------------------------------------------------- /cypher/Community_Detection/Set_Parameters.cypher: -------------------------------------------------------------------------------- 1 | // Example on how to set the parameters for community detaction in this case for Packages and Leiden 2 | 3 | :params { 4 | "dependencies_projection": "package-community", 5 | "dependencies_projection_node": "Package", 6 | "dependencies_projection_weight_property": "weight25PercentInterfaces", 7 | "dependencies_projection_write_property": "communityLeidenId", 8 | "dependencies_leiden_gamma": "1.14", 9 | } -------------------------------------------------------------------------------- /cypher/Community_Detection/Type_communities_that_span_the_most_packages.cypher: -------------------------------------------------------------------------------- 1 | // Communities that span the most packages. Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (a:Artifact)-[:CONTAINS]->(p:Package)-[:CONTAINS]->(t:Type) 4 | WITH a.name AS artifactName 5 | ,t.communityLeidenId AS communityId 6 | ,collect(DISTINCT p.fqn) AS packageNames 7 | ,count(DISTINCT p.fqn) AS packageCount 8 | ,collect(DISTINCT t.fqn) AS typeNames 9 | ,count(DISTINCT t.fqn) AS typeCount 10 | WHERE communityId IS NOT NULL 11 | RETURN artifactName 12 | ,communityId 13 | ,packageCount 14 | ,typeCount 15 | ,packageNames 16 | ,typeNames 17 | ORDER BY packageCount DESCENDING 18 | ,typeCount DESCENDING 19 | ,communityId ASCENDING -------------------------------------------------------------------------------- /cypher/Community_Detection/Which_package_community_spans_multiple_artifacts.cypher: -------------------------------------------------------------------------------- 1 | // Which package community spans multiple artifacts? Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (artifact:Artifact)-[:CONTAINS]->(package:Package) 4 | WITH package.communityLeidenId AS communityId 5 | ,collect(DISTINCT artifact.name) AS artifactNames 6 | ,size(collect(DISTINCT artifact)) AS artifactCount 7 | WHERE communityId IS NOT NULL 8 | RETURN communityId, artifactNames, artifactCount 9 | ORDER BY artifactCount DESC, communityId -------------------------------------------------------------------------------- /cypher/Community_Detection/Which_package_community_spans_several_artifacts_and_how_are_the_packages_distributed.cypher: -------------------------------------------------------------------------------- 1 | // Which package community spans several artifacts and how are the packages distributed? Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (artifact:Artifact)-[:CONTAINS]->(package:Package) 4 | MATCH (externalArtifact:Artifact)-[:CONTAINS]->(externalPackage:Package) 5 | WHERE artifact.fileName <> externalArtifact.fileName 6 | AND package.communityLeidenId 7 | = externalPackage.communityLeidenId 8 | WITH package.communityLeidenId AS communityId 9 | ,artifact.name AS artifactName 10 | ,collect(DISTINCT package.name) AS packageNames 11 | ,size(collect(DISTINCT package)) AS packageCount 12 | WHERE communityId IS NOT NULL 13 | RETURN communityId, artifactName, packageCount, packageNames 14 | ORDER BY communityId, artifactName -------------------------------------------------------------------------------- /cypher/Community_Detection/Which_type_community_spans_several_artifacts_and_how_are_the_types_distributed.cypher: -------------------------------------------------------------------------------- 1 | // Which type community spans several artifacts and how are the types distributed? Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (artifact:Artifact)-[:CONTAINS]->(package:Package)-[:CONTAINS]->(type:Type) 4 | MATCH (externalArtifact:Artifact)-[:CONTAINS]->(externalPackage:Package)-[:CONTAINS]->(externalType:Type) 5 | WHERE artifact.fileName <> externalArtifact.fileName 6 | AND package.fqn <> externalPackage.fqn 7 | AND type.communityLeidenId = externalType.communityLeidenId 8 | WITH type.communityLeidenId AS communityId 9 | ,size(collect(DISTINCT artifact)) AS artifactCount 10 | ,collect(DISTINCT artifact.name) AS artifactNames 11 | ,size(collect(DISTINCT package)) AS packageCount 12 | ,collect(DISTINCT package.name) AS packageNames 13 | ,size(collect(DISTINCT type)) AS typeCount 14 | ,collect(DISTINCT type.name) AS typeNames 15 | RETURN communityId, artifactCount, packageCount, typeCount, artifactNames, packageNames, typeNames 16 | ORDER BY artifactCount DESC, communityId -------------------------------------------------------------------------------- /cypher/Count_nodes_and_relationships.cypher: -------------------------------------------------------------------------------- 1 | // Count nodes and relationships 2 | 3 | MATCH (n)-[r]-(m) 4 | RETURN COUNT(DISTINCT n) AS nodeCount 5 | ,COUNT(DISTINCT r) AS relationshipCount -------------------------------------------------------------------------------- /cypher/Create_Java_Type_index_for_full_qualified_name.cypher: -------------------------------------------------------------------------------- 1 | // Create index for the full qualified type name 2 | 3 | CREATE INDEX INDEX_JAVA_FULL_QUALIFIED_NAME IF NOT EXISTS FOR (t:Type) ON (t.fqn) -------------------------------------------------------------------------------- /cypher/Create_Typescript_index_for_full_qualified_name.cypher: -------------------------------------------------------------------------------- 1 | // Create index for the full qualified type name 2 | 3 | CREATE INDEX INDEX_TYPESCRIPT_FULL_QUALIFIED_NAME IF NOT EXISTS FOR (t:TS) ON (t.globalFqn) -------------------------------------------------------------------------------- /cypher/Create_Typescript_index_for_name.cypher: -------------------------------------------------------------------------------- 1 | // Create index for the name for Typescript nodes 2 | 3 | CREATE INDEX INDEX_TYPESCRIPT_NAME IF NOT EXISTS FOR (typescript:TS) ON (typescript.name) -------------------------------------------------------------------------------- /cypher/Cyclic_Dependencies/Cyclic_Dependencies_Concatenated.cypher: -------------------------------------------------------------------------------- 1 | //Cyclic Dependencies Concatenated 2 | MATCH (package:Package)-[:CONTAINS]->(forwardSource:Type)-[:DEPENDS_ON]->(forwardTarget:Type)<-[:CONTAINS]-(dependentPackage:Package) 3 | MATCH (dependentPackage)-[:CONTAINS]->(backwardSource:Type)-[:DEPENDS_ON]->(backwardTarget:Type)<-[:CONTAINS]-(package) 4 | WHERE package <> dependentPackage 5 | WITH package, dependentPackage 6 | ,collect(DISTINCT forwardSource) + collect(DISTINCT backwardTarget) + 7 | collect(DISTINCT backwardSource) + collect(DISTINCT backwardTarget) 8 | AS dependencies 9 | UNWIND dependencies AS dependenciesUnwind 10 | RETURN package, dependentPackage 11 | ,collect(DISTINCT dependenciesUnwind) AS dependencies -------------------------------------------------------------------------------- /cypher/Cyclic_Dependencies/Cyclic_Dependencies_as_Nodes.cypher: -------------------------------------------------------------------------------- 1 | // Cyclic Dependencies 2 | MATCH (package:Package)-[:CONTAINS]->(type:Type)-[:DEPENDS_ON]->(dependentType:Type)<-[:CONTAINS]-(dependentPackage:Package) 3 | MATCH (dependentPackage)-[:CONTAINS]->(cycleType:Type)-[:DEPENDS_ON]->(cycleDependentType:Type)<-[:CONTAINS]-(package) 4 | WHERE package <> dependentPackage 5 | RETURN package, dependentPackage 6 | ,type, dependentType, cycleType, cycleDependentType 7 | LIMIT 100 -------------------------------------------------------------------------------- /cypher/Data_verification_DEPENDS_ON_relationships.cypher: -------------------------------------------------------------------------------- 1 | // Data verification DEPENDS_ON relationship distinct label constellations 2 | 3 | MATCH (s)-[r:DEPENDS_ON]->(t) 4 | WHERE s <> t 5 | RETURN count(DISTINCT s) AS sourceNodeCount -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_0_Check_Projectable.cypher: -------------------------------------------------------------------------------- 1 | // Check if there is at least one projectable dependency. Variables: dependencies_projection_node, dependencies_projection_weight_property 2 | 3 | MATCH (source)-[dependency:DEPENDS_ON]->(target) 4 | WHERE $dependencies_projection_node IN labels(source) 5 | AND $dependencies_projection_node IN labels(target) 6 | AND $dependencies_projection_weight_property IN keys(dependency) 7 | RETURN elementId(source) AS sourceElementId 8 | LIMIT 1 -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_0_Prepare_Projection.cypher: -------------------------------------------------------------------------------- 1 | // Prepare projection by e.g. filling in default values for missing properties 2 | 3 | MATCH (source)-[DEPENDS_ON]->(target) 4 | WHERE $dependencies_projection_node IN labels(source) 5 | AND $dependencies_projection_node IN labels(target) 6 | SET source.testMarkerInteger = coalesce(source.testMarkerInteger, 0) 7 | ,target.testMarkerInteger = coalesce(target.testMarkerInteger, 0) 8 | RETURN count(*) AS numberOfDependencies -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_10_Delete_Label.cypher: -------------------------------------------------------------------------------- 1 | // Community Detection Label Propagation Label Delete 2 | 3 | CALL db.labels() YIELD label 4 | WHERE label STARTS WITH 'Mark4' + $dependencies_projection_node + $dependencies_projection_write_label 5 | WITH collect(label) AS selectedLabels 6 | MATCH (member) 7 | WHERE $dependencies_projection_node IN labels(member) 8 | AND member[$dependencies_projection_write_property] IS NOT NULL 9 | WITH collect(member) AS members, selectedLabels 10 | CALL apoc.create.removeLabels(members, selectedLabels) YIELD node 11 | RETURN COUNT(node) AS nodesCount; -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_11_Add_Label.cypher: -------------------------------------------------------------------------------- 1 | // Write a property from the projection into the Graph. Variables: dependencies_projection, dependencies_projection_write_property 2 | 3 | MATCH (member) 4 | WHERE member[$dependencies_projection_write_property] IS NOT NULL 5 | AND $dependencies_projection_node IN LABELS(member) 6 | WITH collect(member) AS members 7 | ,count(DISTINCT member) AS memberCount 8 | ,'Mark4' + $dependencies_projection_node + $dependencies_projection_write_label + toString(member[$dependencies_projection_write_property]) AS labelName 9 | WHERE memberCount > 1 10 | UNWIND members AS member 11 | CALL apoc.create.addLabels(member, [labelName]) YIELD node 12 | RETURN count(node) AS nodesCount -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_12_Get_Projection_Statistics.cypher: -------------------------------------------------------------------------------- 1 | // Get dependency projection statistics 2 | 3 | CALL gds.graph.list($dependencies_projection + '-cleaned') 4 | YIELD nodeCount, relationshipCount, density, sizeInBytes, degreeDistribution 5 | RETURN nodeCount 6 | ,relationshipCount 7 | ,density 8 | ,sizeInBytes 9 | ,degreeDistribution.min 10 | ,degreeDistribution.mean 11 | ,degreeDistribution.max 12 | ,degreeDistribution.p50 13 | ,degreeDistribution.p75 14 | ,degreeDistribution.p90 15 | ,degreeDistribution.p95 16 | ,degreeDistribution.p99 17 | ,degreeDistribution.p999 -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_1_Delete_Projection.cypher: -------------------------------------------------------------------------------- 1 | // Delete projection if existing. Variables: dependencies_projection 2 | 3 | CALL gds.graph.drop($dependencies_projection, false) 4 | YIELD graphName, nodeCount, relationshipCount, creationTime, modificationTime 5 | RETURN graphName, nodeCount, relationshipCount, creationTime, modificationTime -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_2_Delete_Subgraph.cypher: -------------------------------------------------------------------------------- 1 | // Delete filtered subgraph projection if exists. Variables: dependencies_projection 2 | 3 | CALL gds.graph.drop($dependencies_projection + '-cleaned', false) 4 | YIELD graphName, nodeCount, relationshipCount, creationTime, modificationTime 5 | RETURN graphName, nodeCount, relationshipCount, creationTime, modificationTime -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_3_Create_Projection.cypher: -------------------------------------------------------------------------------- 1 | // Create directed projection. Variables: dependencies_projection, dependencies_projection_node, dependencies_projection_weight_property 2 | 3 | CALL gds.graph.project( 4 | $dependencies_projection, 5 | $dependencies_projection_node, 6 | 'DEPENDS_ON', { 7 | relationshipProperties: [$dependencies_projection_weight_property], 8 | nodeProperties: ['incomingDependencies', 'outgoingDependencies', 'testMarkerInteger'] 9 | } 10 | ) 11 | YIELD graphName, nodeCount, relationshipCount 12 | RETURN graphName, nodeCount, relationshipCount -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_3b_Create_Multi_Relationship_Projection.cypher: -------------------------------------------------------------------------------- 1 | // Create multi relationship projection. Variables: dependencies_projection, dependencies_projection_node 2 | 3 | CALL gds.graph.project( 4 | $dependencies_projection, 5 | $dependencies_projection_node, 6 | ['DEPENDS_ON', 'CONTAINS'], 7 | { 8 | relationshipProperties: { 9 | weight: { 10 | defaultValue: 1.0 11 | }, 12 | weightInterfaces: { 13 | defaultValue: 1.0 14 | }, 15 | weight25PercentInterfaces: { 16 | defaultValue: 1.0 17 | } 18 | }, 19 | nodeProperties: ['incomingDependencies', 'outgoingDependencies', 'testMarkerInteger'] 20 | } 21 | ) 22 | YIELD graphName, nodeCount, relationshipCount 23 | RETURN graphName, nodeCount, relationshipCount -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_3d_Create_Java_Method_Projection.cypher: -------------------------------------------------------------------------------- 1 | // Create directed projection for public Java methods filtering out constructors, getters and setters. Variables: dependencies_projection, dependencies_projection_weight_property 2 | 3 | MATCH (source:Java:Method)-[r:INVOKES]->(target:Java:Method) 4 | WHERE source.effectiveLineCount > 1 5 | AND target.effectiveLineCount > 1 6 | AND source.visibility = 'public' 7 | AND target.visibility = 'public' 8 | AND source.name <> '' 9 | AND target.name <> '' 10 | WITH gds.graph.project($dependencies_projection + '-cleaned', source, target) AS projection 11 | RETURN projection.graphName AS graphName 12 | ,projection.nodeCount AS nodeCount 13 | ,projection.relationshipCount AS relationshipCount -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_4_Create_Undirected_Projection.cypher: -------------------------------------------------------------------------------- 1 | // Create undirected projection. Variables: dependencies_projection, dependencies_projection_node, dependencies_projection_weight_property 2 | 3 | CALL gds.graph.project( 4 | $dependencies_projection, 5 | $dependencies_projection_node, 6 | { 7 | DEPENDS_ON: { 8 | orientation: 'UNDIRECTED' 9 | } 10 | }, 11 | { 12 | relationshipProperties: [$dependencies_projection_weight_property], 13 | nodeProperties: ['incomingDependencies', 'outgoingDependencies', 'testMarkerInteger'] 14 | } 15 | ) 16 | YIELD graphName, nodeCount, relationshipCount 17 | RETURN graphName, nodeCount, relationshipCount -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_5_Create_Subgraph.cypher: -------------------------------------------------------------------------------- 1 | //Create filtered subgraph projection without zero-degree nodes. Variables: dependencies_projection, dependencies_projection_node 2 | 3 | CALL gds.graph.filter( 4 | $dependencies_projection + '-cleaned', 5 | $dependencies_projection, 6 | 'n.testMarkerInteger = 0 AND (n.outgoingDependencies > 0 OR n.incomingDependencies > 0)', 7 | '*' 8 | ) 9 | YIELD graphName, fromGraphName, nodeCount, relationshipCount, nodeFilter 10 | RETURN graphName, fromGraphName, nodeCount, relationshipCount, nodeFilter -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_6_Check_Projection_Nodes.cypher: -------------------------------------------------------------------------------- 1 | // Check Projection Node Properties 2 | 3 | CALL gds.graph.nodeProperties.stream( 4 | $dependencies_projection + '-cleaned' 5 | ,['incomingDependencies', 'outgoingDependencies'] 6 | ) 7 | YIELD nodeId, propertyValue 8 | WITH * ,gds.util.asNode(nodeId) AS source 9 | RETURN nodeId 10 | ,coalesce(source.fqn, source.fileName, source.name) AS sourceName 11 | ,propertyValue 12 | ,labels(source)[0..4] AS first5NodeLabels 13 | ORDER BY sourceName ASC 14 | LIMIT 50 -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_7_Check_Projection_Relationships.cypher: -------------------------------------------------------------------------------- 1 | // Check Projection Relationships 2 | 3 | CALL gds.graph.relationshipProperty.stream( 4 | $dependencies_projection + '-cleaned' 5 | ,$dependencies_projection_weight_property 6 | ,['DEPENDS_ON'] 7 | ) 8 | YIELD sourceNodeId, targetNodeId, propertyValue, relationshipType 9 | WITH sourceNodeId 10 | ,targetNodeId 11 | ,gds.util.asNode(sourceNodeId) AS source 12 | ,gds.util.asNode(targetNodeId) AS target 13 | ,propertyValue AS weight 14 | ,relationshipType 15 | RETURN sourceNodeId 16 | ,coalesce(source.fqn, source.fileName, source.name) AS sourceName 17 | ,targetNodeId 18 | ,coalesce(target.fqn, target.fileName, target.name) AS targetName 19 | ,weight 20 | ,relationshipType 21 | ORDER BY weight DESC, sourceName ASC 22 | LIMIT 50 -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_8_Stream_Mutated.cypher: -------------------------------------------------------------------------------- 1 | // Read a property from projected nodes unordered. Variables: dependencies_projection, dependencies_projection_write_property. Requires "Add_file_name and_extension.cypher", "Set_localRootPath_for_modules", "Set_declaring_type_on_method_nodes". 2 | 3 | CALL gds.graph.nodeProperties.stream( 4 | $dependencies_projection + '-cleaned' 5 | ,[$dependencies_projection_write_property] 6 | ) 7 | YIELD nodeId, nodeProperty, propertyValue 8 | WITH gds.util.asNode(nodeId) AS codeUnit 9 | ,nodeProperty AS propertyName 10 | ,propertyValue 11 | WITH *, coalesce(codeUnit.declaringType + ': ', '') + 12 | coalesce(codeUnit.rootProjectName + '/', '') + 13 | coalesce(codeUnit.signature, codeUnit.name) AS codeUnitNameWithDetails 14 | RETURN DISTINCT coalesce(codeUnit.fqn, codeUnitNameWithDetails, codeUnit.fileName, codeUnit.name) AS codeUnitName 15 | ,codeUnit.name AS shortCodeUnitName 16 | ,propertyName 17 | ,propertyValue -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_8_Stream_Mutated_Value_Descending.cypher: -------------------------------------------------------------------------------- 1 | // Read a property from projected nodes ordered by their value descending. Variables: dependencies_projection, dependencies_projection_write_property. Requires "Add_file_name and_extension.cypher", "Set_localRootPath_for_modules", "Set_declaring_type_on_method_nodes". 2 | 3 | CALL gds.graph.nodeProperties.stream( 4 | $dependencies_projection + '-cleaned' 5 | ,[$dependencies_projection_write_property] 6 | ) 7 | YIELD nodeId, nodeProperty, propertyValue 8 | WITH gds.util.asNode(nodeId) AS codeUnit 9 | ,nodeProperty AS propertyName 10 | ,propertyValue 11 | WITH *, coalesce(codeUnit.declaringType + ': ', '') + 12 | coalesce(codeUnit.rootProjectName + '/', '') + 13 | coalesce(codeUnit.signature, codeUnit.name) AS codeUnitNameWithDetails 14 | RETURN DISTINCT coalesce(codeUnit.fqn, codeUnitNameWithDetails, codeUnit.fileName, codeUnit.name) AS codeUnitName 15 | ,codeUnit.name AS shortCodeUnitName 16 | ,propertyName 17 | ,propertyValue 18 | ORDER BY propertyValue DESCENDING, codeUnitName ASCENDING -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Dependencies_9_Write_Mutated.cypher: -------------------------------------------------------------------------------- 1 | // Write a property from the projection into the Graph. Variables: dependencies_projection, dependencies_projection_write_property 2 | 3 | CALL gds.graph.nodeProperties.write( 4 | $dependencies_projection + '-cleaned' 5 | ,[$dependencies_projection_write_property] 6 | ) 7 | YIELD propertiesWritten, nodeProperties, writeMillis 8 | RETURN propertiesWritten, nodeProperties, writeMillis -------------------------------------------------------------------------------- /cypher/Dependencies_Projection/Set_Parameters.cypher: -------------------------------------------------------------------------------- 1 | // Example on how to set the parameters for the dependencies projection in this case for Packages and the useage with PageRank 2 | 3 | :params { 4 | "dependencies_projection": "package-centrality", 5 | "dependencies_projection_node": "Package", 6 | "dependencies_projection_weight_property": "weight25PercentInterfaces", 7 | "dependencies_projection_write_property": "centralityPageRank", 8 | } -------------------------------------------------------------------------------- /cypher/DependsOn_Relationship_Weights/Add_weight10PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher: -------------------------------------------------------------------------------- 1 | // Add weight10PercentInterfaces to Package DEPENDS_ON relationships 2 | 3 | MATCH (package:Java:Package)-[r:DEPENDS_ON]->(dependent:Java:Package) 4 | WITH package, r 5 | ,toInteger(r.weight - round(r.weightInterfaces * 0.90)) AS weight10PercentInterfaces 6 | SET r.weight10PercentInterfaces = weight10PercentInterfaces 7 | RETURN package.fqn, weight10PercentInterfaces, r.weight, r.weightInterfaces 8 | ORDER BY weight10PercentInterfaces DESC -------------------------------------------------------------------------------- /cypher/DependsOn_Relationship_Weights/Add_weight25PercentInterfaces_to_Java_Package_DEPENDS_ON_relationships.cypher: -------------------------------------------------------------------------------- 1 | // Add weight25PercentInterfaces to Package DEPENDS_ON relationships 2 | 3 | MATCH (package:Java:Package)-[r:DEPENDS_ON]->(dependent:Java:Package) 4 | WITH package, r 5 | ,toInteger(r.weight - round(r.weightInterfaces * 0.75)) AS weight25PercentInterfaces 6 | SET r.weight25PercentInterfaces = weight25PercentInterfaces 7 | RETURN package.fqn, weight25PercentInterfaces, r.weight, r.weightInterfaces 8 | ORDER BY weight25PercentInterfaces DESC -------------------------------------------------------------------------------- /cypher/DependsOn_Relationship_Weights/Add_weight_property_for_Java_Interface_Dependencies_to_Package_DEPENDS_ON_Relationship.cypher: -------------------------------------------------------------------------------- 1 | // Add weight property for Interface Dependencies to Package DEPENDS_ON Relationship 2 | 3 | MATCH (sourcePackage:Java:Package)-[packageDependency:DEPENDS_ON]->(dependentPackage:Java:Package) 4 | MATCH (sourcePackage)-[:CONTAINS]->(sourceType:Type) 5 | OPTIONAL MATCH (sourceType:Type)-[typeDependency:DEPENDS_ON]->(dependentInterface:Interface)<-[:CONTAINS]-(dependentPackage) 6 | WHERE sourcePackage.fqn <> dependentPackage.fqn 7 | WITH packageDependency 8 | ,sourcePackage.fqn AS sourcePackageName 9 | ,dependentPackage.fqn AS dependentPackageName 10 | ,SUM(typeDependency.weight) AS packageInterfaceDependencyWeight 11 | ,COUNT(dependentInterface.fqn) AS dependentInterfaces 12 | SET packageDependency.weightInterfaces = packageInterfaceDependencyWeight 13 | RETURN sourcePackageName 14 | ,dependentPackageName 15 | ,packageInterfaceDependencyWeight 16 | ,dependentInterfaces -------------------------------------------------------------------------------- /cypher/Exploration/Explore_DEPENDS_ON_relationships.cypher: -------------------------------------------------------------------------------- 1 | // Explore DEPENDS_ON relationships schema 2 | 3 | MATCH (s)-[r:DEPENDS_ON]->(t) 4 | RETURN labels(s) AS sourceLabels 5 | ,labels(t) AS targetLabels 6 | ,keys(r) AS relationshipKeys 7 | ,count(*) AS numberOfNodes 8 | ORDER BY sourceLabels, targetLabels, relationshipKeys -------------------------------------------------------------------------------- /cypher/Exploration/Explore_ExternalDeclaration.cypher: -------------------------------------------------------------------------------- 1 | // External declarations split by their module and their contained symbols 2 | 3 | MATCH (s:ExternalDeclaration) 4 | WITH * 5 | ,replace(split(s.globalFqn, '".')[0],'"', '') AS externalDeclarationModule 6 | ,split(s.globalFqn, '".')[1] AS externalDeclarationSymbol 7 | RETURN externalDeclarationModule 8 | ,count(DISTINCT externalDeclarationSymbol) AS externalDeclarationSymbols 9 | ,collect(externalDeclarationSymbol)[0..4] AS someExternalDeclarationSymbols 10 | ,count(*) as numberOfExternalDeclarations 11 | ORDER BY numberOfExternalDeclarations DESC, externalDeclarationModule ASC 12 | LIMIT 50 -------------------------------------------------------------------------------- /cypher/Exploration/Explore_Module_outgoing_dependencies.cypher: -------------------------------------------------------------------------------- 1 | // Explore outgoing dependencies of modules 2 | 3 | MATCH (source:Module)-[rm:DEPENDS_ON]->(module:ExternalModule) 4 | OPTIONAL MATCH (module)-[:EXPORTS]->(declaration:ExternalDeclaration)<-[re:DEPENDS_ON]-(source) 5 | OPTIONAL MATCH (source)-[:DECLARES]->(implementation:Function|Variable)-[ri:DEPENDS_ON]->(module) 6 | OPTIONAL MATCH (source)-[:DECLARES]->(abstract:Interface|TypeAlias)-[ra:DEPENDS_ON]->(module) 7 | RETURN source.globalFqn AS module 8 | ,count(DISTINCT abstract) AS numberOfAbstract 9 | ,count(DISTINCT declaration) AS numberOfExternalDeclarations 10 | ,count(DISTINCT implementation) AS numberOfImplementations 11 | ,sum(rm.cardinality) AS sumModuleDependencyWeights 12 | ,sum(re.cardinality) AS sumExternalDeclarationWeights 13 | ,sum(ri.cardinality) AS sumImplementationWeights 14 | ,sum(ra.cardinality) AS sumAbstractWeights 15 | //TODO sumWeights should sum up to sumModuleDependencyWeights 16 | ,sum(re.cardinality) + sum(ri.cardinality) + sum(ra.cardinality) as sumWeights 17 | ORDER BY source.globalFqn ASC -------------------------------------------------------------------------------- /cypher/Exploration/Explore_Typescript_elements_with_same_globalFqn.cypher: -------------------------------------------------------------------------------- 1 | // Explore Typescript elements with same globalFqn 2 | 3 | MATCH (ts1:TS) 4 | WHERE ts1.globalFqn IS NOT NULL 5 | MATCH (ts2:TS) 6 | WHERE ts2.globalFqn IS NOT NULL 7 | AND ts2.globalFqn = ts1.globalFqn 8 | AND ts1 <> ts2 9 | RETURN labels(ts1), labels(ts2), count(*) 10 | ,collect(ts1.globalFqn)[0..4] AS examples1 11 | ,collect(ts2.globalFqn)[0..4] AS examples2 12 | LIMIT 30 -------------------------------------------------------------------------------- /cypher/Exploration/Explore_Typescript_modules_overview.cypher: -------------------------------------------------------------------------------- 1 | // Explore nodes grouped by their module (first part of globalFqn) 2 | 3 | MATCH (n:TS) 4 | WHERE n.globalFqn IS NOT NULL 5 | UNWIND labels(n) AS nodeLabel 6 | WITH replace(split(n.globalFqn, '".')[0],'"', '') AS module 7 | ,collect(split(n.globalFqn, '".')[1]) AS symbols 8 | ,nodeLabel 9 | ,count(DISTINCT n) as numberOfNodes 10 | WHERE nodeLabel <> 'TS' 11 | RETURN module 12 | ,collect(DISTINCT nodeLabel) AS nodeLabels 13 | ,sum(numberOfNodes) AS numberOfNodes 14 | ,collect(symbols[0..4]) AS symbolExamples 15 | ORDER BY module ASC -------------------------------------------------------------------------------- /cypher/Exploration/Explore_Typescript_modules_per_symboltype.cypher: -------------------------------------------------------------------------------- 1 | // Explore nodes grouped by their module (first part of globalFqn) and their type of contained symbols 2 | 3 | MATCH (n:TS) 4 | WHERE n.globalFqn IS NOT NULL 5 | UNWIND labels(n) AS nodeLabel 6 | WITH replace(split(n.globalFqn, '".')[0],'"', '') AS module 7 | ,collect(split(n.globalFqn, '".')[1]) AS symbols 8 | ,nodeLabel 9 | ,count(DISTINCT n) as numberOfNodes 10 | WHERE nodeLabel <> 'TS' 11 | RETURN module 12 | ,collect(DISTINCT nodeLabel) as nodeLabels 13 | ,numberOfNodes 14 | ,symbols[0..4] AS symbolExamples 15 | ORDER BY module ASC -------------------------------------------------------------------------------- /cypher/Exploration/Explore_Typescript_projects.cypher: -------------------------------------------------------------------------------- 1 | // Explore Typescript Projects 2 | 3 | MATCH (project:TS:Project)-[:HAS_ROOT]->(dir:Directory)-[:CONTAINS]->(module:Module) 4 | OPTIONAL MATCH (project)<-[:REFERENCED_PROJECTS*]-(top:TS:Project) 5 | RETURN project, dir, module, top -------------------------------------------------------------------------------- /cypher/Exploration/Explore_common_globalfqn_prefix.cypher: -------------------------------------------------------------------------------- 1 | // Get common global full qualified name prefix 2 | 3 | MATCH (module:TS) 4 | WHERE module.globalFqn STARTS WITH '/' 5 | WITH count(module.globalFqn) AS numberOfAllModules 6 | ,collect(module) AS modules 7 | UNWIND modules AS module 8 | WITH numberOfAllModules 9 | ,module.globalFqn AS moduleFullQualifiedName 10 | ,split(module.globalFqn, '/') AS paths 11 | UNWIND paths AS path 12 | WITH path, numberOfAllModules, count(*) AS numberOfModulesUsingThePath 13 | WHERE numberOfAllModules = numberOfModulesUsingThePath 14 | RETURN apoc.text.join(collect(path), '/') AS commonPath -------------------------------------------------------------------------------- /cypher/Exploration/Explore_degree_schema.cypher: -------------------------------------------------------------------------------- 1 | // Explore incoming/outgoing relationship (degree) schema 2 | 3 | MATCH (source)-[relation]-(target) 4 | OPTIONAL MATCH (source)<-[incoming]-(target) 5 | OPTIONAL MATCH (source)-[outgoing]->(target) 6 | RETURN labels(source) AS sourceType 7 | ,type(incoming) AS incomingRelationship 8 | ,type(outgoing) AS outgoingRelationship 9 | ,labels(target) AS dependentType 10 | ,count(distinct source) AS sourceCount 11 | ,count(distinct target) AS dependentCount 12 | ,collect(distinct coalesce(source.globalFqn, source.name, source.referencedGlobalFqn))[0..9] AS sourceNameExamples 13 | ,collect(distinct coalesce(target.globalFqn, target.name, target.referencedGlobalFqn))[0..9] AS dependentNameExamples 14 | ORDER BY sourceType, dependentType -------------------------------------------------------------------------------- /cypher/Exploration/Explore_external_Typescript_dependencies.cypher: -------------------------------------------------------------------------------- 1 | // Explore Typescript nodes with globalFqn property by their label, count and if they came from the node_modules folder 2 | 3 | MATCH (typescript:TS) 4 | WHERE typescript.globalFqn IS NOT NULL 5 | RETURN labels(file)[0..4] AS nodeType 6 | ,(typescript.globalFqn contains '/node_modules/') AS isNodeModule 7 | ,count(*) AS numberOfNodes 8 | ,collect(DISTINCT typescript.globalFqn)[0..9] AS examples 9 | ORDER BY nodeType ASC, numberOfNodes DESC -------------------------------------------------------------------------------- /cypher/Exploration/Explore_node_properties.cypher: -------------------------------------------------------------------------------- 1 | // Explore node properties, the labels of their nodes and their count 2 | 3 | MATCH (n) 4 | UNWIND keys(n) AS nodePropertyName 5 | UNWIND labels(n) AS nodeLabel 6 | RETURN nodePropertyName 7 | ,collect(DISTINCT nodeLabel) AS nodeLabels 8 | ,count(DISTINCT n) AS numberOfNodes 9 | ,count(DISTINCT n[nodePropertyName]) AS numberOfDistinctValues 10 | ,collect(DISTINCT n[nodePropertyName])[0..4] AS exampleValues 11 | ORDER BY nodePropertyName -------------------------------------------------------------------------------- /cypher/Exploration/Explore_node_relationships.cypher: -------------------------------------------------------------------------------- 1 | // Get all relationships of one specific node to explore the schema 2 | 3 | MATCH (s:TS:Module)-[r]->(t) 4 | RETURN labels(s) AS sourceLabels 5 | ,keys(s) AS sourceKeys 6 | ,labels(t) AS targetLabels 7 | ,keys(t) AS targetKeys 8 | ,type(r) AS relationshipType 9 | ,keys(r) AS relationshipKeys 10 | ,count(*) AS numberOfNodes 11 | ORDER BY sourceLabels, targetLabels, relationshipKeys -------------------------------------------------------------------------------- /cypher/Export_the_whole_database_as_CSV.cypher: -------------------------------------------------------------------------------- 1 | // Export the whole database as CSV 2 | CALL apoc.export.csv.all("codegraph.csv", {}) -------------------------------------------------------------------------------- /cypher/External_Dependencies/External_package_levels.cypher: -------------------------------------------------------------------------------- 1 | // External package levels 2 | 3 | MATCH (externalType:ExternalType) 4 | WITH replace(externalType.fqn, '.' + externalType.name, '') AS externalPackageName 5 | WITH count(DISTINCT split(externalPackageName, '.')[0]) AS externalFirstLevelPackages 6 | ,count(DISTINCT split(externalPackageName, '.')[0..1]) AS externalSecondLevelPackages 7 | ,count(DISTINCT split(externalPackageName, '.')[0..2]) AS externalThirdLevelPackages 8 | ,count(DISTINCT split(externalPackageName, '.')[0..3]) AS externalForthLevelPackages 9 | ,count(DISTINCT split(externalPackageName, '.')[0..4]) AS externalFifthLevelPackages 10 | ,count(DISTINCT externalPackageName) AS allExternalPackages 11 | RETURN externalFirstLevelPackages 12 | ,externalSecondLevelPackages 13 | ,externalThirdLevelPackages 14 | ,externalForthLevelPackages 15 | ,externalFifthLevelPackages 16 | ,allExternalPackages -------------------------------------------------------------------------------- /cypher/External_Dependencies/External_package_name_elements.cypher: -------------------------------------------------------------------------------- 1 | // External package name elements 2 | 3 | MATCH (externalType:ExternalType) 4 | WITH replace(externalType.fqn, '.' + externalType.name, '') AS packageName 5 | WITH size(split(packageName,'.')) AS packageNameElements 6 | ,count(DISTINCT packageName) AS packageCount 7 | ,collect(DISTINCT packageName)[0..19] AS somePackageNames 8 | RETURN packageNameElements 9 | ,packageCount 10 | ,somePackageNames 11 | ORDER BY packageNameElements -------------------------------------------------------------------------------- /cypher/External_Dependencies/External_types_per_artifact_using_requires.cypher: -------------------------------------------------------------------------------- 1 | // External types per artifact using requires. Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (artifact:Artifact)-[:REQUIRES]->(externalType:ExternalType) 4 | MATCH (artifact)-[:CONTAINS]->(caller:Type) 5 | OPTIONAL MATCH (caller)-[callerDependency:DEPENDS_ON]->(externalType) 6 | WITH artifact.name AS artifactName 7 | ,replace(externalType.fqn, '.' + externalType.name, '') AS externalTypePackage 8 | ,COLLECT(DISTINCT externalType.name) AS externalTypeNames 9 | ,COUNT(callerDependency) AS numberOfCaller 10 | ,sum(callerDependency.weight) AS numberOfCalls 11 | ,COUNT(DISTINCT caller) AS numberOfAllTypes 12 | WHERE numberOfCalls > 0 13 | RETURN artifactName 14 | ,externalTypePackage 15 | ,numberOfCaller 16 | ,numberOfCalls 17 | ,numberOfAllTypes 18 | ,externalTypeNames 19 | ORDER BY artifactName ASC, numberOfCaller DESC -------------------------------------------------------------------------------- /cypher/External_Dependencies/Label_external_types_and_annotations.cypher: -------------------------------------------------------------------------------- 1 | // Label external types and external annotations. Requires 'Label_base_java_types', 'Label_buildin_java_types' and 'Label_resolved_duplicate_types' of 'Types' directory. 2 | 3 | MATCH (type:Type&!PrimitiveType&!Void&!JavaType&!ResolvedDuplicateType&!TS) 4 | WITH type 5 | ,type.byteCodeVersion IS NULL AS isExternalType 6 | ,exists((type)<-[:OF_TYPE]-()<-[:ANNOTATED_BY]-()) AS isAnnotation 7 | WITH type 8 | ,isExternalType 9 | ,CASE WHEN isAnnotation THEN [1] ELSE [] END AS annotation 10 | WHERE isExternalType 11 | FOREACH (x in annotation | SET type:ExternalAnnotation) 12 | SET type:ExternalType 13 | RETURN labels(type), count(type) as numberOfExternalTypes -------------------------------------------------------------------------------- /cypher/External_Dependencies/List_external_Java_types_used.cypher: -------------------------------------------------------------------------------- 1 | // List external Java types used 2 | 3 | MATCH (external:Java:ExternalType) 4 | RETURN labels(external), count(DISTINCT external.fqn) as numberOfExternalTypes -------------------------------------------------------------------------------- /cypher/External_Dependencies/List_external_modules_resolved_to_internal_ones_for_Typescript.cypher: -------------------------------------------------------------------------------- 1 | // Statistics about how many ExternalModule nodes were found that match internal Module nodes 2 | 3 | MATCH (module:TS:Module)<-[resolved:IS_IMPLEMENTED_IN]-(external:TS:ExternalModule) 4 | OPTIONAL MATCH (project:TS:Project)-[:CONTAINS]->(module) 5 | WITH project.name AS projectName 6 | ,count(DISTINCT module) AS resolvedModuleCount 7 | ,COUNT { (modules:Module) } AS totalModuleCount 8 | ,COUNT { (externalModules:ExternalModule) } AS totalExternalModuleCount 9 | ,collect(DISTINCT module.fileName + ' -> ' + external.globalFqn)[0..4] AS resolvedExamples 10 | RETURN projectName 11 | ,resolvedModuleCount 12 | ,totalModuleCount 13 | ,round(100.0 / totalModuleCount 14 | * resolvedModuleCount, 2) AS resolvedModulePercentage 15 | ,totalExternalModuleCount 16 | ,round(100.0 / totalExternalModuleCount 17 | * resolvedModuleCount, 2) AS resolvedExternalModulePercentage 18 | ,resolvedExamples -------------------------------------------------------------------------------- /cypher/External_Dependencies/Maven_POMs_and_their_declared_dependencies.cypher: -------------------------------------------------------------------------------- 1 | // Maven POMs and their declared dependencies 2 | 3 | MATCH (pom:Pom)-[r1:DECLARES_DEPENDENCY]->(dependency:Dependency)-[r2:TO_ARTIFACT]->(dependentArtifact) 4 | RETURN pom.artifactId, pom.name, coalesce(dependency.scope, 'default') as scope, dependency.optional, dependentArtifact.group, dependentArtifact.name 5 | ORDER BY pom.artifactId -------------------------------------------------------------------------------- /cypher/External_Dependencies/Package_json_dependencies_by_package.cypher: -------------------------------------------------------------------------------- 1 | // List package.json dependencies by package 2 | 3 | MATCH (package:NPM:Package)-[:DECLARES_DEPENDENCY]->(dependency:NPM:Dependency) 4 | OPTIONAL MATCH (package)-[:CONTAINS]->(:Json:Object)-[:HAS_KEY]->(:Json:Key{name:'name'})-[:HAS_VALUE]->(packageName:Json:Scalar:Value) 5 | RETURN replace(replace(package.fileName, '/npm-package-json/', ''), '/package.json', '') 6 | AS packageDirectory 7 | ,packageName.value AS packageName 8 | ,dependency.name AS dependencyName 9 | ,dependency.dependency AS dependencyVersion 10 | ORDER BY packageName, dependencyName -------------------------------------------------------------------------------- /cypher/External_Dependencies/Package_json_dependencies_combinations.cypher: -------------------------------------------------------------------------------- 1 | // List most used combination of 2 and 3 dependencies 2 | 3 | MATCH (package:NPM:Package)-[:DECLARES_DEPENDENCY]->(dependency:NPM:Dependency) 4 | OPTIONAL MATCH (package)-[:CONTAINS]->(:Json:Object)-[:HAS_KEY]->(:Json:Key{name:'name'})-[:HAS_VALUE]->(packageName:Json:Scalar:Value) 5 | WITH package.fileName AS packageFileName 6 | ,dependency.name AS dependencyName 7 | ORDER BY packageFileName, dependencyName 8 | WITH packageFileName 9 | ,apoc.coll.combinations(collect(dependencyName), 2, 3) AS dependencyCombinations 10 | UNWIND dependencyCombinations AS dependencyCombination 11 | WITH dependencyCombination 12 | ,count(*) as occurrences 13 | ,collect(packageFileName) AS packages 14 | WHERE occurrences > 1 15 | RETURN dependencyCombination 16 | ,occurrences 17 | ,packages[0..9] AS firstTenPackages 18 | ORDER BY occurrences DESC -------------------------------------------------------------------------------- /cypher/External_Dependencies/Package_json_dependencies_combinations_with_versions.cypher: -------------------------------------------------------------------------------- 1 | // List most used combination of 2 and 3 dependencies including version specifier 2 | 3 | MATCH (package:NPM:Package)-[:DECLARES_DEPENDENCY]->(dependency:NPM:Dependency) 4 | OPTIONAL MATCH (package)-[:CONTAINS]->(:Json:Object)-[:HAS_KEY]->(:Json:Key{name:'name'})-[:HAS_VALUE]->(packageName:Json:Scalar:Value) 5 | WITH package.fileName AS packageFileName 6 | ,dependency.name AS dependencyName 7 | ,dependency.dependency AS dependencyVersion 8 | ORDER BY packageFileName, dependencyName 9 | WITH packageFileName 10 | ,apoc.coll.combinations(collect(dependencyName + ' ' + dependencyVersion), 2, 3) AS dependencyCombinations 11 | UNWIND dependencyCombinations AS dependencyCombination 12 | WITH dependencyCombination 13 | ,count(*) as occurrences 14 | ,collect(packageFileName) AS packages 15 | WHERE occurrences > 1 16 | RETURN dependencyCombination 17 | ,occurrences 18 | ,packages[0..9] AS firstTenPackages 19 | ORDER BY occurrences DESC -------------------------------------------------------------------------------- /cypher/External_Dependencies/Package_json_dependencies_occurrence.cypher: -------------------------------------------------------------------------------- 1 | // List package.json dependencies by the number they are used by all packages 2 | 3 | MATCH (package:NPM:Package)-[:DECLARES_DEPENDENCY]->(dependency:NPM:Dependency) 4 | OPTIONAL MATCH (package)-[:CONTAINS]->(:Json:Object)-[:HAS_KEY]->(:Json:Key{name:'name'})-[:HAS_VALUE]->(packageName:Json:Scalar:Value) 5 | WITH replace(replace(package.fileName, '/npm-package-json/', ''), '/package.json', '') 6 | AS packageDirectory 7 | ,packageName.value AS packageName 8 | ,dependency.name AS dependencyName 9 | ,dependency.dependency AS dependencyVersion 10 | RETURN dependencyName 11 | ,count(*) AS usingPackageCount 12 | ,count(DISTINCT dependencyVersion) AS dependencyVersionCount 13 | ,collect(packageName)[0..9] AS packageNameExamples 14 | ,collect(dependencyVersion)[0..4] AS dependencyVersionExamples 15 | ,collect(packageDirectory)[0..4] AS packageDirectory 16 | ORDER BY usingPackageCount DESC -------------------------------------------------------------------------------- /cypher/External_Dependencies/Remove_external_type_and_annotation_labels.cypher: -------------------------------------------------------------------------------- 1 | // Remove external type and annotation labels 2 | 3 | MATCH (externalType:ExternalType) 4 | REMOVE externalType:ExternalType:ExternalAnnotation -------------------------------------------------------------------------------- /cypher/GitLog/Add_CHANGED_TOGETHER_WITH_relationships_to_code_files.cypher: -------------------------------------------------------------------------------- 1 | // Take the already existing "CHANGED_TOGETHER_WITH" relationship between git files and apply it to resolved file nodes. Requires "Add_CHANGED_TOGETHER_WITH_relationships_to_git_files". 2 | 3 | MATCH (firstGitFile:Git&File&!Repository)-[gitChange:CHANGED_TOGETHER_WITH]-(secondGitFile:Git&File&!Repository) 4 | WHERE elementId(firstGitFile) < elementId(secondGitFile) 5 | MATCH (firstGitFile)-[:RESOLVES_TO]->(firstCodeFile:File&!Git&!Repository) 6 | MATCH (secondGitFile)-[:RESOLVES_TO]->(secondCodeFile:File&!Git&!Repository) 7 | CALL (firstCodeFile, secondCodeFile, gitChange) { 8 | MERGE (firstCodeFile)-[pairwiseChange:CHANGED_TOGETHER_WITH]-(secondCodeFile) 9 | SET pairwiseChange = properties(gitChange) 10 | } IN TRANSACTIONS 11 | RETURN count(*) AS pairCount -------------------------------------------------------------------------------- /cypher/GitLog/Add_HAS_PARENT_relationships_to_commits.cypher: -------------------------------------------------------------------------------- 1 | // Creates a HAS_PARENT relationship between Git Commit nodes and their parent. 2 | 3 | MATCH (git_commit:Git:Commit) 4 | MATCH (parent_commit:Git:Commit{hash: git_commit.parent}) 5 | MERGE (git_commit)-[:HAS_PARENT]->(parent_commit) 6 | RETURN count(DISTINCT git_commit.hash) AS numberOfCommitsWithParent -------------------------------------------------------------------------------- /cypher/GitLog/Create_git_repository_node.cypher: -------------------------------------------------------------------------------- 1 | // Create git repository information node 2 | 3 | MERGE (git_repository:Git:Repository { 4 | name: $git_repository_origin, 5 | tags: split($git_repository_current_tags, ','), 6 | branch: coalesce($git_repository_current_branch, ''), 7 | commit: coalesce($git_repository_current_commit, ''), 8 | fileName: $git_repository_directory_name, 9 | absoluteFileName: $git_repository_absolute_directory_name 10 | }) -------------------------------------------------------------------------------- /cypher/GitLog/Delete_git_log_data.cypher: -------------------------------------------------------------------------------- 1 | // Delete all Git log data in the Graph 2 | 3 | MATCH (n:Git) 4 | CALL { WITH n 5 | DETACH DELETE n 6 | } IN TRANSACTIONS OF 1000 ROWS 7 | RETURN count(n) as numberOfDeletedRows -------------------------------------------------------------------------------- /cypher/GitLog/Delete_plain_git_directory_file_nodes.cypher: -------------------------------------------------------------------------------- 1 | // Delete plain file nodes in "/.git" directory 2 | 3 | MATCH (git_metadata_file:File&!Repository)<-[:CONTAINS*]-(git_directory:Directory&!Repository) 4 | WHERE git_directory.fileName ENDS WITH '/.git' 5 | WITH git_directory.fileName AS gitDirectory 6 | ,count(DISTINCT git_metadata_file.fileName) AS numberOfFiles 7 | ,collect(DISTINCT git_metadata_file.fileName)[0..4] AS fileExamples 8 | ,collect(DISTINCT git_metadata_file) AS git_metadata_files 9 | UNWIND git_metadata_files AS git_metadata_file 10 | CALL { WITH git_metadata_file 11 | DETACH DELETE git_metadata_file 12 | } IN TRANSACTIONS OF 1000 ROWS 13 | RETURN DISTINCT gitDirectory, numberOfFiles, fileExamples 14 | ORDER BY numberOfFiles DESC -------------------------------------------------------------------------------- /cypher/GitLog/Index_absolute_file_name.cypher: -------------------------------------------------------------------------------- 1 | // Create index for the absolute file name 2 | 3 | CREATE INDEX INDEX_ABSOLUTE_FILE_NAME IF NOT EXISTS FOR (file:File) ON (file.absoluteFileName) -------------------------------------------------------------------------------- /cypher/GitLog/Index_author_name.cypher: -------------------------------------------------------------------------------- 1 | // Create index for author name (git data) 2 | 3 | CREATE INDEX INDEX_AUTHOR_NAME IF NOT EXISTS FOR (n:Author) ON (n.name) -------------------------------------------------------------------------------- /cypher/GitLog/Index_change_span_year.cypher: -------------------------------------------------------------------------------- 1 | // Create index for change span year (aggregated git data) 2 | 3 | CREATE INDEX INDEX_CHANGE_SPAN_YEAR IF NOT EXISTS FOR (n:ChangeSpan) ON (n.year) -------------------------------------------------------------------------------- /cypher/GitLog/Index_commit_hash.cypher: -------------------------------------------------------------------------------- 1 | // Create index for commit hash (git data) 2 | 3 | CREATE INDEX INDEX_COMMIT_HASH IF NOT EXISTS FOR (n:Commit) ON (n.hash) -------------------------------------------------------------------------------- /cypher/GitLog/Index_commit_parent.cypher: -------------------------------------------------------------------------------- 1 | // Create index for parent commit hash (git data) 2 | 3 | CREATE INDEX INDEX_COMMIT_PARENT IF NOT EXISTS FOR (n:Commit) ON (n.parent) -------------------------------------------------------------------------------- /cypher/GitLog/Index_commit_sha.cypher: -------------------------------------------------------------------------------- 1 | // Create index for git commit sha 2 | 3 | CREATE INDEX INDEX_COMMIT_HASH IF NOT EXISTS FOR (commit:Commit) ON (commit.sha) -------------------------------------------------------------------------------- /cypher/GitLog/Index_file_name.cypher: -------------------------------------------------------------------------------- 1 | // Create index for the file name 2 | 3 | CREATE INDEX INDEX_FILE_NAME IF NOT EXISTS FOR (t:File) ON (t.fileName) -------------------------------------------------------------------------------- /cypher/GitLog/Index_file_relative_path.cypher: -------------------------------------------------------------------------------- 1 | // Create index for the relative file path 2 | 3 | CREATE INDEX INDEX_FILE_NAME IF NOT EXISTS FOR (file:File) ON (file.relativePath) -------------------------------------------------------------------------------- /cypher/GitLog/List_ambiguous_git_files.cypher: -------------------------------------------------------------------------------- 1 | // List ambigiously resolved git files where a single git file is attached to more than one code file for troubleshooting/testing. 2 | 3 | MATCH (file:File&!Git)<-[:RESOLVES_TO]-(git_file:File&Git) 4 | OPTIONAL MATCH (artifact:Artifact:Archive)-[:CONTAINS_CHANGED]->(file) 5 | WITH file.fileName AS fileName 6 | ,reverse(split(reverse(file.fileName),'.')[0]) AS fileExtension 7 | ,count(DISTINCT git_file.fileName) AS gitFilesCount 8 | ,collect(DISTINCT split(git_file.fileName,'/')[0])[0..6] AS gitFileFirstPathExamples 9 | ,collect(DISTINCT git_file.fileName)[0..6] AS gitFileExamples 10 | ,collect(DISTINCT artifact.fileName) AS artifacts 11 | WHERE gitFilesCount > 1 12 | RETURN fileName 13 | ,fileExtension 14 | ,gitFilesCount 15 | ,count(*) AS numberOfCases 16 | ,artifacts 17 | ,gitFileFirstPathExamples 18 | ,gitFileExamples 19 | ORDER BY gitFilesCount DESC, fileName ASC 20 | LIMIT 50 -------------------------------------------------------------------------------- /cypher/GitLog/List_git_files_by_resolved_label_and_extension.cypher: -------------------------------------------------------------------------------- 1 | // List resolved and unresolved git files by their extension 2 | 3 | MATCH (git_file:Git&File) 4 | OPTIONAL MATCH (git_file)-[:RESOLVES_TO]->(code_file:File&!Git) 5 | WITH git_file 6 | ,code_file 7 | ,(code_file IS NOT NULL) AS resolved 8 | ,coalesce(git_file.fileName, git_file.relativePath) AS gitFileName 9 | RETURN resolved 10 | ,reverse(split(split(reverse(gitFileName), '/')[0], '.')[0]) AS extension 11 | ,count(DISTINCT git_file) AS gitFileCount 12 | ,coalesce(labels(code_file), labels(git_file)) AS fileLabels 13 | ,collect(DISTINCT gitFileName)[0..9] AS gitFileExamples 14 | ORDER BY resolved ASC, gitFileCount DESC, extension ASC -------------------------------------------------------------------------------- /cypher/GitLog/List_git_files_per_commit_distribution.cypher: -------------------------------------------------------------------------------- 1 | // List how many git commits changed one file, how mandy changed two files, .... 2 | 3 | MATCH (git_commit:Git:Commit)-[:CONTAINS_CHANGE]->(git_change:Git:Change)-[]->(git_file:Git:File) 4 | WITH git_commit, count(DISTINCT git_file.relativePath) AS filesPerCommit 5 | RETURN filesPerCommit, count(DISTINCT git_commit.sha) AS commitCount 6 | ORDER BY filesPerCommit ASC -------------------------------------------------------------------------------- /cypher/GitLog/List_git_files_that_were_changed_together.cypher: -------------------------------------------------------------------------------- 1 | // List git files that where changed together frequently. Requires "Add_CHANGED_TOGETHER_WITH_relationships_to_git_files". 2 | 3 | MATCH (firstGitFile:Git&File&!Repository)-[gitChange:CHANGED_TOGETHER_WITH]-(secondGitFile:Git&File&!Repository) 4 | WHERE elementId(firstGitFile) < elementId(secondGitFile) 5 | MATCH (gitRepository:Git&Repository)-[:HAS_FILE]->(firstGitFile) 6 | MATCH (gitRepository:Git&Repository)-[:HAS_FILE]->(secondGitFile) 7 | RETURN gitRepository.name + '/' + firstGitFile.relativePath AS firstFile 8 | ,gitRepository.name + '/' + secondGitFile.relativePath AS secondFile 9 | ,gitChange.commitCount AS commitCount 10 | ORDER BY commitCount DESC 11 | -------------------------------------------------------------------------------- /cypher/GitLog/List_git_files_that_were_changed_together_with_another_file.cypher: -------------------------------------------------------------------------------- 1 | // List git files that where frequently changed with another file. Requires "Add_CHANGED_TOGETHER_WITH_relationships_to_git_files". 2 | 3 | MATCH (firstGitFile:Git&File&!Repository)-[gitChange:CHANGED_TOGETHER_WITH]-(secondGitFile:Git&File&!Repository) 4 | MATCH (gitRepository:Git&Repository)-[:HAS_FILE]->(firstGitFile) 5 | UNWIND gitChange.commitHashes AS commitHash 6 | RETURN gitRepository.name + '/' + firstGitFile.relativePath AS filePath 7 | ,count(DISTINCT commitHash) AS commitCount 8 | ORDER BY commitCount DESC -------------------------------------------------------------------------------- /cypher/GitLog/List_git_files_that_were_changed_together_with_another_file_all_in_one.cypher: -------------------------------------------------------------------------------- 1 | // List git files that where changed together frequently 2 | 3 | MATCH (global_git_commit:Git:Commit) 4 | WITH count(global_git_commit) AS globalCommitCount 5 | MATCH (git_commit:Git:Commit)-[:CONTAINS_CHANGE]->(git_change:Git:Change)-[:UPDATES]->(git_file:Git:File) 6 | MATCH (git_repository:Git&Repository)-[:HAS_FILE]->(git_file) 7 | WHERE git_file.deletedAt IS NULL 8 | WITH *, git_repository.name + '/' + git_file.relativePath AS filePath 9 | WITH globalCommitCount 10 | ,git_commit.sha AS commitHash 11 | ,collect(DISTINCT filePath) AS filesInCommit 12 | WHERE size(filesInCommit) >= 2 13 | AND size(filesInCommit) <= 50 14 | WITH globalCommitCount 15 | ,commitHash 16 | ,apoc.coll.combinations(filesInCommit, 2, 2) AS fileCombinations 17 | UNWIND fileCombinations AS fileCombination 18 | UNWIND fileCombination AS filePath 19 | WITH globalCommitCount 20 | ,filePath 21 | ,count(DISTINCT commitHash) AS commitCount 22 | WHERE commitCount > globalCommitCount * 0.001 // Filter out combinations that are too rare 23 | RETURN filePath 24 | ,commitCount 25 | ORDER BY commitCount DESC -------------------------------------------------------------------------------- /cypher/GitLog/List_unresolved_git_files.cypher: -------------------------------------------------------------------------------- 1 | // List code files not covered by imported git data for troubleshooting/testing. 2 | 3 | MATCH (code_file:File&!Git&!Directory) 4 | WHERE NOT EXISTS { (code_file)<-[:RESOLVES_TO]-(git_file:File&Git) } 5 | RETURN reverse(split(reverse(code_file.fileName),'.')[0]) AS codeFileExtension 6 | ,labels(code_file)[0..2] AS firstThreeCodeFileLabels 7 | ,count(DISTINCT code_file.fileName) AS codeFileCount 8 | ,collect(DISTINCT code_file.fileName)[0..6] AS codeFileExamples 9 | LIMIT 50 -------------------------------------------------------------------------------- /cypher/GitLog/Set_number_of_aggregated_git_commits.cypher: -------------------------------------------------------------------------------- 1 | // Set numberOfGitCommits property on code File nodes when aggregated change spans with grouped commits are present. 2 | 3 | MATCH (code_file:File&!Git)<-[:RESOLVES_TO]-(git_file:File&Git) 4 | MATCH (git_file)<-[:CONTAINS_CHANGED]-(git_changespan:Git:ChangeSpan) 5 | WITH code_file, toInteger(sum(git_changespan.commits)) AS numberOfGitCommits 6 | SET code_file.numberOfGitCommits = numberOfGitCommits 7 | RETURN count(DISTINCT coalesce(code_file.absoluteFileName, code_file.fileName)) AS changedCodeFiles -------------------------------------------------------------------------------- /cypher/GitLog/Set_number_of_git_log_commits.cypher: -------------------------------------------------------------------------------- 1 | // Set numberOfGitCommits property on code File nodes when git commits are present 2 | 3 | MATCH (code_file:File&!Git)<-[:RESOLVES_TO]-(git_file:File&Git) 4 | MATCH (git_file)<-[:CONTAINS_CHANGED]-(git_commit:Git:Commit) 5 | WITH code_file, count(DISTINCT git_commit.hash) AS numberOfGitCommits 6 | SET code_file.numberOfGitCommits = numberOfGitCommits 7 | RETURN count(DISTINCT coalesce(code_file.absoluteFileName, code_file.fileName)) AS changedCodeFiles 8 | //,collect(DISTINCT coalesce(code_file.absoluteFileName, code_file.fileName))[0..4] AS examples -------------------------------------------------------------------------------- /cypher/GitLog/Set_number_of_git_plugin_commits.cypher: -------------------------------------------------------------------------------- 1 | // Set numberOfGitCommits property on code File nodes when git commits (detected by the plugin) are present 2 | 3 | MATCH (code_file:File&!Git)<-[:RESOLVES_TO]-(git_file:File&Git) 4 | MATCH (git_file)<-[]-(:Git&Change)<-[:CONTAINS_CHANGE]-(git_commit:Git&Commit) 5 | WITH code_file, count(DISTINCT git_commit.sha) AS numberOfGitCommits 6 | SET code_file.numberOfGitCommits = numberOfGitCommits 7 | RETURN count(DISTINCT coalesce(code_file.absoluteFileName, code_file.fileName)) AS changedCodeFiles 8 | //,collect(DISTINCT coalesce(code_file.absoluteFileName, code_file.fileName))[0..4] AS examples -------------------------------------------------------------------------------- /cypher/GitLog/Verify_code_to_git_file_unambiguous.cypher: -------------------------------------------------------------------------------- 1 | // Verify that code to git file relationships aren't ambiguous 2 | 3 | MATCH (git_file:Git&File)-[:RESOLVES_TO]->(code_file:File&!Git) 4 | WITH code_file 5 | ,count(*) AS numberOfResolvedGitFiles 6 | ,collect(DISTINCT git_file) AS git_files 7 | WHERE numberOfResolvedGitFiles > 1 8 | UNWIND git_files AS git_file 9 | OPTIONAL MATCH (git_file)<-[:HAS_FILE]-(git_repository:Git&Repository) 10 | RETURN numberOfResolvedGitFiles 11 | ,collect(DISTINCT coalesce(code_file.absoluteFileName, code_file.fileName))[0..4] AS codeFileExamples 12 | ,collect(DISTINCT coalesce(git_file.fileName, git_file.relativePath))[0..4] AS gitFileExamples 13 | ,collect(DISTINCT git_repository.name)[0..4] AS gitRepositoryExamples 14 | //,collect(git_repository)[0..9] 15 | //,collect(git_file)[0..9] 16 | //,collect(code_file)[0..9] -------------------------------------------------------------------------------- /cypher/GitLog/Verify_git_to_code_file_unambiguous.cypher: -------------------------------------------------------------------------------- 1 | // Verify that git to code file relationships aren't ambiguous 2 | 3 | MATCH (git_file:Git&File)-[:RESOLVES_TO]->(code_file:File&!Git) 4 | OPTIONAL MATCH (git_file)<-[:HAS_FILE]-(git_repository:Git&Repository) 5 | WITH git_file 6 | ,git_repository 7 | ,count(*) AS numberOfResolvedCodeFiles 8 | ,collect(DISTINCT code_file) AS code_files 9 | WHERE numberOfResolvedCodeFiles > 1 10 | UNWIND code_files AS code_file 11 | RETURN numberOfResolvedCodeFiles 12 | ,collect(DISTINCT coalesce(code_file.absoluteFileName, code_file.fileName))[0..4] AS codeFileExamples 13 | ,collect(DISTINCT coalesce(git_file.fileName, git_file.relativePath))[0..4] AS gitFileExamples 14 | ,collect(DISTINCT git_repository.name)[0..4] AS gitRepositoryExamples 15 | //,collect(git_repository)[0..9] 16 | //,collect(git_file)[0..9] 17 | //,collect(code_file)[0..9] -------------------------------------------------------------------------------- /cypher/Internal_Dependencies/Get_file_distance_as_shortest_contains_path_for_dependencies.cypher: -------------------------------------------------------------------------------- 1 | // Get file distance distribution for dependencies (intuitively the fewest number of change directory commands needed) 2 | 3 | MATCH (source:File)-[dependency:DEPENDS_ON]->(target:File) 4 | WHERE dependency.fileDistanceAsFewestChangeDirectoryCommands IS NOT NULL 5 | RETURN dependency.fileDistanceAsFewestChangeDirectoryCommands 6 | ,count(*) AS numberOfDependencies 7 | ,count(DISTINCT source) AS numberOfDependencyUsers 8 | ,count(DISTINCT target) AS numberOfDependencyProviders 9 | ,collect(source.fileName + ' uses ' + target.fileName)[0..4] AS examples 10 | ORDER BY dependency.fileDistanceAsFewestChangeDirectoryCommands -------------------------------------------------------------------------------- /cypher/Internal_Dependencies/Inter_scan_and_project_dependencies_of_Typescript_modules.cypher: -------------------------------------------------------------------------------- 1 | // Inter scan/project higher-level module dependencies for manual exploration 2 | 3 | MATCH (source_module:TS:Module)-[:DEPENDS_ON]->(target_module:TS:Module) 4 | MATCH (source_project:TS:Project)-[:CONTAINS]->(source_module) 5 | MATCH (target_project:TS:Project)-[:CONTAINS]->(target_module) 6 | OPTIONAL MATCH (source_project)<-[:REFERENCED_PROJECTS*1..3]-(source_project_roots:TS:Project) 7 | MATCH (source_scan:TS:Scan)-[:CONTAINS_PROJECT]->(source_project) 8 | MATCH (target_scan:TS:Scan)-[:CONTAINS_PROJECT]->(target_project) 9 | RETURN source_scan, target_scan 10 | ,collect(source_project)[0..2], collect(target_project)[0..2] 11 | ,collect(source_module)[0..9], collect(target_module)[0..9] 12 | LIMIT 50 -------------------------------------------------------------------------------- /cypher/Internal_Dependencies/List_all_Java_artifacts.cypher: -------------------------------------------------------------------------------- 1 | // List all existing artifacts 2 | 3 | MATCH (artifact:Java:Artifact)-[:CONTAINS]->(package:Java:Package)-[:CONTAINS]->(type:Java:Type) 4 | WITH last(split(artifact.fileName, '/')) AS artifactName 5 | ,artifact.incomingDependencies AS incomingDependencies 6 | ,artifact.outgoingDependencies AS outgoingDependencies 7 | ,COUNT(DISTINCT package.fqn) AS packages 8 | ,COUNT(DISTINCT type.fqn) AS types 9 | RETURN artifactName, packages, types, incomingDependencies, outgoingDependencies -------------------------------------------------------------------------------- /cypher/Internal_Dependencies/List_all_Typescript_modules.cypher: -------------------------------------------------------------------------------- 1 | // List all existing internal Typescript modules. Requires "Set_localRootPath_for_modules.cypher", "Set_number_of...commits.cypher". 2 | 3 | MATCH (internalModule:TS:Module)-[:EXPORTS]->(internalElement:TS) 4 | WITH internalModule.name AS moduleName 5 | ,internalModule.rootProjectName AS rootProjectName 6 | ,internalModule.localModuleDir AS localModuleDir 7 | ,internalModule.incomingDependencies AS incomingDependencies 8 | ,internalModule.outgoingDependencies AS outgoingDependencies 9 | ,coalesce(internalModule.numberOfGitCommits, 0) AS numberOfGitCommits 10 | ,COUNT(DISTINCT internalElement.globalFqn) AS numberOfElements 11 | RETURN rootProjectName, moduleName, numberOfElements, numberOfGitCommits, incomingDependencies, outgoingDependencies -------------------------------------------------------------------------------- /cypher/Internal_Dependencies/List_elements_that_are_used_by_many_different_modules_for_Typescript.cypher: -------------------------------------------------------------------------------- 1 | // List elements that are used by many different modules 2 | 3 | MATCH (sourceModule:TS&Module&!TestRelated)-[:EXPORTS]->(sourceElement:TS) 4 | MATCH (sourceElement)-[:DEPENDS_ON]->(dependentElement:TS&!Module&!ExternalModule) 5 | MATCH (dependentModule:TS&Module&!TestRelated)-[:EXPORTS]->(dependentElement) 6 | WHERE sourceModule <> dependentModule 7 | WITH dependentElement 8 | ,labels(dependentElement) AS dependentElementLabels 9 | ,COUNT(DISTINCT sourceModule.globalFqn) AS numberOfUsingModules 10 | UNWIND dependentElementLabels AS dependentElementLabel 11 | WITH * 12 | WHERE NOT dependentElementLabel = 'TS' // Filter out generic TS label 13 | RETURN dependentElement.globalFqn AS fullQualifiedDependentElementName 14 | ,dependentElement.moduleName AS dependentElementModuleName 15 | ,dependentElement.name AS dependentElementName 16 | ,dependentElementLabel AS dependentElementLabels 17 | ,numberOfUsingModules 18 | ORDER BY numberOfUsingModules DESC, dependentElementName ASC -------------------------------------------------------------------------------- /cypher/Internal_Dependencies/List_types_that_are_used_by_many_different_packages.cypher: -------------------------------------------------------------------------------- 1 | // List types that are used by many different packages 2 | 3 | MATCH (artifact:Artifact)-[:CONTAINS]->(package:Package)-[:CONTAINS]->(type:Type)-[:DEPENDS_ON]->(dependentType:Type)<-[:CONTAINS]-(dependentPackage:Package)<-[:CONTAINS]-(dependentArtifact:Artifact) 4 | WHERE package <> dependentPackage 5 | WITH dependentType 6 | ,labels(dependentType) AS dependentTypeLabels 7 | ,COUNT(DISTINCT package.fqn) AS numberOfUsingPackages 8 | RETURN dependentType.fqn AS fullQualifiedDependentTypeName 9 | ,dependentType.name AS dependentTypeName 10 | ,dependentTypeLabels 11 | ,numberOfUsingPackages 12 | ORDER BY numberOfUsingPackages DESC, dependentTypeName ASC -------------------------------------------------------------------------------- /cypher/Java/Get_all_declared_and_inherited_methods_of_a_type.cypher: -------------------------------------------------------------------------------- 1 | // Get all declared and inherited methods of a type 2 | 3 | MATCH (type:Type)-[:DECLARES]->(method:Method) 4 | MATCH (type)-[:IMPLEMENTS*]->(superType:Type)-[:DECLARES]->(inheritedMethod:Method) 5 | WHERE type.name = 'TrackedEventMessage' 6 | AND method.name IS NOT NULL 7 | AND inheritedMethod.name IS NOT NULL 8 | //RETURN type, method, superType, inheritedMethod 9 | WITH type 10 | ,COLLECT(DISTINCT method.name) AS methodNames 11 | ,COLLECT(DISTINCT superType.name) AS superTypes 12 | ,COLLECT(DISTINCT inheritedMethod.name) AS inheritedMethods 13 | ,COLLECT(DISTINCT split(method.signature, ' ')[1]) + COLLECT(DISTINCT split(inheritedMethod.signature, ' ')[1]) AS allMethodSignaturesWithoutReturnType 14 | RETURN type.fqn, type.name, methodNames 15 | ,size(allMethodSignaturesWithoutReturnType) AS distinctDeclaredMethods, allMethodSignaturesWithoutReturnType 16 | ,inheritedMethods, superTypes -------------------------------------------------------------------------------- /cypher/Java/Java_Reflection_usage.cypher: -------------------------------------------------------------------------------- 1 | // Query Java Reflection usage combined with invocations of "Class.forName". Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (dependentArtifact:Artifact)-[:CONTAINS]-(dependentType:Type) 4 | WITH dependentArtifact.name AS dependentArtifactName 5 | ,dependentType 6 | OPTIONAL MATCH (dependentType)-[:DEPENDS_ON]->(reflectionType:Type) 7 | WHERE reflectionType.fqn STARTS WITH 'java.lang.reflect.' 8 | OPTIONAL MATCH (dependentType)-[:DECLARES]->(dependentMethod:Method)-[:INVOKES]->(classForName:Method) 9 | WHERE classForName.signature STARTS WITH 'java.lang.Class forName' 10 | WITH dependentArtifactName 11 | ,collect(DISTINCT coalesce(reflectionType.fqn, 'Class.' + classForName.name)) AS reflectionTypes 12 | ,collect(DISTINCT dependentType.fqn) AS reflectionCaller 13 | ,count(DISTINCT dependentType.fqn) AS numberOfReflectionCaller 14 | RETURN dependentArtifactName 15 | ,numberOfReflectionCaller 16 | ,reflectionCaller[0..19] AS someReflectionCaller 17 | ,reflectionTypes[0..19] AS someReflectionTypes 18 | -------------------------------------------------------------------------------- /cypher/Java/Java_Reflection_usage_detailed.cypher: -------------------------------------------------------------------------------- 1 | // Query all types that use Java Reflection or "Class.forName". Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (dependentArtifact:Artifact)-[:CONTAINS]-(dependentType:Type) 4 | WITH dependentArtifact.name AS dependentArtifactName 5 | ,dependentType 6 | OPTIONAL MATCH (dependentType)-[:DEPENDS_ON]->(reflectionType:Type) 7 | WHERE reflectionType.fqn STARTS WITH 'java.lang.reflect.' 8 | OPTIONAL MATCH (dependentType)-[:DECLARES]->(dependentMethod:Method)-[:INVOKES]->(classForName:Method) 9 | WHERE classForName.signature STARTS WITH 'java.lang.Class forName' 10 | WITH dependentArtifactName 11 | ,dependentType.fqn AS reflectionCallerTypeName 12 | ,collect(DISTINCT coalesce(reflectionType.fqn, 'Class.' + classForName.name)) AS reflectionTypes 13 | WHERE size(reflectionTypes) > 0 14 | RETURN dependentArtifactName 15 | ,reflectionCallerTypeName 16 | ,reflectionTypes[0..19] AS reflectionTypes -------------------------------------------------------------------------------- /cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java.cypher: -------------------------------------------------------------------------------- 1 | // Calculate distance between abstractness and instability. Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (artifact:Artifact)-[:CONTAINS]->(package:Java:Package) 4 | RETURN artifact.name AS artifactName 5 | ,package.fqn AS fullQualifiedName 6 | ,package.name AS name 7 | ,abs(package.abstractness + package.instability - 1) AS distance 8 | ,package.abstractness AS abstractness 9 | ,package.instability AS instability 10 | ,package.numberOfTypes AS elementsCount 11 | ORDER BY distance DESC, elementsCount DESC -------------------------------------------------------------------------------- /cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Java_including_subpackages.cypher: -------------------------------------------------------------------------------- 1 | // Calculate distance between abstractness and instability including subpackages. Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (artifact:Artifact)-[:CONTAINS]->(package:Java:Package) 4 | WHERE package.abstractnessIncludingSubpackages IS NOT NULL 5 | AND package.instabilityIncludingSubpackages IS NOT NULL 6 | AND package.numberOfTypesIncludingSubpackages IS NOT NULL 7 | RETURN artifact.name AS artifactName 8 | ,package.fqn AS fullQualifiedName 9 | ,package.name AS name 10 | ,abs(package.abstractnessIncludingSubpackages + package.instabilityIncludingSubpackages - 1) AS distance 11 | ,package.abstractnessIncludingSubpackages AS abstractness 12 | ,package.instabilityIncludingSubpackages AS instability 13 | ,package.numberOfTypesIncludingSubpackages AS elementsCount 14 | ORDER BY distance DESC, elementsCount DESC -------------------------------------------------------------------------------- /cypher/Metrics/Calculate_distance_between_abstractness_and_instability_for_Typescript.cypher: -------------------------------------------------------------------------------- 1 | // Calculate distance between abstractness and instability for Typescript 2 | 3 | MATCH (module:TS:Module) 4 | OPTIONAL MATCH (projectDirectory:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(module) 5 | RETURN reverse(split(reverse(projectDirectory.absoluteFileName), '/')[0]) AS artifactName 6 | ,module.globalFqn AS fullQualifiedName 7 | ,module.localFqn AS name 8 | ,abs(module.abstractness + module.instability - 1) AS distance 9 | ,module.abstractness AS abstractness 10 | ,module.instability AS instability 11 | ,module.numberOfTypes AS elementsCount 12 | ORDER BY distance DESC, elementsCount DESC -------------------------------------------------------------------------------- /cypher/Metrics/Get_Abstractness_for_Java.cypher: -------------------------------------------------------------------------------- 1 | // Get Java Packages with the lowest abstractness first (if set before). Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (package:Java:Package) 4 | WHERE package.abstractness IS NOT NULL 5 | MATCH (artifact:Artifact)-[:CONTAINS]->(package) 6 | RETURN artifact.name AS artifactName 7 | ,package.fqn AS fullQualifiedPackageName 8 | ,package.name AS packageName 9 | ,package.abstractness AS abstractness 10 | ,package.numberOfAbstractTypes AS numberAbstractTypes 11 | ,package.numberOfTypes AS numberTypes 12 | ORDER BY abstractness ASC, numberTypes DESC -------------------------------------------------------------------------------- /cypher/Metrics/Get_Abstractness_for_Java_including_Subpackages.cypher: -------------------------------------------------------------------------------- 1 | // Get Java Packages including their sub packages with the lowest abstractness first (if set before). Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH path = (package:Java:Package)-[:CONTAINS*0..]->(subpackage:Java:Package) 4 | WHERE package.abstractnessIncludingSubpackages IS NOT NULL 5 | MATCH (artifact:Artifact)-[:CONTAINS]->(package) 6 | RETURN artifact.name AS artifactName 7 | ,package.fqn AS fullQualifiedPackageName 8 | ,package.name AS packageName 9 | ,package.abstractnessIncludingSubpackages AS abstractness 10 | ,package.numberOfAbstractTypesIncludingSubpackages AS numberAbstractTypes 11 | ,package.numberOfTypesIncludingSubpackages AS numberTypes 12 | ,max(length(path)) AS maxSubpackageDepth 13 | ORDER BY abstractness ASC, maxSubpackageDepth DESC, numberTypes DESC -------------------------------------------------------------------------------- /cypher/Metrics/Get_Abstractness_for_Typescript.cypher: -------------------------------------------------------------------------------- 1 | // Get Typscript Modules with the lowest abstractness first (if set before) 2 | 3 | MATCH (module:TS:Module) 4 | WHERE module.abstractness IS NOT NULL 5 | OPTIONAL MATCH (projectdir:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(module) 6 | RETURN reverse(split(reverse(projectdir.absoluteFileName), '/')[0]) AS projectName 7 | ,module.globalFqn AS fullQualifiedModuleName 8 | ,module.name AS moduleName 9 | ,module.abstractness AS abstractness 10 | ,module.numberAbstractTypes AS numberAbstractTypes 11 | ,module.numberTypes AS numberTypes 12 | ORDER BY abstractness ASC, numberTypes DESC -------------------------------------------------------------------------------- /cypher/Metrics/Get_Incoming_Java_Package_Dependencies.cypher: -------------------------------------------------------------------------------- 1 | // Get Java Packages with the most incoming dependencies first (if set before). Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (p:Java:Package) 4 | WHERE p.incomingDependencies IS NOT NULL 5 | MATCH (artifact:Artifact)-[:CONTAINS]->(p) 6 | RETURN artifact.name AS artifactName 7 | ,p.fqn AS fullQualifiedPackageName 8 | ,p.name AS packageName 9 | ,p.incomingDependencies AS incomingDependencies 10 | ,p.incomingDependenciesWeight AS incomingDependenciesWeight 11 | ,p.incomingDependentTypes AS incomingDependentTypes 12 | ,p.incomingDependentInterfaces AS incomingDependentInterfaces 13 | ,p.incomingDependentPackages AS incomingDependentPackages 14 | ,p.incomingDependentArtifacts AS incomingDependentArtifacts 15 | ORDER BY incomingDependencies DESC, p.fqn ASC // package with most incoming dependencies first -------------------------------------------------------------------------------- /cypher/Metrics/Get_Incoming_Java_Package_Dependencies_Including_Subpackages.cypher: -------------------------------------------------------------------------------- 1 | // Get Java Packages including their sub-packages with the most incoming dependencies first (if set before). Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (p:Java:Package) 4 | WHERE p.incomingDependenciesIncludingSubpackages IS NOT NULL 5 | MATCH (artifact:Artifact)-[:CONTAINS]->(p) 6 | RETURN artifact.name AS artifactName 7 | ,p.fqn AS fullQualifiedPackageName 8 | ,p.name AS packageName 9 | ,p.incomingDependenciesIncludingSubpackages AS incomingDependencies 10 | ,p.incomingDependenciesWeightIncludingSubpackages AS incomingDependenciesWeight 11 | ,p.incomingDependentTypesIncludingSubpackages AS incomingDependentTypes 12 | ,p.incomingDependentInterfacesIncludingSubpackages AS incomingDependentInterfaces 13 | ,p.incomingDependentPackagesIncludingSubpackages AS incomingDependentPackages 14 | ,p.incomingDependentArtifactsIncludingSubpackages AS incomingDependentArtifacts 15 | ORDER BY incomingDependencies DESC, p.fqn ASC // package with most incoming dependencies first -------------------------------------------------------------------------------- /cypher/Metrics/Get_Incoming_Typescript_Module_Dependencies.cypher: -------------------------------------------------------------------------------- 1 | // Get Typscript Modules with the most incoming dependencies first (if set before) 2 | 3 | MATCH (module:TS:Module) 4 | WHERE module.incomingDependencies IS NOT NULL 5 | RETURN module.globalFqn AS fullQualifiedModuleName 6 | ,module.name AS moduleName 7 | ,module.incomingDependencies AS incomingDependencies 8 | ,module.incomingDependenciesWeight AS incomingDependenciesWeight 9 | ,module.incomingDependentAbstractTypes AS incomingDependentAbstractTypes 10 | ,module.incomingDependentAbstractTypeWeight AS incomingDependentAbstractTypeWeight 11 | ,module.incomingDependentModules AS incomingDependentModules 12 | ,module.incomingDependentPackages AS incomingDependentPackages 13 | ORDER BY incomingDependencies DESC, fullQualifiedModuleName ASC -------------------------------------------------------------------------------- /cypher/Metrics/Get_Instability_for_Java.cypher: -------------------------------------------------------------------------------- 1 | // Get Java Packages with the lowest Instability (outgoing / all dependencies) first (if set before). Requires "Add_file_name and_extension.cypher". 2 | // Instability = outgoing / (outgoing + incoming) Dependencies 3 | 4 | MATCH (p:Java:Package) 5 | WHERE p.instability IS NOT NULL 6 | MATCH (artifact:Artifact)-[:CONTAINS]->(p) 7 | RETURN artifact.name AS artifactName 8 | ,p.fqn AS fullQualifiedPackageName 9 | ,p.name AS packageName 10 | ,p.instability AS instability 11 | ,p.instabilityTypes AS instabilityTypes 12 | ,p.instabilityInterfaces AS instabilityInterfaces 13 | ,p.instabilityPackages AS instabilityPackages 14 | ,p.instabilityArtifacts AS instabilityArtifacts 15 | ,p.outgoingDependencies, p.incomingDependencies 16 | ,p.outgoingDependentTypes, p.incomingDependentTypes 17 | ,p.outgoingDependentInterfaces, p.incomingDependentInterfaces 18 | ,p.outgoingDependentPackages, p.incomingDependentPackages 19 | ,p.outgoingDependentArtifacts, p.incomingDependentArtifacts 20 | ORDER BY instability ASC, p.fqn ASC -------------------------------------------------------------------------------- /cypher/Metrics/Get_Instability_for_Typescript.cypher: -------------------------------------------------------------------------------- 1 | // Get Typscript Modules with the lowest Instability (outgoing / all dependencies) first (if set before) 2 | 3 | MATCH (module:TS:Module) 4 | WHERE module.instability IS NOT NULL 5 | OPTIONAL MATCH (projectdir:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(module) 6 | RETURN reverse(split(reverse(projectdir.absoluteFileName), '/')[0]) AS projectName 7 | ,module.globalFqn AS fullQualifiedModuleName 8 | ,module.name AS moduleName 9 | ,module.instability AS instability 10 | ,module.instabilityAbstractTypes AS instabilityAbstractTypes 11 | ,module.instabilityModules AS instabilityModules 12 | ,module.instabilityPackages AS instabilityPackages 13 | ,module.outgoingDependencies, module.incomingDependencies 14 | ,module.outgoingDependentAbstractTypes, module.incomingDependentAbstractTypes 15 | ,module.outgoingDependentModules, module.incomingDependentModules 16 | ,module.outgoingDependentPackages, module.incomingDependentPackages 17 | ORDER BY instability ASC, fullQualifiedModuleName ASC -------------------------------------------------------------------------------- /cypher/Metrics/Get_Outgoing_Java_Package_Dependencies.cypher: -------------------------------------------------------------------------------- 1 | // Get Java Packages with the most outgoing dependencies first (if set before). Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (p:Java:Package) 4 | WHERE p.outgoingDependencies IS NOT NULL 5 | MATCH (artifact:Artifact)-[:CONTAINS]->(p) 6 | RETURN artifact.name AS artifactName 7 | ,p.fqn AS fullQualifiedPackageName 8 | ,p.name AS packageName 9 | ,p.outgoingDependencies AS outgoingDependencies 10 | ,p.outgoingDependenciesWeight AS outgoingDependenciesWeight 11 | ,p.outgoingDependentTypes AS outgoingDependentTypes 12 | ,p.outgoingDependentInterfaces AS outgoingDependentInterfaces 13 | ,p.outgoingDependentPackages AS outgoingDependentPackages 14 | ,p.outgoingDependentArtifacts AS outgoingDependentArtifacts 15 | ORDER BY outgoingDependencies DESC, p.fqn ASC // package with most incoming dependencies first -------------------------------------------------------------------------------- /cypher/Metrics/Get_Outgoing_Java_Package_Dependencies_Including_Subpackages.cypher: -------------------------------------------------------------------------------- 1 | // Get Java Packages including their sub packages with the most outgoing dependencies first (if set before). Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (p:Java:Package) 4 | WHERE p.outgoingDependenciesIncludingSubpackages IS NOT NULL 5 | MATCH (artifact:Artifact)-[:CONTAINS]->(p) 6 | RETURN artifact.name AS artifactName 7 | ,p.fqn AS fullQualifiedPackageName 8 | ,p.name AS packageName 9 | ,p.outgoingDependenciesIncludingSubpackages AS outgoingDependencies 10 | ,p.outgoingDependenciesWeightIncludingSubpackages AS outgoingDependenciesWeight 11 | ,p.outgoingDependentTypesIncludingSubpackages AS outgoingDependentTypes 12 | ,p.outgoingDependentInterfacesIncludingSubpackages AS outgoingDependentInterfaces 13 | ,p.outgoingDependentPackagesIncludingSubpackages AS outgoingDependentPackages 14 | ,p.outgoingDependentArtifactsIncludingSubpackages AS outgoingDependentArtifacts 15 | ORDER BY outgoingDependencies DESC, p.fqn ASC // package with most incoming dependencies first -------------------------------------------------------------------------------- /cypher/Metrics/Get_Outgoing_Typescript_Module_Dependencies.cypher: -------------------------------------------------------------------------------- 1 | // Get Typscript Modules with the most outgoing dependencies first (if set before) 2 | 3 | MATCH (module:TS:Module) 4 | WHERE module.outgoingDependencies IS NOT NULL 5 | RETURN module.globalFqn AS fullQualifiedModuleName 6 | ,module.name AS sourceName 7 | ,module.outgoingDependencies AS outgoingDependencies 8 | ,module.outgoingDependenciesWeight AS outgoingDependenciesWeight 9 | ,module.outgoingDependentAbstractTypes AS outgoingDependentAbstractTypes 10 | ,module.outgoingDependentAbstractTypeWeight AS outgoingDependentAbstractTypeWeight 11 | ,module.outgoingDependentModules AS outgoingDependentModules 12 | ,module.outgoingDependentPackages AS outgoingDependentPackages 13 | ORDER BY outgoingDependencies DESC, fullQualifiedModuleName ASC -------------------------------------------------------------------------------- /cypher/Metrics/Incoming_Class_Dependencies.cypher: -------------------------------------------------------------------------------- 1 | // Incoming Class Dependencies 2 | MATCH (p:Package) 3 | OPTIONAL MATCH (p)-[:CONTAINS]->(it:Java:Type)<-[r:DEPENDS_ON]-(et:Java:Type)<-[:CONTAINS]-(ep:Package)<-[:CONTAINS]-(ea:Artifact) 4 | OPTIONAL MATCH (it)<-[:DEPENDS_ON]-(eti:Java:Type:Interface) 5 | WHERE p <> ep 6 | WITH p, it 7 | ,COUNT(et) AS incomingDependencies 8 | ,SUM(r.weight) AS incomingDependenciesWeight 9 | ,COUNT(DISTINCT et) AS incomingDependentTypes 10 | ,COUNT(DISTINCT eti) AS incomingDependentInterfaces // also included in usedTypes 11 | ,COUNT(DISTINCT ep) AS incomingDependentPackages 12 | ,COUNT(DISTINCT ea) AS incomingDependentArtifacts 13 | ORDER BY incomingDependencies DESC 14 | RETURN p.fqn AS packageName 15 | ,it.fqn AS className 16 | ,incomingDependencies 17 | ,incomingDependenciesWeight 18 | ,incomingDependentTypes 19 | ,incomingDependentInterfaces 20 | ,incomingDependentPackages 21 | ,incomingDependentArtifacts 22 | LIMIT 50 -------------------------------------------------------------------------------- /cypher/Metrics/Incoming_Class_Method_Call_Dependencies.cypher: -------------------------------------------------------------------------------- 1 | //Incoming Class Method Call Dependencies 2 | MATCH (p:Package) 3 | OPTIONAL MATCH (p)-[:CONTAINS]->(t:Java:Type)-[:DECLARES]->(m:Method)<-[:INVOKES]-(dm:Method)<-[:DECLARES]-(dt:Java:Type)<-[:CONTAINS]-(dp:Package)<-[:CONTAINS]-(da:Artifact) 4 | OPTIONAL MATCH (dm)<-[:DECLARES]-(dti:Interface) 5 | WHERE p <> dp 6 | WITH p, t 7 | ,COUNT(dm) AS incomingMethodCalls 8 | ,COUNT(DISTINCT dm) AS incomingDistinctMethodCalls 9 | ,COUNT(DISTINCT dt) AS incomingMethodCallTypes 10 | ,COUNT(DISTINCT dti) AS incomingMethodCallInterfaces 11 | ,COUNT(DISTINCT dp) AS incomingMethodCallPackages 12 | ,COUNT(DISTINCT da) AS incomingMethodCallArtifacts 13 | RETURN p.fqn AS packageName 14 | ,t.fqn AS className 15 | ,incomingMethodCalls 16 | ,incomingDistinctMethodCalls 17 | ,incomingMethodCallTypes 18 | ,incomingMethodCallInterfaces 19 | ,incomingMethodCallPackages 20 | ,incomingMethodCallArtifacts 21 | ORDER BY incomingMethodCalls DESC 22 | LIMIT 50 -------------------------------------------------------------------------------- /cypher/Metrics/Incoming_Package_Method_Call_Dependencies.cypher: -------------------------------------------------------------------------------- 1 | //Incoming Package Method Call Dependencies 2 | MATCH (p:Package) 3 | OPTIONAL MATCH (p)-[:CONTAINS]->(t:Java:Type)-[:DECLARES]->(m:Method)<-[:INVOKES]-(dm:Method)<-[:DECLARES]-(dt:Java:Type)<-[:CONTAINS]-(dp:Package)<-[:CONTAINS]-(da:Artifact) 4 | OPTIONAL MATCH (dm)<-[:DECLARES]-(dti:Interface) 5 | WHERE p <> dp 6 | WITH p 7 | ,COUNT(dm) AS incomingMethodCalls 8 | ,COUNT(DISTINCT dm) AS incomingDistinctMethodCalls 9 | ,COUNT(DISTINCT dt) AS incomingMethodCallTypes 10 | ,COUNT(DISTINCT dti) AS incomingMethodCallInterfaces 11 | ,COUNT(DISTINCT dp) AS incomingMethodCallPackages 12 | ,COUNT(DISTINCT da) AS incomingMethodCallArtifacts 13 | RETURN p.fqn AS packageName 14 | ,incomingMethodCalls 15 | ,incomingDistinctMethodCalls 16 | ,incomingMethodCallTypes 17 | ,incomingMethodCallInterfaces 18 | ,incomingMethodCallPackages 19 | ,incomingMethodCallArtifacts 20 | ORDER BY incomingMethodCalls DESC 21 | LIMIT 50 -------------------------------------------------------------------------------- /cypher/Metrics/Outgoing_Class_Dependencies.cypher: -------------------------------------------------------------------------------- 1 | //Outgoing Class Dependencies 2 | MATCH (p:Package) 3 | MATCH (p)-[:CONTAINS]->(it:Java:Type)-[r:DEPENDS_ON]->(et:Java:Type)<-[:CONTAINS]-(ep:Package)<-[:CONTAINS]-(ea:Artifact) 4 | OPTIONAL MATCH (it)-[:DEPENDS_ON]->(eti:Interface) 5 | WHERE p <> ep 6 | WITH p, it 7 | ,COUNT(et) AS outgoingDependencies 8 | ,SUM(r.weight) AS outgoingDependenciesWeight 9 | ,COUNT(DISTINCT et) AS outgoingDependentTypes 10 | ,COUNT(DISTINCT eti) AS outgoingDependentInterfaces // included in usedTypes 11 | ,COUNT(DISTINCT ep) AS outgoingDependentPackages 12 | ,COUNT(DISTINCT ea) AS outgoingDependentArtifacts 13 | ORDER BY outgoingDependencies DESC 14 | RETURN p.fqn AS packageName 15 | ,it.fqn AS className 16 | ,outgoingDependencies 17 | ,outgoingDependenciesWeight 18 | ,outgoingDependentTypes 19 | ,outgoingDependentInterfaces 20 | ,outgoingDependentPackages 21 | ,outgoingDependentArtifacts 22 | LIMIT 50 -------------------------------------------------------------------------------- /cypher/Metrics/Outgoing_Class_Method_Call_Dependencies.cypher: -------------------------------------------------------------------------------- 1 | //Outgoing Class Method Call Dependencies 2 | MATCH (p:Package) 3 | OPTIONAL MATCH (p)-[:CONTAINS]->(t:Java:Type)-[:DECLARES]->(m:Method)-[:INVOKES]->(dm:Method)<-[:DECLARES]-(dt:Java:Type)<-[:CONTAINS]-(dp:Package)<-[:CONTAINS]-(da:Artifact) 4 | OPTIONAL MATCH (dm)<-[:DECLARES]-(dti:Interface) 5 | WHERE p <> dp 6 | WITH p, t 7 | ,COUNT(dm) AS outgoingMethodCalls 8 | ,COUNT(DISTINCT dm) AS outgoingDistinctMethodCalls 9 | ,COUNT(DISTINCT dt) AS outgoingMethodCallTypes 10 | ,COUNT(DISTINCT dti) AS outgoingMethodCallInterfaces 11 | ,COUNT(DISTINCT dp) AS outgoingMethodCallPackages 12 | ,COUNT(DISTINCT da) AS outgoingMethodCallArtifacts 13 | RETURN p.fqn AS packageName 14 | ,t.fqn AS className 15 | ,outgoingMethodCalls 16 | ,outgoingDistinctMethodCalls 17 | ,outgoingMethodCallTypes 18 | ,outgoingMethodCallInterfaces 19 | ,outgoingMethodCallPackages 20 | ,outgoingMethodCallArtifacts 21 | ORDER BY outgoingMethodCalls DESC 22 | LIMIT 50 -------------------------------------------------------------------------------- /cypher/Metrics/Outgoing_Package_Method_Call_Dependencies.cypher: -------------------------------------------------------------------------------- 1 | //Outgoing Package Method Call Dependencies 2 | MATCH (p:Package) 3 | OPTIONAL MATCH (p)-[:CONTAINS]->(t:Java:Type)-[:DECLARES]->(m:Method)-[:INVOKES]->(dm:Method)<-[:DECLARES]-(dt:Java:Type)<-[:CONTAINS]-(dp:Package)<-[:CONTAINS]-(da:Artifact) 4 | OPTIONAL MATCH (dm)<-[:DECLARES]-(dti:Interface) 5 | WHERE p <> dp 6 | WITH p 7 | ,COUNT(dm) AS outgoingMethodCalls 8 | ,COUNT(DISTINCT dm) AS outgoingDistinctMethodCalls 9 | ,COUNT(DISTINCT dt) AS outgoingMethodCallTypes 10 | ,COUNT(DISTINCT dti) AS outgoingMethodCallInterfaces 11 | ,COUNT(DISTINCT dp) AS outgoingMethodCallPackages 12 | ,COUNT(DISTINCT da) AS outgoingMethodCallArtifacts 13 | RETURN p.fqn AS packageName 14 | ,outgoingMethodCalls 15 | ,outgoingDistinctMethodCalls 16 | ,outgoingMethodCallTypes 17 | ,outgoingMethodCallInterfaces 18 | ,outgoingMethodCallPackages 19 | ,outgoingMethodCallArtifacts 20 | ORDER BY outgoingMethodCalls DESC 21 | LIMIT 50 -------------------------------------------------------------------------------- /cypher/Miscellaneous/Adding_the_artifact_name_temporarily_to_a_new_virtual_node_using_APOC.cypher: -------------------------------------------------------------------------------- 1 | // Adding the artifact name temporarily to a new virtual node using APOC. 2 | // Doesn't take all relationships into account and therefore doesn't work yet. 3 | MATCH (source:Package)-[dependency:DEPENDS_ON]->(dependent:Package) 4 | MATCH (sourceArtifact:Artifact)-[:CONTAINS]->(source) 5 | MATCH (dependentArtifact:Artifact)-[:CONTAINS]->(dependent) 6 | WHERE sourceArtifact.fileName CONTAINS 'modelling' 7 | CALL apoc.create.vNode( 8 | labels(source), 9 | source{.*, artifactName:sourceArtifact.fileName} 10 | ) YIELD node AS vSource 11 | CALL apoc.create.vNode( 12 | labels(dependent), 13 | dependent{.*, artifactName:dependentArtifact.fileName} 14 | ) YIELD node AS vDependent 15 | CALL apoc.create.vRelationship( 16 | vSource, type(dependency), dependency{.*}, vDependent) 17 | YIELD rel AS vDependency 18 | RETURN vSource 19 | ,vDependency 20 | ,vDependent 21 | LIMIT 10 -------------------------------------------------------------------------------- /cypher/Miscellaneous/Adding_the_artifact_name_temporarily_to_the_Package_node_using_map_projection.cypher: -------------------------------------------------------------------------------- 1 | // Adding the artifact name temporarily to the Package node using map projection 2 | MATCH (source:Package)-[dependency:DEPENDS_ON]->(dependent:Package) 3 | MATCH (sourceArtifact:Artifact)-[:CONTAINS]->(source) 4 | MATCH (dependentArtifact:Artifact)-[:CONTAINS]->(dependent) 5 | WHERE sourceArtifact.fileName CONTAINS 'modelling' 6 | RETURN source{.*, artifactName:sourceArtifact.fileName} 7 | ,dependency 8 | ,dependent{.*, artifactName:dependentArtifact.fileName} 9 | LIMIT 10 -------------------------------------------------------------------------------- /cypher/Miscellaneous/Extract_Custom_Manifest_Entries.cypher: -------------------------------------------------------------------------------- 1 | //Extract Custom Manifest Entries 2 | MATCH (artifact:Artifact)-[:CONTAINS]->(manifest:Manifest)-[:DECLARES]->(section:ManifestSection) 3 | OPTIONAL MATCH (section)-[:HAS]->(bundleName:ManifestEntry{name: 'Bundle-Name'}) 4 | OPTIONAL MATCH (section)-[:HAS]->(bundleVersion:ManifestEntry{name: 'Bundle-Version'}) 5 | //WHERE artifact.fileName CONTAINS 'messaging' 6 | RETURN artifact, bundleName.value, bundleVersion.value 7 | LIMIT 10 -------------------------------------------------------------------------------- /cypher/Miscellaneous/Get_Awesome_Procedures_On_Cypher_APOC_Version.cypher: -------------------------------------------------------------------------------- 1 | // Get Awesome Procedures On Cypher APOC Version 2 | 3 | RETURN apoc.version() AS APOC_Version; -------------------------------------------------------------------------------- /cypher/Miscellaneous/Get_Graph_Data_Science_Library_Version.cypher: -------------------------------------------------------------------------------- 1 | // Get Graph Data Science Library Version 2 | 3 | RETURN gds.version() AS GDS_Version; -------------------------------------------------------------------------------- /cypher/Miscellaneous/Get_Graph_Data_Science_System_Information.cypher: -------------------------------------------------------------------------------- 1 | // Get Graph Data Science System Information 2 | 3 | CALL gds.debug.sysInfo() -------------------------------------------------------------------------------- /cypher/Miscellaneous/Set_artifactName_property_on_every_Package_node.cypher: -------------------------------------------------------------------------------- 1 | // Set artifactName property on every Package node. Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (a:Artifact:File)-[:CONTAINS]->(p:Package) 4 | WHERE a.fileName IS NOT NULL 5 | WITH p, a.name AS artifactName 6 | SET p.artifactName = artifactName 7 | RETURN p, artifactName -------------------------------------------------------------------------------- /cypher/Node_Embeddings/Node_Embeddings_1a_Fast_Random_Projection_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Node Embeddings 1a using Fast Random Projection: Estimate 2 | 3 | CALL gds.fastRP.stream.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | embeddingDimension: toInteger($dependencies_projection_embedding_dimension) 6 | ,randomSeed: 30 7 | ,relationshipWeightProperty: $dependencies_projection_weight_property 8 | } 9 | ) 10 | YIELD requiredMemory, nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView 11 | RETURN requiredMemory, nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView -------------------------------------------------------------------------------- /cypher/Node_Embeddings/Node_Embeddings_1b_Fast_Random_Projection_Statistics.cypher: -------------------------------------------------------------------------------- 1 | // Node Embeddings 1b using Fast Random Projection: Statistics 2 | 3 | CALL gds.fastRP.stats( 4 | $dependencies_projection + '-cleaned', { 5 | embeddingDimension: toInteger($dependencies_projection_embedding_dimension) 6 | ,randomSeed: 30 7 | ,relationshipWeightProperty: $dependencies_projection_weight_property 8 | } 9 | ) 10 | YIELD nodeCount, preProcessingMillis, computeMillis 11 | RETURN nodeCount, preProcessingMillis, computeMillis -------------------------------------------------------------------------------- /cypher/Node_Embeddings/Node_Embeddings_1c_Fast_Random_Projection_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Node Embeddings 1c using Fast Random Projection: Mutate 2 | 3 | CALL gds.fastRP.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | embeddingDimension: toInteger($dependencies_projection_embedding_dimension) 6 | ,randomSeed: 30 7 | ,relationshipWeightProperty: $dependencies_projection_weight_property 8 | ,mutateProperty: $dependencies_projection_write_property 9 | } 10 | ) 11 | YIELD nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, mutateMillis 12 | RETURN nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, mutateMillis -------------------------------------------------------------------------------- /cypher/Node_Embeddings/Node_Embeddings_1e_Fast_Random_Projection_Write.cypher: -------------------------------------------------------------------------------- 1 | // Node Embeddings 1d using Fast Random Projection: Write 2 | 3 | CALL gds.fastRP.write( 4 | $dependencies_projection + '-cleaned', { 5 | embeddingDimension: toInteger($dependencies_projection_embedding_dimension) 6 | ,randomSeed: 30 7 | ,relationshipWeightProperty: $dependencies_projection_weight_property 8 | ,writeProperty: $dependencies_projection_write_property 9 | } 10 | ) 11 | YIELD nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, writeMillis 12 | RETURN nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, writeMillis -------------------------------------------------------------------------------- /cypher/Node_Embeddings/Node_Embeddings_2a_Hash_GNN_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Node Embeddings 2a using Hash GNN (Graph Neural Networks): Estimate 2 | 3 | CALL gds.beta.hashgnn.stream.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | embeddingDensity: toInteger($dependencies_projection_embedding_dimension) * 2 6 | ,iterations: 3 7 | ,generateFeatures: { 8 | dimension: toInteger($dependencies_projection_embedding_dimension) * 4 9 | ,densityLevel: 3 10 | } 11 | ,outputDimension: toInteger($dependencies_projection_embedding_dimension) 12 | ,neighborInfluence: 0.9 13 | ,randomSeed: 30 14 | } 15 | ) 16 | YIELD requiredMemory, nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView 17 | RETURN requiredMemory, nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView -------------------------------------------------------------------------------- /cypher/Node_Embeddings/Node_Embeddings_2c_Hash_GNN_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Node Embeddings 2b using Hash GNN (Graph Neural Networks): Mutate 2 | 3 | CALL gds.beta.hashgnn.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | embeddingDensity: toInteger($dependencies_projection_embedding_dimension) * 2 6 | ,iterations: 3 7 | ,generateFeatures: { 8 | dimension: toInteger($dependencies_projection_embedding_dimension) * 4 9 | ,densityLevel: 3 10 | } 11 | ,outputDimension: toInteger($dependencies_projection_embedding_dimension) 12 | ,neighborInfluence: 0.9 13 | ,randomSeed: 30 14 | ,mutateProperty: $dependencies_projection_write_property 15 | } 16 | ) 17 | YIELD nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, mutateMillis 18 | RETURN nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, mutateMillis -------------------------------------------------------------------------------- /cypher/Node_Embeddings/Node_Embeddings_3a_Node2Vec_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Node Embeddings 3a using Node2Vec: Estimate 2 | 3 | CALL gds.node2vec.write.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | embeddingDimension: toInteger($dependencies_projection_embedding_dimension) 6 | ,iterations: 3 7 | ,randomSeed: 30 8 | ,relationshipWeightProperty: $dependencies_projection_weight_property 9 | ,writeProperty: $dependencies_projection_write_property 10 | } 11 | ) 12 | YIELD requiredMemory, nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView 13 | RETURN requiredMemory, nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView -------------------------------------------------------------------------------- /cypher/Node_Embeddings/Node_Embeddings_3c_Node2Vec_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Node Embeddings 3c using Node2Vec: Mutate 2 | 3 | CALL gds.node2vec.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | embeddingDimension: toInteger($dependencies_projection_embedding_dimension) 6 | ,iterations: 3 7 | ,randomSeed: 30 8 | ,relationshipWeightProperty: $dependencies_projection_weight_property 9 | ,mutateProperty: $dependencies_projection_write_property 10 | } 11 | ) 12 | YIELD nodePropertiesWritten, lossPerIteration, nodeCount, preProcessingMillis, computeMillis, mutateMillis 13 | RETURN nodePropertiesWritten, lossPerIteration, nodeCount, preProcessingMillis, computeMillis, mutateMillis -------------------------------------------------------------------------------- /cypher/Node_Embeddings/Node_Embeddings_3e_Node2Vec_Write.cypher: -------------------------------------------------------------------------------- 1 | // Node Embeddings 3d using Node2Vec: Write 2 | 3 | CALL gds.node2vec.write( 4 | $dependencies_projection + '-cleaned', { 5 | embeddingDimension: toInteger($dependencies_projection_embedding_dimension) 6 | ,iterations: 3 7 | ,randomSeed: 30 8 | ,relationshipWeightProperty: $dependencies_projection_weight_property 9 | ,writeProperty: $dependencies_projection_write_property 10 | } 11 | ) 12 | YIELD nodePropertiesWritten, lossPerIteration, nodeCount, preProcessingMillis, computeMillis, writeMillis 13 | RETURN nodePropertiesWritten, lossPerIteration, nodeCount, preProcessingMillis, computeMillis, writeMillis -------------------------------------------------------------------------------- /cypher/Node_Embeddings/Set_Parameters.cypher: -------------------------------------------------------------------------------- 1 | // Example on how to set the parameters for node embeddings in this case for Packages and Node2Vec 2 | 3 | :params { 4 | "dependencies_projection": "package-embeddings-directed", 5 | "dependencies_projection_node": "Package", 6 | "dependencies_projection_weight_property": "weight25PercentInterfaces", 7 | "dependencies_projection_write_property": "embeddingsNode2Vec", 8 | "dependencies_projection_embedding_dimension": "64" 9 | } -------------------------------------------------------------------------------- /cypher/Overview/Cyclomatic_Method_Complexity_Distribution.cypher: -------------------------------------------------------------------------------- 1 | // Cyclomatic Complexity Method Complexity Distribution 2 | 3 | MATCH (artifact:Artifact)-[:CONTAINS]->(type:Type)-[:DECLARES]->(method:Method) 4 | WHERE method.effectiveLineCount > 0 5 | WITH last(split(artifact.fileName, '/')) AS artifactName 6 | ,method.cyclomaticComplexity AS cyclomaticComplexity 7 | ,count(method) AS methods 8 | RETURN artifactName, cyclomaticComplexity, methods 9 | ORDER BY artifactName asc, cyclomaticComplexity -------------------------------------------------------------------------------- /cypher/Overview/Effective_Method_Line_Count_Distribution.cypher: -------------------------------------------------------------------------------- 1 | // Effective Method Line Count Distribution 2 | 3 | MATCH (artifact:Artifact)-[:CONTAINS]->(type:Type)-[:DECLARES]->(method:Method) 4 | WHERE method.effectiveLineCount > 0 5 | WITH last(split(artifact.fileName, '/')) AS artifactName 6 | ,method.effectiveLineCount AS effectiveLineCount 7 | ,count(method) AS methods 8 | RETURN artifactName, effectiveLineCount, methods 9 | ORDER BY artifactName asc, effectiveLineCount -------------------------------------------------------------------------------- /cypher/Overview/Node_label_combination_count.cypher: -------------------------------------------------------------------------------- 1 | // Node count for each label combination. Sums up to the total number of nodes. 2 | 3 | MATCH (allNodes) 4 | WITH COUNT(allNodes) AS totalNodeCount 5 | MATCH (nodesAndTheirLabels) 6 | WITH totalNodeCount 7 | ,labels(nodesAndTheirLabels) AS nodeLabels 8 | ,nodesAndTheirLabels 9 | UNWIND nodeLabels AS nodeLabel 10 | WITH totalNodeCount 11 | ,nodeLabel 12 | ,nodesAndTheirLabels 13 | WHERE NOT nodeLabel STARTS WITH 'Mark4' 14 | WITH totalNodeCount 15 | ,collect(nodeLabel) AS nodeLabels 16 | ,nodesAndTheirLabels 17 | WITH totalNodeCount 18 | ,nodeLabels 19 | ,count(nodesAndTheirLabels) AS nodesWithThatLabels 20 | ,toFloat(count(nodesAndTheirLabels)) / totalNodeCount * 100.0 AS nodesWithThatLabelsPercent 21 | RETURN nodeLabels, nodesWithThatLabels, nodesWithThatLabelsPercent 22 | ORDER BY nodesWithThatLabels DESC -------------------------------------------------------------------------------- /cypher/Overview/Node_label_count.cypher: -------------------------------------------------------------------------------- 1 | // Node count for each label separate. Doesn_t sum up to the number of total labels since one node can have multiple labels. 2 | 3 | MATCH (allNodes) 4 | WITH COUNT(allNodes) AS totalNodeCount 5 | MATCH (nodesAndTheirLabels) 6 | WITH totalNodeCount 7 | ,labels(nodesAndTheirLabels) AS nodeLabels 8 | ,nodesAndTheirLabels 9 | UNWIND nodeLabels AS nodeLabel 10 | WITH totalNodeCount 11 | ,nodeLabel 12 | ,count(nodesAndTheirLabels) AS nodesWithThatLabel 13 | ,toFloat(count(nodesAndTheirLabels)) / totalNodeCount * 100.0 AS nodesWithThatLabelPercent 14 | WHERE NOT nodeLabel STARTS WITH 'Mark4' 15 | RETURN nodeLabel, nodesWithThatLabel, nodesWithThatLabelPercent 16 | ORDER BY nodesWithThatLabel DESC, nodeLabel ASC -------------------------------------------------------------------------------- /cypher/Overview/Number_of_packages_per_artifact.cypher: -------------------------------------------------------------------------------- 1 | // Number of packages per artifact. Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (artifact:Artifact)-[:CONTAINS]->(package:Package)-[:CONTAINS]->(type:Type) 4 | WITH artifact.name AS artifactName 5 | ,count(DISTINCT package.fqn) as numberOfPackages 6 | RETURN artifactName, numberOfPackages -------------------------------------------------------------------------------- /cypher/Overview/Number_of_types_per_artifact.cypher: -------------------------------------------------------------------------------- 1 | // Number of types per artifact. Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (artifact:Artifact)-[:CONTAINS]->(type:Type) 4 | WITH artifact.name AS artifactName 5 | ,count(DISTINCT type.fqn) AS numberOfArtifactTypes 6 | ,collect(DISTINCT type) AS types 7 | UNWIND types AS type 8 | WITH artifactName 9 | ,numberOfArtifactTypes 10 | ,type 11 | ,labels(type) AS typeLabels 12 | UNWIND typeLabels AS typeLabel 13 | WITH artifactName 14 | ,numberOfArtifactTypes 15 | ,type 16 | ,typeLabel 17 | WHERE typeLabel IN ['Class', 'Interface', 'Annotation', 'Enum'] 18 | RETURN artifactName 19 | ,numberOfArtifactTypes 20 | ,typeLabel AS languageElement 21 | ,count(type) AS numberOfTypes 22 | ORDER BY numberOfArtifactTypes DESC, artifactName ASC -------------------------------------------------------------------------------- /cypher/Overview/Overview_size.cypher: -------------------------------------------------------------------------------- 1 | // Overview size 2 | 3 | MATCH (n) 4 | WITH COUNT(n) AS nodeCount 5 | MATCH ()-[]->() 6 | WITH nodeCount 7 | ,count(*) AS relationshipCount 8 | MATCH (a:Artifact:Archive) 9 | WITH nodeCount 10 | ,relationshipCount 11 | ,count(DISTINCT a.fileName) AS artifactCount 12 | MATCH (p:Package) 13 | WITH nodeCount 14 | ,relationshipCount 15 | ,artifactCount 16 | ,count(DISTINCT p.fqn) AS packageCount 17 | MATCH (t:Type) 18 | WITH nodeCount 19 | ,relationshipCount 20 | ,artifactCount 21 | ,packageCount 22 | ,count(DISTINCT t.fqn) AS typeCount 23 | MATCH (m:Method) 24 | WITH nodeCount 25 | ,relationshipCount 26 | ,artifactCount 27 | ,packageCount 28 | ,typeCount 29 | ,count(DISTINCT m.signature) AS methodCount 30 | MATCH (member:Member) 31 | WITH nodeCount 32 | ,relationshipCount 33 | ,artifactCount 34 | ,packageCount 35 | ,typeCount 36 | ,methodCount 37 | ,count(DISTINCT member.signature) AS memberCount 38 | RETURN nodeCount 39 | ,relationshipCount 40 | ,artifactCount 41 | ,packageCount 42 | ,typeCount 43 | ,methodCount 44 | ,memberCount -------------------------------------------------------------------------------- /cypher/Overview/Relationship_type_count.cypher: -------------------------------------------------------------------------------- 1 | // Relationship count for each type separate. Sums up to the total number of relationships (100%). 2 | 3 | MATCH ()-[allRelationships]-() 4 | WITH COUNT(DISTINCT allRelationships) AS totalRelationshipCount 5 | MATCH ()-[relationshipsAndTheirTypes]-() 6 | WITH totalRelationshipCount 7 | ,type(relationshipsAndTheirTypes) AS relationshipType 8 | ,count(DISTINCT relationshipsAndTheirTypes) AS nodesWithThatRelationshipType 9 | ,toFloat( 10 | count(DISTINCT relationshipsAndTheirTypes)) 11 | / totalRelationshipCount * 100.0 AS nodesWithThatRelationshipTypePercent 12 | RETURN relationshipType 13 | ,nodesWithThatRelationshipType 14 | ,nodesWithThatRelationshipTypePercent 15 | ORDER BY nodesWithThatRelationshipType DESC, relationshipType ASC -------------------------------------------------------------------------------- /cypher/Overview/Words_for_Wordcloud.cypher: -------------------------------------------------------------------------------- 1 | // Words for Wordcloud 2 | 3 | MATCH (package:Package) 4 | WITH collect(package.name) AS packageNames 5 | MATCH (type:Type&!PrimitiveType&!Void&!JavaType&!ResolvedDuplicateType&!ExternalType) 6 | WHERE type.name <> 'package-info' // not package-info files 7 | WITH packageNames, split(type.name, '$') AS splittedInnerClasses 8 | UNWIND splittedInnerClasses AS splittedInnerClass 9 | WITH packageNames 10 | ,apoc.text.replace(splittedInnerClass, '(? 1 6 | RETURN author.name AS word, count(commit) AS frequency -------------------------------------------------------------------------------- /cypher/Overview/Words_for_universal_Wordcloud.cypher: -------------------------------------------------------------------------------- 1 | // Words for universal Wordcloud 2 | 3 | MATCH (named:!Key&!Primitive&!PrimitiveType&!Void&!JavaType&!ResolvedDuplicateType&!ExternalType&!Git) 4 | WHERE named.name > '' 5 | AND named.name <> 'package-info' 6 | AND named.name <> '' 7 | AND named.name <> '' 8 | WITH apoc.text.replace(named.name, '(? 1 15 | RETURN word 16 | // ,count(*) as numberOfAppearances 17 | //ORDER BY numberOfAppearances DESC, word -------------------------------------------------------------------------------- /cypher/Path_Finding/Path_Finding_1_Create_Projection.cypher: -------------------------------------------------------------------------------- 1 | //Path Finding 1 Create Projection 2 | CALL gds.graph.project('package-dependencies', 'Package', 'DEPENDS_ON') -------------------------------------------------------------------------------- /cypher/Path_Finding/Path_Finding_2_Estimate_Memory.cypher: -------------------------------------------------------------------------------- 1 | //Path Finding 2 Estimate Memory 2 | MATCH (source:Package {fqn: 'org.axonframework.commandhandling'}) 3 | CALL gds.dfs.stream.estimate('package-dependencies', { 4 | sourceNode: source 5 | }) 6 | YIELD nodeCount, relationshipCount, bytesMin, bytesMax, requiredMemory 7 | RETURN nodeCount, relationshipCount, bytesMin, bytesMax, requiredMemory -------------------------------------------------------------------------------- /cypher/Path_Finding/Path_Finding_3_Depth_First_Search_Path.cypher: -------------------------------------------------------------------------------- 1 | //Path Finding 3 Depth First Search Path 2 | MATCH (source:Package{fqn:'org.axonframework.commandhandling'}) 3 | CALL gds.dfs.stream('package-dependencies', { 4 | sourceNode: source 5 | }) 6 | YIELD path 7 | RETURN path -------------------------------------------------------------------------------- /cypher/Path_Finding/Path_Finding_4_Breadth_First_Search_Path.cypher: -------------------------------------------------------------------------------- 1 | //Path Finding 4 Breadth First Search Path 2 | MATCH (source:Package{fqn:'org.axonframework.commandhandling'}) 3 | CALL gds.bfs.stream('package-dependencies', { 4 | sourceNode: source, 5 | maxDepth: 1 6 | }) 7 | YIELD path 8 | RETURN path -------------------------------------------------------------------------------- /cypher/Path_Finding/Path_Finding_5_All_pairs_shortest_path_distribution_overall.cypher: -------------------------------------------------------------------------------- 1 | // Path Finding - All pairs shortest path algorithm - Stream - Overall 2 | 3 | CALL gds.allShortestPaths.stream($dependencies_projection + '-cleaned') 4 | YIELD sourceNodeId, targetNodeId, distance 5 | WHERE gds.util.isFinite(distance) = true 6 | WITH gds.util.asNode(sourceNodeId) AS source 7 | ,gds.util.asNode(targetNodeId) AS target 8 | ,toInteger(distance) AS distance 9 | ,sourceNodeId 10 | ,targetNodeId 11 | WHERE sourceNodeId <> targetNodeId 12 | RETURN distance 13 | ,count(*) AS pairCount 14 | ,count(DISTINCT sourceNodeId) AS sourceNodeCount 15 | ,count(DISTINCT targetNodeId) AS targetNodeCount 16 | ,collect(DISTINCT source.fileName + ' ->' + target.fileName)[0..2] AS examples 17 | ORDER BY distance -------------------------------------------------------------------------------- /cypher/Path_Finding/Path_Finding_6_Longest_paths_distribution_overall.cypher: -------------------------------------------------------------------------------- 1 | // Longest paths distribution 2 | 3 | CALL gds.dag.longestPath.stream($dependencies_projection + '-cleaned') 4 | YIELD index, sourceNode, targetNode, totalCost, nodeIds, costs, path 5 | RETURN toInteger(totalCost) AS totalCost 6 | ,count(*) AS nodeCount 7 | ORDER BY totalCost -------------------------------------------------------------------------------- /cypher/Path_Finding/Set_Parameters.cypher: -------------------------------------------------------------------------------- 1 | // Example on how to set the parameters for path finding in this case for Packages and PageRank 2 | 3 | :params { 4 | "dependencies_projection": "package-path-finding", 5 | "dependencies_projection_node": "Package", 6 | "dependencies_projection_weight_property": "weight25PercentInterfaces", 7 | } -------------------------------------------------------------------------------- /cypher/Similarity/Set_Parameters.cypher: -------------------------------------------------------------------------------- 1 | // Example on how to set the parameters for similarity in this case for Packages and Node Similarity 2 | 3 | :params { 4 | "dependencies_projection": "package-similarity", 5 | "dependencies_projection_node": "Package", 6 | "dependencies_projection_weight_property": "weight25PercentInterfaces", 7 | "dependencies_projection_write_property": "similarityScore", 8 | } -------------------------------------------------------------------------------- /cypher/Similarity/Similarity_1a_Estimate.cypher: -------------------------------------------------------------------------------- 1 | // Similarity Estimate Memory 2 | 3 | CALL gds.nodeSimilarity.write.estimate( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,relationshipTypes: ['DEPENDS_ON'] 7 | ,writeRelationshipType: 'SIMILAR' 8 | ,writeProperty: 'score' 9 | ,topK: 3 10 | }) 11 | YIELD requiredMemory, nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView 12 | RETURN requiredMemory, nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView -------------------------------------------------------------------------------- /cypher/Similarity/Similarity_1b_Statistics.cypher: -------------------------------------------------------------------------------- 1 | // Similarity Statistics 2 | 3 | CALL gds.nodeSimilarity.stats( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,relationshipTypes: ['DEPENDS_ON'] 7 | ,topK: 3 8 | }) 9 | YIELD nodesCompared 10 | ,similarityPairs 11 | ,preProcessingMillis 12 | ,computeMillis 13 | ,postProcessingMillis 14 | ,similarityDistribution 15 | RETURN nodesCompared 16 | ,similarityPairs 17 | ,preProcessingMillis 18 | ,computeMillis 19 | ,postProcessingMillis 20 | ,similarityDistribution.min 21 | ,similarityDistribution.mean 22 | ,similarityDistribution.max 23 | ,similarityDistribution.p50 24 | ,similarityDistribution.p75 25 | ,similarityDistribution.p90 26 | ,similarityDistribution.p95 27 | ,similarityDistribution.p99 -------------------------------------------------------------------------------- /cypher/Similarity/Similarity_1c_Mutate.cypher: -------------------------------------------------------------------------------- 1 | // Similarity Mutate 2 | 3 | CALL gds.nodeSimilarity.mutate( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,relationshipTypes: ['DEPENDS_ON'] 7 | ,topK: 3 8 | ,mutateRelationshipType: 'SIMILAR' 9 | ,mutateProperty: 'score' 10 | }) 11 | YIELD relationshipsWritten 12 | ,nodesCompared 13 | ,preProcessingMillis 14 | ,computeMillis 15 | ,mutateMillis 16 | ,postProcessingMillis 17 | ,similarityDistribution 18 | RETURN relationshipsWritten 19 | ,nodesCompared 20 | ,preProcessingMillis 21 | ,computeMillis 22 | ,mutateMillis 23 | ,postProcessingMillis 24 | ,similarityDistribution.min 25 | ,similarityDistribution.mean 26 | ,similarityDistribution.max 27 | ,similarityDistribution.p50 28 | ,similarityDistribution.p75 29 | ,similarityDistribution.p90 30 | ,similarityDistribution.p95 31 | ,similarityDistribution.p99 32 | ,similarityDistribution.p999 -------------------------------------------------------------------------------- /cypher/Similarity/Similarity_1f_Delete_Relationships.cypher: -------------------------------------------------------------------------------- 1 | // Delete Relationship "SIMILAR" 2 | 3 | MATCH (source)-[similarity:SIMILAR]->(target) 4 | WHERE $dependencies_projection_node IN labels(source) 5 | AND $dependencies_projection_node IN labels(target) 6 | DELETE similarity -------------------------------------------------------------------------------- /cypher/Similarity/Similarity_1g_Write_Mutated.cypher: -------------------------------------------------------------------------------- 1 | // Write the Similarity relationship from the projection into the Graph. Variables: dependencies_projection, dependencies_projection_write_property 2 | 3 | CALL gds.graph.relationship.write( 4 | $dependencies_projection + '-cleaned' 5 | ,'SIMILAR' 6 | ,'score' 7 | ) 8 | YIELD relationshipsWritten, propertiesWritten, writeMillis 9 | RETURN relationshipsWritten, propertiesWritten, writeMillis -------------------------------------------------------------------------------- /cypher/Similarity/Similarity_1h_Write.cypher: -------------------------------------------------------------------------------- 1 | // Similarity Write 2 | 3 | CALL gds.nodeSimilarity.write( 4 | $dependencies_projection + '-cleaned', { 5 | relationshipWeightProperty: $dependencies_projection_weight_property 6 | ,relationshipTypes: ['DEPENDS_ON'] 7 | ,writeRelationshipType: 'SIMILAR' 8 | ,writeProperty: 'score' 9 | ,topK: 3 10 | }) 11 | YIELD nodesCompared 12 | ,relationshipsWritten 13 | ,preProcessingMillis 14 | ,computeMillis 15 | ,postProcessingMillis 16 | ,writeMillis 17 | ,similarityDistribution 18 | RETURN nodesCompared 19 | ,relationshipsWritten 20 | ,preProcessingMillis 21 | ,computeMillis 22 | ,postProcessingMillis 23 | ,writeMillis 24 | ,similarityDistribution.min 25 | ,similarityDistribution.mean 26 | ,similarityDistribution.max 27 | ,similarityDistribution.p50 28 | ,similarityDistribution.p75 29 | ,similarityDistribution.p90 30 | ,similarityDistribution.p95 31 | ,similarityDistribution.p99 -------------------------------------------------------------------------------- /cypher/Similarity/Similarity_1i_Write_Node_Properties.cypher: -------------------------------------------------------------------------------- 1 | // Write similar node names and their score per node 2 | 3 | MATCH (source)-[similar:SIMILAR]->(target) 4 | WHERE $dependencies_projection_node IN labels(source) 5 | AND $dependencies_projection_node IN labels(target) 6 | WITH source 7 | ,coalesce(source.fqn, source.fileName, source.name) AS sourceName 8 | ,similar.score AS similarityScore 9 | ,coalesce(target.fqn, target.fileName, target.name) AS targetName 10 | ORDER BY sourceName ASCENDING, similarityScore DESCENDING 11 | WITH source 12 | ,sourceName 13 | ,collect(DISTINCT targetName) AS similarNames 14 | ,collect(DISTINCT similarityScore) AS similarityScores 15 | SET source.similarNames = similarNames 16 | ,source.similarityScores = similarityScores 17 | //RETURN sourceName, similarNames, similarityScores 18 | //ORDER BY sourceName ASCENDING 19 | RETURN count(source) AS writtenNodes 20 | -------------------------------------------------------------------------------- /cypher/Topological_Sort/Set_Parameters.cypher: -------------------------------------------------------------------------------- 1 | // Example on how to set the parameters for topological sort in this case for Java Artifacts and Node Similarity 2 | 3 | :params { 4 | "dependencies_projection": "artifact-topology", 5 | "dependencies_projection_node": "Artifact", 6 | "dependencies_projection_weight_property": "weight" 7 | } -------------------------------------------------------------------------------- /cypher/Topological_Sort/Topological_Sort_Write.cypher: -------------------------------------------------------------------------------- 1 | // Topological Sort to write the properties topologicalSortIndex (e.g. build order) and maxDistanceFromSource (build level) into the graph. 2 | // Needs graph-data-science plugin version >= 2.5.0 3 | 4 | CALL gds.dag.topologicalSort.stream( 5 | $dependencies_projection + '-cleaned', { 6 | computeMaxDistanceFromSource: true 7 | }) YIELD nodeId, maxDistanceFromSource 8 | WITH nodeId 9 | ,gds.util.asNode(nodeId) AS codeUnit 10 | ,toInteger(maxDistanceFromSource) AS maxDistanceFromSource 11 | SET codeUnit.maxDistanceFromSource = maxDistanceFromSource 12 | WITH collect(nodeId) AS sortedNodeIds 13 | ,collect(codeUnit) AS sortedArtifacts 14 | ,max(maxDistanceFromSource) AS overallMaxDistance 15 | FOREACH (i IN range(0, SIZE(sortedArtifacts)-1) | 16 | SET gds.util.asNode(sortedNodeIds[i]).topologicalSortIndex = i) 17 | RETURN size(sortedArtifacts) AS numberOfArtifacts, overallMaxDistance -------------------------------------------------------------------------------- /cypher/Types/Label_base_java_types.cypher: -------------------------------------------------------------------------------- 1 | // Label primitive Java types and void 2 | 3 | MATCH (type:Type) 4 | WITH type 5 | ,type.fqn in ['byte', 'short', 'int', 'long', 'float', 'double', 'boolean', 'char'] AS isPrimitiveType 6 | ,type.fqn = 'void' AS isVoid 7 | WITH type 8 | ,isPrimitiveType 9 | ,isVoid 10 | ,CASE WHEN isPrimitiveType THEN [1] ELSE [] END AS primitive 11 | ,CASE WHEN isVoid THEN [1] ELSE [] END AS void 12 | WHERE isPrimitiveType OR isVoid 13 | FOREACH (x in primitive | SET type:PrimitiveType) 14 | FOREACH (x in void | SET type:Void) 15 | RETURN labels(type), count(type) as numberOfBaseTypes -------------------------------------------------------------------------------- /cypher/Types/Label_resolved_duplicate_types.cypher: -------------------------------------------------------------------------------- 1 | // Label resolved duplicate types. 2 | 3 | MATCH (type:Type) 4 | WITH type, exists((type)-[:RESOLVES_TO]->(:Type)) AS isResolvedDuplicate 5 | WHERE isResolvedDuplicate 6 | SET type:ResolvedDuplicateType 7 | RETURN labels(type), count(type) as numberOfResolvedDuplicateTypes -------------------------------------------------------------------------------- /cypher/Types/Remove_extended_type_labels.cypher: -------------------------------------------------------------------------------- 1 | // Remove external type and annotation labels 2 | 3 | MATCH (extendedLabeledType:JavaType|PrimitiveType|Void|ResolvedDuplicateType) 4 | REMOVE extendedLabeledType:JavaType:PrimitiveType:Void:ResolvedDuplicateType -------------------------------------------------------------------------------- /cypher/Types/Set_declaring_type_on_method_nodes.cypher: -------------------------------------------------------------------------------- 1 | // Set property "declaringType" on Method nodes. 2 | 3 | MATCH (javaType:Type)-[:DECLARES]->(javaMethod:Method) 4 | SET javaMethod.declaringType = javaType.fqn 5 | RETURN count(DISTINCT javaMethod) AS numberOfMethods 6 | ,count(DISTINCT javaType) AS numberOfTypes -------------------------------------------------------------------------------- /cypher/Typescript_Enrichment/Add_DEPENDS_ON_relationship_to_resolved_modules.cypher: -------------------------------------------------------------------------------- 1 | // Propagates "DEPENDS_ON" relations between modules to their resolved modules with a property "resolved:true". 2 | // Inspired by https://github.com/jQAssistant/jqassistant/blob/4cd7face5d6d2953449d8e6ff5b484f00ffbdc2f/plugin/java/src/main/resources/META-INF/jqassistant-rules/java-classpath.xml#L5 3 | 4 | MATCH (module:TS:Module)-[dependsOn:DEPENDS_ON]->(externalModule:TS:ExternalModule) 5 | MATCH (externalModule)-[:IS_IMPLEMENTED_IN]->(resolvedModule:TS:Module) 6 | WHERE module <> resolvedModule 7 | CALL { WITH module, dependsOn, resolvedModule 8 | MERGE (module)-[resolvedDependsOn:DEPENDS_ON]->(resolvedModule) 9 | ON CREATE SET resolvedDependsOn = dependsOn 10 | ,resolvedDependsOn.resolved = true 11 | } IN TRANSACTIONS 12 | RETURN count(*) as resolvedDependencies -------------------------------------------------------------------------------- /cypher/Typescript_Enrichment/Add_name_to_property_on_projects.cypher: -------------------------------------------------------------------------------- 1 | // Set name property on Typescript project nodes 2 | 3 | MATCH (project:TS:Project)-[:HAS_ROOT]->(root:Directory) 4 | OPTIONAL MATCH (project)-[:HAS_CONFIG]->(config:File)<-[:CONTAINS]-(config_dir:Directory) 5 | WITH * 6 | ,reverse(split(reverse(root.absoluteFileName), '/')[0]) AS projectNameFromRoot 7 | ,reverse(split(reverse(config_dir.absoluteFileName), '/')[0]) AS projectNameFromConfig 8 | ,nullif(substring(replace(config.name, 'tsconfig', ''), 1), '') AS projectAddOnFromConfig 9 | WITH * 10 | ,projectNameFromRoot + '/' + 11 | nullif(projectNameFromConfig, projectNameFromRoot) + 12 | coalesce(' (' + projectAddOnFromConfig + ')', '') AS projectNameWithDifferentConfigIfPresent 13 | WITH * 14 | ,coalesce(projectNameWithDifferentConfigIfPresent, projectNameFromRoot) AS projectName 15 | SET project.name = projectName 16 | RETURN count(*) AS numberOfNamesProjects 17 | // For debugging 18 | //RETURN projectNameFromRoot 19 | // ,projectNameFromConfig 20 | // ,projectNameWithDifferentConfigIfPresent 21 | // ,projectName 22 | // ,project, root, config 23 | //LIMIT 10 -------------------------------------------------------------------------------- /cypher/Typescript_Enrichment/Add_name_to_property_on_scan_nodes.cypher: -------------------------------------------------------------------------------- 1 | // Set name property on Typescript scan nodes 2 | 3 | MATCH (typescriptScan:TS:Scan) 4 | WITH typescriptScan 5 | ,reverse(split(reverse(split(typescriptScan.fileName, '/.reports/')[0]), '/')[0]) AS scanName 6 | SET typescriptScan.name = scanName 7 | RETURN count(*) AS numberOfNamesScans 8 | // Debugging 9 | //RETURN scanName, scanNameOld, typescriptScan.fileName -------------------------------------------------------------------------------- /cypher/Typescript_Enrichment/Add_namespace_property_on_nodes_from_linked_npm_packages.cypher: -------------------------------------------------------------------------------- 1 | // Add namespace property to Typescript nodes if a npm a package is linked. Requires Link_projects_to_npm_packages. 2 | 3 | MATCH (element:TS)<-[:CONTAINS]-(project:TS:Project)-[:HAS_NPM_PACKAGE]->(package:NPM:Package) 4 | WHERE element.globalFqn IS NOT NULL 5 | WITH * 6 | ,coalesce(nullif(split(package.name, '/')[0], package.name), '') AS npmPackageNamespace 7 | ,coalesce(split(package.name, '/')[1], package.name) AS packageName 8 | SET element.namespace = coalesce(nullif(element.namespace, ''), npmPackageNamespace) 9 | SET element.packageName = coalesce(nullif(element.packageName, ''), packageName) 10 | RETURN labels(element)[0..4] AS nodeLabels, count(*) AS numberOfWrittenNamespaceProperties 11 | // Debugging 12 | //RETURN element.globalFqn, element.moduleName, element.namespace 13 | // ,package.name, package.fileName 14 | // ,npmPackageNamespace 15 | // ,packageName 16 | //LIMIT 10 -------------------------------------------------------------------------------- /cypher/Typescript_Enrichment/Count_internal_modules_resolving_external_ones.cypher: -------------------------------------------------------------------------------- 1 | // How many internal modules resolve/represent external ones (for manual exploration)? 2 | 3 | MATCH (internal_module:TS:Module) 4 | WITH count(internal_module) AS totalNumberOfInternalModules 5 | ,collect(internal_module) AS internal_modules 6 | UNWIND internal_modules AS internal_module 7 | MATCH (external_module:TS:ExternalModule)-[:IS_IMPLEMENTED_IN]->(internal_module) 8 | WHERE NOT external_module.isNodeModule = true 9 | RETURN totalNumberOfInternalModules 10 | ,COUNT { (all_external_modules:TS:ExternalModule) 11 | WHERE NOT all_external_modules.isNodeModule = true} 12 | AS totalNumberOfExternalModules 13 | ,count(DISTINCT external_module) AS numberOfResolvedExternalModules 14 | ,collect(external_module.globalFqn + ' -> ' + internal_module.globalFqn)[0..4] AS exampleFullNames -------------------------------------------------------------------------------- /cypher/Typescript_Enrichment/Index_module_name.cypher: -------------------------------------------------------------------------------- 1 | // Create index for module name 2 | 3 | CREATE INDEX INDEX_MODULE_NAME IF NOT EXISTS FOR (module:TS) ON (module.moduleName) -------------------------------------------------------------------------------- /cypher/Typescript_Enrichment/Link_npm_dependencies_to_npm_packages.cypher: -------------------------------------------------------------------------------- 1 | // Link npm dependencies to the npm package that describe them if it exists 2 | 3 | MATCH (npm_dependency:NPM:Dependency) 4 | MATCH (npm_package:NPM:Package) 5 | WHERE npm_package.name = npm_dependency.name 6 | AND npm_package <> npm_dependency 7 | CALL { WITH npm_package, npm_dependency 8 | MERGE (npm_dependency)-[:IS_DESCRIBED_IN_NPM_PACKAGE]->(npm_package) 9 | } IN TRANSACTIONS 10 | RETURN count(*) AS numberOfWrittenRelationships 11 | ,count(DISTINCT npm_dependency) AS numberOfDistinctNpmDependencies 12 | ,count(DISTINCT npm_package) AS numberOfDistinctNpmPackages 13 | // Debugging 14 | // RETURN npm_dependency, npm_package 15 | // LIMIT 1 -------------------------------------------------------------------------------- /cypher/Typescript_Enrichment/Remove_duplicate_CONTAINS_relations_between_files.cypher: -------------------------------------------------------------------------------- 1 | // Remove duplicate CONTAINS relationships with the same properties between files 2 | 3 | MATCH (directory:File)-[contains_relation:CONTAINS]-(file:File) 4 | WITH directory 5 | ,file 6 | ,keys(contains_relation) AS contains_relation_property_names 7 | ,collect(DISTINCT contains_relation)[1..] AS contains_relations 8 | WHERE size(contains_relations) > 0 9 | UNWIND contains_relations AS contains_relation 10 | DELETE contains_relation 11 | RETURN count(*) 12 | // For Debugging 13 | // RETURN directory, file 14 | // LIMIT 10 -------------------------------------------------------------------------------- /cypher/Typescript_Enrichment/Verify_projects_linked_to_npm_packages.cypher: -------------------------------------------------------------------------------- 1 | // Verify that all Typescript projects are linked to npm packages 2 | 3 | MATCH (project:TS:Project) 4 | WITH count(project) AS totalProjectsCount 5 | ,collect(project) AS projects 6 | UNWIND projects AS project 7 | OPTIONAL MATCH (project)-[:HAS_NPM_PACKAGE]->(npm:NPM:Package) 8 | WITH totalProjectsCount 9 | ,count(npm) AS npmLinkedProjectsCount 10 | RETURN npmLinkedProjectsCount 11 | ,totalProjectsCount 12 | ,(totalProjectsCount - npmLinkedProjectsCount) AS unresolvedProjectsCount 13 | ,(100.0 / totalProjectsCount * npmLinkedProjectsCount) AS npmLinkedProjectsPercentage -------------------------------------------------------------------------------- /cypher/Validation/ValidateGitHistory.cypher: -------------------------------------------------------------------------------- 1 | // Check if there is at least one Git:Commit pointing to a Git:Change containing a Git:File from a Git:Repository 2 | 3 | MATCH (commit:Git:Commit)-[:CONTAINS_CHANGE]->(change:Git:Change)-->(file:Git:File) 4 | MATCH (repository:Git:Repository)-[:HAS_FILE]->(file) 5 | RETURN commit.sha AS commitSha 6 | LIMIT 1 -------------------------------------------------------------------------------- /cypher/Validation/ValidateJavaArtifactDependencies.cypher: -------------------------------------------------------------------------------- 1 | // Check if there is at least one Java Artifact dependency. 2 | 3 | MATCH (source:Java:Artifact:Archive)-[dependency:DEPENDS_ON]->(target:Java:Artifact:Archive) 4 | RETURN elementId(source) AS sourceElementId 5 | LIMIT 1 -------------------------------------------------------------------------------- /cypher/Validation/ValidateJavaExternalDependencies.cypher: -------------------------------------------------------------------------------- 1 | // Check if there is at least one external Java Type dependency. 2 | 3 | MATCH (source:Java:Package)-[:CONTAINS]->(type:Java:Type)-[:DEPENDS_ON]->(externalType:Java:ExternalType) 4 | RETURN elementId(source) AS sourceElementId 5 | LIMIT 1 -------------------------------------------------------------------------------- /cypher/Validation/ValidateJavaInternalDependencies.cypher: -------------------------------------------------------------------------------- 1 | // Check if there is at least one Java Artifact containing a Java Package with at least one Java Type. 2 | 3 | MATCH (source:Java:Artifact)-[:CONTAINS]->(package:Java:Package)-[:CONTAINS]->(type:Java:Type) 4 | RETURN elementId(source) AS sourceElementId 5 | LIMIT 1 -------------------------------------------------------------------------------- /cypher/Validation/ValidateJavaMethods.cypher: -------------------------------------------------------------------------------- 1 | // Check if there is at least one Java Method, its Type and an Artifact it belongs to. 2 | 3 | MATCH (source:Java:Artifact)-[:CONTAINS]->(type:Java:Type)-[:DECLARES]->(method:Java:Method) 4 | RETURN elementId(source) AS sourceElementId 5 | LIMIT 1 -------------------------------------------------------------------------------- /cypher/Validation/ValidateJavaPackageDependencies.cypher: -------------------------------------------------------------------------------- 1 | // Check if there is at least one Java Packagte dependency. 2 | 3 | MATCH (source:Java:Package)-[dependency:DEPENDS_ON]->(target:Java:Package) 4 | RETURN elementId(source) AS sourceElementId 5 | LIMIT 1 -------------------------------------------------------------------------------- /cypher/Validation/ValidateJavaTypes.cypher: -------------------------------------------------------------------------------- 1 | // Check if there is at least one Java Method, its Type and an Artifact it belongs to. 2 | 3 | MATCH (source:Java:Artifact)-[:CONTAINS]->(package:Java:Package)-[:CONTAINS]->(type:Java:Type) 4 | RETURN elementId(source) AS sourceElementId 5 | LIMIT 1 -------------------------------------------------------------------------------- /cypher/Validation/ValidateTypescriptModuleDependencies.cypher: -------------------------------------------------------------------------------- 1 | // Check if there is at least one Typescript Module dependency. 2 | 3 | MATCH (source:TS:Module)-[dependency:DEPENDS_ON]->(target:TS:Module) 4 | RETURN elementId(source) AS sourceElementId 5 | LIMIT 1 -------------------------------------------------------------------------------- /cypher/Visibility/Relative_visibility_exported_elements_to_all_elements_per_module_for_Typescript.cypher: -------------------------------------------------------------------------------- 1 | // Relative visibility: exported elements to all elements per module 2 | 3 | MATCH (project:Directory)<-[:HAS_ROOT]-(:Project)-[:CONTAINS]->(module:TS:Module) 4 | MATCH (module)-[:DECLARES]->(moduleElement:TS) 5 | // Check if element is not only declared but also exported. 6 | // Only EXPORTS refers to re-exported elements. 7 | OPTIONAL MATCH (module)-[export:EXPORTS]->(moduleElement) 8 | WITH project.absoluteFileName AS projectPath 9 | ,module 10 | ,count(DISTINCT export) AS exportedElements 11 | ,count(DISTINCT moduleElement) AS allElements 12 | WITH projectPath 13 | ,module 14 | ,exportedElements 15 | ,allElements 16 | ,toFloat(exportedElements) / allElements AS relativeVisibility 17 | RETURN projectPath 18 | ,replace(module.fileName, './', '') AS modulePath 19 | ,module.name AS moduleName 20 | ,exportedElements 21 | ,allElements 22 | ,relativeVisibility 23 | ORDER BY relativeVisibility DESC, allElements DESC, projectPath ASC, moduleName ASC -------------------------------------------------------------------------------- /cypher/Visibility/Relative_visibility_public_types_to_all_types_per_package.cypher: -------------------------------------------------------------------------------- 1 | // Relative visibility: public types to all types per package. Requires "Add_file_name and_extension.cypher". 2 | 3 | MATCH (artifact:Artifact)-[:CONTAINS]->(package:Package) 4 | MATCH (package)-[:CONTAINS]->(anyType:Type) 5 | OPTIONAL MATCH (package)-[:CONTAINS]->(publicType:Type{visibility:"public"}) 6 | WITH artifact.name AS artifactName 7 | ,package 8 | ,COUNT(DISTINCT publicType) AS publicTypes 9 | ,COUNT(DISTINCT anyType) AS allTypes 10 | WITH artifactName 11 | ,package 12 | ,publicTypes 13 | ,allTypes 14 | ,toFloat(publicTypes) / allTypes AS relativeVisibility 15 | RETURN artifactName 16 | ,package.fqn AS fullQualifiedPackageName 17 | ,package.name AS packageName 18 | ,publicTypes 19 | ,allTypes 20 | ,relativeVisibility 21 | ORDER BY relativeVisibility DESC, allTypes DESC, artifactName ASC, packageName ASC -------------------------------------------------------------------------------- /graph-visualization/.nvmrc: -------------------------------------------------------------------------------- 1 | 23.11.1 -------------------------------------------------------------------------------- /graph-visualization/DEPRECATED.md: -------------------------------------------------------------------------------- 1 | # Render Graph Visualizations (Deprecated) 2 | 3 | :warning: **This package is deprecated and might get removed in future.** :warning: 4 | 5 | Visualizations are now done using [GraphViz](https://graphviz.org). Please use the new script [visualizeQueryResults.sh](./../scripts/visualization/visualizeQueryResults.sh) like it is done in [InternalDependenciesVisualization.sh](./../scripts/reports/InternalDependenciesVisualization.sh) to create Graph Visualizations. 6 | -------------------------------------------------------------------------------- /graph-visualization/index.css: -------------------------------------------------------------------------------- 1 | div { 2 | width: 100vw; 3 | height: 100vh; 4 | } 5 | 6 | div.vis-tooltip { 7 | font-size: 4px; 8 | overflow-y: auto; 9 | } 10 | 11 | .indexedVisualization { 12 | margin-top: 10px; 13 | margin-left: 10px; 14 | width: 400vw; 15 | height: 400vh; 16 | display:inline-block; 17 | } 18 | 19 | .indexedVisualization.visualization-finished { 20 | border-width: 1px; 21 | border-style: solid; 22 | border-color: lightgreen; 23 | } 24 | 25 | .indexedVisualization:not(.visualization-finished) { 26 | border-width: 2px; 27 | border-style: dotted; 28 | border-color: orange; 29 | } 30 | 31 | .indexedVisualization.visualization-finished.visualization-failed { 32 | height: 6em; 33 | border-width: 2px; 34 | border-style: solid; 35 | border-color: red; 36 | } 37 | -------------------------------------------------------------------------------- /graph-visualization/java-artifact-dependencies/graphVisualizationJavaArtifactDependencies.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Java Artifact Dependencies Graph Visualization with neovis.js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /graph-visualization/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "code-structure-graph-visualization", 3 | "version": "0.9.0", 4 | "description": "Visualizes code structure as a graph and provides a script to export it as an image", 5 | "main": "renderVisualization.js", 6 | "type": "module", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "author": "JohT", 11 | "license": "MIT", 12 | "dependencies": { 13 | "glob": "11.0.2", 14 | "jimp": "1.6.0", 15 | "neovis.js": "2.1.0", 16 | "puppeteer": "24.10.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /graph-visualization/typescript-module-dependencies/graphVisualizationTypescriptModuleDependencies.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Typescript Module Dependencies Graph Visualization with neovis.js 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /graph-visualization/vis-configuration-presets.js: -------------------------------------------------------------------------------- 1 | function hierarchicalHexagons() { 2 | return { 3 | nodes: { 4 | shape: "hexagon", 5 | shadow: false, 6 | font: { 7 | strokeWidth: 4, 8 | strokeColor: "#F2F2FF", 9 | size: 11, 10 | }, 11 | size: 22, 12 | widthConstraint: { 13 | maximum: 60, 14 | }, 15 | }, 16 | edges: { 17 | arrows: { 18 | to: { 19 | enabled: true, 20 | scaleFactor: 0.5, 21 | }, 22 | }, 23 | scaling: { 24 | max: 8, 25 | }, 26 | }, 27 | physics: { 28 | hierarchicalRepulsion: { 29 | nodeDistance: 200, // 100 30 | centralGravity: 0.5, // 0.2 31 | springLength: 200, // 200 32 | springConstant: 0.06, // 0.05 33 | damping: 0.09, // 0.09 34 | avoidOverlap: 1, // 0 35 | }, 36 | solver: "hierarchicalRepulsion", // barnesHut 37 | }, 38 | layout: { 39 | hierarchical: { 40 | enabled: true, 41 | sortMethod: "directed", 42 | }, 43 | }, 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /images/DALL-E-Mini-Graph-Pipeline-Logo-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohT/code-graph-analysis-pipeline/13f2ea3c8d6b13c07e4b1d56b52445382f099a34/images/DALL-E-Mini-Graph-Pipeline-Logo-2.png -------------------------------------------------------------------------------- /images/DALL-E-Mini-Graph-Pipeline-Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohT/code-graph-analysis-pipeline/13f2ea3c8d6b13c07e4b1d56b52445382f099a34/images/DALL-E-Mini-Graph-Pipeline-Logo.png -------------------------------------------------------------------------------- /jupyter/environment.yml: -------------------------------------------------------------------------------- 1 | name: codegraph 2 | channels: 3 | - conda-forge/label/python_rc # Needed on Mac since Python >= 3.12 4 | - plotly 5 | - conda-forge 6 | dependencies: 7 | - python=3.12.* 8 | - _python_rc=* # Needed on Mac since Python >= 3.12 9 | - jupyter=1.1.* 10 | - matplotlib=3.10.* 11 | - nbconvert=7.16.* 12 | - nbconvert-webpdf=7.16.* 13 | - numpy=1.26.* 14 | - pandas=2.2.* 15 | - pip=25.0.* 16 | - setuptools=75.8.* # opentsne uses sklearn.base uses joblib uses distutils missing in Python >= 12 (TODO use native openTSNE?) 17 | - typing-extensions=4.12.* # Also needed for opentsne and Python >= 3.12 18 | - opentsne=1.0.* # to visualize node embeddings in 2D (t-SNE dimensionality reduction) 19 | - wordcloud=1.9.* 20 | - monotonic=1.* 21 | - plotly=6.0.* 22 | - python-kaleido=0.2.* # To render plotly plots. Static image export for web-based visualization libraries. 23 | - pip: 24 | - neo4j==5.23.* -------------------------------------------------------------------------------- /markdown-lint-check-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignorePatterns": [ 3 | { 4 | "pattern": "^http://localhost" 5 | } 6 | ], 7 | "timeout": "30s", 8 | "retryOn429": true, 9 | "retryCount": 3, 10 | "fallbackRetryDelay": "60s", 11 | "aliveStatusCodes": [200, 202, 206] 12 | } -------------------------------------------------------------------------------- /scripts/configuration/template-neo4j-low-memory.conf: -------------------------------------------------------------------------------- 1 | 2 | # The following static configuration entries were taken from "template-neo4j.conf". 3 | 4 | # List of procedures and user defined functions that are allowed 5 | # full access to the database through unsupported/insecure internal APIs. 6 | dbms.security.procedures.unrestricted=apoc.*,gds.* 7 | 8 | # Memory: Java Heap Size 9 | server.memory.heap.initial_size=4g 10 | server.memory.heap.max_size=4g 11 | 12 | # Memory: The amount of memory to use for mapping the store files. 13 | server.memory.pagecache.size=1g 14 | 15 | # Memory: Exits JVM on the first occurrence of an out-of-memory error. 16 | server.jvm.additional=-XX:+ExitOnOutOfMemoryError 17 | 18 | # Memory: Limit the amount of memory that all of the running transaction can consume. 19 | db.memory.transaction.total.max=3g 20 | 21 | # Memory: Limit the amount of memory that a single transaction can consume. 22 | db.memory.transaction.max=3g 23 | 24 | # Transaction: Retention policy for transaction logs needed to perform recovery and backups. 25 | db.tx_log.rotation.retention_policy=keep_none -------------------------------------------------------------------------------- /scripts/configuration/template-neo4j-v4-low-memory.conf: -------------------------------------------------------------------------------- 1 | 2 | # The following static configuration entries were taken from "template-neo4j.conf". 3 | 4 | # List of procedures and user defined functions that are allowed 5 | # full access to the database through unsupported/insecure internal APIs. 6 | dbms.security.procedures.unrestricted=apoc.*,gds.* 7 | 8 | # Memory: Java Heap Size 9 | dbms.memory.heap.initial_size=4g 10 | dbms.memory.heap.max_size=4g 11 | 12 | # Memory: The amount of memory to use for mapping the store files. 13 | dbms.memory.pagecache.size=1g 14 | 15 | # Memory: Exits JVM on the first occurrence of an out-of-memory error. 16 | dbms.jvm.additional=-XX:+ExitOnOutOfMemoryError 17 | 18 | # Memory: Limit the amount of memory that all of the running transaction can consume. 19 | dbms.memory.transaction.global_max_size=3g 20 | 21 | # Memory: Limit the amount of memory that a single transaction can consume. 22 | dbms.memory.transaction.max_size=3g 23 | 24 | # Transaction: Retention policy for transaction logs needed to perform recovery and backups. 25 | dbms.tx_log.rotation.retention_policy=keep_none -------------------------------------------------------------------------------- /scripts/configuration/template-neo4j-v4.conf: -------------------------------------------------------------------------------- 1 | 2 | # The following static configuration entries were taken from "template-neo4j.conf". 3 | 4 | # List of procedures and user defined functions that are allowed 5 | # full access to the database through unsupported/insecure internal APIs. 6 | dbms.security.procedures.unrestricted=apoc.*,gds.* 7 | 8 | # Memory: Java Heap Size 9 | dbms.memory.heap.initial_size=8g 10 | dbms.memory.heap.max_size=8g 11 | 12 | # Memory: The amount of memory to use for mapping the store files. 13 | dbms.memory.pagecache.size=2g 14 | 15 | # Memory: Exits JVM on the first occurrence of an out-of-memory error. 16 | dbms.jvm.additional=-XX:+ExitOnOutOfMemoryError 17 | 18 | # Memory: Limit the amount of memory that all of the running transaction can consume. 19 | dbms.memory.transaction.global_max_size=6g 20 | 21 | # Memory: Limit the amount of memory that a single transaction can consume. 22 | dbms.memory.transaction.max_size=6g 23 | 24 | # Transaction: Retention policy for transaction logs needed to perform recovery and backups. 25 | dbms.tx_log.rotation.retention_policy=keep_none -------------------------------------------------------------------------------- /scripts/configuration/template-neo4j.conf: -------------------------------------------------------------------------------- 1 | 2 | # The following static configuration entries were taken from "template-neo4j.conf". 3 | 4 | # List of procedures and user defined functions that are allowed 5 | # full access to the database through unsupported/insecure internal APIs. 6 | dbms.security.procedures.unrestricted=apoc.*,gds.* 7 | 8 | # Memory: Java Heap Size 9 | server.memory.heap.initial_size=8g 10 | server.memory.heap.max_size=8g 11 | 12 | # Memory: The amount of memory to use for mapping the store files. 13 | server.memory.pagecache.size=2g 14 | 15 | # Memory: Exits JVM on the first occurrence of an out-of-memory error. 16 | server.jvm.additional=-XX:+ExitOnOutOfMemoryError 17 | 18 | # Memory: Limit the amount of memory that all of the running transaction can consume. 19 | db.memory.transaction.total.max=6g 20 | 21 | # Memory: Limit the amount of memory that a single transaction can consume. 22 | db.memory.transaction.max=6g 23 | 24 | # Transaction: Retention policy for transaction logs needed to perform recovery and backups. 25 | db.tx_log.rotation.retention_policy=keep_none -------------------------------------------------------------------------------- /scripts/profiles/Default.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Sets (if any) settings variables for a default analysis. 4 | # The chosen settings are tested to be compatible and working. -------------------------------------------------------------------------------- /scripts/visualization/templates/default.template.gv: -------------------------------------------------------------------------------- 1 | // This is a GraphViz dot template file for the visualization of a graph in lightblue color scheme. 2 | // The main part of the template is marked by the comments "Begin-Template" and "End-Template". 3 | // It also contains a simple example graph. 4 | // 5 | strict digraph lightblue_template { 6 | //Begin-Template 7 | fontname = "Helvetica,Arial,sans-serif"; 8 | node [fontname = "Helvetica,Arial,sans-serif";]; 9 | edge [fontname = "Helvetica,Arial,sans-serif"; fontsize = 10;]; 10 | node [style = filled; fillcolor = "0.560 0.400 0.999";]; 11 | node [color = "0.560 0.900 0.700";]; 12 | edge [color = "0.560 0.900 0.700";]; 13 | //End-Template 14 | "A" -> "B" [penwidth = 1.0; label = 1;]; 15 | "A" -> "C" [penwidth = 3.0; label = 4;]; 16 | "B" -> "V" [penwidth = 2.0; label = 2;]; 17 | } --------------------------------------------------------------------------------