Edges
The single relationship concept. Every dependency the model holds is an edge from one entity to another, of one kind out of a closed vocabulary of eleven, grouped here in four families by what they connect.
The diagram is a map of this page: an edge has exactly one kind, so at most one of a family’s, and exactly one provenance — a dashed one is an inference. The red dot marks import, the first-class layer.
Attributes
Every edge, regardless of kind, carries:
| Attribute | Type | Required | Meaning |
|---|---|---|---|
edge | EdgeKind | yes | discriminant, see Edge kinds |
from | EntityId | yes | source |
to | EntityId | yes | primary target (best candidate if uncertain) |
provenance | Provenance | yes | how we know |
anchor | SourceAnchor | yes | where observed |
candidates | EntityId[] | no | possible targets when dispatch is uncertain; non-empty iff resolution was ambiguous |
sourceFile | string | no | disambiguates which declaration site produced the edge (C# partial classes, TS declaration merging) |
Relations: edges connect entities; are licensed per language profile (a profile lists which edge kinds its extractor can emit); carry a SourceAnchor and a Provenance.
Rules
- Outgoing only, stored once. All inverse views — callers of X, subtypes of Y, importers of M, and
children(the inverse ofparent) — are derived in memory, never serialized. Onlyparentis a stored fact. - Closure:
fromandtomust resolve to a known entity or a stub — a tested property of every model. - No self-reference:
from ≠ to.
The member of a stub
An invocation, access or reference edge whose to is a stub may carry member: string — the name of the member it reaches, as written at the site, in the spelling the language profile states: Elixir insert/2 (arity is identity there), Java save (the simple name; an external method’s parameter types would need a classpath). So Repo.insert/2 and Repo.get/2 are two edges to one stub, and :ets.lookup is told from :ets.delete.
- It is a string, never an id: no entity is made for the member, and closure is untouched.
- It is legal nowhere else. On another kind it is refused; on an edge to a corpus entity
codegraph validatereports it (rulemember) — a corpus member is an entity, and the edge points at it. - It is part of the edge, not of any entity’s identity: two calls on one line to two members of one stub are two edges.
codegraph validatesays how far an extractor names them:members named: N of M edges to stubs. In SQL it isedge.memberand thedepview’smembercolumn; a JSON selector takes"member": GLOBon anedgeoredgeInterm.
The navigator’s dependency rows also say “member” — there it is the corpus entity a row reaches, a different thing.
The receiver of an access
An access edge may carry receiver: "self" | "other" (contract 1.2.0): self when the field is reached through the accessor’s own receiver, written (this.lines) or implied (lines); other through any other expression (other.lines). Absent when the target has no receiver (a static field, a local) or when the extractor does not say.
- It is legal on
accessonly, and only when the target is not a stub: a stub has no members, so nothing says the field reached needs an instance.codegraph validatereports one that is (rulereceiver). - It is part of the edge:
this.lines = other.linesis aselfwrite and anotherread at one site — two edges, ordered aftermember, absent first. - In SQL it is
edge.receiverand thedepview’sreceivercolumn. No extractor writes it yet; the Java extractor is next.
Edge kinds
Four families, by what an edge connects. Extra attributes are the keys a kind adds to the ones every edge carries.
Modularity
| Kind | From → To | Extra attributes | Notes |
|---|---|---|---|
import | Module → Module | First-class layer: the only relation reliable ≈100% across all languages, hence the granularity for cross-language comparison. Rust has two levels (mod, crate) | |
fileInclude | CodeFile → CodeFile | PHP include/require — the only file-to-file dependency in the metamodel |
Types
| Kind | From → To | Extra attributes | Notes |
|---|---|---|---|
inheritance | Type → Type | N edges for multiple inheritance (Python); optional MRO order left to profile notes | |
interfaceImplementation | Type → Type (interface/trait/protocol) | declared (Java implements) or derived (Go, TS structural) depending on language. For Rust/Clojure the anchor is the reified impl block | |
embedding | Type → Type | Go struct { Base } — neither inheritance nor attribute (method promotion); dedicated relation | |
traitUsage | Type → Trait (PHP), Type → mixin module (Ruby) | PHP use TraitX;, Ruby include/extend/prepend — kept as a usage edge, never flattened into the class |
Behavior
| Kind | From → To | Extra attributes | Notes |
|---|---|---|---|
invocation | Invocable → Invocable | candidates, member (to a stub) | uncertain dispatch → provenance: dynamic-candidate + candidates list |
access | Invocable → Structural | isRead: bool, isWrite: bool, member (to a stub), receiver (not to a stub) | field/variable reads and writes; a compound assignment sets both |
throws | Invocable → Type (exception) | a written throw statement whose static exception type resolved; the anchor is the throw SITE. A declared propagation clause (Java throws E) is a plain reference, not this |
References
| Kind | From → To | Extra attributes | Notes |
|---|---|---|---|
reference | Entity → Type | member (to a stub) | type usage that is none of the above (declarations, generics, casts) |
annotationUse | Entity → Type (annotation) | arguments: NamedArgument[] | a written annotation on any entity, with its arguments. The dedicated kind carries the values and lets a consumer select annotation usages without guessing from the target’s kind — which a stub target cannot answer |
The closed vocabulary
Eleven names, in the order the header dictionary’s enum declares them:
import · inheritance · interfaceImplementation · invocation · access · reference · embedding · traitUsage · fileInclude · annotationUse · throws
The keys each edge carries on the wire are listed under model.jsonl.
Folded edges
Analyses do not read base edges directly: the analyzer folds them to --level module or --level type first, aggregating every base edge between two folded nodes into one arrow that carries the count, the set of base kinds and the set of provenances. A folded arrow is an inference about a group, not a written fact; what it aggregates is stated in every rendering.