Class: RDF::Query::Solutions

Inherits:
Object
  • Object
show all
Includes:
SPARQL::Results
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/sparql-7b34b4cf091a/lib/sparql/extensions.rb,
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-spec-ab2aa521dd46/lib/rdf/spec/inspects.rb,
vendor/bundler/ruby/2.5.0/bundler/gems/sparql-7b34b4cf091a/lib/sparql/algebra/extensions.rb

Overview

Extensions for RDF::Query::Solutions.

Constant Summary

Constants included from SPARQL::Results

SPARQL::Results::MIME_TYPES

Instance Method Summary collapse

Methods included from SPARQL::Results

#to_csv, #to_html, #to_json, #to_tsv, #to_xml

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)


414
415
416
417
418
419
420
421
422
423
424
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-7b34b4cf091a/lib/sparql/algebra/extensions.rb', line 414

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



403
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-7b34b4cf091a/lib/sparql/algebra/extensions.rb', line 403

alias_method :filter_without_expression, :filter

#inspectObject



67
68
69
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-spec-ab2aa521dd46/lib/rdf/spec/inspects.rb', line 67

def inspect
  string = "vars: #{variable_names.join(",")}\n#{to_a.inspect}"
end