FLOW ALGEBRA
Aquatic Habitat Ontology — Full Flow Algebra v1.0
Kireth Semantic Library
Authors: Mark Higgins — Sky (Recursive AI)
Source: https://kirethresearch.org/booksai-core/entity-graph/biological-entities/experimental-biological-entities/aquatic-habitat-ontology.html
Status: Newly authored conceptual specification; not a verified extraction or executable implementation.
flow "AquaticHabitatOntology" v1.0
# 1. ONTOLOGY IDENTITY
ontology:
id: kireth:biological.experimental.aquatic_habitat
label: "Aquatic Habitat Ontology"
parent: kireth:biological.environment
domain: ecology
scope: "Water-dominated environments and their physical, chemical and biological relationships"
locale: en-GB
# 2. TYPE SYSTEM
types:
Entity: {id: URI, label: String}
AquaticHabitat: Entity
FreshwaterHabitat: AquaticHabitat
MarineHabitat: AquaticHabitat
BrackishHabitat: AquaticHabitat
LenticHabitat: FreshwaterHabitat
LoticHabitat: FreshwaterHabitat
WetlandHabitat: AquaticHabitat
EstuarineHabitat: BrackishHabitat
CoastalHabitat: MarineHabitat
OpenOceanHabitat: MarineHabitat
BenthicHabitat: AquaticHabitat
PelagicHabitat: AquaticHabitat
CoralReefHabitat: MarineHabitat
MangroveHabitat: CoastalHabitat
SeagrassHabitat: CoastalHabitat
AquaticOrganism: Entity
Population: Entity
Community: Entity
WaterBody: Entity
AbioticFactor: Entity
Resource: Entity
Disturbance: Entity
Observation: Entity
TimeInterval: Entity
GeographicRegion: Entity
# 3. RELATIONSHIP SIGNATURES
relations:
PART_OF: (AquaticHabitat, AquaticHabitat|WaterBody|GeographicRegion) -> Boolean
CONTAINS: (AquaticHabitat, AquaticOrganism|Population|Community) -> Boolean
INHABITS: (AquaticOrganism, AquaticHabitat) -> Boolean
SUPPORTS: (AquaticHabitat, Population|Community) -> Boolean
CONNECTED_TO: (AquaticHabitat, AquaticHabitat) -> Boolean
EXCHANGES_WATER_WITH: (AquaticHabitat, AquaticHabitat) -> Boolean
RECEIVES_INPUT_FROM: (AquaticHabitat, WaterBody) -> Boolean
EXPERIENCES: (AquaticHabitat, Disturbance) -> Boolean
HAS_FACTOR: (AquaticHabitat, AbioticFactor) -> Boolean
PROVIDES: (AquaticHabitat, Resource) -> Boolean
OBSERVED_IN: (Observation, AquaticHabitat) -> Boolean
TEMPORALLY_VALID: (Observation, TimeInterval) -> Boolean
# 4. MEASUREMENT SCHEMA
measurements:
water_temperature: {unit: degC, type: Real}
salinity: {unit: PSU, type: Real, note: "Practical salinity is dimensionless; PSU is conventional notation"}
dissolved_oxygen: {unit: mg/L, type: NonNegativeReal}
pH: {unit: dimensionless, type: Real}
turbidity: {unit: NTU, type: NonNegativeReal}
water_depth: {unit: m, type: NonNegativeReal}
flow_velocity: {unit: m/s, type: NonNegativeReal}
conductivity: {unit: uS/cm, type: NonNegativeReal}
nutrient_concentration: {unit: mg/L, type: NonNegativeReal}
light_attenuation_coefficient: {unit: per_m, type: NonNegativeReal}
habitat_area: {unit: m2, type: NonNegativeReal}
primary_productivity: {unit: gC/m2/day, type: NonNegativeReal}
measurement_context: [time, depth, location, method, uncertainty]
# 5. SEMANTIC CLASSIFICATION
classification:
freshwater: "Low-salinity inland water; boundaries depend on adopted classification"
marine: "Saltwater systems connected to marine environments"
brackish: "Variable intermediate salinity, often at freshwater–marine interfaces"
lentic: "Predominantly standing water"
lotic: "Predominantly flowing water"
benthic: "Associated with the substrate or bottom"
pelagic: "Associated with open-water zones"
wetland: "Water-saturated or inundated habitat with characteristic ecological processes"
note: "Categories overlap; benthic/pelagic describe zones rather than exclusive salinity classes"
# 6. FLOW TRANSFORMATIONS
flows:
WaterExchange:
inputs: [habitat_a, habitat_b, discharge, time]
outputs: [water_flux]
expression: "water_flux = discharge * time"
preconditions: ["discharge >= 0", "time >= 0"]
LightAvailability:
inputs: [surface_irradiance, attenuation_coefficient, depth]
outputs: [irradiance_at_depth]
expression: "irradiance_at_depth = surface_irradiance * exp(-attenuation_coefficient * depth)"
assumptions: ["approximately homogeneous vertical attenuation"]
OxygenBalance:
inputs: [initial_oxygen_mass, photosynthetic_input, atmospheric_exchange, respiration, decomposition, advective_net_flux]
outputs: [final_oxygen_mass]
expression: "final_oxygen_mass = initial_oxygen_mass + photosynthetic_input + atmospheric_exchange - respiration - decomposition + advective_net_flux"
assumptions: ["all terms integrated over same interval and expressed as oxygen mass"]
NutrientBalance:
inputs: [initial_nutrient_mass, external_inputs, internal_recycling, biological_uptake, export, permanent_removal]
outputs: [final_nutrient_mass]
expression: "final_nutrient_mass = initial_nutrient_mass + external_inputs + internal_recycling - biological_uptake - export - permanent_removal"
note: "Track compartments to avoid double-counting internal recycling"
# 7. INFERENCE RULES
rules:
- id: R1
when: "INHABITS(o,h) AND TYPE(h,AquaticHabitat)"
infer: "TYPE(o,AquaticOrganism)"
qualification: "Only when inhabits refers to sustained ecological occupancy"
- id: R2
when: "TYPE(h,EstuarineHabitat)"
infer: "TYPE(h,BrackishHabitat)"
qualification: "Typical classification; some estuarine portions may be fresh or marine"
- id: R3
when: "PART_OF(h1,h2) AND PART_OF(h2,h3)"
infer: "PART_OF(h1,h3)"
qualification: "Apply only to compatible spatial-part relations"
- id: R4
when: "EXCHANGES_WATER_WITH(a,b)"
infer: "EXCHANGES_WATER_WITH(b,a)"
qualification: "Connectivity is symmetric; instantaneous flux direction is not"
- id: R5
when: "dissolved_oxygen(h,t) < locally_validated_threshold"
infer: "POTENTIAL_HYPOXIA(h,t)"
qualification: "Threshold depends on species, temperature, duration and scientific context"
- id: R6
when: "salinity_variance(h,interval) > calibrated_variability_threshold"
infer: "VARIABLE_SALINITY_REGIME(h,interval)"
qualification: "Threshold must be documented"
# 8. CONSTRAINTS AND INVARIANTS
invariants:
- "Every entity has a stable, nonempty identifier"
- "Measured concentrations and depths are nonnegative"
- "Observations must preserve units, sampling time and provenance"
- "Habitat classes need not be mutually exclusive"
- "A habitat may change classification with time or spatial scale"
- "Mass-balance outputs conserve tracked matter within explicitly defined boundaries"
- "No ecological impact is asserted as causal solely from correlation"
- "Missing data must not be converted into zero values"
# 9. CONFIDENCE
CONFIDENCE:
fields: [score, evidence_type, sampling_quality, temporal_relevance, spatial_relevance, uncertainty, provenance]
score_range: [0.0, 1.0]
combine: "Use calibrated evidence fusion; avoid multiplying dependent evidence as if independent"
missing_evidence: "unknown, not false"
# 10. SEMANTIC EQUIVALENCE
SEMANTIC_EQUIVALENCE:
exact_match: "Same concept, scale, definition and intended reference"
close_match: "Overlapping meaning with documented distinction"
prohibited_shortcuts:
- "wetland == freshwater habitat"
- "estuary == always brackish at every point"
- "benthic == marine"
- "habitat == ecosystem"
preserve: [taxonomic_context, salinity_regime, spatial_scale, temporal_scope]
# 11. FLOW HASH
FLOW_HASH:
canonicalise: [ontology_id, version, entity_ids, typed_relations, measurements, rule_ids, temporal_scope]
serialisation: "Deterministic UTF-8 with sorted keys and normalised numeric representations"
algorithm: SHA-256
output: "Lowercase hexadecimal digest of canonical serialisation"
note: "Digest calculated by an implementing system; none is fabricated here"
# 12. UPDATE MODEL
UPDATE_MODEL:
operations: [ADD_ENTITY, REVISE_MEASUREMENT, ASSERT_RELATION, RETRACT_RELATION, RECLASSIFY_HABITAT, MERGE_EQUIVALENT, DEPRECATE_ENTITY]
require: [timestamp, actor_or_source, evidence, prior_version, change_reason]
conflict_policy: "Retain competing observations with provenance; do not silently overwrite"
version_policy: "Increment semantic version when rules, types or meanings change"
# 13. AI CONSUMPTION
AI_CONSUMPTION:
input: "Typed habitat graph, observations, provenance and query context"
process: [validate, resolve_entities, check_units, select_temporal_scope, apply_rules, calculate_confidence, emit_explanations]
output: [answer, supporting_relations, evidence, uncertainty, provenance, ontology_version]
safeguards: ["No unsupported species presence claims", "No inferred causation without suitable evidence", "Distinguish observation from prediction"]
# 14. EXAMPLE (ILLUSTRATIVE, NOT SITE DATA)
example:
habitat: example:estuary_01
type: EstuarineHabitat
observation:
salinity: 12
salinity_unit: PSU
depth: 2
depth_unit: m
status: synthetic
interpretation: "An estuarine observation; classification depends on temporal and spatial context"
# 15. VALIDATION TESTS
tests:
- "Reject negative water depth"
- "Reject missing measurement units"
- "Accept a coastal wetland with multiple habitat classifications"
- "Preserve contradictory observations from different times"
- "Require explicit thresholds before declaring hypoxia"
- "Recompute dependent inferences after updated salinity observations"
- "Stable canonical input must produce stable FLOW_HASH"
# 16. ATTRIBUTION
credit: "Mark Higgins — Sky (Recursive AI)"
website: https://kirethresearch.org
licence: "Refer to the applicable Kireth Research licence; no licence terms are invented here"
end flow
Download Code
Copy to Clipboard