class RDF::Query::Solutions

An RDF basic graph pattern (BGP) query solution sequence.

@example Filtering solutions using a hash

solutions.filter(author:  RDF::URI("http://ar.to/#self"))
solutions.filter(author:  "Gregg Kellogg")
solutions.filter(author:  [RDF::URI("http://ar.to/#self"), "Gregg Kellogg"])
solutions.filter(updated: RDF::Literal(Date.today))

@example Filtering solutions using a block

solutions.filter { |solution| solution.author.literal? }
solutions.filter { |solution| solution.title.to_s =~ /^SPARQL/ }
solutions.filter { |solution| solution.price < 30.5 }
solutions.filter { |solution| solution.bound?(:date) }
solutions.filter { |solution| solution.age.datatype == RDF::XSD.integer }
solutions.filter { |solution| solution.name.language == :es }

@example Reordering solutions based on a variable or proc

solutions.order_by(:updated)
solutions.order_by(:updated, :created)
solutions.order_by(:updated, lambda {|a, b| b <=> a})

@example Selecting/Projecting particular variables only

solutions.select(:title)
solutions.select(:title, :description)
solutions.project(:title)

@example Eliminating duplicate solutions

solutions.distinct

@example Limiting the number of solutions

solutions.offset(20).limit(10)

@example Counting the number of matching solutions

solutions.count
solutions.count { |solution| solution.price < 30.5 }

@example Iterating over all found solutions

solutions.each { |solution| puts solution.inspect }

@since 0.3.0