Class: SPARQL::Algebra::Operator::Prefix

Inherits:
Binary show all
Includes:
Query
Defined in:
lib/sparql/algebra/operator/prefix.rb

Overview

The SPARQL GraphPattern prefix operator.

Examples:

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

See Also:

Constant Summary

NAME =
[:prefix]

Constants inherited from Binary

Binary::ARITY

Constants inherited from SPARQL::Algebra::Operator

ARITY

Instance Attribute Summary

Attributes included from Query

#solutions

Attributes inherited from SPARQL::Algebra::Operator

#operands, #options

Instance Method Summary collapse

Methods included from Query

#context=, #each_solution, #failed?, #matched?, #unshift, #variables

Methods inherited from Binary

#initialize

Methods inherited from SPARQL::Algebra::Operator

arity, #base_uri, base_uri, base_uri=, #boolean, #constant?, #eql?, #evaluatable?, evaluate, #executable?, for, #initialize, #inspect, #operand, #prefixes, prefixes, prefixes=, #to_sse, #to_sxp, #variable?

Methods included from Evaluatable

#apply, #evaluate, #memoize

Methods included from Expression

cast, #constant?, #evaluate, for, new, open, parse, #to_sse, #variable?

Constructor Details

This class inherits a constructor from SPARQL::Algebra::Operator::Binary

Instance Method Details

#execute(queryable, options = {}) ⇒ 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

Returns:

See Also:



29
30
31
# File 'lib/sparql/algebra/operator/prefix.rb', line 29

def execute(queryable, options = {})
  @solutions = operands.last.execute(queryable, options.merge(:depth => options[:depth].to_i + 1))
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:



40
41
42
# File 'lib/sparql/algebra/operator/prefix.rb', line 40

def optimize
  operands.last.optimize
end