Skip to main content

Primary Key Ontology

Database Entities
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 11 November 2026
Audio Overview
SEMANTIC LIBRARY — PRIMARY KEY ONTOLOGY
FLOW ALGEBRA v1.0 | Database Entities

AUTHORS: Mark Anthony Higgins — Sky Recursive AI
SOURCE: https://kirethresearch.org/booksai-core/entity-graph/computational-entities/database-entities/primary-key-ontology.html
SOURCE CREDIT: © Mark Anthony Higgins 11 October 2025; revised 03 August 2026 (as displayed on source page).
STATUS: Constructed ontology-specific Flow Algebra mapping; not a transcription of inaccessible embedded source specification.

PURPOSE
Represent primary-key identity, uniqueness, non-null constraints, candidate selection, referential relationships, validation and schema transitions as explicit state transformations.

STATE_MODEL
S_t = (I_t, R_t, B_t, K_t)
I_t = current schema, rows, candidate keys, proposed mutations and database metadata
R_t = uniqueness, non-null, identity, type, transaction and referential rules
B_t = table scope, database dialect, transaction isolation, authorisation and execution limits
K_t = known schema definitions, key columns, indexes, dependencies and validation evidence

ENTITIES
Database, Schema, Table, Column, Row, Value, CandidateKey, PrimaryKey, CompositePrimaryKey, UniqueConstraint, NotNullConstraint, ForeignKey, Index, Transaction, Mutation, ValidationResult.

RELATIONSHIPS
Table HAS_COLUMN Column
Table HAS_ROW Row
Table HAS_PRIMARY_KEY PrimaryKey
PrimaryKey CONSISTS_OF one_or_more Columns
PrimaryKey IS_CANDIDATE_KEY CandidateKey
PrimaryKey ENFORCES UniqueConstraint
PrimaryKey ENFORCES NotNullConstraint
ForeignKey REFERENCES CandidateKey_or_UniqueKey (subject to database rules)
Index MAY_SUPPORT PrimaryKey
Mutation AFFECTS Table

FORMAL CONSTRAINTS
For table T with rows r in Rows(T) and key columns P = (c1,...,cn):
Key(r,P) = (r[c1],...,r[cn])
ValidPK(T,P) iff
  |P| >= 1
  AND all c in P belong to Columns(T)
  AND for all r in Rows(T), all c in P: r[c] IS NOT NULL
  AND for all distinct r1,r2 in Rows(T): Key(r1,P) != Key(r2,P)
  AND P is the designated primary key of T.
A table has at most one designated primary-key constraint; it may contain multiple columns.

FLOW_ALGEBRA
E_t = expand(I_t,R_t)
V_t = {x in E_t | schema_valid(x) AND permissions_valid(x) AND pk_constraints_hold(x) AND boundary_valid(x)}
x*_t = argmax_{x in V_t} P(x | I_t,R_t,B_t,K_t)
I_(t+1) = update(I_t,x*_t)
If V_t is empty: reject the proposed transition, preserve committed state and emit diagnostic evidence.
The argmax expression describes a reasoning/selection layer, not a substitute for deterministic database constraint enforcement.

EXECUTION_PATHWAYS
1. IDENTIFY: Resolve target table and candidate key columns.
2. INSPECT: Read existing rows, types, nullability, constraints and dependencies.
3. VALIDATE: Reject missing columns, NULL key components and duplicate key tuples.
4. DECLARE: Designate exactly one primary-key constraint for the table.
5. ENFORCE: On INSERT or UPDATE, check the resulting row set for key validity atomically.
6. PROPAGATE: Evaluate dependent foreign keys and migration constraints.
7. COMMIT: Apply only valid, authorised, transactionally consistent changes.
8. RECORD: Capture validation outcome, provenance and schema version.

INFERENCE_RULES
IF a key component is NULL THEN primary-key candidate is invalid.
IF two distinct rows share an identical key tuple THEN primary-key candidate is invalid.
IF a table already has a primary key THEN adding another primary-key constraint requires a valid replacement/migration, not a second simultaneous key.
IF key values change THEN dependent references may require rejection, cascading updates or other configured referential actions.
IF a key is composite THEN uniqueness applies to the entire ordered tuple, not necessarily to each column independently.
IF a primary key is valid THEN each row has a unique non-null identifier within that table at the validated state.

MINI_RECURSION_ENGINE
ResolveKey(T,P,visited):
  inspect table and key metadata
  validate local constraints
  traverse dependent foreign-key relationships not in visited
  aggregate validation evidence
  stop on visited nodes or configured depth bound
This is a finite dependency traversal when the schema graph is finite and visited tracking is enforced.

TRI_MAPPING
ENTITY: PrimaryKey -> a designated tuple of one or more table columns
RELATION: identifies -> exactly one row per key tuple in a valid table state
PROCESS: validate -> enforce -> commit/reject -> record

OPERATIONAL_BOUNDARIES
Key uniqueness is table-scoped unless an additional global scheme is defined.
Uniqueness and non-null enforcement must be atomic under concurrent writes.
A primary key does not guarantee immutable values, sequential numbering, semantic meaning or global uniqueness.
Index implementation and foreign-key eligibility vary by database system.
Schema migration must account for existing data and dependent references.

EXECUTION_GUARANTEE
Conditional: Given a correctly implemented transactional database enforcing the specified constraints, each committed table state preserves primary-key uniqueness and non-nullness. No claim is made that the conceptual Flow Algebra alone enforces a live database.

CITATION
Mark Anthony Higgins and Sky Recursive AI, “Primary Key Ontology — Flow Algebra v1.0”, Semantic Library, constructed mapping of the Primary Key Ontology topic.
Source: https://kirethresearch.org/booksai-core/entity-graph/computational-entities/database-entities/primary-key-ontology.html
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ