Script Definition
A Script Definition declares a Script — a computation that runs against the graph on a schedule (or on demand) and writes its results into a sdg:DerivedAuxGraph. Scripts are how organisations materialise heat-maps, audit reports, OWL inference closures, and external-system projections.
Difference from a Hook
- A Hook fires on a Transaction (event-driven). Input = the transaction payload. Output = a veto or a reaction.
- A Script fires on a schedule or on demand (time-driven). Input = the graph. Output = triples in a DerivedAuxGraph.
Some logic wants both forms: an incremental update via a post-commit Hook plus a periodic full recompute via a Script that heals drift.
Fields
sdg:schedule— a cron-like or interval descriptor;"on-demand"for manual invocation only.sdg:inputGraphSelector— the subset of named graphs the script reads.sdg:outputGraph— the specific DerivedAuxGraph IRI the script owns. Gate-2 authz permits only this Script's service identity to write here.sdg:implementation— a reference to the implementation: either a built-in code-at-init symbol or a SPARQLCONSTRUCTstring the registry runs natively.
Phase 1 runtimes
Two kinds ship in Phase 1:
- Code-at-init scripts — logic compiled into the registry binary. The ScriptDefinition document is published on service init for discoverability.
- Declarative CONSTRUCT scripts — the registry runs the embedded
CONSTRUCT { … } WHERE { … }on schedule and commits the result to the output aux graph.
Phase 4+ opens up external scheduled services, WASM sandboxing, leader election for horizontal scale, and dynamic code registration.
Scripts can publish documents
A Script may itself submit a publish Transaction — e.g., generating a quarterly report document. The Transaction runs through all four gates like any other. The Script's service identity carries whatever publish permissions policy grants it.