RdfFusionExprBuilder

Struct RdfFusionExprBuilder 

Source
pub struct RdfFusionExprBuilder<'root> { /* private fields */ }
Expand description

A builder for expressions that make use of RDF Fusion built-ins.

Users of RDF Fusion can override all built-ins with custom implementations. As a result, constructing expressions requires access to some state that holds the set of registered built-ins. This struct provides an abstraction over using this registry.

Implementations§

Source§

impl<'root> RdfFusionExprBuilder<'root>

Source

pub fn try_new_from_context( root: RdfFusionExprBuilderContext<'root>, expr: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression builder.

Returns an Err if the expression does not evaluate to an RDF term.

Source

pub fn context(&self) -> &RdfFusionExprBuilderContext<'root>

Returns the schema of the input data.

Source

pub fn bound(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that checks if a variable is bound.

§Relevant Resources
Source

pub fn sparql_if( self, if_true: Expr, if_false: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Returns an expression that evaluates to either the value of if_true´ or if_false` depending on the effective boolean value of the inner expression.

§Relevant Resources
Source

pub fn coalesce( self, args: Vec<Expr>, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that evaluates to the first argument that does not produce an error.

§Relevant Resources
Source

pub fn rdf_term_equal( self, rhs: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that checks for RDF term equality.

§Relevant Resources
Source

pub fn is_iri(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that checks if the inner expression is an IRI.

§Relevant Resources
Source

pub fn is_blank(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that checks if the inner expression is a blank node.

§Relevant Resources
Source

pub fn is_literal(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that checks if the inner expression is a literal.

§Relevant Resources
Source

pub fn is_numeric(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that checks if the inner expression is a numeric value.

§Relevant Resources
Source

pub fn str(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that returns the string representation of the inner expression.

§Relevant Resources
Source

pub fn lang(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that returns the language tag of a literal.

§Relevant Resources
Source

pub fn datatype(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that returns the datatype of a literal.

§Relevant Resources
Source

pub fn iri( self, base_iri: Option<&Iri<String>>, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that constructs an IRI from a string.

An optional base_iri can be provided to resolve relative IRIs. If no base_iri is provided, relative IRIs will produce an error.

§Relevant Resources
Source

pub fn bnode_from(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that constructs a blank node from a string.

§Relevant Resources
Source

pub fn strdt( self, datatype_iri: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a literal with a specified datatype from a simple literal.

§Relevant Resources
Source

pub fn strlang( self, lang_tag: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a literal with a specified language tag from a simple literal.

§Relevant Resources
Source

pub fn strlen(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that returns the length of a string.

§Relevant Resources
Source

pub fn substr( self, starting_loc: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that returns a substring of a string, starting at a given location.

§Relevant Resources
Source

pub fn substr_with_length( self, starting_loc: Expr, length: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that returns a substring of a string, with a given length.

§Relevant Resources
Source

pub fn ucase(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that converts a string to uppercase.

§Relevant Resources
Source

pub fn lcase(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that converts a string to lowercase.

§Relevant Resources
Source

pub fn str_starts( self, arg2: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that checks if a string starts with another string.

§Relevant Resources
Source

pub fn str_ends( self, arg2: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that checks if a string ends with another string.

§Relevant Resources
Source

pub fn contains( self, arg2: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that checks if a string contains another string.

§Relevant Resources
Source

pub fn str_before( self, arg2: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that returns the part of a string before the first occurrence of another string.

§Relevant Resources
Source

pub fn str_after( self, arg2: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that returns the part of a string after the first occurrence of another string.

§Relevant Resources
Source

pub fn encode_for_uri( self, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that encodes a string for use in a URI.

§Relevant Resources
Source

pub fn concat( self, args: Vec<Expr>, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that concatenates multiple strings.

§Relevant Resources
Source

pub fn lang_matches( self, language_range: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that checks if a language tag matches a language range.

§Relevant Resources
Source

pub fn regex( self, pattern: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that applies a regular expression to a string.

§Relevant Resources
Source

pub fn regex_with_flags( self, pattern: Expr, flags: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression that applies a regular expression to a string, with flags.

§Relevant Resources
Source

pub fn replace( self, pattern: Expr, replacement: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Replaces all occurrences of a pattern with a given replacement.

If more control about the matching behavior is required, use the Self::replace_with_flags operation.

§Relevant Resources
Source

pub fn replace_with_flags( self, pattern: Expr, replacement: Expr, flags: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Replaces all occurrences of a pattern with a given replacement.

In addition to the regular Self::replace functions, this allows providing flags used for the regex matching process.

§Relevant Resources
Source

pub fn abs(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Compute the absolute value of a numeric literal.

§Relevant Resources
Source

pub fn round(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Rounds the inner expression to the nearest integer.

If the value is exactly between two integers, the integer closer to positive infinity is used (e.g., 0.5 -> 1).

§Relevant Resources
Source

pub fn ceil(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Computes the ceiling of a numeric literal.

§Relevant Resources
Source

pub fn floor(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Computes the floor of a numeric literal.

§Relevant Resources
Source

pub fn year(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that returns the year component of the inner expression.

§Relevant Resources
Source

pub fn month(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that returns the month component of the inner expression.

§Relevant Resources
Source

pub fn day(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that returns the day component of the inner expression.

§Relevant Resources
Source

pub fn hours(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that returns the hours component of the inner expression.

§Relevant Resources
Source

pub fn minutes(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that returns the minutes component of the inner expression.

§Relevant Resources
Source

pub fn seconds(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that returns the seconds component of the inner expression.

§Relevant Resources
Source

pub fn timezone(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that returns the timezone of the inner expression.

This returns the timezone as an xsd:dayTimeDuration. For a simple string representation see Self::tz.

§Relevant Resources
Source

pub fn tz(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that returns the timezone of the inner expression.

This returns the timezone as a simple literal. For a representation as a duration see Self::timezone.

§Relevant Resources
Source

pub fn md5(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that computes the MD5 checksum of the inner expression.

The checksum is encoded as a hexadecimal string.

§Relevant Resources
Source

pub fn sha1(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that computes the SHA1 checksum of the inner expression.

The checksum is encoded as a hexadecimal string.

§Relevant Resources
Source

pub fn sha256(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that computes the SHA256 checksum of the inner expression.

The checksum is encoded as a hexadecimal string.

§Relevant Resources
Source

pub fn sha384(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that computes the SHA384 checksum of the inner expression.

The checksum is encoded as a hexadecimal string.

§Relevant Resources
Source

pub fn sha512(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new expression that computes the SHA512 checksum of the inner expression.

The checksum is encoded as a hexadecimal string.

§Relevant Resources
Source

pub fn cast_string(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Casts the inner expression to an xsd:string.

§Relevant Resources
Source

pub fn cast_date_time( self, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Casts the inner expression to an xsd:dateTime.

§Relevant Resources
Source

pub fn cast_decimal( self, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Casts the inner expression to an xsd:decimal.

§Relevant Resources
Source

pub fn cast_double(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Casts the inner expression to an xsd:double.

§Relevant Resources
Source

pub fn cast_float(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Casts the inner expression to an xsd:float.

§Relevant Resources
Source

pub fn cast_integer( self, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Casts the inner expression to an xsd:integer.

§Relevant Resources
Source

pub fn cast_int(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Casts the inner expression to an xsd:int.

§Relevant Resources
Source

pub fn cast_boolean( self, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Casts the inner expression to an xsd:boolean.

Note that this does not encode the result as a native boolean array. Use Self::build_effective_boolean_value for this purpose

§Relevant Resources
Source

pub fn unary_plus(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression for the unary plus operator.

§Relevant Resources
Source

pub fn unary_minus(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression for the unary minus operator.

§Relevant Resources
Source

pub fn add( self, rhs: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression for the addition operator.

§Relevant Resources
Source

pub fn sub( self, rhs: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression for the subtraction operator.

§Relevant Resources
Source

pub fn mul( self, rhs: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression for the multiplication operator.

§Relevant Resources
Source

pub fn div( self, rhs: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression for the division operator.

§Relevant Resources
Source

pub fn equal( self, rhs: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression for the equality operator.

§Relevant Resources
Source

pub fn greater_than( self, rhs: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression for the greater than operator.

§Relevant Resources
Source

pub fn greater_or_equal( self, rhs: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression for the greater than or equal operator.

§Relevant Resources
Source

pub fn less_than( self, rhs: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression for the less than operator.

§Relevant Resources
Source

pub fn less_or_equal( self, rhs: Expr, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression for the less than or equal operator.

§Relevant Resources
Source

pub fn not(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates an expression for the logical not operator.

§Relevant Resources
Source

pub fn avg( self, distinct: bool, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new aggregate expression that computes the average of the inner expression.

If distinct is true, only distinct values are considered.

§Relevant Resources
Source

pub fn count( self, distinct: bool, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new aggregate expression that computes the average of the inner expression.

If distinct is true, only distinct values are considered.

§Relevant Resources
Source

pub fn max(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new aggregate expression that computes the maximum of the inner expression.

§Relevant Resources
Source

pub fn min(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new aggregate expression that computes the minimum of the inner expression.

§Relevant Resources
Source

pub fn sample(self) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new aggregate expression that returns any value of the inner expression.

§Relevant Resources
Source

pub fn sum( self, distinct: bool, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new aggregate expression that computes the sum of the inner expression.

§Relevant Resources
Source

pub fn group_concat( self, distinct: bool, separator: Option<&str>, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Creates a new aggregate expression that computes the concatenation of the inner expression.

The separator parameter can be used to use a custom separator for combining strings.

If distinct is true, only distinct values are considered.

§Relevant Resources
Source

pub fn with_encoding( self, target_encoding: EncodingName, ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Equivalent to calling Self::with_any_encoding with a &[target_encoding].

Source

pub fn with_any_encoding( self, target_encodings: &[EncodingName], ) -> Result<RdfFusionExprBuilder<'root>, DataFusionError>

Ensures that the expression is one of the given target_encodings.

Generally one of the following things happens:

  • The expression already in a target encoding and the builder itself is returns.
  • The expression is in another encoding and the builder tries to cast the expression to the first encoding in target_encodings.
  • The expression is not an RDF term and an error is returned.
Source

pub fn build(self) -> Result<Expr, DataFusionError>

Returns the expression that has been build and checks whether it evaluates to an RDF term.

Source

pub fn build_any(self) -> Expr

Returns the expression that has been build without any validation.

Source

pub fn build_same_term(self, rhs: Expr) -> Result<Expr, DataFusionError>

Builds an expression that checks for SPARQL sameTerm equality.

This is a terminating builder function as it no longer produces an RDF term as output.

Source

pub fn build_effective_boolean_value(self) -> Result<Expr, DataFusionError>

Builds an expression that computes the effective boolean value of the inner expression.

This is a terminating builder function as it no longer produces an RDF term as output.

Source

pub fn build_is_compatible(self, rhs: Expr) -> Result<Expr, DataFusionError>

Builds an expression that checks if two terms are compatible for a join.

This is a terminating builder function as it no longer produces an RDF term as output.

Source

pub fn build_same_term_scalar( self, scalar: TermRef<'_>, ) -> Result<Expr, DataFusionError>

Builds an expression that checks for sameTerm equality with a scalar value.

This is a terminating builder function as it no longer produces an RDF term as output.

Trait Implementations§

Source§

impl<'root> Clone for RdfFusionExprBuilder<'root>

Source§

fn clone(&self) -> RdfFusionExprBuilder<'root>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'root> Debug for RdfFusionExprBuilder<'root>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'root> Freeze for RdfFusionExprBuilder<'root>

§

impl<'root> !RefUnwindSafe for RdfFusionExprBuilder<'root>

§

impl<'root> Send for RdfFusionExprBuilder<'root>

§

impl<'root> Sync for RdfFusionExprBuilder<'root>

§

impl<'root> Unpin for RdfFusionExprBuilder<'root>

§

impl<'root> !UnwindSafe for RdfFusionExprBuilder<'root>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,