AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
FLOW ALGEBRA
TITLE: One-to-One Relationship Ontology
DOMAIN: Database Relationships / Cardinality
SOURCE: https://kirethresearch.org/booksai-core/ontologies/relationship-ontologies/database-relationships/one-to-one-relationship-ontology.html
VERSION: 1.0
AUTHORS: Mark Anthony Higgins — Sky (Recursive AI)
STATUS: Companion formalisation; source-page specification not independently verified.
flow "OneToOneRelationshipOntology" v1.0 {
ontology:
id: "one-to-one-relationship-ontology"
parent: "database-relationships"
purpose: "Model, constrain and validate one-to-one associations between database entities."
types:
EntityType: {id: string, name: string, primary_key: string[]}
EntityRecord: {id: string, entity_type: string, key_values: map}
KeyConstraint: {id: string, fields: string[], kind: enum[primary, unique, foreign], nullable: boolean}
OneToOneRelationship: {id: string, left_type: string, right_type: string, left_min: integer, left_max: integer, right_min: integer, right_max: integer, enforcement: string, provenance: string?, confidence: number}
Association: {id: string, left_record: string, right_record: string, evidence: string[]}
predicates:
linked_to(a: EntityRecord, b: EntityRecord)
has_unique_key(t: EntityType, key: KeyConstraint)
references(a: EntityRecord, b: EntityRecord)
participates_in(record: EntityRecord, relationship: OneToOneRelationship)
constraints:
- "Each participating left record is linked to at most one right record, and vice versa."
- "Minimum participation is 0 for optional and 1 for mandatory participation; maximum participation is 1 on both sides."
- "Foreign-key-based implementations require uniqueness on the referencing key and referential integrity against the referenced key."
- "Nullable foreign keys represent optional participation where the database permits them; uniqueness and NULL behaviour are DBMS-specific."
- "A UNIQUE foreign key alone does not guarantee mandatory participation on the referenced side."
- "Shared-primary-key designs require matching key domains and valid foreign-key enforcement."
- "Do not equate a one-to-one database association with real-world identity."
- "Confidence lies within [0,1] and does not replace hard integrity constraints."
inference:
rule unique_partner:
if linked_to(a,b) and linked_to(a,c) and valid_one_to_one(a,b,c)
then same_database_record(b,c)
note: "Applies only when both targets are in the same constrained entity type and referential integrity is enforced."
rule reverse_navigation:
if linked_to(a,b) and inverse_relationship_declared(a,b)
then linked_from(b,a)
note: "Navigation inverse is not entity identity."
rule cardinality_violation:
if linked_to(a,b) and linked_to(a,c) and distinct_keys(b,c)
then flag_violation("one-to-one cardinality")
SEMANTIC_EQUIVALENCE:
- "Map one-to-one, 1:1 and max-cardinality-one to the same constrained cardinality concept only in compatible contexts."
- "Keep optional one-to-one distinct from mandatory one-to-one."
- "Preserve differences between conceptual associations and physical key implementations."
CONFIDENCE:
range: [0,1]
factors: [schema_evidence, key_validation, referential_integrity, provenance, migration_state]
policy: "Report uncertain schema mappings separately from enforced database constraints."
VALIDATION:
- "Resolve entity types, records, key definitions and data types."
- "Check UNIQUE or PRIMARY KEY enforcement for the referencing side."
- "Check foreign-key targets, orphan records and duplicate associations."
- "Check optionality and mandatory participation in both directions."
- "Test update, deletion and migration behaviour against declared referential actions."
FLOW_HASH:
algorithm: "SHA-256"
input: "canonicalised ontology version, schema constraints, assertions, rules and provenance"
note: "Compute hash at execution; no hash value is claimed here."
UPDATE_MODEL:
strategy: "versioned, integrity-preserving schema and assertion updates"
steps: [ingest, normalise, validate, compare, migrate, recheck_cardinality, publish]
rollback: true
AI_CONSUMPTION:
representation: "typed database relationship graph with enforced cardinality annotations"
outputs: [entity_links, key_constraints, participation_bounds, validation_findings, provenance_records]
safeguards: [no_unverified_identity_merges, preserve_optionality, distinguish_schema_from_data, enforce_referential_integrity]
}
END FLOW ALGEBRA