RdfFusionExprBuilderContext

Struct RdfFusionExprBuilderContext 

Source
pub struct RdfFusionExprBuilderContext<'context> { /* private fields */ }
Expand description

An expression builder for creating SPARQL expressions.

This is the builder context, which can be used to create expression builders. Each builder context has an associated schema. This schema is used for, for example, inferring the type of built expressions and is therefore crucial.

Furthermore, the context holds a reference to an RdfFusionFunctionRegistry that is used to resolve the registered built-ins and user-defined functions.

Implementations§

Source§

impl<'context> RdfFusionExprBuilderContext<'context>

Source

pub fn new( rdf_fusion_context: &'context RdfFusionContextView, schema: &'context DFSchema, ) -> RdfFusionExprBuilderContext<'context>

Creates a new expression builder context.

Source

pub fn schema(&self) -> &DFSchema

Returns the schema of the input data.

Source

pub fn rdf_fusion_context(&self) -> &RdfFusionContextView

Returns a reference to the RDF Fusion context.

Source

pub fn registry(&self) -> &dyn RdfFusionFunctionRegistry

Returns a reference to the used function registry.

Source

pub fn encodings(&self) -> &'context RdfFusionEncodings

Returns a reference to the used object id encoding.

Source

pub fn try_create_builder( &self, expr: Expr, ) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates a new RdfFusionExprBuilder from an existing Expr.

Source

pub fn try_create_builder_for_udf( &self, name: &FunctionName, args: Vec<Expr>, ) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates a new RdfFusionExprBuilder from an existing Expr.

Source

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

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

§Relevant Resources
Source

pub fn bnode(&self) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates an expression that generates a new blank node.

§Relevant Resources
Source

pub fn uuid(&self) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates an expression that computes a fresh IRI from the urn:uuid: scheme.

§Relevant Resources
Source

pub fn str_uuid( &self, ) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates an expression that computes a string literal representation of a UUID.

§Relevant Resources
Source

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

Creates an expression that concatenates the string representations of its arguments.

§Relevant Resources
Source

pub fn rand(&self) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates an expression that computes a pseudo-random value between 0 and 1.

The data type of the value is xsd:double.

§Relevant Resources
Source

pub fn variable( &self, variable: VariableRef<'_>, ) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates an expression from a SPARQL variable.

If the variable is not bound in the current context (i.e., not in the schema), the expression evaluates to a null literal.

Source

pub fn literal<'lit>( &self, term: impl Into<TermRef<'lit>>, ) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates a literal expression from an RDF term.

The term is encoded using the PlainTermEncoding.

Source

pub fn null_literal( &'context self, ) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates a null literal expression.

This is used to represent unbound variables or errors.

Source

pub fn exists( self, exists_plan: LogicalPlan, ) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates a new exists filter operator. This operator takes another graph pattern (as a LogicalPlan) that is checked against the current graph pattern. Only solutions that have at least one compatible solution in the EXISTS graph pattern pass this filter.

§Relevant Resources
Source

pub fn not_exists( self, exists_plan: LogicalPlan, ) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates a new not exists filter operator. This operator takes another graph pattern (as a LogicalPlan) that is checked against the current graph pattern. Only solutions that have no compatible solution in the EXISTS graph pattern pass this filter.

§Relevant Resources
Source

pub fn native_int64_as_term( &self, expr: Expr, ) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates an expression that converts a native i64 value into an RDF term.

This is done by encoding the literal and calling BuiltinName::NativeInt64AsTerm.

Source

pub fn native_boolean_as_term( &self, expr: Expr, ) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates an expression that converts a native boolean value into an RDF term.

This is done by encoding the literal and calling BuiltinName::NativeBooleanAsTerm.

Source

pub fn and( &self, lhs: Expr, rhs: Expr, ) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates a SPARQL logical AND expression.

This differs from a standard AND by its error treatment.

§Relevant Resources
Source

pub fn sparql_or( self, lhs: Expr, rhs: Expr, ) -> Result<RdfFusionExprBuilder<'context>, DataFusionError>

Creates a SPARQL logical OR expression.

This differs from a standard OR by its error treatment.

§Relevant Resources

Trait Implementations§

Source§

impl<'context> Clone for RdfFusionExprBuilderContext<'context>

Source§

fn clone(&self) -> RdfFusionExprBuilderContext<'context>

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<'context> Debug for RdfFusionExprBuilderContext<'context>

Source§

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

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

impl<'context> Copy for RdfFusionExprBuilderContext<'context>

Auto Trait Implementations§

§

impl<'context> Freeze for RdfFusionExprBuilderContext<'context>

§

impl<'context> !RefUnwindSafe for RdfFusionExprBuilderContext<'context>

§

impl<'context> Send for RdfFusionExprBuilderContext<'context>

§

impl<'context> Sync for RdfFusionExprBuilderContext<'context>

§

impl<'context> Unpin for RdfFusionExprBuilderContext<'context>

§

impl<'context> !UnwindSafe for RdfFusionExprBuilderContext<'context>

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,