Skip to content

Instantly share code, notes, and snippets.

@arockwell
Created June 17, 2010 20:32
Show Gist options
  • Select an option

  • Save arockwell/442731 to your computer and use it in GitHub Desktop.

Select an option

Save arockwell/442731 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'rubygems'
require 'mechanize'
require 'digest/md5'
# change these to make it work
username = 'test'
password = 'test'
agent = Mechanize.new
password = Digest::MD5.hexdigest(password).upcase
agent.post('http://vivo.ufl.edu/login_process.jsp', {
'home' => '1',
'loginName' => username,
'loginPassword' => password,
'loginSubmitMode' => 'Log in'
})
sparql = <<-EOH
select ?org
where
{
?org <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Organization>
}
limit 10
EOH
format = "RS_TEXT"
page = agent.get('http://vivo.ufl.edu/admin/sparqlquery',
{ :query => sparql, :resultFormat => format })
puts page.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment