class SPARQL::Algebra::Operator::Base

The SPARQL GraphPattern `base` operator.

@example

(base <http://example.org/>
  (bgp (triple <a> <b> 123.0)))

@see www.w3.org/TR/sparql11-query/#QSynIRI

Constants

NAME

Public Instance Methods

execute(queryable, **options, &block) click to toggle source

Executes this query on the given `queryable` graph or repository. Really a pass-through, as this is a syntactic object used for providing context for relative URIs.

@param [RDF::Queryable] queryable

the graph or repository to query

@param [Hash{Symbol => Object}] options

any additional keyword options

@yield [solution]

each matching solution, statement or boolean

@yieldparam [RDF::Statement, RDF::Query::Solution, Boolean] solution @yieldreturn [void] ignored @return [RDF::Queryable, RDF::Query::Solutions]

the resulting solution sequence

@see www.w3.org/TR/sparql11-query/#sparqlAlgebra

# File lib/sparql/algebra/operator/base.rb, line 32
def execute(queryable, **options, &block)
  debug(options) {"Base #{operands.first}"}
  Operator.base_uri = operands.first
  queryable.query(operands.last, depth: options[:depth].to_i + 1, **options, &block)
end
optimize(**options) click to toggle source

Return optimized query

@return [Base] a copy of `self` @see SPARQL::Algebra::Expression#optimize

# File lib/sparql/algebra/operator/base.rb, line 43
def optimize(**options)
  Operator.base_uri = operands.first
  operands.last.optimize(**options)
end
query_yields_boolean?() click to toggle source

Query results in a boolean result (e.g., ASK) @return [Boolean]

# File lib/sparql/algebra/operator/base.rb, line 50
def query_yields_boolean?
  operands.last.query_yields_boolean?
end
query_yields_statements?() click to toggle source

Query results statements (e.g., CONSTRUCT, DESCRIBE, CREATE) @return [Boolean]

# File lib/sparql/algebra/operator/base.rb, line 56
def query_yields_statements?
  operands.last.query_yields_statements?
end