codegraph dataop prints a model as a Specy Data & Operation model
(.dataop): what data exists, what operations exist over it, and what each
operation depends on, reads, writes and raises. The text is at Specy's
observed conformance level, the one its metamodel reserves for a model
"lowered from a code graph". The design is PLAN.md §26; the target language is
Specy's DATA-OPERATION-METAMODEL.md and data-operation.ebnf.
Status (M25): the lowering and the command, for every extractor's model. Type expressions and receivers are emitted by the Java extractor only; the other languages lower through the fallback stated below. Flows, contracts, states, descriptions and lineage are not written (§5).
The lowering states what the model holds and nothing else. Where the model
does not hold a fact, the text says so in the form Specy gives it (opaque,
?, a // FINDING:), and never guesses. It is a projection: nothing reads it
back, and nothing of it enters model.jsonl.
./bin/codegraph-java --src src/main/java --out model.jsonl
./bin/codegraph dataop model.jsonl --out model.dataop
./bin/codegraph dataop model.jsonl --name petclinic --boundaries plugin/references/stacks/spring.json
./bin/codegraph dataop model.jsonl --scope 'module:org.acme.billing' # one module; the rest becomes external--out FILEwrites the text there; without it, stdout carries the text and nothing else.--name NAMEnames the model (default: the last segment of the model's root, kebab-case).--boundaries FILEtakes acodegraph.boundaries/1file or a stack table (docs/boundaries.md) and marks entry points (§3).--scope SEL(repeatable) lowers only the modules a selector matches; every corpus declaration outside it becomes anexternalone.
stderr carries a summary: what was lowered, how many types are opaque, how
many nameless invocables were folded, and every invocation, access and
throws edge that was not declared, by reason. The command reads the
.jsonl, never model.db: the contract version in the header decides how a
missing receiver marker is read (§4).
| In the model | In the .dataop |
|---|---|
| a module the corpus declares | module |
| a stub module or type the text references | external module, external struct |
| a named type | struct; a nested type keeps its path as one quoted name (@"Basket.Line") |
| a field with a receiver | a schema field; the fields of corpus supertypes are flattened in, each with its own anchor, and a // NOTE: names the supertypes |
| a field without a receiver (static, an enum constant) | a global written in the struct; its initial value is the constant when the model holds one, opaque otherwise |
| a named invocable | an operation, nested where it is written: attached to the struct with a receiver, on module without |
| a constructor | operation new(…): Struct on module |
| a lambda, an anonymous invocable | nothing of its own: its edges fold into the nearest named operation |
And per operation, one clause per edge kind:
| Clause | From |
|---|---|
errors |
throws edges: the operation's own raise sites |
depends on |
invocation to a corpus operation; a dynamic-candidate and each of its candidates are written ? |
uses |
invocation to a stub: the external struct or module called into |
reads, writes |
access edges: a global by its path, _.field through the receiver, param.field for a write on the one parameter typed by the field's owner |
Types come from the type expression (METAMODEL.md §1.7) through a table per
language, held as data: which primitives and stubs are string, number or
boolean, which generic stubs are a sequence (array<T>) or an optional
(T?). A type the closed language cannot say is opaque "…" with the
expression rendered. Without a type expression, the erased declaredType is
printed, since it is all the model knows.
A name is printed as the code spells it: bare when it is letters, digits and
_, quoted (@"model", @"src/a.ts") when it is not or when it is a keyword
of the grammar.
With --boundaries, an operation the entry inventory finds by a rule read at
its declaration (an annotation, a supertype, a type-name pattern, a rule by
hand) is marked entry. One the inventory inferred (an uncalled operation an
operations rule names, such as main; a concept label) is marked entry?.
An uncalled operation that no rule names is not marked: that nothing calls
it is a position in the graph, which Specy says the mark does not mean. stderr
counts those rows.
- No receiver marker.
TWithReceiveris read as a fact, and its absence as "no receiver", only in a model whose header states contract 1.2.0 or later and on a kind whose profile licenses the marker. Anywhere else, every field of a type is a schema field, every method is attached, and an access to a field of the operation's own struct reads as_. The first comment lines of the output say which reading each language took. - No type table. Every language but Java has an empty table today: a named type prints as a struct reference, and the header says so.
- A write that cannot be attributed (through another instance, with no
single parameter typed by the field's owner) is not declared; a
// FINDING: blind-spot:says so. - A body that branches gets
// FINDING: branching: cyclomatic N, since a flow could not show it. - A call the model does not hold cannot be printed. On Spring PetClinic,
this.owners.save(owner)is such a call:saveis declared by a Spring Data interface that is not on the extractor's classpath, the extractor drops the site, and the controller's operation shows the read ofownersand no call. This is the extractor's limit (thejavaprofile's notes), not a choice of the lowering.
States, contracts (requires, ensures), flows, :: descriptions, lineage
and domain links. A flow needs the names bound to results and the arguments
passed, which a dependency graph does not hold. They are for a walk to write,
with these clauses as context (PLAN.md §26.7, §26.10).
Specy has no .dataop parser yet. Three properties stand in for one, run on
every fixture model (packages/dataop/test): every token is legal and every
name that needs quoting is quoted; every reference resolves to a declaration
or a printed external; every clause item is backed by an edge, and every edge
is declared or counted. fixtures/java/expected/model.dataop is the committed
snapshot; CODEGRAPH_UPDATE_SNAPSHOTS=1 pnpm --filter @codegraph/dataop test fixtures
rewrites it.