Class: RDF::Query::Solutions

Inherits:
Object
  • Object
show all
Defined in:
lib/sparql/algebra/extensions.rb

Overview

Extensions for RDF::Query::Solutions.

Instance Method Summary collapse

Instance Method Details

#filter(expression = {}) {|solution| ... } Also known as: filter!

This method returns an undefined value.

Filters this solution sequence by the given criteria.

Parameters:

Yields:

  • (solution)

    each solution

Yield Parameters:

  • solution (RDF::Query::Solution)

Yield Returns:

  • (Boolean)


236
237
238
239
240
241
242
243
244
245
246
# File 'lib/sparql/algebra/extensions.rb', line 236

def filter(expression = {}, &block)
  case expression
    when SPARQL::Algebra::Expression
      filter_without_expression do |solution|
        expression.evaluate(solution).true?
      end
      filter_without_expression(&block) if block_given?
      self
    else filter_without_expression(expression, &block)
  end
end

#filter_without_expressionObject



225
# File 'lib/sparql/algebra/extensions.rb', line 225

alias_method :filter_without_expression, :filter