Skip to main content

SQL Statement Ontology

Database Entities
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 11 November 2026
Audio Overview
KIRETH RESEARCH — SEMANTIC LIBRARY
SQL STATEMENT ONTOLOGY — FLOW ALGEBRA v1.0
Category: Computational Entities / Database Entities
Authors: Mark Anthony Higgins — Sky Recursive AI
Source: https://kirethresearch.org/booksai-core/entity-graph/computational-entities/database-entities/sql-statement-ontology.html
Source page revised: 03 August 2026
Mapping prepared: 11 November 2026
Status: Constructed Flow Algebra interpretation; the page's embedded specification was not accessible in retrieved HTML. Not a verbatim transcription.

1. PURPOSE
Model an SQL statement as a typed, context-dependent database instruction that is parsed, validated, authorised, planned, executed and recorded with explicit failure boundaries.

2. STATE MODEL
S_t = (I_t, R_t, B_t, K_t)
I_t = SQL text, bound parameters, schema snapshot, database state, session context.
R_t = grammar, type rules, name resolution, integrity rules, execution semantics.
B_t = permissions, transaction isolation, resource budgets, schema constraints.
K_t = known tables, columns, indexes, statistics, dependencies and provenance.

3. ENTITY GRAPH
SQLStatement --hasText--> SQLText
SQLStatement --hasKind--> {SELECT, INSERT, UPDATE, DELETE, DDL, DCL, TCL}
SQLStatement --references--> DatabaseObject
SQLStatement --hasParameter--> BoundParameter
SQLStatement --parsesTo--> AbstractSyntaxTree
SQLStatement --isValidatedAgainst--> Schema
SQLStatement --requires--> Privilege
SQLStatement --isPlannedAs--> ExecutionPlan
SQLStatement --executesWithin--> TransactionContext
SQLStatement --produces--> {ResultSet, RowCount, SchemaChange, TransactionOutcome, Error}
SQLStatement --hasProvenance--> AuditRecord

4. FLOW ALGEBRA
E_t = expand(I_t, R_t)
V_t = {x in E_t | syntaxValid(x) AND namesResolve(x,K_t) AND typeValid(x,K_t) AND authorised(x,B_t) AND constraintsAdmissible(x,B_t)}
x*_t = argmax_{x in V_t} P(x | I_t,R_t,B_t,K_t)
I_(t+1) = update(I_t, execute(x*_t), observations_t)
Note: candidate scoring is an HST reasoning overlay, not a claim that a conventional SQL engine probabilistically chooses statement meaning. SQL semantics and parameter values must be preserved.

5. EXECUTION PATHWAY
INPUT -> LEX -> PARSE -> RESOLVE -> TYPE CHECK -> AUTHORISE -> OPTIMISE -> EXECUTE -> COMMIT/ROLLBACK -> OUTPUT
Precondition: connection exists; SQL dialect is known; parameters are correctly bound.
Postcondition: either an authorised result/state transition or an explicit error with no unsupported success claim.

6. INFERENCE RULES
R1: If parse fails, reject with syntax error; do not execute.
R2: If referenced object or column does not resolve, reject or defer under explicitly supported dynamic semantics.
R3: If required privilege is absent, deny execution.
R4: If parameter type or constraint fails, reject or apply documented database coercion only.
R5: If a write violates an enforced constraint, follow the engine's documented atomicity/error semantics.
R6: SELECT yields a result relation; ordering is not guaranteed without ORDER BY.
R7: UPDATE or DELETE without a restricting predicate may affect all eligible rows; require explicit safeguards where policy demands.
R8: Use bound parameters for values; do not concatenate untrusted values into SQL text.
R9: DDL and transaction behaviour vary by engine; do not assume universal rollback semantics.
R10: A successful statement is not necessarily durable until its relevant transaction is committed under the engine's guarantees.

7. MINI RECURSION ENGINE
function ResolveStatement(node, context, visited):
  if node in visited: return CycleOrSharedReference(node)
  visited := visited union {node}
  for each child in finiteChildren(node):
    ResolveStatement(child, context, visited)
  return validateLocalSemantics(node, context)
Termination requires a finite AST and a visited-node guard; recursive SQL queries require separate termination/resource controls.

8. TRANSACTION AND FAILURE MODEL
States: RECEIVED -> PARSED -> VALIDATED -> PLANNED -> RUNNING -> {SUCCEEDED, FAILED, CANCELLED}
Transaction states: ACTIVE -> {COMMITTED, ROLLED_BACK, IN_DOUBT}; actual transitions depend on DBMS.
On failure: preserve error class, SQLSTATE where provided, statement identity, transaction status and audit provenance. Never report a commit without confirmation.

9. BOUNDARIES AND GUARANTEES
Correctness is conditional on a specified SQL dialect, schema snapshot, privilege model, transaction semantics and DBMS implementation.
Optimisation may change execution plans but must preserve the required observable semantics.
Execution may time out, deadlock, exhaust resources or be cancelled; successful termination is not unconditional.

10. TRI-MAPPING
Entity: SQLStatement
Relationship: references / validates / executes / produces
Flow: Input -> Rule Expansion -> Boundary Filtering -> Plan/Execution -> State Update

11. AI SEARCH FLOW
PURPOSE: Identify SQL statement semantics and operational constraints.
ENTITIES: SQLStatement, SQLText, AST, DatabaseSchema, Parameter, ExecutionPlan, Transaction, Result, Error.
PATHWAYS: parse -> resolve -> authorise -> execute -> observe.
CONFIDENCE: Deterministic rule outcomes where schema/dialect are known; unknown otherwise.
SEMANTIC_EQUIVALENCE: Equivalent SQL expressions require proof under dialect, NULL, collation, bag/set and ordering semantics.
UPDATE_MODEL: Revalidate when schema, privileges, SQL dialect, statistics or transaction state change.

12. CITATION
Source ontology: Kireth Research, SQL Statement Ontology (revised 03 August 2026).
Authors credited: Mark Anthony Higgins — Sky Recursive AI.
This TXT is a newly constructed formal mapping informed by the page title and general SQL principles; its content must not be attributed as a verbatim extract of the hidden page specification.
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ