What graphitron generates from a schema follows from what the store states about each place in it. This page reads those statements off one running example, the store’s own rows beside the schema that wrote them, and says what each kind of statement makes graphitron generate. Every schema block and every table here is rendered from a fact document, and the build checks each table against a real capture of that document.
The chain
flowchart LR
SDL[GraphQL schema] --> CAP[capture]
CAT[jOOQ catalog] --> CAP
CAP --> F[("facts<br/>graphql_ / graphitron_ / sql_")]
F --> ANC[anchoring]
ANC --> O[("occurrences<br/>source, path, bind, producer")]
O --> EMIT[emit]
EMIT --> OUT[generated units]
Capture reads the schema, the jOOQ catalog, the configuration and the classpath into the store, one family of relations per corpus. Anchoring is each gatherer’s last step: over the captured facts it states, for every place a field, argument or input field is used, where its values come from, how it reaches what it needs, what it binds and whether it runs something of its own. Emit reads those statements and writes the generated code.
The modelling rules every relation obeys are in The fact model and Modelling discipline; each relation’s columns and its full comment are in the generated schema reference.
One transitional note, so nothing here reads as more settled than it is. A classification walk
(GraphitronSchemaBuilder and the sealed GraphitronSchema model) still runs beside the store and
still feeds parts of generation. This page describes what the store states, which is what the
generator is moving onto, one emitter at a time.
The running example
A film, the plain type holding two of its columns, and the three tables a film reaches: its
language by the key written, its inventory by the one key inventory has to film, and its actors
through film_actor. The root field takes a filter.
type Query {
films(filter: FilmFilter): [Film!]!
}
type Film @table(name: "film") {
title: String
details: FilmDetails
language: Language @reference(path: [{key : "film_language_id_fkey"}])
inventory: [Inventory!]!
actors: [Actor!]!
@reference(path: [{key : "film_actor_film_id_fkey"}, {key : "film_actor_actor_id_fkey"}])
}
type FilmDetails {
length: Int
releaseYear: Int @field(name: "release_year")
}
type Language @table(name: "language") {
name: String
}
type Inventory @table(name: "inventory") {
inventoryId: Int @field(name: "inventory_id")
}
type Actor @table(name: "actor") {
lastName: String @field(name: "last_name")
}
input FilmFilter {
title: String
}
The occurrence
An occurrence is a use of a declared field, argument or input field, at the place it is reached.
Its coordinate spells that place: Film.title on the table-bound Film, Film.details.length for
the field of FilmDetails, which has no table of its own and is only reached under Film.details,
and Query.films(filter.title:) for an input field inside an argument. The element coordinate names
what it is an occurrence of, so a field declared once is an occurrence at every place it is reached.
A chain starts at a field of a root type or of a table-bound type, and grows through each field whose type has no table of its own: an argument hangs under its field, an input field under its argument. A field whose type is table-bound ends the chain, and that type’s fields start chains of their own.
| coordinate | element_coordinate | kind | depth |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Everything below is stated per occurrence, not per declaration. A plain type reached under two fields is two sets of facts, because what its fields read can differ at each place.
A developer who knows GraphQL’s error path can read a chain as one: an occurrence is the response
path from the chain’s start with its list indices left out, ["films", 0, "details", "length"]
read from Film being Film.details.length. It is not an instance: an occurrence is a static place
in the schema, worked out before anything runs, and one occurrence yields many result values. Where
a coordinate is shown (a defect’s message, the editor’s hover, a fact document’s output, this
manual), each step that is a list is marked [], Query.films[] or Film.details[].length when
details is a list, one [] per list level; the key itself carries no marker, a field’s list depth
being a fact of its declaration that can change without the place changing (Alf, 2026-11-13).
Source
An occurrence’s source is what its values come from: rows of one or more tables, TABLE, or an
instance of a class, OBJECT. graphitron_occurrence_source states the kind, and its two subtypes
name the tables or the class.
-
A field of a table-bound type reads that type’s table.
-
A field nested in a plain type reads what its parent reads, so
Film.details.lengthreadsfilm. -
An argument reads the table of its field’s target, and an input field its argument’s.
-
A field reached under a producer that hands back objects reads what that producer produces: a table record is rows of its table, any other class an object.
-
A field of a root type has no source. It executes from nothing, so
Query.filmshas no row.
A type can be reached both ways, nested in a table’s row and handed back as an object by a
producer. That mix is served where the object’s class is read by accessor, each field dispatching on
which it was handed. An object that is a jOOQ record, of any catalog, does not mix with a row: the
generated fetcher reads any jOOQ record it is handed as the row, so the type is refused as
RESULT_SHAPES_CONFLICT (Alf, 2026-11-21).
| coordinate | table_name |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Path
An occurrence with a table source must reach the type it returns, and an argument the type its field
returns. graphitron_path_need states each such need, and graphitron_path_need_table the table it starts on and the table it
lands on, and graphitron_path says how the need is met: by joins from a table source, JOIN, or
by accessor calls on an object, ACCESSOR. A path’s origin says where it came from.
| Origin | Meaning |
|---|---|
|
The author wrote it, with |
|
Written on an interface’s field, and followed by each implementation’s field. |
|
Nothing was written, and the path rides the one foreign key between the two tables. |
|
The path ends where it starts: a column on its own table, a plain type nested in its parent’s table, an argument filtering its own field’s table. |
| coordinate | target_type | kind | origin |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A join path’s steps are graphitron_join_path_step, one per table it moves through, with the
column pairs it joins on in graphitron_join_path_step_column and the key it rode in
graphitron_join_path_step_key where one was written, or graphitron_join_path_step_inferred_key
where the step inferred it.
| coordinate | target_type | position | from_table | to_table |
|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A need nothing meets is a defect at the written position. Had Film.language written no key, the
two keys film has to language would leave its need unmet, and the store would state a
ROUTE_AMBIGUOUS defect at the field naming both.
A word on vocabulary. One written or inferred route resolved between one table it starts on and one
table it lands on is a path. "The walk" names only the classification walk being dissolved; a
@reference chain is never called one.
Paths on arguments and input fields
Inputs follow the output rules with fewer forms; a filter will extend them. The author-facing wording is the manual’s path rules, and a rule changes in the same commit as its code and that page.
-
An input is bound to a table record: the field’s target table, or under a
@servicethe table of the record type of the parameter or bean member it fills, asgraphitron_occurrence_built_classstates it ahead of the depth loop. An input type is never table-bound itself. -
Without
@referencean input’s path isEMPTY: a nested input is the same row, unnested into the bound record. -
On an input that filters, a written path is a join in the condition, a correlated
EXISTS, single- or multi-hop by the output rules. On an input that fills a record,@referencegoes with@nodeIdonly, since a jOOQ record does not nest; anywhere else it is a defect. -
@nodeId(typeName:)is bound to its node’s table, so it always has a path from the bound table to it, inferred exactly as between two table-bound output types: one foreign key, either direction, one hop; none or several isNODE_ID_LANDS_ON_TABLEand the author writes it. Inference never spans hops, and a self-referencing key is never inferred on an input. Where the node’s table is the bound table and nothing is written, there is no path: the id is the record’s own key. -
A bare
@nodeIdtakes its node from a table: the one node over it, none beingNODE_ID_TARGET_UNRESOLVEDand severalNODE_ID_TARGET_AMBIGUOUS. On an argument or input field a@servicetakes as a table’s generated record, as a parameter or a bean member, itself or as a list’s element, the table is the record’s, ahead of the field’s return table and@mutation(table:). Otherwise it is the field’s return table, then@mutation(table:). With neither a record nor a table to take the node from, the@nodeIdisNODE_ID_TARGET_UNRESOLVED, andtypeName:settles it. The record decides because the parameter’s type already says which id the method takes (Alf, 2026-11-17):setFilmLanguage(film: ID! @nodeId, language: ID! @nodeId): Film @service(service: {className: "FilmService", method: "setLanguage"})with
FilmRecord setLanguage(FilmRecord film, LanguageRecord language):filmis aFilmid, from its record and its return table alike, andlanguageaLanguageid, from its record, where the return table would have made it aFilmid the record cannot take. -
On an input that fills a record, a written path may span several hops only where identity passes along composite keys: every column of the record’s first-hop key traces through the path’s column pairs to a column of the node’s key, so the decoded id carries the values. A column that does not trace through is a defect naming it.
Bind
What an occurrence takes is its binding, graphitron_occurrence_binding, one row per occurrence
and place it binds, keyed by the place and stating its kind.
| Kind | What the occurrence takes |
|---|---|
|
A column where its path lands: a scalar reads it, an argument or input field narrows by it. |
|
The table an object or list it returns joins to. |
|
A node identity, packing or unpacking the key columns of its node’s table. |
|
A member’s value off its parent’s object. |
|
A member of the class its parent input object is built into, which its value fills. |
|
A value an |
|
A value computed over what its producer produced. |
|
A parameter of a call, which its value supplies. |
Each kind has a relation of its own beneath the binding stating what it takes. In the running
example every scalar binds a column, and so does the filter’s title, which narrows by
film.title:
| coordinate | bound | kind |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
graphitron_occurrence_column names the column, and how the name matched it: by the SQL name, or by
the name jOOQ generated for it, which answers only where no SQL name on the table does.
| coordinate | bound | column_name | matched_by |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
An input object a call takes is built into a class first, and graphitron_occurrence_built_class
says which: the class the parameter takes where the input object lands on it, the class of the
member it fills below that, or its parent’s own class where it fills no member and groups its
fields onto the parent’s. A @service matches a field to a member by its bound name, so
@field(name:) renames the member; a @condition matches by the field’s own name, since @field
there names the column the filter compares. A jOOQ record is built too, but its fields bind columns
rather than members. The input in that Mutation.customerUpsert takes is built into
CustomerRecord, and so is its field details, which groups firstName and lastName onto the
same record.
An input field built into a bean or Java record has to bind (Alf, 2026-11-17): it, or a field inside
it, fills a member of the class, is a call’s parameter or tenant, is an @outbox message’s key,
carries its own @condition, or is a column a filter compares, which it is only where no
overriding condition and no @service stands in the way. An input field nothing takes is
MEMBER_UNKNOWN, reported once, at the outermost such field: a nested input object none of whose
fields binds is the misspelt member, and its fields are not reported, while one some of whose fields
fill the bean groups them and binds. Names match exactly, case included: setAktivInnenForPeriode
is the member aktivInnenForPeriode, which aktivInnenforPeriode does not name. A jOOQ record’s
fields bind columns, and one naming none is COLUMN_UNRESOLVED at each such field.
An input object reaches a call typed, never as the untyped map graphql-java delivers (Alf,
2026-11-13). A parameter takes it whole as a class the store builds, a @condition on an input field
included, or takes its fields one by one through argMapping paths into it, fra:
range.fraVerdi. A parameter declaring Map or Object for an input object is refused, and its
remedy names those two forms; it is not a deferral, the shape being one graphitron does not mean to
generate.
An argument or input field a call takes binds the call’s parameter, a PARAMETER binding at the
parameter, stated in graphitron_occurrence_binding_parameter. One occurrence may bind several
parameters, of one call or of several, as argMapping hands it to each; a parameter is bound by one
occurrence. The call’s own parameter list, with what supplies each parameter no argument does, stays
in graphitron_occurrence_call_parameter.
Every producer is a call (Alf, 2026-11-13): a @service or @condition method, a @routine, a
write, and a selection graphitron generates alike. Where graphitron generates the producer’s body,
that body is in effect a service method it could inline or extract, more or less identical to the
code it emits; so a producer states what it takes as call parameters as a service does, and an
argument any producer takes is stated by its fill, never inferred from the producer’s kind.
What follows from it (Alf, 2026-11-13). Every call is a Java method call, so a call’s parameter list
is one relation whatever its kind. A write takes each argument as one parameter, an input object
whole as its record: its input is bound against the record of the table the write goes against,
its fields to the columns they set or key. That is how the store states it today; the direction is
to emit the INSERT, UPDATE and DELETE statements directly, which is more powerful than going
through a record. A @routine producer composes with filters: an argument its call does not
bind filters its result, as on any field. A @service cannot: an argument it does not bind has
nowhere to go and is a defect. A child @routine is never a producer
but a join, at least for now: the field’s producer is the lift that starts a query from the
parent’s key, as for @splitQuery, and the routine is a step on that query’s path, first or after a
table, its arguments stated on the step. Only a root @routine is a call.
A call keeps its provenance, as every claim the store registers does (Alf, 2026-11-14): the directive application it came from is stored with it, so a reader that needs to know which directive made a call, a defect rule naming where to fix it among them, joins that application rather than working it out again from the call’s kind.
How a value the client sends reaches the parameter it binds is decided once: "How clients value reach parameters should be worked out once." (Alf, 2026-11-26). Whether the value is passed as it arrives, decoded from a node id into a key column, or decoded from a generated scalar into one of its components, and how it is converted where it is, is a fact the store states per parameter binding, and every reader of a call’s parameters takes it from there, a `@service’s fill, a routine write’s argument and a root `@routine’s alike, rather than each working it out again from the flags of the binding.
A node id reaches a parameter whole: "NODE_ID_KEY seems wrong. That should be either a NODE_ID_RECORD
or AS_SENT." (Alf, 2026-11-26). Either the parameter takes the decoded record, or it takes the id as the
client sent it. A key value is a column of that record, and the author names it: "Yes, if the user
wants a key component then it must identify that component with an extra path element." (Alf,
2026-11-26). So pActorId: filter.actorRef.actor_id passes the decoded record’s actor_id, and
pActorId: filter.actorRef, a node id bound to a parameter that takes one column’s value, names no
column and is refused.
Producer
An occurrence that binds and runs nothing belongs to the query of its producer, the nearest
occurrence up its chain that executes something of its own. graphitron_occurrence_producer states
each producer, what it runs and where it starts.
-
A
ROOTproducer is a field of a root type. It has no source and runs from nothing. -
A
CHILDproducer starts a query of its own from what its parent produced, batched over all its parents: a@splitQueryfield, a child connection, a table-bound field under a parent that holds an object rather than rows, a payload’s data field re-read by key after a write, or a child@service.
A child connection, a list under a non-root type made a connection by @asConnection or by
returning a hand-written connection type, is always a producer of its own, split, whatever markers
are written on it: it has no inline form, each parent’s page being cut by its own cursor, so the split is inferred rather than
asked of the author, and a @splitQuery written on one is admitted with the SPLIT_QUERY_REDUNDANT
warning (Alf, 2026-11-25).
A mutation over a routine that returns one row of a table calls the routine once and re-reads by the record’s key (Alf, 2026-11-24, replacing his 2026-11-23 ruling that the record itself be the answer):
-
The call is the routine’s execute form, alone in its statement, and returns the routine’s record.
-
The record hands its key to the payload’s data field, which re-reads the row by that key in a statement of its own, as it does after any write, under the caller’s read policy.
-
A record whose key is null, a routine that changed no row, re-reads nothing, and the data field is null.
A table-bound field under a parent that holds an object, and a payload’s data field, start their own
query whatever is written on them, so a @splitQuery there changes nothing. It is admitted, and the
store warns that it is redundant, SPLIT_QUERY_REDUNDANT, a write’s payload included (Alf,
2026-11-19).
A child the parent’s query can join in does not produce: it binds, and its join path continues its
producer’s query. In the running example only Query.films produces; every field below it, the
language, the actors and the inventory among them, is read by the one query it runs.
| coordinate | kind | start |
|---|---|---|
|
|
|
One producer of each kind a root runs, and a split child:
type Query {
films: [Film!]!
filmsByKey(film_id: [Int!] @lookupKey): [Film]!
filmsByService(ids: [Int!]!): [Film!]!
@service(service: {className : "no.sikt.graphitron.rewrite.test.services.SampleQueryService", method : "filmsByService"})
rows(actorId: Int!, minLength: Int!): [Row!]!
@routine(name: "films_for_actor", argMapping: "pActorId: actorId, pMinLength: minLength")
@defaultOrder(fields: [{name : "film_id"}])
}
type Film @table(name: "film") {
title: String
language: Language @splitQuery @reference(path: [{key : "film_language_id_fkey"}])
originalLanguage: Language @reference(path: [{key : "film_original_language_id_fkey"}])
}
type Language @table(name: "language") {
name: String
}
type Row {
title: String
}
type Mutation {
createFilm(in: FilmInput!): Film @mutation(typeName: INSERT)
}
input FilmInput {
title: String
languageId: Int @field(name: "language_id")
}
| coordinate | kind | start |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Film.language is a CHILD because it is written @splitQuery; Film.originalLanguage, joined in,
produces nothing. A connection carries two more, COUNT for its totalCount and FACETS for its
facets, each run only when a client asks for it; graphitron_producer states them for the field
today, and the occurrence will once the connection model lands.
A field nothing reaches has no producer and no fetcher, whatever is written on it, a @service
included (Alf, 2026-11-19). Nothing reaches a field when nothing in the schema leads to its type: the
type is no entrance, and no field of a reached type returns it, itself or as a member of a union or
interface the field returns. An entrance is an operation root, or an entity a federation router enters
through _entities by a resolvable key, the author’s @key or the one graphitron mints for a node or an
accepting type, whether or not any field returns it. Reach is a fact of the types, graphitron_type_schema_reach, stored before the
results flow; a field’s producer is a candidate only, a row of graphitron_producer_candidate, and
graphitron_producer keeps the candidates on a type the schema reaches. This is not the same as a
result arriving. Given
type Film @table(name: "film") { extras: Extras }
union Extras = Note | Tag
type Note { text: String @service(...) }
type Tag { name: String }
Film.extras lands nowhere and gets no fetcher, so no result ever reaches Note; but a field of a
reached type returns Note as a member of the Extras union, so Note is reached, and Note.text keeps its
producer and its fetcher, which is never called. An earlier reading the same day counted a type as
reached when a result reached it; it was superseded for the cost of gating the producers inside the
result rounds, where the type-level fact is known before the first round.
What a producer produces is graphitron_occurrence_producer_result: its shape, one record, a list
of records, a connection page, an object or a scalar, with the class its values are where one is
named and, for records, the table they are rows of. The occurrences under a producer bind into that
result.
| coordinate | shape | table_name |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A producer’s subtypes state what it calls. Every call an occurrence makes is a row of
graphitron_occurrence_call, the methods it could make rows of graphitron_occurrence_call_candidate
and the one it pins a row of graphitron_occurrence_call_method, whatever its kind.
graphitron_occurrence_producer_service names, for a SERVICE producer’s instance method, the
constructor its object is made with;
graphitron_occurrence_producer_routine a ROUTINE producer’s database routine;
graphitron_occurrence_producer_write a write’s table. graphitron_occurrence_call_parameter says
what fills each parameter of a call: an argument, which fills that parameter, as
Query.filmsByService(ids:) fills the second parameter of filmsByService, or a value graphitron
supplies, such as the jOOQ context. graphitron_occurrence_producer_lift states how a child
producer under an object is filled from it: the key constraint whose values the object supplies,
read as columns or through a member (graphitron_occurrence_producer_lift_accessor), and how many
per parent.
An output occurrence’s source is the value its parent holds, as the parent’s producer lifted it: a row of a table-bound parent’s table, a table record as rows of its table, any other class as an instance of it, and for a field of a root write’s payload the written rows, as jOOQ records (Alf, 2026-11-10). It is never the table the occurrence’s own query starts on. Restarting a query from that source is the child producer’s lift, and it belongs to the producer.
A target lift restarts the query at the target, its batch keyed on values the source already
holds. A producer takes one in three cases. The source hands over the target’s own records, directly
or through a member of its class matching the producer field. Or its path is one hop with no
condition on it and the source is a row graphitron selected that holds the hop’s foreign key to the
target. Or, for a list, its path is one hop with no condition on it and the target’s foreign key
references the source’s key, so the batch is keyed on that key and each key’s rows are its own. A
single hop skips no table, so a dangling or null key finds nothing exactly as the join would,
whether the key is enforced or not. A @condition on the field reads only the target and does not
prevent a target lift. Every other producer takes a source lift: the batch is keyed on the
source’s primary key and the query anchors the source’s table and walks the whole path. That covers
a path of several hops, a hop carrying a condition, and a foreign key read off a record a @service
or a write handed over, which guarantees only its primary key (Alf, 2026-11-10).
The key a lift states is always a primary or unique key, never a foreign key: where a foreign key
is followed, the key it references (Alf, 2026-11-14). For a list whose target’s foreign key
references the source, as Language.films over film.language_id, that is the source’s key the
foreign key points at; which of the target’s foreign keys the rows are matched through, when two
reference one key as film.language_id and film.original_language_id do, is the path step’s fact.
A source lift needs the source’s table to have a primary key, and a key spanning several columns is
read whole and in key order. A polymorphic producer has one lift: which participant each fetched row
is, graphitron_occurrence_participant decides once the rows are fetched. A node id argument on
such a producer is dispatched by the type id every node id carries, known at runtime without
decoding (Alf, 2026-11-14): each id goes to the participant whose type it names, so a lookup by ids
of several participant types answers each from its own participant’s rows, and no participant
decodes another’s id. An id naming no participant is malformed for the field, a client error. A
query-root field returning the Node interface, as Query.node and Query.nodes do, is the
exception (Alf, 2026-11-04; Filip, 2026-11-20): it asks whether an id resolves in this subgraph at
all, so a well-formed id whose type id names no node this subgraph serves by id (the nodes
graphitron_node_served_by_id states: resolvable, and the id binding the node id) answers null, as an
id of no row does, and only an id that is not well formed is the client error. A subgraph cannot tell
another subgraph’s type from one that exists nowhere, and a gateway asking every subgraph for one id
hears null from those that do not own it. Where
a field answers node ids by position, as Query.nodes does, a malformed id fails its own position
and not the field (Filip, 2026-11-20): that position is null with the client error at its path, and
the other ids are answered, so how far one bad id reaches is the schema’s own nullability to say. A root producer has no
parent and so has no source. An argument or an input field never produces and reads the table it
binds.
An argument filling a parameter with a table’s jOOQ record writes, for each column, what the input
sent for it: a value, or an explicit null written as NULL, whatever else the input decodes into
the record. The classified emitter erased that null beside a decoded node id; that is a defect,
and the store’s build corrects it rather than reproducing it, its execution pin changed with it
(Alf, 2026-11-10).
A table record a @service or a write returns carries only its primary key. Every table-bound
field under it is a new producer that lifts from that key and re-selects; none is answered by a
same-table rule, a path or inference off the record. A design that asks whether such a field is
"the same row or a join" is asking the wrong relation: the key row and the lift answer it.
Whether a field is lifted is decided by its type, not by the class handed back: a field whose
type carries @table is lifted from the record’s key, and a type without @table reads a jOOQ
table record as it reads any class, as handed, since Graphitron does not know which of its fields
the service filled (Alf, 2026-11-18). So a table with no primary key can be returned from a
@service through a type without @table, and is refused only behind one with it. A @service
may hand back a list, a set or any iterable of what its field returns (Alf, 2026-11-18).
A routine write’s rows are lifted the same way, in the order the routine delivers them, which
is defined only where the routine defines it (Alf, 2026-11-18): a row gone by the time it is read leaves a null in its slot rather than shortening
the list, while a filter on the path drops the row, since the filter says the row is not part of
the answer. A single-record routine write whose path fans out is a defect. A routine write that
answers a payload and finds no row answers the payload with null data and a null errors
field, as a @service does; an errors field that cannot hold null is refused at build as
ERRORS_FIELD_NON_NULL, so no other answer arises.
Output that keeps the order of its input is owed only where a list argument names one item per
element and the answer is one item per element, the plural identifying root field of the Global
Object Identification specification (Alf, 2026-11-18). A routine can keep that contract in two ways.
One that takes an array answers an array in the same order, and Graphitron only unnests it; the
order is the routine’s to keep. One that takes a single value is called laterally once per element
of a derived table built from the argument, and Graphitron orders by that table’s position. A
routine returning a table cannot keep the contract, since nothing ties its rows to the elements.
@lookupKey is what declares a field plural identifying; an insert or a delete whose schema has
that shape, a list argument and one answer per element, is taken to want the same order without it
(Alf, 2026-11-18).
A mutation of that shape is held to the contract whatever writes it, a routine included, since a
consumer reads the contract off the schema (Alf, 2026-11-18). Graphitron cannot know what a
routine does, but it does know a routine returning a table has no order of its own: such a routine
behind a plural mutation must be given an order, and is refused without one, the refusal naming the
plural identifying field it fails to keep.
The order is given with @defaultOrder(fields:) on the mutation field, naming columns of the
routine’s own result rather than of the table the field’s type is bound to, since only what the
routine hands back can say which element a row answers (Alf, 2026-11-18).
A field returning a @table type on its parent’s own table is refused unless the schema says how
it is reached: a nesting type, with no table of its own, or a @reference keyed on the table’s
primary key (the parent’s own
row). Graphitron never infers the parent’s row; an unwritten same-table path rides the
self-referencing key or fails. The fix for a schema that meets the refusal is in the schema.
A nullable single child is null exactly when its read finds no row: a table-bound child’s row is
there or not, and a reached row whose columns are all null is an object with null fields. A nesting
field is its parent’s row, so it is present wherever its parent is and never null on its own account
(Alf, 2026-11-15). No presence is computed from a subtree’s columns, expressions or probes.
A root single read answers by the same rule: a field of Query returning one table-bound object is
null exactly when its read finds no row (Alf, 2026-11-23), whether the store or the walk emits its
fetcher.
A single child below the root may be looked up by its @lookupKey arguments, read as the one row
of its table they match or null (Alf, 2026-11-15). Its keys must cover an identifying key of that
table, its primary key or a unique key whose columns are all not null; keys that could match several
rows are refused rather than read as the first of them, and the schema makes the field a list or
keys it on a unique column.
Which connection a query runs on is decided by the tenant facts, never by @splitQuery (Alf,
2026-11-14). A split splits a query and nothing else: the child runs on the connection key its
producer hands down. At each occurrence the key is one of three things. It is inherited, which is
the default. Or it is routed by a row’s tenant column: where a followed foreign key lands on the
tenant column under a parent that is not on that tenant, the store states a fan-out, and the child
becomes a producer that groups its parents by the tenant they name and runs each group on that
tenant’s connection, whether or not the field is written @splitQuery. A composite foreign key
counts when one of its columns lands on the tenant column: that column’s value in the parent row
names the tenant, the key’s other columns the row within it (Alf, 2026-11-15). A parent not on that tenant is
one whose table carries no tenant column (Alf, 2026-11-15): a reference from a global table, never
one routed away from a scoped parent. A foreign key followed from a nesting type’s field, which
starts from its parent’s row rather than a table of its own, is refused for now as unsupported
(Alf, 2026-11-15): nothing uses it, and opening it later means stating the fan-out per occurrence.
Or its tenant part is
empty, for a table no tenant column scopes; which connection that is, the consumer’s connection
hook decides (Alf, 2026-11-14). The author never writes a split to make routing work;
the facts already say where a query fans out.
A root’s tenant is the input that binds its table’s tenant column, and that input is the $tenant
whether or not the author names it (Alf, 2026-11-15). The store derives it, from an argument or input
field bound to the tenant column as from an authored $tenant, so an author never names a tenant
the bindings already state; this holds for a root query as for a root @service.
What the facts generate
Each producer becomes a data fetcher, and each producer kind decides what that fetcher runs.
| Producer | What its fetcher runs |
|---|---|
|
One jOOQ query from its start, |
|
The same query, keyed by the values the caller supplies, returning one result per key in the order
given, a key matching no row being a null in its place. A root field with |
|
A count or a facet aggregation over the same rows and arguments as the connection that carries it. |
|
The write on its table, then a re-read of the written rows by key for whatever the client selected. |
|
A call to the database routine, its rows read as the routine’s derived table. |
|
A call to the method, its parameters filled as |
The occurrences under a producer shape its query rather than add fetchers. A COLUMN binding is a
selected column, or under an argument a predicate on it. A join path is a join in the producer’s
query, or a nested multiset for a list. A NODE_ID binding packs or unpacks key columns, and an
EXPRESSION binding is its method’s value selected in place. A field that neither produces nor needs
a value of its own, a plain type’s field reading its parent’s row, generates no query of its own;
like every field it is wired (emitter-conventions.adoc § Return types).
Between these facts and the code sits the planning tier as it stands today: emit joins what it reads into command rows, one per thing it will write, and renders each into a class or a method. The command relations, with the grain each states:
| Relation | Package | What one row is |
|---|---|---|
|
|
The condition command relation of one generation run. |
|
|
The fetcher edge relation of one generation run: one row per coordinate of the covered non-launcher families whose emitted fetcher methods reference other generated units (see |
|
|
Every |
|
|
The launcher command relation of one generation run: one row per migrated root SELECT coordinate, keyed by the coordinate alone. |
|
|
The projection command relation: one row per projection unit, keyed by the unit’s address (type name for anchor units, |
|
|
The type-keyed command relation: every per-type unit this run emits, one row per |
When nothing is generated
A schema that asks for something the store cannot state is refused at the written position, as a
defect in graphitron_entry_defect with a code and the place the author wrote. A need no path meets,
a column that is not there: each is a defect beside the facts it judges, and the build reports it
where the author wrote it. The relation and its codes are in the generated
schema reference.
What an author wrote is stated apart from what took effect. graphitron_claim holds each claim a
directive makes, a producer such as @service or @mutation, a binding such as @field(name:) or
@nodeId, a type’s @table or @error, as written, and decides nothing; the occurrence’s producer
and bindings are what took effect. Two claims one element cannot hold together are one
CLAIMS_CONFLICT at its declaration, each claim weighed a row of graphitron_entry_defect_claim
under it, and ROUTINE_LOOKUP_DEFERRED is the one pair graphitron_claim_inclusion reports
otherwise.