Java codebase knowledge graph pipeline. Load when building graphs from Java source code for learning — mapping class hierarchies, dependencies, package relationships, and design patterns as CanonicalEnvelope data.
Builds a CanonicalEnvelope knowledge graph from Java source code. The graph visualizes class hierarchies, package relationships, and design patterns using the same Stalin/Teacher rendering modes as the book graph system.
| Graph concept | Java source |
|---|---|
id | Fully-qualified class name slug (e.g. java-util-arraylist) |
label | Simple class name (ArrayList) |
faction | Package group (java.util, java.io, custom domain) |
centrality | Importance: number of inbound dependencies + inheritance depth |
bio | Javadoc summary or inferred purpose |
introducedChapter |
| Module/lesson where this class is first taught |
educationalNote | Pedagogical callout: why this class matters, common mistake to avoid |
conceptTags | e.g. ['collections', 'generics', 'iterator-pattern'] |
| Graph concept | Java relationship |
|---|---|
type | extends, implements, uses, creates, calls, annotated_by |
description | Human-readable relationship ("ArrayList extends AbstractList") |
weight | Coupling strength (0.1–1.0) |
In book mode, confirmedChapter gates what the reader has seen. In Java learning mode:
confirmedChapter → confirmed learning module numberintroducedChapter → the module where this class/concept is first taught| Ladder rung | Java equivalent |
|---|---|
| Characters | Classes and interfaces: what are they, what do they do |
| Relationships | Inheritance, composition, dependency injection |
| Events | Method calls, lifecycle hooks, exception flow |
| Patterns | GoF patterns, SOLID violations, recurring anti-patterns |
| Themes | Design philosophy: why Java chose this approach |
| Context | JVM internals, JDK evolution, ecosystem tradeoffs |
| Structure | How the standard library is organized |
| Mode | Faction = | Level = | Use for |
|---|---|---|---|
| Stalin | Package | dependency count | Dependency/architecture overview |
| Teacher | Domain | concept maturity | Pedagogical concept map |
| Bulow | — | inheritance depth | Class hierarchy visualization |
Static analysis only — no runtime needed:
import javalang # or tree-sitter-java
for java_file in source_files:
tree = javalang.parse.parse(source)
# class/interface declaration → node
# extends/implements → EXTENDS/IMPLEMENTS edges
# field type declarations → USES edges
# method parameter/return types → CALLS edges
# @Annotation usage → ANNOTATED_BY edges
# package prefix → faction
# in-degree count → centrality
{
"id": "java-util-arraylist",
"label": "ArrayList",
"faction": "java.util",
"centrality": 18,
"bio": "Resizable array implementation of the List interface. Not synchronized.",
"introducedChapter": 3,
"educationalNote": "ArrayList vs LinkedList: ArrayList has O(1) random access; LinkedList has O(1) insertion at head/tail.",
"conceptTags": ["collections", "generics", "dynamic-array"]
}
CanonicalNode and CanonicalEdge schemas defined in /graph-schemas skilljavalang for Java AST; tree-sitter for multi-language support/graph-schemas skill