Quickly Understanding FreeBase

I had to explain what FreeBase was to someone earlier today. Briefly, FreeBase “is an open database of the world’s information. It’s built by the community and for the community – free for anyone to query, contribute to, build applications on top of, or integrate into their websites.” After saying it’s like a

  • “Wikipedia for linked lists”
  • “It’s a public information exchange”
  • “It will be like a queryable semantic resource for all of the worlds knowledge”

I figured the easiest way to truly understand the power of FreeBase would be to write a quick example. Jim Pick and I have talked about getting information in to FreeBase automatically, but here’s a super quick ruby example that shows you what you can do.

Let’s say you want a list of all of the Computers ever made. (Okay FreeBase doesn’t have them all in there yet but it’s a cool example).

Let’s use Ruby because its dead easy and quick!

gem install freebase

The following code will print up a list of all the computer names

#!/usr/bin/env ruby
 
require 'rubygems'
require 'freebase'
require 'pp'
 
computers = Freebase::Types::Computer::Computer.find(:all)
computers.each do |computer|
puts computer.name
end
 
puts computers.length
MacBook Pro 17 inch
MacBook Pro 15.4 inch
CM-2
CM-2a
CM-200
CM-5
CM-5e
MacBook Pro
Apple IIe
Apple IIc
...
...
...
NeXTcube
NeXTstation Color Turbo
NeXTstation Color
NeXTstation Turbo
NeXTcube Turbo
NeXTcube 040
NeXTcube 030
Tinkertoy Tic-Tac-Toe Computer
Z3
100

Cool, huh? You can access tons of Meta Data, and this is perhaps the most simple example possible but I think it nicely demonstrates why FreeBase is awesome. If you like it, you should check out the OpenCalais project by Reuters. Their site is kind of awful but the platform does some very powerful semantic analysis.

  • http://jimpick.com/ Jim Pick

    Cool. I hadn’t looked at the Ruby bindings yet. That’s sweet!

  • Marco

    Very interesting post! I was trying it just now, but after i lunch my ruby class an error was rised:

    ./freebase.rb:7: uninitialized constant Freebase (NameError)
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require’
    from db.rb:4

    That is an error rised from the Kernel module because the freebase constant is undefined…
    How can I solve it?

  • http://trevoro.ca Trevor Orsztynowicz

    It looks like you haven’t installed the freebase gem. Try installing it again. you can check to make sure it’s there by doing ‘gem list | grep -i freebase’

  • http://hook.org anselm

    same issue with me. i installed the gem and it shows up in the list. anyway its a 0.0.1 gem that is a year old …

  • http://Website David

    Anything better? This doesn’t seem to work anymore…

  • http://www.quasipartikel.at Michael Aufreiter

    I’ve just pushed an initial version of Ken, my attempt of a Ruby Freebase API, to Github.

    http://github.com/michael/ken/

    Maybe one wants to have a look at it…

  • Erand

    Where exactly do they get data from? The whole Net by some crawling or custom – made? database?

  • http://mackeeper.zeobit.com/clean-my-mac clean my mac

    The interaction with Rubi is little bit difficult unless the set – up works perfectly which is a rare thing to happen.