Class: SPARQL::Algebra::Operator::Slice
- Inherits:
-
Ternary
- Object
- SPARQL::Algebra::Operator
- Ternary
- SPARQL::Algebra::Operator::Slice
- Includes:
- Query
- Defined in:
- lib/sparql/algebra/operator/slice.rb
Overview
The SPARQL GraphPattern slice operator.
Constant Summary
- NAME =
[:slice]
Constants inherited from Ternary
Constants inherited from SPARQL::Algebra::Operator
Instance Attribute Summary
Attributes included from Query
Attributes inherited from SPARQL::Algebra::Operator
Instance Method Summary (collapse)
-
- (RDF::Query::Solutions) execute(queryable, options = {})
Executes this query on the given
queryablegraph or repository. -
- (Union, RDF::Query) optimize
Returns an optimized version of this query.
Methods included from Query
#context=, #each_solution, #failed?, #matched?, #unshift, #variables
Methods inherited from Ternary
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
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::Ternary
Instance Method Details
- (RDF::Query::Solutions) execute(queryable, options = {})
Executes this query on the given queryable graph or repository.
Returns a subset of the solutions resulting from executing
the third operand, an RDF::Queryable object by indexing in to the
result set by the amount specified in the first operand and limiting
the total number of solutions returned by the amount specified in the
second operand.
If either the first or second operands are :_, they are not considered.
42 43 44 45 46 47 |
# File 'lib/sparql/algebra/operator/slice.rb', line 42 def execute(queryable, = {}) @solutions = operands.last. execute(queryable, .merge(:depth => [:depth].to_i + 1)) @solutions.offset(operands[0]) unless operands[0] == :_ @solutions.limit(operands[1]) unless operands[1] == :_ @solutions end |
- (Union, RDF::Query) optimize
Returns an optimized version of this query.
Return optimized query
55 56 57 |
# File 'lib/sparql/algebra/operator/slice.rb', line 55 def optimize operands = operands.map(&:optimize) end |