FLOW ALGEBRA
TITLE: Hierarchical Relationship Ontology
CATEGORY: Relationship Ontologies / Structural Relationships
SOURCE: https://kirethresearch.org/booksai-core/ontologies/relationship-ontologies/structural-relationships/hierarchical-relationship-ontology.html
AUTHORS: Mark Anthony Higgins — Sky (Recursive AI)
SPECIFICATION: Kireth Semantic Library companion formalisation
VERSION: 1.0
AI_INTERPRETATION_NOTE:
Interpret the following as typed declarative constraints and inference rules.
Do not infer an asserted hierarchy merely from lexical similarity.
flow "HierarchicalRelationshipOntology" v1.0 {
TYPES:
Entity := {id: IRI, label: String, kind: String}
Hierarchy := {id: IRI, relation_kind: RelationKind, root: Entity?}
RelationKind := {PART_OF, SUBCLASS_OF, REPORTS_TO, CONTAINS, CATEGORY_OF, CUSTOM}
Edge := {parent: Entity, child: Entity, hierarchy: Hierarchy, evidence: Evidence}
Evidence := {source: IRI?, method: String, observed_at: DateTime?, confidence: Real}
Path := List[Entity]
RELATIONSHIPS:
PARENT_OF(parent, child, hierarchy) := Edge(parent, child, hierarchy, evidence)
CHILD_OF(child, parent, hierarchy) <=> PARENT_OF(parent, child, hierarchy)
ANCESTOR_OF(ancestor, descendant, hierarchy) := transitive_closure(PARENT_OF, hierarchy)
DESCENDANT_OF(descendant, ancestor, hierarchy) <=> ANCESTOR_OF(ancestor, descendant, hierarchy)
SIBLING_OF(a, b, hierarchy) := exists p: PARENT_OF(p,a,hierarchy) and PARENT_OF(p,b,hierarchy) and a != b
ROOT_OF(root, hierarchy) := hierarchy.root = root and not exists p: PARENT_OF(p,root,hierarchy)
LEAF_OF(node, hierarchy) := not exists c: PARENT_OF(node,c,hierarchy)
CONSTRAINTS:
C1: forall p,c,h: PARENT_OF(p,c,h) => p != c
C2: forall n,h: not ANCESTOR_OF(n,n,h) # acyclic hierarchy
C3: forall p,c,h: PARENT_OF(p,c,h) => valid(p) and valid(c) and valid(h)
C4: no duplicate (parent,child,hierarchy) edges
C5: single_parent_required(h) => forall c: count({p | PARENT_OF(p,c,h)}) <= 1
C6: root_required(h) => exactly_one(ROOT_OF(_,h))
C7: edge evidence confidence must be in [0,1]
C8: do not mix relation kinds during transitive inference without an explicit composition rule
INFERENCE:
R1: PARENT_OF(a,b,h) => CHILD_OF(b,a,h)
R2: PARENT_OF(a,b,h) and PARENT_OF(b,c,h) => ANCESTOR_OF(a,c,h)
R3: ANCESTOR_OF(a,b,h) and PARENT_OF(b,c,h) => ANCESTOR_OF(a,c,h)
R4: ANCESTOR_OF(a,b,h) => DESCENDANT_OF(b,a,h)
R5: PARENT_OF(p,a,h) and PARENT_OF(p,b,h) and a != b => SIBLING_OF(a,b,h)
R6: shortest_parent_path(a,b,h) => HIERARCHICAL_DISTANCE(a,b,h,length(path)-1)
R7: common_ancestors(a,b,h) => LOWEST_COMMON_ANCESTORS(a,b,h,maximal_by_depth)
SEMANTIC_EQUIVALENCE:
canonical_relation("has parent") = CHILD_OF
canonical_relation("has child") = PARENT_OF
canonical_relation("ancestor of") = ANCESTOR_OF
canonical_relation("descendant of") = DESCENDANT_OF
rule: equivalence requires matching domain, range, relation kind and hierarchy context
rule: PART_OF is not equivalent to SUBCLASS_OF
CONFIDENCE:
asserted_edge := clamp(evidence.confidence, 0, 1)
inferred_path := product(confidence(edge) for edge in supporting_path)
alternative_paths := 1 - product(1 - path_confidence for independently_supported_paths)
rule: shared or correlated evidence must not be treated as independent
rule: confidence is evidential support, not logical truth
VALIDATION:
require_unique_entity_ids: true
reject_self_loops: true
detect_cycles: true
enforce_relation_types: true
verify_root_and_parent_constraints: according_to_hierarchy_profile
flag_unsupported_inference: true
report: [errors, warnings, orphan_nodes, cycles, conflicting_edges]
FLOW_HASH:
algorithm: SHA-256
input: canonical_serialisation(types, edges, rules, constraints, version)
exclude: [display_order, generated_timestamp]
UPDATE_MODEL:
operations: [ADD_ENTITY, REMOVE_ENTITY, ADD_EDGE, REMOVE_EDGE, UPDATE_EVIDENCE, RECLASSIFY_EDGE]
process: validate -> recompute_affected_closure -> refresh_confidence -> recalculate_FLOW_HASH
preserve_provenance: true
version_history: true
rollback_on_constraint_failure: true
AI_CONSUMPTION:
representation: typed_semantic_graph
supported_queries: [parents, children, ancestors, descendants, siblings, roots, leaves, paths, depth, common_ancestors]
reasoning_mode: explicit_rules_with_provenance
expose: [asserted_facts, inferred_facts, confidence, evidence, validation_status, flow_hash]
uncertainty_policy: distinguish_unknown_from_false
interoperability: [RDF, RDFS, OWL, SKOS, JSON-LD]
}
END FLOW ALGEBRA
Download Code
Copy to Clipboard