Module: SPARQL::Algebra

Includes:
RDF
Defined in:
lib/sparql/algebra.rb,
lib/sparql/algebra/query.rb,
lib/sparql/algebra/version.rb,
lib/sparql/algebra/operator.rb,
lib/sparql/algebra/expression.rb,
lib/sparql/algebra/evaluatable.rb,
lib/sparql/algebra/operator/or.rb,
lib/sparql/algebra/operator/and.rb,
lib/sparql/algebra/operator/asc.rb,
lib/sparql/algebra/operator/ask.rb,
lib/sparql/algebra/operator/not.rb,
lib/sparql/algebra/operator/str.rb,
lib/sparql/algebra/operator/add.rb,
lib/sparql/algebra/operator/bgp.rb,
lib/sparql/algebra/operator/desc.rb,
lib/sparql/algebra/operator/join.rb,
lib/sparql/algebra/operator/lang.rb,
lib/sparql/algebra/operator/plus.rb,
lib/sparql/algebra/operator/base.rb,
lib/sparql/algebra/operator/union.rb,
lib/sparql/algebra/operator/bound.rb,
lib/sparql/algebra/operator/regex.rb,
lib/sparql/algebra/operator/minus.rb,
lib/sparql/algebra/operator/slice.rb,
lib/sparql/algebra/operator/equal.rb,
lib/sparql/algebra/operator/order.rb,
lib/sparql/algebra/operator/graph.rb,
lib/sparql/algebra/operator/divide.rb,
lib/sparql/algebra/operator/is_iri.rb,
lib/sparql/algebra/operator/prefix.rb,
lib/sparql/algebra/operator/filter.rb,
lib/sparql/algebra/operator/project.rb,
lib/sparql/algebra/operator/reduced.rb,
lib/sparql/algebra/operator/compare.rb,
lib/sparql/algebra/operator/dataset.rb,
lib/sparql/algebra/operator/subtract.rb,
lib/sparql/algebra/operator/is_blank.rb,
lib/sparql/algebra/operator/multiply.rb,
lib/sparql/algebra/operator/datatype.rb,
lib/sparql/algebra/operator/distinct.rb,
lib/sparql/algebra/operator/describe.rb,
lib/sparql/algebra/operator/exprlist.rb,
lib/sparql/algebra/operator/less_than.rb,
lib/sparql/algebra/operator/not_equal.rb,
lib/sparql/algebra/operator/same_term.rb,
lib/sparql/algebra/operator/left_join.rb,
lib/sparql/algebra/operator/construct.rb,
lib/sparql/algebra/operator/is_literal.rb,
lib/sparql/algebra/operator/lang_matches.rb,
lib/sparql/algebra/operator/greater_than.rb,
lib/sparql/algebra/operator/less_than_or_equal.rb,
lib/sparql/algebra/operator/greater_than_or_equal.rb

Overview

A SPARQL algebra for RDF.rb.

Parses Sparql S-Expressions (SSE) into SPARQL Algebra operators.

Operators implementing Query#execute may directly execute an object implementing RDF::Queryable, and so may be treated equivalently to RDF::Query.

Operators implementing Expression#evaluate may be evaluated with RDF::Query::Solution bindings to yield an appropriate result.

An entire SSE expression is parsed into a recursive set of Operator instances, with each operand representing an additional operator.

RDF::Query and RDF::Query::Pattern are used as primitives for bgp and triple expressions.

See Also:

Defined Under Namespace

Modules: Evaluatable, Expression, Query, VERSION Classes: Operator

Constant Summary

Variable =
RDF::Query::Variable

Instance Method Summary (collapse)

Instance Method Details

- (SPARQL::Algebra::Expression) Expression(*sse) Also known as: Expr

Examples:

Expression(:isLiteral, RDF::Literal(3.1415))

Parameters:

  • sse (Array)

    a SPARQL S-Expression (SSE) form

Returns:



56
57
58
# File 'lib/sparql/algebra.rb', line 56

def Expression(*sse)
  Expression.for(*sse)
end

- (Class) Operator(name, arity = nil) Also known as: Op

Examples:

Operator(:isLiteral)

Parameters:

  • name (Symbol, #to_sym)

Returns:

  • (Class)


68
69
70
# File 'lib/sparql/algebra.rb', line 68

def Operator(name, arity = nil)
  Operator.for(name, arity)
end

- (SPARQL::Algebra::Operator) parse(sse, options = {})

Examples:

sse = (prefix ((foaf: <http://xmlns.com/foaf/0.1/>))
        (project (?name ?mbox)
          (join
            (bgp (triple ?x foaf:name ?name))
            (bgp (triple ?x foaf:mbox ?mbox)))))
}

Parameters:

Returns:



44
45
46
# File 'lib/sparql/algebra.rb', line 44

def parse(sse, options = {})
  Expression.parse(sse, options)
end

- (Variable) Variable(name) Also known as: Var

Examples:

Variable(:foobar)

Parameters:

  • name (Symbol, #to_sym)

Returns:

See Also:



81
82
83
# File 'lib/sparql/algebra.rb', line 81

def Variable(name)
  Variable.new(name)
end