RdfFusionLogicalPlanBuilder

Struct RdfFusionLogicalPlanBuilder 

Source
pub struct RdfFusionLogicalPlanBuilder { /* private fields */ }
Expand description

A convenient builder for programmatically creating SPARQL queries.

§Example


let subject = Variable::new_unchecked("s");
let predicate = Variable::new_unchecked("p");
let object = Variable::new_unchecked("o");

let pattern = TriplePattern {
    subject: TermPattern::Variable(subject.clone()),
    predicate: NamedNodePattern::Variable(predicate),
    object: TermPattern::Variable(object),
};

let builder_context = RdfFusionLogicalPlanBuilderContext::new(rdf_fusion_context);
let plan: LogicalPlan = builder_context
    .create_pattern(ActiveGraph::DefaultGraph, None, pattern)
    .project(&[subject])
    .unwrap()
    .build()
    .unwrap();

Implementations§

Source§

impl RdfFusionLogicalPlanBuilder

Source

pub fn project( self, variables: &[Variable], ) -> Result<RdfFusionLogicalPlanBuilder, DataFusionError>

Projects the current plan to a new set of variables.

Source

pub fn filter( self, expression: Expr, ) -> Result<RdfFusionLogicalPlanBuilder, DataFusionError>

Applies a filter using expression.

The filter expression is evaluated for each solution. If the effective boolean value of the expression is true, the solution is kept; otherwise, it is discarded.

If the expression does not evaluate to a boolean, its effective boolean value is determined according to SPARQL rules.

§Relevant Resources
Source

pub fn extend( self, variable: Variable, expr: Expr, ) -> Result<RdfFusionLogicalPlanBuilder, DataFusionError>

Extends the current plan with a new variable binding.

Source

pub fn join( self, rhs: LogicalPlan, join_type: SparqlJoinType, filter: Option<Expr>, ) -> Result<RdfFusionLogicalPlanBuilder, DataFusionError>

Creates a join node of two logical plans that contain encoded RDF Terms.

§Relevant Resources
Source

pub fn slice( self, start: usize, length: Option<usize>, ) -> Result<RdfFusionLogicalPlanBuilder, DataFusionError>

Creates a limit node that applies skip (start) and fetch (length) to inner.

Source

pub fn order_by( self, exprs: &[Sort], ) -> Result<RdfFusionLogicalPlanBuilder, DataFusionError>

Sorts the current plan by a given set of expressions.

Source

pub fn union( self, rhs: LogicalPlan, ) -> Result<RdfFusionLogicalPlanBuilder, DataFusionError>

Creates a union of the current plan and another plan.

Source

pub fn minus( self, rhs: LogicalPlan, ) -> Result<RdfFusionLogicalPlanBuilder, DataFusionError>

Subtracts the results of another plan from the current plan.

Source

pub fn group( self, variables: &[Variable], aggregates: &[(Variable, Expr)], ) -> Result<RdfFusionLogicalPlanBuilder, DataFusionError>

Groups the current plan by a set of variables and applies aggregate expressions.

Source

pub fn distinct(self) -> Result<RdfFusionLogicalPlanBuilder, DataFusionError>

Removes duplicate solutions from the current plan.

Source

pub fn distinct_with_sort( self, sorts: Vec<Sort>, ) -> Result<RdfFusionLogicalPlanBuilder, DataFusionError>

Removes duplicate solutions from the current plan, with additional sorting.

Source

pub fn pattern( self, pattern: Vec<Option<TermPattern>>, ) -> Result<RdfFusionLogicalPlanBuilder, DataFusionError>

Removes duplicate solutions from the current plan.

Source

pub fn with_plain_terms( self, ) -> Result<RdfFusionLogicalPlanBuilder, DataFusionError>

Ensures all columns are encoded as plain terms.

Source

pub fn schema(&self) -> &Arc<DFSchema>

Returns the schema of the current plan.

Source

pub fn context(&self) -> &RdfFusionLogicalPlanBuilderContext

Returns the builder context.

Source

pub fn into_inner(self) -> LogicalPlanBuilder

Consumes the builder and returns the inner LogicalPlanBuilder.

Source

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

Builds the LogicalPlan.

Source

pub fn expr_builder_root(&self) -> RdfFusionExprBuilderContext<'_>

Source

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

Returns a new RdfFusionExprBuilder for a given expression.

Trait Implementations§

Source§

impl Clone for RdfFusionLogicalPlanBuilder

Source§

fn clone(&self) -> RdfFusionLogicalPlanBuilder

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 Debug for RdfFusionLogicalPlanBuilder

Source§

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

Formats the value using the given formatter. Read more

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> 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,