The Ruby Freebase API currently provides read access to
http://www.freebase.com/
.
This release includes:
Gem support. This means installing is a snap if you already have ruby
and gems installed on your system.
JSON Parsing fix. The Ruby on Rails JSON parser was not compliant and
failed on some freebase mql reads, JSON is now parsed using the JSON
parser from http://json.rubyforge.org/
Unit test framework - support for caching responses as files so
there’s no runtime requirement on the freebase service and changes to
data will not break existing tests.
This library is still early ALPHA. The API will change, there’s going
to be some bugs. Your help in any form is appreciated.
To Install:
~ $ sudo gem install -y freebase
Successfully installed freebase-0.0.1
1 gem installed
Installing ri documentation for freebase-0.0.1…
Installing RDoc documentation for freebase-0.0.1…
You can then launch an interactive ruby shell to try it out:
chris:~ chris$ irb
irb(main):001:0> require ‘rubygems’
=> true
irb(main):002:0> require ‘freebase’
=> true
irb(main):003:0> (an_artist =
Freebase::Types::Music::Artist.find(:first)).name
=> “Blonde Redhead”
irb(main):004:0> an_artist.albums.size
=> 17
irb(main):005:0> an_artist.albums[2].name
=> “Fake Can Be Just as Good”
irb(main):006:0> an_artist.albums[2].tracks.size
=> 8
irb(main):007:0> an_artist.albums[2].tracks.first.name
=> “Kazuality”
Ruby on Rails support is still available, but it now requires the gem
to be installed. To install the latest:
rails_project $ ./script/plugin install
http://freebaseapi.rubyforge.org/svn/trunk/plugins/rails/freebase
- ./config/freebase.yml
- ./init.rb
- ./install.rb
- ./tasks/freebase_tasks.rake
- ./uninstall.rb
Installing: config/freebase.yml
If you haven’t yet done so, please install the freebase gem:
[sudo] gem install freebase
Enjoy!
- Chris Eppstein