Aschenblog: Thoughts on Code and Fabrication

Freebase Astronomy Gems

With 47 million topics and 2.7 billion facts, Freebase has an imposing amount of community curated data. Unfortunately, they are closing up shop by mid 2015. Their plan is to help support the up and coming Wikimedia Foundation’s project Wikidata by assisting in transferring their data to this project. Given the short amount of time they are online, I wanted to do a small project using their data sets.

I am interested in astronomy, but found the Freebase JSON data a little unwieldy. I decided to write a pair gems:

  • The astronomy gem facilitates browsing and search of astronomical phenomena. Each topic includes a name, description, an array of image URLs and a link to the original detailed Freebase data via Google APIs.
  • The astronomy_engine wraps the astronomy gem and has a web interface and can easily be included in a Rails project:

Add the following to your config/routes.rb in your rails app:

1
2
Rails.application.routes.draw do
  mount AstronomyEngine::App => '/astronomy'

This adds the web page at the root and adds a few additional routes.

Request the list of categories:

1
curl {APPLICATION_ROOT}/astronomy/categories

Request all topics for a given category:

1
curl {APPLICATION_ROOT}/astronomy/categories/Star/topics

Search all topic names and descriptions:

1
curl {APPLICATION_ROOT}/astronomy/topics?q=cluster

I have a sample web app on Heroku available if you want to take a look. Here are the Github pages for the astronomy gem and astronomy_engine gem.

Resources:

Comments