FLOW ALGEBRA
Semantic Search Ontology
Kireth Semantic Research Archive
PAGE:
https://kirethresearch.org/booksai-core/ontologies/computing-ontologies/semantic-computing/semantic-search-ontology-2.html
AUTHORS:
Mark Anthony Higgins — Sky (Recursive AI)
FLOW "SemanticSearchOntology" v4.0
# ---------- DOMAIN ----------
DOMAIN := ComputingOntology
SUBDOMAIN := SemanticComputing
ONTOLOGY := SemanticSearchOntology
# ---------- PRIMARY ENTITY ----------
ENTITY SemanticSearch {
definition:
"A search approach that retrieves and ranks information using meaning,
entities, concepts, relationships, context and user intent in addition
to or instead of exact lexical term matching.";
objectives: [
MeaningAwareRetrieval,
IntentUnderstanding,
EntityAwareSearch,
ConceptualMatching,
ContextualRanking,
KnowledgeIntegration,
RelevantAnswerRetrieval
];
}
# ---------- CORE ENTITIES ----------
SearchEntity := {
Query,
SearchIntent,
Entity,
Concept,
Document,
Passage,
Result,
Ranking
};
SemanticResource := {
Ontology,
KnowledgeGraph,
Vocabulary,
EmbeddingModel,
VectorIndex,
SearchIndex
};
RetrievalSignal := {
LexicalScore,
SemanticSimilarity,
EntityMatch,
ConceptMatch,
GraphRelation,
MetadataMatch,
ContextMatch
};
ProcessingEntity := {
QueryParsing,
EntityRecognition,
Disambiguation,
QueryExpansion,
Retrieval,
Reranking
};
# ---------- FUNDAMENTAL RELATIONSHIPS ----------
Query EXPRESSES SearchIntent;
Query MAY_MENTION Entity;
Entity HAS ConceptOrType;
Document MAY_MENTION Entity;
Ontology DEFINES ConceptRelationships;
KnowledgeGraph CONNECTS Entities;
Embedding REPRESENTS QueryOrContent;
SearchEngine RETRIEVES CandidateResults;
Ranking ORDERS ResultsByEstimatedRelevance;
# ---------- SEMANTIC SEARCH FLOW ----------
UserQuery
-> NormaliseQuery
-> DetectIntent
-> ExtractEntitiesAndConcepts
-> ResolveAmbiguity
-> ExpandSemanticMeaning
-> GenerateRetrievalRepresentations
-> RetrieveCandidates
-> ApplyGraphVectorLexicalSignals
-> FilterByContextAndConstraints
-> RerankCandidates
-> ReturnRelevantResults
-> LearnFromFeedback;
# ---------- QUERY ----------
Query :=
UserExpressionOfInformationNeed;
Query MAY_BE {
KeywordQuery,
NaturalLanguageQuestion,
EntityQuery,
StructuredQuery,
MultimodalQuery
};
# ---------- SEARCH INTENT ----------
SearchIntent :=
InferredGoalBehindQuery;
Intent MAY_INCLUDE {
Informational,
Navigational,
Transactional,
Comparative,
Exploratory
};
IntentUnderstanding MAY_CHANGE RetrievalAndRankingStrategy;
# ---------- QUERY NORMALISATION ----------
QueryNormalisation MAY_INCLUDE {
CaseNormalisation,
SpellingCorrection,
Tokenisation,
Lemmatization,
PunctuationHandling
};
Normalisation SHOULD_PRESERVE Meaning;
# ---------- ENTITY RECOGNITION ----------
EntityRecognition :=
Query
-> DetectEntityMentions
-> AssignCandidateEntityTypes;
# ---------- ENTITY LINKING ----------
EntityLinking :=
Mention
+ Context
-> CanonicalEntity;
EntityLinking MAY_USE {
Name,
Alias,
Type,
Context,
KnowledgeGraph
};
# ---------- DISAMBIGUATION ----------
QueryDisambiguation :=
AmbiguousTermOrEntity
-> GenerateCandidateMeanings
-> ScoreByContext
-> SelectOrRetainCandidates;
IF AmbiguityHigh
THEN Search MAY_DIVERSIFY ResultsOrRequestClarification;
# ---------- CONCEPT ----------
Concept :=
SemanticCategoryOrMeaningAssociatedWithQueryOrContent;
Concept MAY_BE IdentifiedThrough {
Ontology,
Taxonomy,
LanguageModel,
KnowledgeGraph
};
# ---------- SYNONYM ----------
Synonym :=
DifferentSurfaceFormWithSameOrSimilarMeaningInContext;
SynonymExpansion MAY_IMPROVE Recall;
UncontrolledExpansion MAY_REDUCE Precision;
# ---------- QUERY EXPANSION ----------
SemanticQueryExpansion :=
OriginalQuery
-> AddRelatedTermsEntitiesOrConcepts;
Expansion MAY_USE {
Synonyms,
Hypernyms,
Hyponyms,
RelatedEntities,
OntologyRelations
};
# ---------- LEXICAL RETRIEVAL ----------
LexicalRetrieval :=
MatchQueryTermsAgainstIndexedTerms;
LexicalScore MAY_USE {
TermFrequency,
InverseDocumentFrequency,
BM25LikeScoring
};
LexicalRetrieval IS_STRONG_FOR ExactNamesCodesAndRareTerms;
# ---------- SEMANTIC RETRIEVAL ----------
SemanticRetrieval :=
MatchQueryMeaningAgainstContentMeaning;
SemanticRetrieval MAY_USE {
Embeddings,
KnowledgeGraph,
Ontology,
SemanticAnnotations
};
# ---------- EMBEDDING ----------
Embedding :=
NumericVectorRepresentationOfQueryDocumentPassageOrEntity;
EmbeddingModel MAPS InputToVectorSpace;
# ---------- VECTOR SIMILARITY ----------
VectorSimilarity :=
Compare(QueryEmbedding, ContentEmbedding);
Metric MAY_INCLUDE {
CosineSimilarity,
DotProduct,
EuclideanDistance
};
HighVectorSimilarity MAY_INDICATE SemanticRelatedness;
VectorSimilarity != LogicalEntailment;
# ---------- VECTOR SEARCH ----------
VectorSearch :=
QueryEmbedding
-> SearchVectorIndex
-> ReturnNearestCandidates;
ApproximateNearestNeighbour MAY_TRADE RecallForLatency;
# ---------- KNOWLEDGE GRAPH SEARCH ----------
KnowledgeGraphSearch :=
ResolveQueryEntities
-> TraverseTypedRelationships
-> RetrieveRelatedEntitiesFactsOrResources;
# ---------- GRAPH PATH ----------
GraphPath :=
EntityA
-> RelationshipSequence
-> EntityB;
PathSemantics MAY_SUPPORT ExplainableRelevance;
# ---------- ONTOLOGY SEARCH ----------
OntologyAwareSearch :=
QueryConcept
-> MapToOntology
-> ExpandOrConstrainUsingConceptHierarchy
-> RetrieveMatchingResources;
# ---------- CLASS HIERARCHY ----------
IF QueryTargetsClassA
AND ClassB SUBCLASS_OF ClassA
THEN InstancesOfClassB MAY_BE RelevantAccordingToSearchPolicy;
# ---------- HYBRID SEARCH ----------
HybridSemanticSearch :=
LexicalRetrieval
+ VectorRetrieval
+ KnowledgeGraphEvidence
+ StructuredFilters
-> CandidateSet;
HybridSearch MAY_IMPROVE RobustnessAcrossDifferentQueryTypes;
# ---------- CANDIDATE GENERATION ----------
CandidateGeneration :=
RetrieveBroadSetOfPotentiallyRelevantResults;
CandidateSource MAY_INCLUDE {
InvertedIndex,
VectorIndex,
KnowledgeGraph,
Database
};
# ---------- FILTER ----------
SearchFilter MAY_USE {
EntityType,
Date,
Location,
Category,
Permission,
Language
};
Filter SHOULD_BE AppliedWithoutViolatingAccessControl;
# ---------- METADATA ----------
DocumentMetadata MAY_INCLUDE {
Title,
Author,
Date,
Type,
Topic,
Source
};
MetadataMatch MAY_CONTRIBUTE_TO Relevance;
# ---------- RANKING ----------
SemanticRanking :=
CandidateResults
-> ComputeFeatures
-> EstimateRelevance
-> OrderResults;
RankingFeature MAY_INCLUDE {
LexicalScore,
SemanticSimilarity,
EntityMatch,
GraphDistance,
Freshness,
Authority,
Context
};
# ---------- SCORE FUSION ----------
CombinedScore :=
w_lexical * LexicalScore
+ w_vector * SemanticScore
+ w_graph * GraphScore
+ w_context * ContextScore;
Weights MAY_BE LearnedOrConfigured;
# ---------- RERANKING ----------
Reranking :=
InitialCandidates
-> MoreExpensiveRelevanceModel
-> ReorderedTopResults;
Reranker MAY_USE {
CrossEncoder,
LanguageModel,
GraphFeatures,
BusinessRules
};
# ---------- CROSS ENCODER ----------
CrossEncoder :=
ModelEvaluatingQueryAndCandidateJointly;
CrossEncoder MAY_HAVE HigherRankingQuality
BUT HigherComputeCostThanIndependentEmbeddingSimilarity;
# ---------- PASSAGE RETRIEVAL ----------
Document MAY_BE SplitInto PassagesOrChunks;
PassageSearch MAY_RETURN SpecificRelevantSectionRatherThanWholeDocument;
# ---------- CHUNK ----------
Chunk :=
RetrievalUnitDerivedFromLargerResource;
Chunk SHOULD_PRESERVE {
SourceReference,
Position,
ContextMetadata
};
# ---------- CHUNKING ----------
ChunkingStrategy MAY_USE {
FixedLength,
SentenceBoundary,
SectionBoundary,
SemanticBoundary
};
Chunking AFFECTS RetrievalQuality;
# ---------- CONTEXT ----------
SearchContext MAY_INCLUDE {
Conversation,
PreviousQuery,
UserTask,
Time,
Domain,
Location
};
Context SHOULD_BE UsedOnlyAccordingToPrivacyAndApplicationPolicy;
# ---------- CONVERSATIONAL SEARCH ----------
ConversationalSemanticSearch :=
CurrentQuery
+ PriorConversationContext
-> ResolvedInformationNeed;
PronounOrEllipsis MAY_REQUIRE ContextResolution;
# ---------- PERSONALISATION ----------
PersonalisedSearch MAY_USE UserPreferencesOrHistoryWherePermitted;
Personalisation SHOULD_NOT OverrideExplicitCurrentQueryIntentWithoutEvidence;
# ---------- FRESHNESS ----------
Freshness MAY_BE RankingSignalForTimeSensitiveQueries;
FreshnessImportance DEPENDS_ON QueryIntent;
# ---------- AUTHORITY ----------
SourceAuthority :=
EstimatedReliabilityOrImportanceOfSource;
Authority SHOULD_NOT_BE SoleMeasureOfRelevance;
# ---------- PROVENANCE ----------
SearchResult SHOULD_PRESERVE SourceAndRetrievalProvenanceWhereRequired;
Provenance MAY_INCLUDE {
SourceDocument,
RetrievalMethod,
IndexVersion,
ModelVersion
};
# ---------- EXPLAINABILITY ----------
SemanticSearch MAY_EXPLAIN ResultThrough {
MatchingEntity,
MatchingConcept,
RelationshipPath,
SemanticSimilarity,
SourceEvidence
};
# ---------- ZERO EXACT MATCH ----------
IF NoExactKeywordMatch
BUT StrongSemanticRelationshipExists
THEN Result MAY_STILL_BE Relevant;
# ---------- POLYSEMY ----------
Polysemy :=
OneSurfaceTermHasMultipleMeanings;
Disambiguation SHOULD_USE Context;
# ---------- HOMONYMY ----------
Homonym :=
SameOrSimilarTermRefersToDifferentEntitiesOrConcepts;
EntityLinking MAY_RESOLVE Homonym;
# ---------- MULTILINGUAL SEARCH ----------
MultilingualSemanticSearch MAY_MAP DifferentLanguagesInto SharedConceptOrEmbeddingSpace;
Translation MAY_BE {
Explicit,
ModelInternal,
OntologyBased
};
# ---------- CROSS-LINGUAL RETRIEVAL ----------
QueryLanguage MAY_DIFFER_FROM DocumentLanguage;
CrossLingualEmbedding MAY_SUPPORT RetrievalAcrossLanguages;
# ---------- MULTIMODAL SEARCH ----------
SemanticSearch MAY_INCLUDE {
Text,
Image,
Audio,
Video
};
MultimodalEmbedding MAY_MAP DifferentModalitiesInto RelatedRepresentationSpace;
# ---------- IMAGE SEARCH ----------
Image MAY_BE RetrievedBy {
TextDescription,
VisualSimilarity,
EntityMetadata
};
# ---------- RAG ----------
RetrievalAugmentedGeneration :=
UserQuery
-> RetrieveRelevantEvidence
-> ConstructContext
-> GenerateResponse;
SemanticSearch MAY_SERVE_AS RetrievalLayerForRAG;
# ---------- SEMANTIC RAG ----------
SemanticRAG MAY_COMBINE {
VectorSearch,
KnowledgeGraphSearch,
LexicalSearch,
OntologyReasoning
};
# ---------- ANSWER RETRIEVAL ----------
SearchSystem MAY_RETURN {
Documents,
Passages,
Entities,
DirectAnswers
};
DirectAnswer SHOULD_BE GroundedInRetrievedOrTrustedKnowledge;
# ---------- RELEVANCE ----------
Relevance :=
DegreeToWhichResultSatisfiesInformationNeed;
Relevance MAY_BE {
Topical,
Semantic,
TaskBased,
Contextual
};
# ---------- PRECISION ----------
Precision :=
RelevantRetrievedResults / RetrievedResults;
# ---------- RECALL ----------
Recall :=
RelevantRetrievedResults / AllRelevantResults;
PrecisionAndRecall MAY_TRADE_OFF;
# ---------- MRR ----------
MeanReciprocalRank :=
Mean(1 / RankOfFirstRelevantResult);
# ---------- NDCG ----------
NDCG :=
NormalisedDiscountedCumulativeGain;
NDCG SUPPORTS GradedRelevanceEvaluation;
# ---------- HIT RATE ----------
HitRateAtK :=
FractionOfQueriesWithRelevantResultInTopK;
# ---------- OFFLINE EVALUATION ----------
SearchEvaluationDataset :=
Queries
+ RelevanceJudgements;
OfflineEvaluation MAY_COMPARE RankingVersions;
# ---------- ONLINE EVALUATION ----------
OnlineSearchEvaluation MAY_USE {
ClickThrough,
Reformulation,
TaskCompletion,
ControlledExperiment
};
Clicks ARE NoisyProxyForRelevance;
# ---------- FEEDBACK ----------
SearchFeedback MAY_BE {
Explicit,
Implicit
};
Feedback MAY_UPDATE RankingModelOrQueryUnderstanding;
# ---------- QUERY REFORMULATION ----------
RepeatedReformulation MAY_INDICATE InitialResultsDidNotSatisfyIntent;
# ---------- SEARCH INDEX ----------
SearchIndex :=
DataStructureSupportingEfficientRetrieval;
Index MAY_INCLUDE {
Terms,
Embeddings,
Entities,
Metadata
};
# ---------- INDEXING ----------
SemanticIndexing :=
Document
-> Parse
-> ExtractMetadata
-> ExtractEntities
-> GenerateEmbeddings
-> StoreRepresentations;
# ---------- UPDATE ----------
IndexUpdate SHOULD_REFLECT SourceChanges;
StaleIndex MAY_RETURN OutdatedResults;
# ---------- ACCESS CONTROL ----------
Search MUST_ENFORCE UserAuthorisationBeforeExposingProtectedResult;
SemanticSimilarity MUST_NOT Bypass AccessPolicy;
# ---------- PRIVACY ----------
Query MAY_CONTAIN SensitiveInformation;
SearchLogging SHOULD_FOLLOW DataMinimisationAndRetentionPolicy;
# ---------- SECURITY ----------
SemanticSearchSecurity MAY_INCLUDE {
QueryValidation,
AccessControl,
IndexIntegrity,
ModelIntegrity,
InjectionResistance
};
# ---------- ADVERSARIAL CONTENT ----------
MaliciousContent MAY_ATTEMPT ToManipulateSemanticRankingOrGeneratedAnswer;
RetrievalSystem SHOULD_DISTINGUISH ContentFromSystemInstructionsWhereRelevant;
# ---------- SCALABILITY ----------
SemanticSearchScalability MAY_DEPEND_ON {
IndexSize,
EmbeddingDimension,
CandidateCount,
RerankerCost,
GraphTraversal
};
# ---------- LATENCY ----------
SearchLatency :=
QueryUnderstandingTime
+ CandidateRetrievalTime
+ FilteringTime
+ RerankingTime;
# ---------- CACHE ----------
SearchCache MAY_STORE {
QueryResult,
Embedding,
EntityResolution
};
Cache MUST_RESPECT IndexVersionAndPermissions;
# ---------- SEMANTIC REASONING ----------
IF SearchUsesMeaningEntitiesConceptsOrRelationshipsBeyondExactTerms
THEN SemanticSearchClassification := supported;
IF QueryEntityResolvedToCanonicalEntity
THEN AliasMentions MAY_RETRIEVE SameEntityResources;
IF QueryConceptHasKnownSubclasses
THEN Search MAY_EXPAND ToSubclassResourcesAccordingToIntent;
IF VectorSimilarityHigh
THEN SemanticRelatedness MAY_BE High
BUT LogicalEquivalence IS_NOT Guaranteed;
IF LexicalAndSemanticSignalsAgree
THEN RelevanceConfidence MAY_INCREASE;
IF AccessPolicyDeniesResource
THEN Resource MUST_NOT_BE ReturnedRegardlessOfSemanticScore;
IF QueryIsTimeSensitive
THEN Freshness SHOULD_RECEIVE GreaterRankingWeight;
# ---------- SEMANTIC EQUIVALENCE ----------
SEMANTIC_EQUIVALENCE {
"semantic search" ~= "meaning-aware search";
"semantic retrieval" ~= "meaning-based retrieval";
"entity search" ~= "entity-aware search" WHEN canonical_entities_used;
"vector search" ~= "embedding similarity search" WHEN vectors_are_embeddings;
"hybrid search" ~= "hybrid semantic retrieval";
"query understanding" ~= "semantic query interpretation";
"entity linking" ~= "entity disambiguation and linking";
"semantic reranking" ~= "meaning-aware result reranking";
}
# ---------- QUERY FLOW ----------
QUERY(q) ->
NORMALISE(q) ->
IDENTIFY_INTENT(q) ->
IDENTIFY_ENTITIES(q) ->
RESOLVE_ENTITY_IDENTITY(q) ->
IDENTIFY_CONCEPTS(q) ->
EXPAND_SEMANTICS(q) ->
GENERATE_RETRIEVAL_REPRESENTATIONS(q) ->
RETRIEVE_CANDIDATES(q) ->
APPLY_FILTERS_AND_ACCESS_CONTROL(q) ->
FUSE_RETRIEVAL_SIGNALS(q) ->
RERANK(q) ->
SCORE_CONFIDENCE(q) ->
RETURN_RELEVANT_RESULTS;
# ---------- CONFIDENCE ----------
CONFIDENCE(result) :=
weighted_mean(
query_intent_match,
entity_match_strength,
semantic_similarity,
lexical_support,
graph_evidence,
source_quality,
contextual_relevance
);
CONFIDENCE >= 0.90 => HIGH;
CONFIDENCE >= 0.70 AND < 0.90 => MODERATE;
CONFIDENCE < 0.70 => REVIEW_OR_DIVERSIFY;
# ---------- AI CONSUMPTION ----------
AI_CONSUMPTION {
primary_entity: SemanticSearch;
ontology: SemanticSearchOntology;
parse_entities: true;
parse_relationships: true;
preserve_relationship_direction: true;
resolve_semantic_equivalence: true;
execute_reasoning_rules: true;
apply_confidence_weighting: true;
preserve_provenance: true;
}
# ---------- UPDATE MODEL ----------
UPDATE_MODEL {
new_document:
parse
-> extract_metadata
-> extract_entities
-> generate_embedding
-> index
-> integrate;
new_query_evidence:
identify_intent
-> identify_entities
-> record_clicked_or_judged_results
-> update_ranking_evidence
-> integrate;
new_ontology_mapping:
validate
-> attach_concept_relationships
-> update_query_expansion
-> integrate;
search_revision:
update_indices
-> update_embedding_model
-> update_ranking_weights
-> evaluate
-> recompute_confidence
-> regenerate_flow_hash;
conflict:
preserve_provenance
-> compare_relevance_evidence
-> adjust_confidence
-> flag_review;
}
# ---------- FLOW HASH ----------
FLOW_HASH_INPUT :=
DOMAIN
+ SUBDOMAIN
+ ONTOLOGY
+ SearchEntity
+ SemanticResource
+ RetrievalSignal
+ ProcessingEntity
+ SemanticRetrieval
+ HybridSemanticSearch
+ SemanticRanking
+ RELATIONSHIPS
+ SEMANTIC_REASONING
+ SEMANTIC_EQUIVALENCE
+ UPDATE_MODEL;
FLOW_HASH :=
HASH(FLOW_HASH_INPUT);
# ---------- TERMINAL ----------
SemanticSearchOntology
-> ReceiveUserQuery
-> InferSearchIntent
-> ExtractAndResolveEntities
-> IdentifyConceptualMeaning
-> ExpandRelevantSemanticRelations
-> RetrieveLexicalVectorAndGraphCandidates
-> EnforceFiltersAndPermissions
-> CombineRetrievalSignals
-> RerankByMeaningAndContext
-> PreserveSourceAndRetrievalProvenance
-> ReturnRelevantDocumentsPassagesOrEntities
-> LearnFromEvaluationAndFeedback
-> MaintainMeaningAwareSearch;
END FLOW
Download Code
Copy to Clipboard