Created
June 17, 2010 20:32
-
-
Save arockwell/442731 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/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