Prompt file imported from JohT/code-graph-analysis-pipeline (
.github/prompts/plan-java.prompt.md). Copyright stays with the author.
Plan: Introduce java Domain
Vertical-slice the existing Java analysis (currently spread across cypher/Java/, cypher/Artifact_Dependencies/, cypher/Overview/, and legacy report scripts) into a self-contained domains/java/ domain. Model on domains/git-history/ with four entry points: two CSV scripts, Python SVG charts, and Markdown summary. domains/java/ as self-contained as possible.
Target Directory Structure
domains/java/
├── README.md
├── PREREQUISITES.md
├── COPIED_FILES.md
├── javaCsv.sh # *Csv.sh: Java code quality CSV reports
├── artifactDependenciesCsv.sh # *Csv.sh: Artifact dependency CSV reports
├── javaPython.sh # *Python.sh: SVG charts
├── javaMarkdown.sh # *Markdown.sh: Markdown summary
├── javaCharts.py # Chart generation
├── explore/
│ └── MethodMetricsJavaExploration.ipynb
├── queries/
│ ├── enrichment/ (6 files)
│ ├── java-code-quality/ (8 files)
│ ├── artifact-dependencies/ (5 files)
│ ├── method-metrics/ (3 files)
│ ├── exploration/ (2 files)
│ └── validation/ (6 files)
└── summary/
├── javaSummary.sh
├── report.template.md
└── report_no_java_data.template.md
Phase 1 — Scaffolding & Documentation (all parallel)
- Create directory tree:
domains/java/, subdirsqueries/enrichment/,queries/java-code-quality/,queries/artifact-dependencies/,queries/method-metrics/,queries/exploration/,queries/validation/,explore/,summary/ - Create
README.md— overview, entry-points table, folder structure (mirrordomains/git-history/README.mdformat) - Create
PREREQUISITES.mdskeleton — filled out fully in Phase 7 - Create
COPIED_FILES.mdskeleton — finalized in Phase 7 - Update
AGENTS.md— addjavato the domains list
Phase 2 — Copy Cypher Queries (all parallel)
-
queries/enrichment/— 6 files:- From
cypher/Artifact_Dependencies/:Set_number_of_Java_packages_and_types_on_artifacts.cypher,Incoming_Java_Artifact_Dependencies.cypher,Outgoing_Java_Artifact_Dependencies.cypher,Set_maven_artifact_version.cypher - From
cypher/Java/:Label_external_types_and_annotations.cypher,Remove_external_type_and_annotation_labels.cypher
- From
-
queries/java-code-quality/— 8 files fromcypher/Java/:Java_Reflection_usage.cypherJava_Reflection_usage_detailed.cypherJava_deprecated_element_usage.cypherJava_deprecated_element_usage_detailed.cypherAnnotated_code_elements.cypherAnnotated_code_elements_per_artifact.cypherSpring_Web_Request_Annotations.cypherJakartaEE_REST_Annotations.cypher
-
queries/artifact-dependencies/— 5 files fromcypher/Artifact_Dependencies/:Most_used_internal_dependencies_acreoss_artifacts.cypherArtifacts_with_dependencies_to_other_artifacts.cypherArtifacts_with_duplicate_packages.cypherUsage_and_spread_of_internal_artifact_dependencies.cypherUsage_and_spread_of_internal_artifact_dependents.cypher
-
queries/method-metrics/— 3 files fromcypher/Overview/:Effective_Method_Line_Count_Distribution.cypherEffective_lines_of_method_code_per_type.cypherEffective_lines_of_method_code_per_package.cypher
-
queries/exploration/— 2 files fromcypher/Java/:JakartaEE_REST_Annotations_Nodes.cypherGet_all_declared_and_inherited_methods_of_a_type.cypher
-
queries/validation/— 6 files fromcypher/Validation/:ValidateJavaArtifactDependencies.cypherValidateJavaExternalDependencies.cypherValidateJavaInternalDependencies.cypherValidateJavaMethods.cypherValidateJavaPackageDependencies.cypherValidateJavaTypes.cypher
Total copied queries: 30 Cypher files
Phase 3 — CSV Entry Point Scripts (depends on Phase 2)
- Create
javaCsv.sh— modeled ondomains/git-history/gitHistoryCsv.sh. Execution order:- Enrichment (no CSV output):
queries/enrichment/Label_external_types_and_annotations.cypher - Code quality (→
reports/java/):Java_Reflection_usage.cypher→ReflectionUsage.csvJava_Reflection_usage_detailed.cypher→ReflectionUsageDetailed.csvJava_deprecated_element_usage.cypher→DeprecatedElementUsage.csvJava_deprecated_element_usage_detailed.cypher→DeprecatedElementUsageDetailed.csvAnnotated_code_elements.cypher→AnnotatedCodeElements.csvAnnotated_code_elements_per_artifact.cypher→AnnotatedCodeElementsPerArtifact.csvSpring_Web_Request_Annotations.cypher→SpringWebRequestAnnotations.csvJakartaEE_REST_Annotations.cypher→JakartaEE_REST_Annotations.csv
- Method metrics (→
reports/java/):Effective_Method_Line_Count_Distribution.cypher→EffectiveMethodLineCountDistribution.csvEffective_lines_of_method_code_per_type.cypher→EffectiveLinesOfMethodCodePerType.csvEffective_lines_of_method_code_per_package.cypher→EffectiveLinesOfMethodCodePerPackage.csv
- Cleanup empty files
- Enrichment (no CSV output):
- Create
artifactDependenciesCsv.sh— modeled onscripts/reports/ArtifactDependenciesCsv.shadapted for domain structure. Execution order:- Enrichment (no CSV output):
queries/enrichment/Set_number_of_Java_packages_and_types_on_artifacts.cypherqueries/enrichment/Incoming_Java_Artifact_Dependencies.cypherqueries/enrichment/Outgoing_Java_Artifact_Dependencies.cypherqueries/enrichment/Set_maven_artifact_version.cypher
- Statistics (→
reports/java/):Most_used_internal_dependencies_acreoss_artifacts.cypher→MostUsedDependenciesAcrossArtifacts.csvArtifacts_with_dependencies_to_other_artifacts.cypher→DependenciesAcrossArtifacts.csvArtifacts_with_duplicate_packages.cypher→DuplicatePackageNamesAcrossArtifacts.csvUsage_and_spread_of_internal_artifact_dependencies.cypher→InternalArtifactUsageSpreadPerDependency.csvUsage_and_spread_of_internal_artifact_dependents.cypher→InternalArtifactUsageSpreadPerDependent.csv
- Cleanup empty files
- Enrichment (no CSV output):
Phase 4 — Python Charts (depends on Phase 3)
-
Create
javaCharts.py— modeled ondomains/git-history/gitHistoryCharts.py. Parameters:--report_directory(required),--verbose(optional). Generates ~14 SVGs inreports/java/. Exits code 0 gracefully if no CSVs found.Charts:
- Artifact dependencies: most used by packages/types (×2), top artifacts by in/out degree (×2), spread per dependency/dependent (×2)
- Method metrics: LOC distribution histogram, top types by LOC, top packages by complexity (×3)
- Code quality: annotation type distribution, deprecated usage by element type, annotated elements per artifact (×3)
- Framework annotations: Spring endpoints by HTTP method, Jakarta EE endpoints (×2)
-
Create
javaPython.sh— modeled ondomains/git-history/gitHistoryPython.sh. Auto-invokesjavaCsv.sh+artifactDependenciesCsv.shif CSVs missing. Graceful exit (code 0) if no Java data.
Phase 5 — Exploration Notebook (parallel with Phase 4)
- Copy
jupyter/MethodMetricsJava.ipynb→explore/MethodMetricsJavaExploration.ipynbwith three changes:- Add notebook metadata:
"code_graph_analysis_pipeline_data_validation": "ValidateAlwaysFalse"(prevents auto-execution — seedomains/anomaly-detection/explore/AnomalyDetectionExploration.ipynb) - Update title in first markdown cell to add "Exploration" (e.g. "Method Metrics Exploration for Java")
- Update Cypher file paths:
../../cypher/Overview/*.cypher→../queries/method-metrics/*.cypher
- Add notebook metadata:
Phase 6 — Markdown Summary (depends on Phases 3 & 4)
- Create
summary/javaSummary.sh— modeled ondomains/git-history/summary/gitHistorySummary.sh. Functions:java_front_matter()— YAML front matter (date, version, dataset)include_svg_if_exists()/include_svgs_matching()— SVG embed helperslimit_markdown_table()— caps tables to 10 rowscypher_table()— run query + format as Markdown tablecsv_link()— append CSV download linkassemble_java_report()— orchestrates all sections, createsincludes/subdir, embeds viaembedMarkdownIncludes.sh
- Create
summary/report.template.md— 7 sections using<!-- include:filename.md|fallback.md -->pattern:- Overview — reading guide
- Artifact Dependencies — most used, dependency graph, spread, duplicate packages
- Method Metrics — line count distribution, LOC per type, LOC per package
- Java Code Quality — reflection usage, deprecated element usage
- Annotated Elements — by type, per artifact
- Web Framework Annotations — Spring Web, Jakarta EE REST
- Glossary
- Create
summary/report_no_java_data.template.md— fallback:⚠️ _No data available — no Java artifacts found in the graph database._ - Create
javaMarkdown.sh— simple delegator tosummary/javaSummary.sh(mirrordomains/git-history/gitHistoryMarkdown.sh)
Phase 7 — Finalize Documentation (depends on all prior phases)
- Complete
PREREQUISITES.md:- Neo4j Running with scanned Java artifacts
- jQAssistant scan completed — creates
Java:Artifact,Java:Package,Type,Method,Field,Parameternodes - Central enrichment prerequisite:
cypher/General_Enrichment/Add_file_name_and_extension.cyphermust run before this domain (providesname,extensionproperties used by artifact dependency and method metrics queries; not copied — referenced as prerequisite) - Own enrichment — run automatically by entry point scripts:
Set_number_of_Java_packages_and_types_on_artifacts.cypher— setsnumberOfPackages,numberOfTypesonArtifactIncoming_Java_Artifact_Dependencies.cypher— setsincomingDependencies,incomingDependenciesWeightOutgoing_Java_Artifact_Dependencies.cypher— setsoutgoingDependencies,outgoingDependenciesWeightSet_maven_artifact_version.cypher— setsversionon Maven artifactsLabel_external_types_and_annotations.cypher— labelsExternalType,ExternalAnnotation(requiresbyteCodeVersionproperty set by jQAssistant)
- Central scripts sourced (not copied):
scripts/executeQueryFunctions.sh—execute_cypher()functionscripts/cleanupAfterReportGeneration.sh— delete empty CSVsscripts/markdown/embedMarkdownIncludes.sh— Markdown assembly
- Graceful degradation: If no Java artifacts present, all queries return empty; cleanup removes directory; Markdown renders fallback template.
- Complete
COPIED_FILES.md— full mapping table (30 Cypher files + 1 notebook). Breaking-change notice: output dirs change fromreports/java-csv/andreports/artifact-dependencies-csv/→reports/java/; major version bump required when originals are eventually removed. - Finalize
README.md— add actual output file list, link to PREREQUISITES.md and COPIED_FILES.md
Relevant Files
domains/git-history/gitHistoryCsv.sh— CSV entry point referencedomains/git-history/gitHistoryPython.sh— Python entry point referencedomains/git-history/gitHistoryCharts.py— charts script referencedomains/git-history/gitHistoryMarkdown.sh— Markdown entry point referencedomains/git-history/summary/gitHistorySummary.sh— summary assembly referencedomains/git-history/summary/report.template.md— report template referencedomains/git-history/PREREQUISITES.md— prerequisites doc referencedomains/git-history/COPIED_FILES.md— copied-files doc referencedomains/anomaly-detection/explore/AnomalyDetectionExploration.ipynb—ValidateAlwaysFalsemetadata referencescripts/reports/JavaCsv.sh— original script (kept, not deleted)scripts/reports/ArtifactDependenciesCsv.sh— original script (kept, not deleted)cypher/Java/— 12 source Cypher files (8 code quality + 2 enrichment + 2 exploration)cypher/Artifact_Dependencies/— 9 source files (4 enrichment + 5 statistics)cypher/Overview/— 3 Java-specific method metrics queriescypher/Validation/— 6 Java-specific validation queriesjupyter/MethodMetricsJava.ipynb— source for explore notebookAGENTS.md— update domains list
Verification
-
shellcheck domains/java/javaCsv.sh domains/java/artifactDependenciesCsv.sh domains/java/javaPython.sh domains/java/javaMarkdown.sh domains/java/summary/javaSummary.sh - Pylance type checking on
domains/java/javaCharts.py -
analyze.sh --domain java --report Csv --keep-running— verifyreports/java/has 11 CSVs fromjavaCsv.sh+ 5 fromartifactDependenciesCsv.sh -
analyze.sh --domain java --report Python --keep-running— verify ~14 SVGs inreports/java/ -
analyze.sh --domain java --report Markdown --keep-running— verifyreports/java/java_report.mdrenders all sections -
npx --yes markdown-link-check --quiet --progress --config=markdown-lint-check-config.json domains/java/README.md domains/java/PREREQUISITES.md - Verify
explore/MethodMetricsJavaExploration.ipynbhasValidateAlwaysFalsein notebook metadata
Decisions & Assumptions
- Typo in prompt resolved: "ArtifactDependenciesCsv.sh" was listed twice; interpreted as
JavaCsv.sh+ArtifactDependenciesCsv.sh - Notebook scope: Only
MethodMetricsJava.ipynb— the solejupyter/notebook with no TypeScript counterpart - Two CSV entry points:
javaCsv.sh(code quality + method metrics) andartifactDependenciesCsv.sh(artifact analysis) — separated by concern - Output directory:
reports/java/for both (breaking change from legacy scripts; documented in COPIED_FILES.md) - No Visualization entry point: No GraphViz graphs planned for this domain
- Validation queries not auto-run: Placed in
queries/validation/for manual verification use only - Scope exclusion:
cypher/Metrics/OO design metrics andcypher/Visibility/visibility metrics excluded — TypeScript variants exist and are already covered byinternal-dependenciesdomain cypher/Artifact_Dependencies/is Java-only: No TypeScript equivalents exist in that directory- No move/delete: Original
scripts/reports/JavaCsv.shandArtifactDependenciesCsv.shremain untouched (copy only)