{"id":403,"date":"2009-11-08T05:11:47","date_gmt":"2009-11-08T05:11:47","guid":{"rendered":"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/?p=403"},"modified":"2009-11-08T05:11:47","modified_gmt":"2009-11-08T05:11:47","slug":"ruby-api-for-accessing-freebasemetaweb-structured-data","status":"publish","type":"post","link":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/artificial-intelligence\/ruby-api-for-accessing-freebasemetaweb-structured-data.php","title":{"rendered":"Ruby API for accessing Freebase\/Metaweb structured data"},"content":{"rendered":"<p>I had a good talk with some of the Metaweb developers last year and started playing with their Python APIs for accessing structured data. I wanted to be able to use this structured data source in a planned Ruby project and was very pleased to see Christopher Eppstein's new project that provides an ActiveRecord style API on top of <a href=\"http:\/\/www.freebase.com\" target=\"new\">Freebase<\/a>. Here is the web page for   <a href=\"http:\/\/rubyforge.org\/projects\/freebaseapi\/\" target=\"new\">Christopher's Freebase API project<\/a>. Assuming that you do a \"gem install freebase\", using this API is easy; some examples:<\/p><pre>require 'rubygems'<br>require \"freebase\"<br>require 'pp'<br><br>an_asteroid = Freebase::Types::Astronomy::Asteroid.find(:first)<br>#pp \"an_asteroid:\", an_asteroid<br>puts \"name of asteroid=#{an_asteroid.name}\"<br>puts \"spectral type=#{an_asteroid.spectral_type[0].name}\"<br><br>#all_asteroids = Freebase::Types::Astronomy::Asteroid.find(:all)<br>#pp \"all_asteroids:\", all_asteroids<br><br>a_company = Freebase::Types::Business::Company.find(:first)<br>#pp \"a_company:\", a_company<br>puts \"name=#{a_company.name}\"<br>puts \"parent company name=#{a_company.parent_company[0].name}\"<\/pre><p>You will want to use this API interactively: use the Freebase web site to find type hierarchies that you are interested in, fetch the first object matching a type hierarchy (e.g., Types -&gt; Astronomy -&gt; Asteroid) and pretty print the fetched object to see what data fields are available.<\/p><div><img loading=\"lazy\" decoding=\"async\" width=\"1\" height=\"1\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/74278_9025880770474050744-8680906328808197016?l=artificial-intelligence-theory.blogspot.com\" style=\"padding-left:10px; padding-right: 10px;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>I had a good talk with some of the Metaweb developers last year and started playing with their Python APIs for accessing structured data. I wanted to be able to use this structured data source in a planned Ruby project &hellip; <a href=\"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/artificial-intelligence\/ruby-api-for-accessing-freebasemetaweb-structured-data.php\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"limit_modified_date":"","last_modified_date":"","_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[13],"tags":[],"class_list":["post-403","post","type-post","status-publish","format-standard","hentry","category-artificial-intelligence"],"modified_by":null,"_links":{"self":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/posts\/403"}],"collection":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/comments?post=403"}],"version-history":[{"count":0,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/posts\/403\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/media?parent=403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/categories?post=403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/tags?post=403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}