Skip to content

Instantly share code, notes, and snippets.

@s-mage
Created November 4, 2013 05:15
Show Gist options
  • Save s-mage/7298347 to your computer and use it in GitHub Desktop.
Save s-mage/7298347 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'sparql/client'
sparql = SPARQL::Client.new("http://dbpedia.org/sparql")
query = "prefix dbpprop: <http://dbpedia.org/property/>
prefix dbpedia-owl: <http://dbpedia.org/ontology/>
select ?name, ?hdi
where {
?country a dbpedia-owl:Country .
?country dbpprop:commonName ?name .
?country dbpprop:hdi ?hdi
}
"
sparql.query(query).each { |r| r.each_binding { |x, y| puts "#{x}: #{y}" } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment