Skip to main content

Module fuzzy_query

Module fuzzy_query 

Source
Expand description

f-SPARQL — degree-aware querying over the semantic graph.

Classical SPARQL answers are crisp: a solution either matches or it does not. f-SPARQL carries a truth degree in [0, 1] on every solution, so a query can ask “guardians who are roughly the right age” or “relations that strongly match”, rank by confidence, and threshold (an α-cut) instead of demanding an exact match. This is the query-layer face of the engine’s fuzzy RDF (crate::modalities::fuzzy_rdf_schema) and the identity discipline: a graded answer is a proposal with a confidence, never an asserted fact.

§Not a fork of the SPARQL engine

This is a thin, composable algebra over the engine’s own solution type (crate::sparql_ast::BindingRow). The crisp executor still does the graph matching and produces rows one at a time; evaluate::annotate / evaluate::collect_from attach a degree to each row and the combinators here (solution) compose them. Nothing here re-implements the parser or the join engine.

§Degree algebra

Conjunction (a basic graph pattern / AND) combines degrees with a t-norm; disjunction (UNION) with a t-conorm; NOT / negation with the fuzzy complement. These are exactly the operators in crate::modalities::fuzzy — the single source of truth — selected by DegreeNorm. Default semantics are Gödel (min/max), the usual f-SPARQL choice.

Kernel-class Reduction over the solution sequence; CPU path always present (§13).

Re-exports§

pub use evaluate::annotate;
pub use evaluate::collect_from;
pub use evaluate::conjunctive_query;
pub use solution::FuzzyResultSet;
pub use solution::FuzzySolution;

Modules§

evaluate
The bridge from the crisp SPARQL executor to the fuzzy algebra.
membership
Membership functions for fuzzy FILTERs — map a crisp numeric value (e.g. an age, a distance, a similarity score bound to a query variable) to a degree in [0, 1]. These produce the per-solution degree that the super::solution algebra then composes. They are query-layer primitives (value → degree); the logic operators that combine degrees are reused from crate::modalities::fuzzy.
solution
Degree-annotated solutions and the algebra that composes them.

Enums§

DegreeNorm
Which fuzzy-logic operator family combines solution degrees. Each variant dispatches to the corresponding operator in crate::modalities::fuzzy (reuse, not a re-implementation).