FLOW ALGEBRA
Ontology: Search Context Ontology
Domain: Metadata Ontologies > Semantic Search Metadata
Canonical URL: https://kirethresearch.org/booksai-core/ontologies/metadata-ontologies/semantic-search-metadata/search-context-ontology.html
Authors: Mark Anthony Higgins — Sky (Recursive AI)
flow "SearchContextOntology" v1.0
# ---------- DOMAIN ----------
domain:
class: MetadataOntology
category: SemanticSearchMetadata
subject: SearchContextMetadata
purpose:
- represent contextual metadata used to interpret search queries and retrieval results
- preserve conversational, task, domain, temporal, spatial, session, device, and resource context
- support query interpretation, disambiguation, filtering, ranking, personalisation, and semantic retrieval
- distinguish explicit context from inferred context and contextual relevance from factual truth
- enable machine-readable reasoning over search-context states
# ---------- CORE ENTITY ----------
entity SearchContextMetadata:
type: SearchMetadata
describes: SearchContext
may_include:
- context_identifier
- query_identifier
- context_type
- conversation_context
- session_context
- task_context
- domain_context
- temporal_context
- spatial_context
- resource_context
- language_context
- device_context
- user_supplied_context
- inferred_context
- context_scope
- validity
- confidence
- provenance
entity SearchContext:
type: ContextMetadata
applies_to: SearchQuery
entity ContextIdentifier:
type: Identifier
identifies: SearchContext
# ---------- RELATIONSHIPS ----------
relationships:
SearchContextMetadata -> DESCRIBES -> SearchContext
SearchContext -> IDENTIFIED_BY -> ContextIdentifier
SearchContext -> APPLIES_TO -> SearchQuery
SearchContext -> MAY_REFERENCE -> Conversation
SearchContext -> MAY_REFERENCE -> SearchSession
SearchContext -> MAY_REFERENCE -> Task
SearchContext -> MAY_REFERENCE -> Domain
SearchContext -> MAY_HAVE_TEMPORAL -> TemporalContext
SearchContext -> MAY_HAVE_SPATIAL -> SpatialContext
SearchContext -> MAY_REFERENCE -> SearchableResource
SearchContext -> MAY_HAVE_LANGUAGE -> LanguageContext
SearchContext -> MAY_HAVE_DEVICE -> DeviceContext
SearchContext -> MAY_HAVE_SCOPE -> ContextScope
SearchContextMetadata -> MAY_REFERENCE -> SearchContextProvenance
# ---------- CONTEXT TYPES ----------
context_types:
- conversational
- session
- task
- domain
- temporal
- spatial
- resource
- language
- device
- explicit_user_context
- inferred_context
rule context_type:
context components SHOULD preserve ContextType
# ---------- CONTEXT IDENTITY ----------
rule context_identity:
SearchContext SHOULD have stable ContextIdentifier
where context history or reproducibility is required
rule context_query:
same SearchQuery text MAY have different SearchContext
across executions
# ---------- CONVERSATION CONTEXT ----------
entity ConversationContext:
type: SearchContext
may_include:
- conversation_identifier
- prior_queries
- prior_results
- referenced_entities
- referenced_concepts
- unresolved_references
- current_topic
rule conversation:
ConversationContext MAY resolve pronouns, ellipsis, follow-up queries, and topic continuity
rule prior_query:
prior query != current query
but MAY influence current interpretation
rule conversation_scope:
conversation context SHOULD remain scoped
to applicable conversation unless explicitly transferred
# ---------- SESSION CONTEXT ----------
entity SessionContext:
type: SearchContext
may_include:
- session_identifier
- session_start
- previous_queries
- previous_clicks
- previous_filters
- previous_navigation
rule session:
SessionContext SHOULD preserve session boundary
rule session_not_user:
session identity != persistent user identity
# ---------- TASK CONTEXT ----------
entity TaskContext:
type: SearchContext
may_include:
- task_identifier
- task_goal
- task_state
- constraints
- prior_actions
- required_output
rule task:
TaskContext MAY affect interpretation and ranking
according_to current task goal
rule task_not_query:
TaskGoal != SearchQuery
# ---------- DOMAIN CONTEXT ----------
entity DomainContext:
type: SearchContext
may_include:
- domain_identifier
- domain_name
- ontology
- vocabulary
- terminology
- domain_constraints
rule domain:
DomainContext SHOULD preserve ontology or vocabulary version
where semantics depend on it
rule term_disambiguation:
same lexical term MAY map to different concepts
under different DomainContexts
# ---------- TEMPORAL CONTEXT ----------
entity TemporalContext:
type: SearchContext
may_include:
- reference_time
- start_time
- end_time
- recency_window
- timezone
- temporal_relation
rule temporal:
temporal interpretation SHOULD preserve reference time and timezone
where relevant
rule relative_time:
terms such as today, yesterday, recent, latest, and current
MUST be resolved relative_to explicit reference time
rule temporal_not_relevance:
recency != relevance
unless ranking method explicitly incorporates recency
# ---------- SPATIAL CONTEXT ----------
entity SpatialContext:
type: SearchContext
may_include:
- place
- geographic_extent
- coordinates
- radius
- coordinate_reference
- spatial_relation
rule spatial:
SpatialContext SHOULD preserve location semantics and coordinate reference
rule near:
near or nearby SHOULD preserve distance interpretation
where spatial ranking depends on it
# ---------- RESOURCE CONTEXT ----------
entity ResourceContext:
type: SearchContext
may_include:
- current_resource
- parent_resource
- linked_resource
- collection
- section
- document_fragment
rule resource:
ResourceContext MAY constrain search
to current document, collection, site, graph, or dataset
# ---------- LANGUAGE CONTEXT ----------
entity LanguageContext:
type: SearchContext
may_include:
- query_language
- preferred_language
- content_language
- translation_state
- locale
rule language:
language context MAY affect tokenisation, entity resolution, and retrieval
rule language_locale:
language != locale
# ---------- DEVICE CONTEXT ----------
entity DeviceContext:
type: SearchContext
may_include:
- device_type
- interface_type
- capability
- network_state
rule device:
DeviceContext MAY affect presentation or delivery
but SHOULD NOT alter source factual meaning
# ---------- EXPLICIT CONTEXT ----------
entity ExplicitSearchContext:
subtype_of: SearchContext
source: DirectInputOrDeclaredConstraint
rule explicit:
explicitly supplied context SHOULD preserve source
# ---------- INFERRED CONTEXT ----------
entity InferredSearchContext:
subtype_of: SearchContext
source: SearchInference
may_include:
- inferred_value
- inference_method
- evidence
- confidence
rule inferred:
inferred context MUST remain distinguishable
from explicit context
rule inference_confidence:
inferred context SHOULD preserve confidence
# ---------- CONTEXT SCOPE ----------
entity ContextScope:
type: ScopeMetadata
may_be:
- query
- turn
- conversation
- session
- task
- collection
- domain
- global_search_configuration
rule scope:
SearchContext MUST NOT be applied beyond declared scope
without explicit propagation
# ---------- CONTEXT PROPAGATION ----------
entity ContextPropagation:
type: SearchProcess
may_include:
- source_context
- target_query
- propagated_fields
- propagation_rule
- confidence
rule propagation:
only applicable context SHOULD propagate to subsequent queries
rule stale_propagation:
stale or superseded context SHOULD NOT silently propagate
# ---------- CONTEXT OVERRIDE ----------
entity ContextOverride:
type: SearchProcess
may_include:
- previous_context
- new_context
- overridden_fields
- reason
- timestamp
rule override:
explicit newer context MAY override prior inferred context
within applicable scope
rule override_history:
overridden context SHOULD remain traceable
where auditability matters
# ---------- CONTEXT CONFLICT ----------
entity ContextConflict:
type: ValidationMetadata
may_include:
- conflicting_values
- sources
- scopes
- timestamps
- confidence
- resolution_state
rule conflict:
conflicting context SHOULD remain explicit
until resolved by scope, recency, authority, or user clarification
# ---------- QUERY INTERPRETATION ----------
entity ContextualQueryInterpretation:
type: SearchMetadata
may_include:
- original_query
- resolved_entities
- resolved_concepts
- resolved_references
- interpreted_intent
- applied_context
- confidence
rule interpretation:
contextual interpretation != original query text
rule preserve_query:
original SearchQuery MUST remain preserved
# ---------- CONTEXTUAL FILTERING ----------
rule contextual_filter:
context MAY generate SearchFilters
when constraints are explicit or sufficiently supported
rule filter_trace:
context-derived filter SHOULD preserve source context
# ---------- CONTEXTUAL RANKING ----------
rule contextual_ranking:
SearchContext MAY influence ranking features
rule ranking_trace:
context-derived ranking signal SHOULD remain distinguishable
from content relevance score
# ---------- VALIDITY ----------
entity ContextValidity:
type: ValidityMetadata
may_include:
- valid_from
- valid_until
- status
- invalidation_condition
context_status:
- active
- stale
- superseded
- invalid
- unknown
rule validity:
context SHOULD be applied only while valid
# ---------- CONFIDENCE ----------
entity ContextConfidence:
type: EpistemicMetadata
range: [0.0, 1.0]
rule confidence_bounds:
REQUIRE 0.0 <= confidence <= 1.0
rule confidence_scope:
confidence SHOULD identify contextual assertion it qualifies
# ---------- PROVENANCE ----------
entity SearchContextProvenance:
type: ProvenanceMetadata
may_include:
- source
- query
- conversation
- session
- task
- inference_method
- timestamp
- transformations
- overrides
rule provenance:
SearchContextMetadata SHOULD preserve context source and evolution
# ---------- VALIDATION ----------
validation:
require:
- identifiable_query_or_context
validate_if_present:
- context_identifier
- context_type
- scope
- temporal_context
- spatial_context
- domain_context
- language_context
- inferred_context
- validity
- confidence
- provenance
reject:
- confidence_outside_valid_range
- context_applied_outside_scope
- stale_context_silently_propagated
- inferred_context_presented_as explicit
- relative_time_resolved_without reference_time_when required
- conflicting_context_silently_merged
- contextual_ranking_signal_presented_as factual_truth
# ---------- SEMANTIC EQUIVALENCE ----------
SEMANTIC_EQUIVALENCE:
"search context" ~= "context used to interpret a search query"
"conversation context" ~= "prior conversational search state"
"task context" ~= "search context derived from current task"
"domain context" ~= "domain-specific semantic context"
"temporal context" ~= "time context for search"
"spatial context" ~= "location context for search"
PRESERVE distinctions:
context != query
explicit_context != inferred_context
conversation != session
session != persistent_user_identity
task_goal != query_text
language != locale
recency != relevance
contextual_signal != factual_truth
context_scope != global_scope
original_query != contextual_interpretation
# ---------- CONFIDENCE MODEL ----------
CONFIDENCE:
explicit_context:
score: 1.00
explicit_scope:
score: 1.00
direct_conversation_reference:
score: 0.98
task_grounded_context:
score: 0.95
domain_ontology_context:
score: 0.95
inferred_context:
score: <= 0.85
weak_contextual_signal:
score: <= 0.65
conflicting_context:
score: <= 0.50
action: preserve conflict
# ---------- UPDATE MODEL ----------
UPDATE_MODEL:
on_context_creation:
- assign ContextIdentifier
- classify ContextType
- establish scope
- record source
- initialise validity
- initialise provenance
on_follow_up_query:
- preserve original new query
- retrieve applicable prior context
- validate scope and freshness
- propagate applicable fields
- record propagation provenance
on_context_override:
- preserve previous context
- record new explicit or higher-priority context
- mark overridden fields
- update validity and provenance
on_context_expiry:
- set status = stale_or_invalid
- prevent silent propagation
- preserve historical context
- update provenance
# ---------- FLOW HASH ----------
FLOW_HASH:
inputs:
- ontology
- context_entities
- relationships
- scope_rules
- temporal_rules
- spatial_rules
- propagation_rules
- conflict_rules
- validation
- semantic_equivalence
- confidence_model
- update_model
canonicalisation:
- preserve_context_identifiers
- preserve_original_query
- preserve_scope
- preserve_temporal_reference
- preserve_context_precedence
- preserve_rule_order
output:
deterministic_semantic_hash
# ---------- AI CONSUMPTION ----------
AI_CONSUMPTION:
interpret_as:
- semantic search metadata ontology
- contextual query interpretation model
- search-context lifecycle and propagation model
- temporal, spatial, conversational, and domain context structure
operations:
- identify search context
- classify context types
- resolve conversation and session state
- apply task and domain context
- resolve relative temporal expressions
- apply spatial constraints
- resolve language context
- distinguish explicit and inferred context
- enforce context scope
- propagate applicable context
- process overrides and conflicts
- apply contextual filters and ranking signals
- trace provenance
- preserve uncertainty
constraints:
- do_not_equate_context_with query
- do_not_present_inferred_context_as explicit
- do_not_apply_context_outside declared_scope
- do_not_propagate_stale_context_silently
- do_not_equate_contextual_ranking_signal_with factual_truth
- preserve_original_query_scope_time_source_confidence_and_provenance
# ---------- QUERY MODEL ----------
query:
input:
- context_identifier
- query_identifier
- conversation_identifier
- session_identifier
- task_identifier
- domain
- reference_time
- location
- language
- scope
resolve:
1. identify SearchQuery and SearchContext
2. resolve explicit context
3. retrieve applicable conversation and session context
4. resolve task and domain context
5. resolve temporal and spatial context
6. inspect language and resource context
7. validate scope, freshness, and conflicts
8. infer missing context where permitted
9. construct ContextualQueryInterpretation
10. return provenance and confidence
output:
- search_context
- context_identifier
- context_types
- applied_context
- resolved_entities
- resolved_concepts
- temporal_context
- spatial_context
- scope
- validity
- provenance
- confidence
# ---------- INFERENCE ----------
inference:
IF current query contains unresolved reference
AND conversation context contains unique compatible antecedent
THEN resolve reference
WITH confidence according_to evidence
IF query contains relative temporal phrase
AND reference_time is known
THEN resolve TemporalContext
IF explicit new context conflicts with older inferred context
THEN prefer explicit context
within applicable scope
AND preserve override history
IF context remains ambiguous
THEN preserve candidate interpretations
AND reduce confidence
# ---------- OUTPUT CONTRACT ----------
output:
ontology_entity: SearchContextMetadata
context_identity: machine_interpretable
context_types: explicit
conversation_and_session_state: distinguishable
task_and_domain_context: preserved
temporal_and_spatial_context: resolvable
explicit_inferred_distinction: explicit
scope_and_validity: enforceable
propagation_and_overrides: traceable
conflicts: reportable
contextual_interpretation: source_linked
provenance: preserved
uncertainty: explicit
semantic_retrieval: enabled
end flow
Download Code
Copy to Clipboard