Skip to main content

BuiltinFilter

Enum BuiltinFilter 

Source
pub enum BuiltinFilter {
Show 18 variants Eq(Term, Term), Ne(Term, Term), Lt(Term, Term), Le(Term, Term), Gt(Term, Term), Ge(Term, Term), StrStarts(Term, Term), StrEnds(Term, Term), Contains(Term, Term), RegexMatch { value: Term, pattern: Term, flags: Option<Term>, }, IsIri(Term), IsLiteral(Term), IsBlank(Term), IsNumeric(Term), LangMatches(Term, Term), And(Box<BuiltinFilter>, Box<BuiltinFilter>), Or(Box<BuiltinFilter>, Box<BuiltinFilter>), Not(Box<BuiltinFilter>),
}
Expand description

Built-in filter expression.

Carries a tree of comparisons / string tests over Datalog Terms plus boolean compositors. The evaluator substitutes each variable with its bound constant from the current candidate binding and then evaluates the test; bindings that fail to substitute (variable not bound), encounter a malformed regex pattern, or evaluate to anything other than true are dropped from the frontier.

Comparison semantics: Lt, Le, Gt, Ge compare two ConstantSymbols lexicographically over the underlying string representation. SPARQL value-typed numeric or xsd:dateTime ordering is not yet implemented at this layer.

String tests: StrStarts, StrEnds, Contains, and RegexMatch operate on the raw constant string. SPARQL language-tag and datatype-aware semantics — LANGMATCHES, language-aware REGEX evaluation against xsd:string-only arguments, etc. — track as further extension follow-ups; see the rule validation specification.

Variants§

§

Eq(Term, Term)

lhs = rhs — equality of constants.

§

Ne(Term, Term)

lhs != rhs — inequality of constants.

§

Lt(Term, Term)

lhs < rhs — lexicographic less-than over constants.

§

Le(Term, Term)

lhs <= rhs — lexicographic less-than-or-equal.

§

Gt(Term, Term)

lhs > rhs — lexicographic greater-than.

§

Ge(Term, Term)

lhs >= rhs — lexicographic greater-than-or-equal.

§

StrStarts(Term, Term)

STRSTARTS(haystack, needle) — haystack begins with needle over the lexical form of each argument. Plain literals ("Alice"), xsd:string-typed literals ("Alice"^^xsd:string), and bare IRI constants all compare against their bare-string representation, so the match is insensitive to datatype framing.

§

StrEnds(Term, Term)

STRENDS(haystack, needle) — haystack ends with needle over the lexical form of each argument. Same datatype-insensitivity as Self::StrStarts.

§

Contains(Term, Term)

CONTAINS(haystack, needle) — haystack contains needle somewhere in the lexical form. Same datatype-insensitivity as Self::StrStarts.

§

RegexMatch

REGEX(value, pattern, flags?) — value matches the regex::Regex compiled from pattern (and the optional flags), comparing against value’s lexical form (same datatype-insensitivity as Self::StrStarts). Supported flags follow the SPARQL subset that maps to the regex crate’s (?…) inline modifiers: i (case-insensitive), m (multi-line), s (dot-matches-newline), x (ignore whitespace inside the pattern). A compile failure or unsupported flag is treated as “undefined for the current binding” — the candidate is dropped, matching the SPARQL “type error → not true” framing.

Fields

§value: Term

The string value to match against.

§pattern: Term

The regular expression pattern.

§flags: Option<Term>

Optional flags string (e.g. "i", "im").

§

IsIri(Term)

isIRI(?x) — true when ?x resolves to an IRI under the term-kind classification in the evaluator’s RDF term classification.

§

IsLiteral(Term)

isLiteral(?x) — true when ?x resolves to a literal.

§

IsBlank(Term)

isBlank(?x) — true when ?x resolves to a blank node.

§

IsNumeric(Term)

isNumeric(?x) — true when ?x resolves to a literal whose datatype IRI is recognized as numeric by the evaluator’s numeric datatype classification.

§

LangMatches(Term, Term)

LANGMATCHES(language-tag, language-range) — RFC 4647 basic-range matching over the lexical form of both arguments. The wildcard range "*" matches any non-empty tag; otherwise the range matches the tag when the tag’s initial subtags (split on -) match the range’s subtags case-insensitively.

Both arguments are resolved through the lexical_form helper, so callers may supply either a plain string constant or an encoded literal (typically the result of a future BindExpr::Lang(?lit) extraction). The full pipeline integration that wires LANG(?lit) through to language-tagged literal storage is tracked under R12-21 follow-up — this slice lands the rule and the basic-range matcher; existing tests construct the language tag as a plain literal manually.

§

And(Box<BuiltinFilter>, Box<BuiltinFilter>)

lhs && rhs — logical conjunction of two filters.

§

Or(Box<BuiltinFilter>, Box<BuiltinFilter>)

lhs || rhs — logical disjunction of two filters.

§

Not(Box<BuiltinFilter>)

!inner — logical negation.

Implementations§

Source§

impl BuiltinFilter

Source

pub fn variables(&self) -> BTreeSet<VariableSymbol>

All variables referenced anywhere inside the filter expression. Used by safety analysis to require that every such variable is bound by some positive body atom.

Trait Implementations§

Source§

impl Clone for BuiltinFilter

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BuiltinFilter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for BuiltinFilter

Source§

impl Hash for BuiltinFilter

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BuiltinFilter

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BuiltinFilter

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.