Created
January 5, 2011 20:28
-
-
Save bad/766954 to your computer and use it in GitHub Desktop.
demonstrates a discrepancy between RDF::Query#each_solution and RDF::Query#solutions.each
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rdf' | |
require 'rdf/rdfxml' | |
require 'sparql/client' | |
lmdb = SPARQL::Client::Repository.new 'http://data.linkedmdb.org/sparql' | |
query = lmdb.client. | |
select(:movie). | |
prefix('movie: <http://data.linkedmdb.org/resource/movie/>'). | |
where( | |
[:actor, RDF::URI.new('http://data.linkedmdb.org/resource/movie/actor_name'), 'Peter O\'Toole'], | |
[:movie, RDF::URI.new('http://data.linkedmdb.org/resource/movie/actor'), :actor] | |
) | |
solutions = 0 | |
query.each_solution { |s| solutions+=1 } | |
puts "each_solutions #{solutions} vs. solutions.each #{query.solutions.size}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment