Class: LD::Patch::Algebra::Prefix

Inherits:
SPARQL::Algebra::Operator::Binary
  • Object
show all
Includes:
SPARQL::Algebra::Update
Defined in:
lib/ld/patch/algebra/prefix.rb

Overview

The LD Patch ‘prefix` operator.

Examples:

(prefix ((: <http://example/>))
  (graph ?g
    (bgp (triple ?s ?p ?o))))

See Also:

Constant Summary collapse

NAME =
:prefix

Instance Method Summary collapse

Instance Method Details

#execute(queryable, options = {}) {|solution| ... } ⇒ RDF::Query::Solutions

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 URIs.

Parameters:

  • queryable (RDF::Queryable)

    the graph or repository to query

  • options (Hash{Symbol => Object}) (defaults to: {})

    any additional keyword options

Yields:

  • (solution)

    each matching solution, statement or boolean

Yield Parameters:

  • solution (RDF::Statement, RDF::Query::Solution, Boolean)

Yield Returns:

  • (void)

    ignored

Returns:

  • (RDF::Query::Solutions)

    the resulting solution sequence

See Also:



32
33
34
35
# File 'lib/ld/patch/algebra/prefix.rb', line 32

def execute(queryable, options = {}, &block)
  debug(options) {"Prefix"}
  @solutions = queryable.query(operands.last, **options.merge(depth: options[:depth].to_i + 1), &block)
end

#optimizeUnion, RDF::Query

Returns an optimized version of this query.

If optimize operands, and if the first two operands are both Queries, replace with the unique sum of the query elements

Returns:

  • (Union, RDF::Query)

    ‘self`



44
45
46
# File 'lib/ld/patch/algebra/prefix.rb', line 44

def optimize
  operands.last.optimize
end