preludes / ontology.lisp
ontology
Domain ontology. Entities, relations, queries, documents, processes, and permissions, elaborated into canonical IR.
The conformance fixtures and example corpus load this stack. The browser playground does not run ontology elaboration yet; its ontology example shows a stored canonical IR golden.
From the source
Purpose: Typed domain forms that project authored declarations to canonical IR. Requires: compiler.lisp; IR contracts are declared here and generated into ontology-ir.lisp. Used by: Ontology elaboration, conformance fixtures, and hosts loading the domain stack. SECTION 1 — ENTITY SCHEMAS AND SEED DATA
Forms 54
Keywords this prelude adds. Each is a form descriptor: its slots, their types, and the IR it produces.
(entity name fields {:keys [doc role id-pattern tier]})ontology.lisp:108
A named record of attributes.
| Slot | Type |
|---|---|
| name | (Declares SchemaDecl) |
| fields | (Record Type) |
| doc | (Option String) |
| role | (Option String) |
| id-pattern | (Option String) |
| tier | (Option (Union :user :meta)) |
Produces EntityDeclarationIR
Example
(entity Person {:name String :age (Option Int)})(relation name source target fields)ontology.lisp:129
A typed relation between entities.
| Slot | Type |
|---|---|
| name | (Declares RelationDef) |
| source | (Refers SchemaDecl) |
| target | (Refers SchemaDecl) |
| fields | (Record Type) |
Produces RelationIR
Example
(entity Person {})
(entity Team {})
(relation Member Person Team {})(seed entity id fields)ontology.lisp:190
Seed data for an entity.
| Slot | Type |
|---|---|
| entity | (Refers SchemaDecl) |
| id | (Declares RecordDef String) |
| fields | (Record Json) |
Produces RecordIR
Example
(entity Person {:name String})
(seed Person "person:ada" {:name "Ada"})(link relation source target fields)ontology.lisp:212
A relation instance.
| Slot | Type |
|---|---|
| relation | (Refers RelationDef) |
| source | String |
| target | String |
| fields | (Record Json) |
Produces LinkIR
Example
(entity Person {})
(entity Team {})
(seed Person "person:ada" {})
(seed Team "team:compiler" {})
(relation Member Person Team {})
(link Member "person:ada" "team:compiler" {})(attribute name value-type {:keys [doc]})ontology.lisp:250
A shared attribute.
| Slot | Type |
|---|---|
| name | (Declares SchemaDecl) |
| value-type | Type |
| doc | (Option String) |
Produces SystemAttributeIR
Example
(attribute created-at Float :doc "Creation time in milliseconds")(query name {:keys [from where select]})ontology.lisp:295
A named read over one entity.
| Slot | Type |
|---|---|
| name | (Declares QueryDef) |
| from | (Refers SchemaDecl) |
| where | (Option (Expr Bool)) |
| select | (Option (List Symbol)) |
Produces QueryIR
Example
(entity Person {:name String :age Int})
(query adults :from Person :where (>= age 18) :select [name])(workspace name {:keys [title persona subject home views]})ontology.lisp:330
Groups views into a named workspace, with an optional home view, persona, and subject.
| Slot | Type |
|---|---|
| name | (Declares WorkspaceDef) |
| title | (Option String) |
| persona | (Option String) |
| subject | (Option Symbol) |
| home | (Option (Refers ViewDef)) |
| views | (Option (List (Refers ViewDef))) |
Produces WorkspaceIR
Example
(view Home :layout (text "Welcome"))
(workspace People :title "People" :home Home :views [Home])(identity name {:keys [kind description member group principal resource resolver]})ontology.lisp:366
Declares a role, group, membership, or contextual role; omitted kind defaults to role. Resolver syntax is retained in the IR.
| Slot | Type |
|---|---|
| name | (Declares IdentityDef) |
| kind | (Option (Union :role :group :membership :contextual-role)) |
| description | (Option String) |
| member | (Option Symbol) |
| group | (Option (Refers IdentityDef)) |
| principal | (Option (Refers IdentityDef)) |
| resource | (Option (Refers SchemaDecl)) |
| resolver | (Option Syntax) |
Produces IdentityDeclarationIR
Example
(identity Editor :kind :role :description "Edits records")(permission name {:keys [principal action resource effect condition description]})ontology.lisp:406
Declares an allow or deny policy linking an identity, action, and entity schema. Omitted effect defaults to allow.
| Slot | Type |
|---|---|
| name | (Declares PermissionDef) |
| principal | (Refers IdentityDef) |
| action | (Refers ActionDef) |
| resource | (Refers SchemaDecl) |
| effect | (Option (Union :allow :deny)) |
| condition | (Option (Expr Bool)) |
| description | (Option String) |
Produces PermissionDeclarationIR
Example
(entity Person {})
(identity Editor)
(: save (Action Unit))
(define save nil)
(permission CanSave :principal Editor :action save :resource Person)(process-trigger/on-create entity)ontology.lisp:446
Describes an entity creation trigger for a process.
| Slot | Type |
|---|---|
| entity | (Refers SchemaDecl) |
Produces TriggerIR
Example
(entity Person {})
(process Review :trigger (on-create Person) (node review))(process-trigger/on-update entity)ontology.lisp:455
Describes an entity update trigger for a process.
| Slot | Type |
|---|---|
| entity | (Refers SchemaDecl) |
Produces TriggerIR
Example
(entity Person {})
(process Review :trigger (on-update Person) (node review))(process-trigger/on-delete entity)ontology.lisp:464
Describes an entity deletion trigger for a process.
| Slot | Type |
|---|---|
| entity | (Refers SchemaDecl) |
Produces TriggerIR
Example
(entity Person {})
(process Review :trigger (on-delete Person) (node review))(process-child/node id {:keys [action join fan-out input]})ontology.lisp:499
Adds a named process node with an optional action, join policy, fan-out policy, and captured input expressions.
| Slot | Type |
|---|---|
| id | Symbol |
| action | (Option (Refers ActionDef)) |
| join | (Option String) |
| fan-out | (Option String) |
| input | (Option (Record Syntax)) |
Produces ProcessNodeIR
Example
(entity Person {})
(process Review :trigger (on-create Person) (node review))(process-child/edge from to {:keys [guard]})ontology.lisp:522
Connects two process node identifiers, optionally guarded by a Boolean expression.
| Slot | Type |
|---|---|
| from | Symbol |
| to | Symbol |
| guard | (Option (Expr Bool)) |
Produces ProcessEdgeIR
Example
(entity Person {})
(process Review
:trigger (on-create Person)
(node review)
(edge start review))(process name {:keys [description trigger]} child ...)ontology.lisp:611
Declares a triggered graph of action nodes and edges. Checks duplicate node identifiers, unresolved edge endpoints, and dependency cycles.
| Slot | Type |
|---|---|
| name | (Declares ProcessDef) |
| description | (Option String) |
| trigger | process-trigger |
| child | (List process-child) |
Produces ProcessIR
Example
(entity Person {})
(process Review
:trigger (on-create Person)
(node review)
(edge start review))(document-option/option value label)ontology.lisp:645
Pairs a stored string value with its display label for a document field or locale override.
| Slot | Type |
|---|---|
| value | String |
| label | String |
Produces DocumentOptionIR
Example
(document Profile
(page
details
:assignee
author
(select :profile/color "Color" (option "blue" "Blue"))))(document-field/text path label {:keys [description required bind transform cardinality]} option ...)ontology.lisp:724
Adds a text field at a keyword path, with optional description, required flag, attribute binding, transform, cardinality, and option children. Checks that a binding names a declared attribute.
| Slot | Type |
|---|---|
| path | Keyword |
| label | String |
| description | (Option String) |
| required | (Option Bool) |
| bind | (Option Symbol) |
| transform | (Option (Union :identity :string :number :boolean :date :datetime :json :ref)) |
| cardinality | (Option (Union :one :many)) |
| option | (List document-option) |
Produces DocumentFieldIR
Example
(document Profile
(page details :assignee author (text :profile/value "Value")))(document-field/date path label {:keys [description required bind transform cardinality]} option ...)ontology.lisp:759
Adds a date field at a keyword path, with optional description, required flag, attribute binding, transform, cardinality, and option children. Checks that a binding names a declared attribute.
| Slot | Type |
|---|---|
| path | Keyword |
| label | String |
| description | (Option String) |
| required | (Option Bool) |
| bind | (Option Symbol) |
| transform | (Option (Union :identity :string :number :boolean :date :datetime :json :ref)) |
| cardinality | (Option (Union :one :many)) |
| option | (List document-option) |
Produces DocumentFieldIR
Example
(document Profile
(page details :assignee author (date :profile/value "Value")))(document-field/number path label {:keys [description required bind transform cardinality]} option ...)ontology.lisp:794
Adds a number field at a keyword path, with optional description, required flag, attribute binding, transform, cardinality, and option children. Checks that a binding names a declared attribute.
| Slot | Type |
|---|---|
| path | Keyword |
| label | String |
| description | (Option String) |
| required | (Option Bool) |
| bind | (Option Symbol) |
| transform | (Option (Union :identity :string :number :boolean :date :datetime :json :ref)) |
| cardinality | (Option (Union :one :many)) |
| option | (List document-option) |
Produces DocumentFieldIR
Example
(document Profile
(page details :assignee author (number :profile/value "Value")))(document-field/checkbox path label {:keys [description required bind transform cardinality]} option ...)ontology.lisp:829
Adds a checkbox field at a keyword path, with optional description, required flag, attribute binding, transform, cardinality, and option children. Checks that a binding names a declared attribute.
| Slot | Type |
|---|---|
| path | Keyword |
| label | String |
| description | (Option String) |
| required | (Option Bool) |
| bind | (Option Symbol) |
| transform | (Option (Union :identity :string :number :boolean :date :datetime :json :ref)) |
| cardinality | (Option (Union :one :many)) |
| option | (List document-option) |
Produces DocumentFieldIR
Example
(document Profile
(page details :assignee author (checkbox :profile/value "Value")))(document-field/select path label {:keys [description required bind transform cardinality]} option ...)ontology.lisp:864
Adds a select field at a keyword path, with optional description, required flag, attribute binding, transform, cardinality, and option children. Checks that a binding names a declared attribute.
| Slot | Type |
|---|---|
| path | Keyword |
| label | String |
| description | (Option String) |
| required | (Option Bool) |
| bind | (Option Symbol) |
| transform | (Option (Union :identity :string :number :boolean :date :datetime :json :ref)) |
| cardinality | (Option (Union :one :many)) |
| option | (List document-option) |
Produces DocumentFieldIR
Example
(document Profile
(page details :assignee author (select :profile/value "Value")))(document-field/textarea path label {:keys [description required bind transform cardinality]} option ...)ontology.lisp:899
Adds a textarea field at a keyword path, with optional description, required flag, attribute binding, transform, cardinality, and option children. Checks that a binding names a declared attribute.
| Slot | Type |
|---|---|
| path | Keyword |
| label | String |
| description | (Option String) |
| required | (Option Bool) |
| bind | (Option Symbol) |
| transform | (Option (Union :identity :string :number :boolean :date :datetime :json :ref)) |
| cardinality | (Option (Union :one :many)) |
| option | (List document-option) |
Produces DocumentFieldIR
Example
(document Profile
(page details :assignee author (textarea :profile/value "Value")))(document-field/signature path label {:keys [description required bind transform cardinality]} option ...)ontology.lisp:934
Adds a signature field at a keyword path, with optional description, required flag, attribute binding, transform, cardinality, and option children. Checks that a binding names a declared attribute.
| Slot | Type |
|---|---|
| path | Keyword |
| label | String |
| description | (Option String) |
| required | (Option Bool) |
| bind | (Option Symbol) |
| transform | (Option (Union :identity :string :number :boolean :date :datetime :json :ref)) |
| cardinality | (Option (Union :one :many)) |
| option | (List document-option) |
Produces DocumentFieldIR
Example
(document Profile
(page details :assignee author (signature :profile/value "Value")))(document-field/file path label {:keys [description required bind transform cardinality]} option ...)ontology.lisp:969
Adds a file field at a keyword path, with optional description, required flag, attribute binding, transform, cardinality, and option children. Checks that a binding names a declared attribute.
| Slot | Type |
|---|---|
| path | Keyword |
| label | String |
| description | (Option String) |
| required | (Option Bool) |
| bind | (Option Symbol) |
| transform | (Option (Union :identity :string :number :boolean :date :datetime :json :ref)) |
| cardinality | (Option (Union :one :many)) |
| option | (List document-option) |
Produces DocumentFieldIR
Example
(document Profile
(page details :assignee author (file :profile/value "Value")))(document-field/email path label {:keys [description required bind transform cardinality]} option ...)ontology.lisp:1004
Adds a email field at a keyword path, with optional description, required flag, attribute binding, transform, cardinality, and option children. Checks that a binding names a declared attribute.
| Slot | Type |
|---|---|
| path | Keyword |
| label | String |
| description | (Option String) |
| required | (Option Bool) |
| bind | (Option Symbol) |
| transform | (Option (Union :identity :string :number :boolean :date :datetime :json :ref)) |
| cardinality | (Option (Union :one :many)) |
| option | (List document-option) |
Produces DocumentFieldIR
Example
(document Profile
(page details :assignee author (email :profile/value "Value")))(document-field/phone path label {:keys [description required bind transform cardinality]} option ...)ontology.lisp:1039
Adds a phone field at a keyword path, with optional description, required flag, attribute binding, transform, cardinality, and option children. Checks that a binding names a declared attribute.
| Slot | Type |
|---|---|
| path | Keyword |
| label | String |
| description | (Option String) |
| required | (Option Bool) |
| bind | (Option Symbol) |
| transform | (Option (Union :identity :string :number :boolean :date :datetime :json :ref)) |
| cardinality | (Option (Union :one :many)) |
| option | (List document-option) |
Produces DocumentFieldIR
Example
(document Profile
(page details :assignee author (phone :profile/value "Value")))(document-field/radio path label {:keys [description required bind transform cardinality]} option ...)ontology.lisp:1074
Adds a radio field at a keyword path, with optional description, required flag, attribute binding, transform, cardinality, and option children. Checks that a binding names a declared attribute.
| Slot | Type |
|---|---|
| path | Keyword |
| label | String |
| description | (Option String) |
| required | (Option Bool) |
| bind | (Option Symbol) |
| transform | (Option (Union :identity :string :number :boolean :date :datetime :json :ref)) |
| cardinality | (Option (Union :one :many)) |
| option | (List document-option) |
Produces DocumentFieldIR
Example
(document Profile
(page details :assignee author (radio :profile/value "Value")))(document-field/hidden path label {:keys [description required bind transform cardinality]} option ...)ontology.lisp:1109
Adds a hidden field at a keyword path, with optional description, required flag, attribute binding, transform, cardinality, and option children. Checks that a binding names a declared attribute.
| Slot | Type |
|---|---|
| path | Keyword |
| label | String |
| description | (Option String) |
| required | (Option Bool) |
| bind | (Option Symbol) |
| transform | (Option (Union :identity :string :number :boolean :date :datetime :json :ref)) |
| cardinality | (Option (Union :one :many)) |
| option | (List document-option) |
Produces DocumentFieldIR
Example
(document Profile
(page details :assignee author (hidden :profile/value "Value")))(document-field/content path content)ontology.lisp:1144
Adds static string content at a document path, without an input binding or options.
| Slot | Type |
|---|---|
| path | Keyword |
| content | String |
Produces DocumentFieldIR
Example
(document Profile
(page details :assignee author (content :profile/intro "Welcome")))(document-completion/completion action {:keys [entity]})ontology.lisp:1171
Names the action to invoke on page completion, with an optional entity reference.
| Slot | Type |
|---|---|
| action | (Refers ActionDef) |
| entity | (Option (Refers SchemaDecl)) |
Produces DocumentCompletionIR
Example
(: save (Action Unit))
(define save nil)
(document Profile
(page
details
:assignee
author
:completion
(completion save)
(text :profile/name "Name")))(document-page/page name {:keys [assignee description depends-on completion]} child ...)ontology.lisp:1207
Groups document fields under a section identifier and assignee, with optional dependencies and a completion action.
| Slot | Type |
|---|---|
| name | Symbol |
| assignee | Symbol |
| description | (Option String) |
| depends-on | (Option (List Symbol)) |
| completion | (Option document-completion) |
| child | (List document-field) |
Produces DocumentPageIR
Example
(document Profile
(page details :assignee author (text :profile/name "Name")))(document name {:keys [description]} page ...)ontology.lisp:1275
Declares a document of assigned pages. Checks duplicate section identifiers and field paths, unknown dependencies, and dependency cycles.
| Slot | Type |
|---|---|
| name | (Declares DocumentDef) |
| description | (Option String) |
| page | (List document-page) |
Produces DocumentIR
Example
(document Profile
(page details :assignee author (text :profile/name "Name")))(task name fields { :keys [title description document sections default-assignee guidance scope]})ontology.lisp:1308
Declares typed task inputs and a title, with optional document sections, assignment, guidance, and scope metadata.
| Slot | Type |
|---|---|
| name | (Declares TaskDef) |
| fields | (Record Type) |
| title | String |
| description | (Option String) |
| document | (Option (Refers DocumentDef)) |
| sections | (Option (List Symbol)) |
| default-assignee | (Option Json) |
| guidance | (Option Symbol) |
| scope | (Option Json) |
Produces TaskDefinitionIR
Example
(task Review {:person String} :title "Review person")(document-locale-child/role name {:keys [label description]})ontology.lisp:1377
Overrides a document role's label and description in a locale.
| Slot | Type |
|---|---|
| name | Symbol |
| label | (Option String) |
| description | (Option String) |
Produces DocumentRoleLocaleIR
Example
(document Profile
(page details :assignee author (text :profile/name "Name")))
(document-locale Profile "fr" (role author :label "Auteur"))(document-locale-child/section name {:keys [label description]})ontology.lisp:1387
Overrides a document section's label and description in a locale.
| Slot | Type |
|---|---|
| name | Symbol |
| label | (Option String) |
| description | (Option String) |
Produces DocumentSectionLocaleIR
Example
(document Profile
(page details :assignee author (text :profile/name "Name")))
(document-locale Profile "fr" (section details :label "Détails"))(document-locale-child/field path {:keys [label description]} option ...)ontology.lisp:1397
Overrides a document field's label, description, and option labels at its path.
| Slot | Type |
|---|---|
| path | Keyword |
| label | (Option String) |
| description | (Option String) |
| option | (List document-option) |
Produces DocumentFieldLocaleIR
Example
(document Profile
(page details :assignee author (text :profile/name "Name")))
(document-locale Profile "fr" (field :profile/name :label "Nom"))(document-locale document locale child ...)ontology.lisp:1469
Adds locale overrides for a document. Checks that referenced roles, sections, and field paths exist in the source document.
| Slot | Type |
|---|---|
| document | (Refers DocumentDef) |
| locale | String |
| child | (List document-locale-child) |
Produces DocumentLocaleIR
Example
(document Profile
(page details :assignee author (text :profile/name "Name")))
(document-locale Profile "fr" (field :profile/name :label "Nom"))(document-localized document locales {:keys [default-locale]})ontology.lisp:1501
Lists a document's supported locales and optional default. Checks that the default belongs to the locale list.
| Slot | Type |
|---|---|
| document | (Refers DocumentDef) |
| locales | (List String) |
| default-locale | (Option String) |
Produces DocumentLocalizedIR
Example
(document Profile)
(document-localized Profile ["en" "fr"] :default-locale "en")(pdf-set/set field value)ontology.lisp:1538
Assigns a JSON value to a named PDF field within a switch case.
| Slot | Type |
|---|---|
| field | String |
| value | Json |
Produces PdfSetIR
Example
(pdf-mapping ProfilePdf
:template-blob "profile.pdf"
(switch :profile/color (case "blue" (set "Blue" true))))(pdf-case/case value assignment ...)ontology.lisp:1553
Groups PDF field assignments for one string match value.
| Slot | Type |
|---|---|
| value | String |
| assignment | (List pdf-set) |
Produces PdfCaseIR
Example
(pdf-mapping ProfilePdf
:template-blob "profile.pdf"
(switch :profile/color (case "blue" (set "Blue" true))))(pdf-entry/direct source field {:keys [transform]})ontology.lisp:1580
Maps a document keyword path to a PDF field, retaining an optional transform symbol.
| Slot | Type |
|---|---|
| source | Keyword |
| field | String |
| transform | (Option Symbol) |
Produces PdfDirectIR
Example
(pdf-mapping ProfilePdf
:template-blob "profile.pdf"
(direct :profile/name "Name"))(pdf-entry/computed expression field {:keys [transform]})ontology.lisp:1591
Maps captured expression syntax to a PDF field, retaining an optional transform symbol.
| Slot | Type |
|---|---|
| expression | Syntax |
| field | String |
| transform | (Option Symbol) |
Produces PdfComputedIR
Example
(pdf-mapping ProfilePdf
:template-blob "profile.pdf"
(computed (str "Hello") "Greeting"))(pdf-entry/switch source case ...)ontology.lisp:1602
Selects PDF assignments by matching a source keyword path against string cases.
| Slot | Type |
|---|---|
| source | Keyword |
| case | (List pdf-case) |
Produces PdfSwitchIR
Example
(pdf-mapping ProfilePdf
:template-blob "profile.pdf"
(switch :profile/color (case "blue" (set "Blue" true))))(pdf-mapping name { :keys [ display-name description template-blob template-file template-filename document]} mapping ...)ontology.lisp:1626
Declares a PDF template mapping with direct, computed, or switch entries and an optional source document.
| Slot | Type |
|---|---|
| name | (Declares PdfMappingDef) |
| display-name | (Option String) |
| description | (Option String) |
| template-blob | String |
| template-file | (Option String) |
| template-filename | (Option String) |
| document | (Option (Refers DocumentDef)) |
| mapping | (List pdf-entry) |
Produces PdfMappingIR
Example
(pdf-mapping ProfilePdf
:template-blob "profile.pdf"
(direct :profile/name "Name"))(constraint-child/resolution label action {:keys [auto input]})ontology.lisp:1686
Describes an action that can resolve a constraint, with optional automatic invocation and captured parameter expressions.
| Slot | Type |
|---|---|
| label | String |
| action | (Refers ActionDef) |
| auto | (Option Bool) |
| input | (Option (Record Syntax)) |
Produces ResolutionIR
Example
(entity Person {:age Int})
(: fix-age (Action Unit))
(define fix-age nil)
(constraint Adult
:entity Person
:severity :error
:when (< age 18)
:message "Must be an adult"
(resolution "Fix age" fix-age))(constraint-child/assigns-task-to role {:keys [priority title body]})ontology.lisp:1726
Adds a role assignment with optional priority and scoped title and body expressions to a constraint.
| Slot | Type |
|---|---|
| role | Symbol |
| priority | (Option String) |
| title | (Option (Expr String)) |
| body | (Option (Expr String)) |
Produces ConstraintTaskAssignmentIR
Example
(entity Person {:age Int})
(constraint Adult
:entity Person
:severity :error
:when (< age 18)
:message "Must be an adult"
(assigns-task-to reviewer :title "Review age"))(constraint name {:keys [entity severity description category when query message]} child ...)ontology.lisp:1796
Declares an entity constraint with a severity and message. Requires exactly one of a Boolean condition or captured query syntax.
| Slot | Type |
|---|---|
| name | (Declares ConstraintDef) |
| entity | (Refers SchemaDecl) |
| severity | (Union :error :warning :info) |
| description | (Option String) |
| category | (Option String) |
| when | (Option (Expr Bool)) |
| query | (Option Syntax) |
| message | (Expr String) |
| child | (List constraint-child) |
Produces ConstraintIR
Example
(entity Person {:age Int})
(constraint Adult
:entity Person
:severity :error
:when (< age 18)
:message "Must be an adult")(query-preset name query defaults {:keys [merge-policy]})ontology.lisp:1866
Declares captured default arguments for a query. Caller values override defaults unless preset-overrides is selected.
| Slot | Type |
|---|---|
| name | (Declares QueryPresetDef) |
| query | (Refers QueryDef) |
| defaults | (Record Syntax) |
| merge-policy | (Option (Union :caller-overrides :preset-overrides)) |
Produces QueryPresetIR
Example
(entity Person {:name String})
(query people :from Person)
(query-preset named people {:name "Ada"})(datalog-query name expression)ontology.lisp:1888
Declares a query from captured Datalog syntax, using the wildcard source and an empty field selection in QueryIR.
| Slot | Type |
|---|---|
| name | (Declares QueryDef) |
| expression | Syntax |
Produces QueryIR
Example
(datalog-query people
{:find [?person] :where [[?person :person/name ?name]]})(view-column/column name {:keys [label expr]})ontology.lisp:1908
Adds a keyword-named view column with an optional label and captured expression.
| Slot | Type |
|---|---|
| name | Keyword |
| label | (Option String) |
| expr | (Option Syntax) |
Produces ViewColumnIR
Example
(view People
:layout (text "People")
(column :person/name :label "Name"))(view name { :keys [ query title description subject mode fragment empty-state where default-sort row-action state input queries defs layout]} column ...)ontology.lisp:1975
Declares a view with query, state, input, and column configuration. Requests layout and reusable-definition compilation through the host's ViewSpec adapter.
| Slot | Type |
|---|---|
| name | (Declares ViewDef) |
| query | (Option (Refers QueryDef)) |
| title | (Option String) |
| description | (Option String) |
| subject | (Option Symbol) |
| mode | (Option String) |
| fragment | (Option Bool) |
| empty-state | (Option String) |
| where | (Option Syntax) |
| default-sort | (Option (List Json)) |
| row-action | (Option Syntax) |
| state | (Option (Record Json)) |
| input | (Option (Record Type)) |
| queries | (Option (Record Json)) |
| defs | (Option (Record Syntax)) |
| layout | (Option Syntax) |
| column | (List view-column) |
Produces ViewIR
Example
(view People :layout (rows (heading "People") (text "Welcome")))(__action name fields returns effect body checked entities relations documents calls)ontology.lisp:2071
Internal target of typed Action definitions. Checks the body in the declared input and capability scope, then projects inputs, return type, and captured body to ActionIR.
| Slot | Type |
|---|---|
| name | (Declares ActionDef) |
| fields | (Record Type) |
| returns | Type |
| effect | Type |
| body | Syntax |
| checked | (Expr effect) |
| entities | (List (Refers SchemaDecl)) |
| relations | (List (Refers RelationDef)) |
| documents | (List (Refers DocumentDef)) |
| calls | (List (Refers ActionDef)) |
Produces ActionIR
Example
(: save (Action Unit))
(define save nil)(http-endpoint/endpoint name {:keys [method path payload query headers success errors openapi]})ontology.lisp:2261
Describes an ontology HTTP endpoint with an uppercase method and checked request and response type syntax. This is separate from the Effect HttpApi prelude.
| Slot | Type |
|---|---|
| name | Symbol |
| method | (Union :get :post :put :patch :delete :head :options) |
| path | String |
| payload | (Option Type) |
| query | (Option (Record Type)) |
| headers | (Option (Record Type)) |
| success | Type |
| errors | (Option (List Type)) |
| openapi | (Option Json) |
Produces HttpEndpointIR
Example
(type Response {:name String})
(api People
(endpoint list :method :get :path "/people" :success Response))(api name {:keys [path-params openapi]} endpoint ...)ontology.lisp:2408
Declares an ontology HTTP API. Checks endpoint names, path parameters, and success and error type references.
| Slot | Type |
|---|---|
| name | (Declares HttpApiDecl) |
| path-params | (Option (Record Type)) |
| openapi | (Option Json) |
| endpoint | (List http-endpoint) |
Produces HttpApiIR
Example
(type Response {:name String})
(api People
(endpoint list :method :get :path "/people" :success Response))Functions 35
Ordinary typed definitions that programs and elaboration hooks can call.
optional-type?ontology.lisp:66
Recognizes the outer Option constructor in authored type syntax.
(define optional-type? [t] …)
field-base-typeontology.lisp:69
Removes Option and field metadata from an attribute's value-type contract.
(define field-base-type [t] …)
fields->irontology.lisp:73
Qualifies attribute names and projects required, indexed, description, and default metadata.
(define fields->ir [owner fields] …)
assignments->irontology.lisp:89
Qualifies assignment keys for a declaration's owning schema.
(define assignments->ir [owner fields] …)
seed-rowontology.lisp:150
Builds an owner-qualified validation row with field metadata stripped.
(define seed-row [owner] …)
seed-valuesontology.lisp:161
Applies declared defaults before validating a seed or relation assignment.
(define seed-values [owner fields] …)
seed-assignmentsontology.lisp:183
Produces owner-qualified seed fields, including defaults omitted by the author.
(define seed-assignments [owner fields] …)
entity-fieldsontology.lisp:276
Exposes entity attributes under short names for scoped expressions.
(define entity-fields [entity] …)
expression-entriesontology.lisp:493
Retains named expressions as runtimeSource entries rather than evaluating them.
(define expression-entries [fields] …)
referenceontology.lisp:497
Builds a named declaration reference only when an optional name is present.
(define reference [kind name] …)
children-of-kindontology.lisp:545
Selects projected child records by their literal IR kind.
(define children-of-kind [kind children] …)
unique-valuesontology.lisp:549
Deduplicates a sequence while retaining its first-seen order.
(define unique-values [values] …)
graph/reachable?ontology.lisp:556
Tests directed reachability with a visited set to terminate on cycles.
(define graph/reachable? [edges from to visited] …)
graph/cycle-diagnosticsontology.lisp:572
Reports edges that close a dependency cycle.
(define graph/cycle-diagnostics [edges] …)
process/checkontology.lisp:588
Checks node uniqueness, edge endpoints (including the virtual start node), and graph cycles.
(define process/check [children] …)
binding/keyontology.lisp:668
Finds a declared field by its full name or final path segment.
(define binding/key [owner field] …)
binding/checkontology.lisp:680
Rejects an unknown attribute binding; absent bindings need no check.
(define binding/check [binding] …)
attribute-bindingontology.lisp:696
Projects an entity attribute reference, retaining absent transform and cardinality as optional values.
(define attribute-binding [binding transform cardinality] …)
document/checkontology.lisp:1237
Checks unique section identifiers and field paths, dependency targets, and dependency cycles.
(define document/check [pages] …)
document/raw-optionontology.lisp:1429
Reads an option directly from captured declaration syntax.
(define document/raw-option [items key] …)
document/locale-checkontology.lisp:1438
Checks locale references against the source document's authored roles, sections, and field paths.
(define document/locale-check [document children] …)
scope/mergeontology.lisp:1748
Combines scope records, letting the right-hand record override an existing name.
(define scope/merge [left right] …)
datalog/scopeontology.lisp:1756
Infers Datalog variable bindings from attribute clauses, excluding not and not-join scopes.
(define datalog/scope [query] …)
optional-recordontology.lisp:1945
Preserves absence while converting a captured record into an ordinary map.
(define optional-record [entries] …)
view/sortontology.lisp:1955
Turns a field/direction pair into a sort record; an omitted direction defaults to asc.
(define view/sort [sort] …)
view/defsontology.lisp:1963
Compiles each named layout definition through the ViewSpec descriptor tree.
(define view/defs [defs state queries input] …)
action/effectontology.lisp:2069
Builds the checked action body's effect contract from its return type.
(define action/effect [result] …)
action/recordontology.lisp:2114
Reifies an entity field row, optionally wrapping every base field type in Option.
(define action/record [entity optional] …)
action/input-typeontology.lisp:2127
Reifies an entity-valued input as its field row plus a typed id; other types pass through.
(define action/input-type [type] …)
action/scopeontology.lisp:2134
Constructs the body scope from input fields and referenced entities, relations, and actions.
(define action/scope [fields entities relations calls] …)
syntax-optionontology.lisp:2209
Finds a keyword option in captured syntax without evaluating it.
(define syntax-option [syntax key] …)
process/scopeontology.lisp:2224
Exposes each node action return type under outputs.node.action; nodes without actions return Unit.
(define process/scope [children] …)
http/type-checkontology.lisp:2301
Validates builtin, named, record, and supported composite HTTP schema syntax.
(: http/type-check (-> Any (List Any)))
http/path-parametersontology.lisp:2338
Extracts brace-delimited path parameter names from an ontology endpoint path.
(define http/path-parameters [path] …)
http/api-checkontology.lisp:2343
Checks duplicate endpoint names, path parameters, and all request and response schemas.
(define http/api-check [path-params endpoints] …)
Types 64
Payload contracts and IR shapes, shown as authored.
EntityFieldIRontology.lisp:12
Normalized attribute contract; names are owner-qualified keywords and defaults retain presence separately from null.
(type EntityFieldIR
{
:name Keyword
:type Type
:required Bool
:indexed Bool
:description (Option String)
:default (Option Json)})EntityIRontology.lisp:21
(type EntityIR
{
:kind "Entity"
:name Symbol
:fields (List EntityFieldIR)
:doc (Option String)
:role (Option String)
:idPattern (Option String)})RelationIRontology.lisp:30
(type RelationIR
{
:kind "Relation"
:name Symbol
:source Symbol
:target Symbol
:fields (List EntityFieldIR)})RecordIRontology.lisp:38
(type RecordIR
{
:kind "Record"
:name String
:id String
:entity Symbol
:fields (Map String Json)})LinkIRontology.lisp:46
(type LinkIR
{
:kind "Link"
:name String
:relation Symbol
:source String
:target String
:sourceId String
:targetId String
:fields (Map String Json)})SystemAttributeIRontology.lisp:57
(type SystemAttributeIR
{
:kind "SystemAttribute"
:name Symbol
:valueType Type
:required Bool
:doc (Option String)})MetaEntityIRontology.lisp:97
A schema-definition entity selected by the entity form's :tier :meta option.
(type MetaEntityIR
{
:kind "MetaEntity"
:name Symbol
:fields (List EntityFieldIR)
:doc (Option String)
:role (Option String)
:idPattern (Option String)})EntityDeclarationIRontology.lisp:106
(type EntityDeclarationIR (Union EntityIR MetaEntityIR))QueryIRontology.lisp:266
SECTION 2 — QUERIES AND FIELD SCOPE
(type QueryIR
{
:kind "Query"
:name Symbol
:from Symbol
:where (Option RuntimeExpr)
:datalog (Option RuntimeExpr)
:select (List Keyword)})WorkspaceIRontology.lisp:320
Domain projections are ordinary functions over typed syntax holes. SECTION 3 — WORKSPACES AND ACCESS POLICIES
(type WorkspaceIR
{
:kind "Workspace"
:name Symbol
:title (Option String)
:persona (Option String)
:subject (Option Symbol)
:home (Option Symbol)
:views (List Symbol)})IdentityDeclarationIRontology.lisp:354
(type IdentityDeclarationIR
{
:kind "IdentityDeclaration"
:identityKind String
:name Symbol
:description (Option String)
:member (Option Symbol)
:group (Option Symbol)
:principal (Option Symbol)
:resource (Option Symbol)
:resolver (Option RuntimeExpr)})PermissionDeclarationIRontology.lisp:395
(type PermissionDeclarationIR
{
:kind "PermissionDeclaration"
:name Symbol
:principal Symbol
:action Symbol
:resource Symbol
:effect String
:condition (Option RuntimeExpr)
:description (Option String)})TriggerIRontology.lisp:440
SECTION 4 — PROCESS GRAPHS
(type TriggerIR {:kind "Trigger" :triggerKind String :entity Symbol})process-triggerontology.lisp:444
Child-form category for process triggers; the namespace selects on-create, on-update, or on-delete.
(type process-trigger TriggerIR)ProcessInputIRontology.lisp:473
(type ProcessInputIR {:name String :expr RuntimeExpr})ProcessNodeIRontology.lisp:475
(type ProcessNodeIR
{
:kind "Node"
:id Symbol
:action (Option Symbol)
:actionRef (Option {:kind "Action" :name Symbol})
:join (Option String)
:fanOut (Option String)
:inputs (List ProcessInputIR)})ProcessEdgeIRontology.lisp:485
(type ProcessEdgeIR
{:kind "Edge" :from Symbol :to Symbol :guard (Option RuntimeExpr)})process-childontology.lisp:489
Child-form category for the mixed node and edge children of a process.
(type process-child (Union ProcessNodeIR ProcessEdgeIR))ProcessIRontology.lisp:535
(type ProcessIR
{
:kind "Process"
:name Symbol
:description (Option String)
:trigger TriggerIR
:nodes (List ProcessNodeIR)
:edges (List ProcessEdgeIR)})DocumentOptionIRontology.lisp:640
SECTION 5 — DOCUMENT FIELDS AND PAGES
(type DocumentOptionIR {:kind "Option" :value String :label String})document-optionontology.lisp:643
Child-form category for stored option values and labels.
(type document-option DocumentOptionIR)AttributeBindingIRontology.lisp:659
(type AttributeBindingIR
{
:kind "AttributeBinding"
:attribute Keyword
:entity Symbol
:transform (Option String)
:cardinality (Option String)})DocumentFieldIRontology.lisp:709
(type DocumentFieldIR
{
:kind "Field"
:type String
:path Keyword
:label (Option String)
:description (Option String)
:content (Option String)
:required Bool
:binding (Option AttributeBindingIR)
:options (List DocumentOptionIR)})document-fieldontology.lisp:722
Child-form category for document input fields and static content.
(type document-field DocumentFieldIR)DocumentCompletionIRontology.lisp:1160
(type DocumentCompletionIR
{
:kind "CompletionMutation"
:mutation Symbol
:mutationRef {:kind "Action" :name Symbol}
:entity (Option Symbol)
:entityRef (Option {:kind "Entity" :name Symbol})})document-completionontology.lisp:1169
Child-form category for page completion actions.
(type document-completion DocumentCompletionIR)DocumentPageIRontology.lisp:1194
(type DocumentPageIR
{
:kind "Page"
:sectionId Symbol
:assignee Symbol
:description (Option String)
:dependsOn (List Symbol)
:completion (Option DocumentCompletionIR)
:fields (List DocumentFieldIR)})document-pageontology.lisp:1205
Child-form category for assigned pages within a document.
(type document-page DocumentPageIR)DocumentIRontology.lisp:1268
(type DocumentIR
{
:kind "Document"
:name Symbol
:description (Option String)
:pages (List DocumentPageIR)})TaskInputIRontology.lisp:1293
SECTION 6 — TASK DEFINITIONS
(type TaskInputIR {:name Keyword :type Type :required Bool})TaskDefinitionIRontology.lisp:1295
(type TaskDefinitionIR
{
:kind "TaskDefinition"
:name Symbol
:title String
:description (Option String)
:documentRef (Option {:kind "Document" :name Symbol})
:sectionRefs (List Symbol)
:defaultAssignee (Option Json)
:guidanceRef (Option Symbol)
:inputs (List TaskInputIR)
:scope (Option Json)})DocumentRoleLocaleIRontology.lisp:1351
SECTION 7 — DOCUMENT LOCALIZATION
(type DocumentRoleLocaleIR
{
:kind "Role"
:name Symbol
:label (Option String)
:description (Option String)})DocumentSectionLocaleIRontology.lisp:1358
(type DocumentSectionLocaleIR
{
:kind "Section"
:name Symbol
:label (Option String)
:description (Option String)})DocumentFieldLocaleIRontology.lisp:1365
(type DocumentFieldLocaleIR
{
:kind "LocaleField"
:path Keyword
:label (Option String)
:description (Option String)
:options (List DocumentOptionIR)})document-locale-childontology.lisp:1374
Child-form category for role, section, and field locale overrides.
(type document-locale-child
(Union DocumentRoleLocaleIR DocumentSectionLocaleIR DocumentFieldLocaleIR))DocumentLocaleIRontology.lisp:1418
(type DocumentLocaleIR
{
:kind "DocumentLocale"
:documentName Symbol
:documentRef {:kind "Document" :name Symbol}
:locale String
:roles (List DocumentRoleLocaleIR)
:sections (List DocumentSectionLocaleIR)
:fields (List DocumentFieldLocaleIR)})DocumentLocalizedIRontology.lisp:1493
(type DocumentLocalizedIR
{
:kind "DocumentLocalized"
:documentName Symbol
:documentRef {:kind "Document" :name Symbol}
:locales (List String)
:defaultLocale (Option String)})PdfSetIRontology.lisp:1533
SECTION 8 — PDF MAPPINGS
(type PdfSetIR {:kind "Set" :pdfField String :value Json})pdf-setontology.lisp:1536
Child-form category for PDF field assignments within a case.
(type pdf-set PdfSetIR)PdfCaseIRontology.lisp:1548
(type PdfCaseIR {:kind "Case" :when String :assignments (List PdfSetIR)})pdf-caseontology.lisp:1551
Child-form category for string cases within a PDF switch.
(type pdf-case PdfCaseIR)PdfDirectIRontology.lisp:1563
(type PdfDirectIR
{:kind "Direct" :source Keyword :pdfField String :transform (Option Symbol)})PdfComputedIRontology.lisp:1566
(type PdfComputedIR
{
:kind "Computed"
:expr RuntimeExpr
:pdfField String
:transform (Option Symbol)})PdfSwitchIRontology.lisp:1573
(type PdfSwitchIR {:kind "Switch" :source Keyword :cases (List PdfCaseIR)})PdfMappingEntryIRontology.lisp:1575
(type PdfMappingEntryIR (Union PdfDirectIR PdfComputedIR PdfSwitchIR))pdf-entryontology.lisp:1578
Child-form category for direct, computed, and switch PDF mappings.
(type pdf-entry PdfMappingEntryIR)PdfMappingIRontology.lisp:1613
(type PdfMappingIR
{
:kind "PdfMapping"
:name Symbol
:displayName (Option String)
:description (Option String)
:templateBlob String
:templateFile (Option String)
:templateFilename (Option String)
:documentName (Option Symbol)
:documentRef (Option {:kind "Document" :name Symbol})
:mappings (List PdfMappingEntryIR)})ResolutionInputIRontology.lisp:1672
Constraints share entity scope with queries. Resolution parameters are records. SECTION 9 — CONSTRAINTS AND RESOLUTIONS
(type ResolutionInputIR {:param String :runtimeSource RuntimeExpr})ResolutionIRontology.lisp:1674
(type ResolutionIR
{
:kind "Resolution"
:label String
:action Symbol
:actionRef {:kind "Action" :name Symbol}
:autoInvoke Bool
:inputs (List ResolutionInputIR)})constraint-childontology.lisp:1684
Child-form category for constraint resolutions and role assignments.
(type constraint-child (Union ResolutionIR ConstraintTaskAssignmentIR))ConstraintTaskAssignmentIRontology.lisp:1718
(type ConstraintTaskAssignmentIR
{
:kind "TaskAssignment"
:role Symbol
:priority (Option String)
:title (Option RuntimeExpr)
:body (Option RuntimeExpr)})ConstraintIRontology.lisp:1781
(type ConstraintIR
{
:kind "Constraint"
:name Symbol
:entity Symbol
:entityRef {:kind "Entity" :name Symbol}
:severity String
:description (Option String)
:category (Option String)
:when (Option RuntimeExpr)
:query (Option RuntimeExpr)
:message RuntimeExpr
:taskAssignments (List ConstraintTaskAssignmentIR)
:resolutions (List ResolutionIR)})QueryPresetParamIRontology.lisp:1856
SECTION 10 — QUERY PRESETS AND DATALOG
(type QueryPresetParamIR {:name String :value RuntimeExpr})QueryPresetIRontology.lisp:1858
(type QueryPresetIR
{
:kind "QueryPreset"
:name Symbol
:queryRef {:kind "Query" :name Symbol}
:defaults (List QueryPresetParamIR)
:mergePolicy String})ViewColumnIRontology.lisp:1902
A view and an embeddable fragment have one shape. State and inputs use records. SECTION 11 — VIEWS AND LAYOUTS
(type ViewColumnIR
{:name Keyword :label (Option String) :expr (Option RuntimeExpr)})view-columnontology.lisp:1906
Child-form category for optional view column descriptors.
(type view-column ViewColumnIR)ViewSortIRontology.lisp:1919
(type ViewSortIR {:field Keyword :direction String})ViewIRontology.lisp:1921
(type ViewIR
{
:kind "View"
:name Symbol
:doc (Option String)
:query (Option Symbol)
:queryRef (Option {:kind "Query" :name Symbol})
:title (Option String)
:subject (Option Symbol)
:mode (Option String)
:fragment Bool
:emptyState (Option String)
:where (Option RuntimeExpr)
:defaultSort (Option ViewSortIR)
:rowAction (Option RuntimeExpr)
:columns (List ViewColumnIR)
:state (Option Json)
:input (Option Json)
:queries (Option Json)
:defs (Option Json)
:root (Option Json)
:layout (Option Json)})ActionInputIRontology.lisp:2054
Internal action projection. Public operations are a signature plus an ordinary define. SECTION 12 — TYPED ACTIONS
(type ActionInputIR {:name String :type Type :required Bool})ActionIRontology.lisp:2056
(type ActionIR
{
:kind "Action"
:name Symbol
:inputs (List ActionInputIR)
:returns Type
:do RuntimeExpr})(Action a)ontology.lisp:2066
Capability-bearing result of typed ontology actions; normalization targets the internal __action form.
(type (Action a) (Effect a [] [OntologyRuntime]))HttpEndpointIRontology.lisp:2244
Datalog introduces the variables bound by positive attribute clauses. SECTION 13 — ONTOLOGY HTTP APIS
(type HttpEndpointIR
{
:kind "Endpoint"
:name Symbol
:method String
:path String
:payload (Option Type)
:query (Map String Type)
:headers (Map String Type)
:success Type
:errors (List Type)
:openapi (Option Json)})http-endpointontology.lisp:2259
Child-form category for the ontology API; distinct from http-api.lisp's Effect vocabulary.
(type http-endpoint HttpEndpointIR)HttpApiIRontology.lisp:2400
(type HttpApiIR
{
:kind "HttpApi"
:name Symbol
:pathParams (Map String Type)
:endpoints (List HttpEndpointIR)
:openapi (Option Json)})Example corpus 19
Unrelated domains written against this stack. Each is reviewable Markdown with Lisp in fenced blocks, and conformance inputs for the engine.
- BizOpsRevenue and operations example in canonical ontology syntax.
- BookstoreBookstore catalog example in canonical ontology syntax.
- ChronicleNarrative event log example in canonical ontology syntax.
- CompanyCore company org example in canonical ontology syntax.
- Compiler DebugSmall compiler fixture focused on demo and debug tooling. It intentionally covers one entity graph, records, a basic query, a filtered query, an action, and a query-backed view without pulling in the larger staffing surface.
- D&DTabletop campaign example in canonical ontology syntax.
- Data RoomSecure deal room example in canonical ontology syntax.
- FamilyFamily relationships example in canonical ontology syntax.
- FantasyFantasy realm example in canonical ontology syntax.
- HRHR onboarding example in canonical ontology syntax.
- InsuranceInsurance policy and claims example in canonical ontology syntax.
- Labor RelationsThis client-neutral example models a labor-relations union authorization card workflow. A covered placement arrives from an HRIS or requisition feed, the ontology evaluates CBA context, creates the correct authorization task, captures a signed mobile form, and exposes the completed document for downstream routing.
- Law Firm BackofficeClient onboarding, matter management, document chasing, and billing review for a general law firm backoffice.
- MoviesMovies catalog example in canonical ontology syntax.
- Performance ReviewsPerformance review cycle example in canonical ontology syntax.
- Real EstateListings and agents example in canonical ontology syntax.
- Staffing AgencyCanonical staffing example as a multi-file markdown ontology.
- TeamsSmall team topology example in canonical ontology syntax.
- Todo Application OntologyA simple todo list application with support for adding, listing, and marking tasks as complete.