Posts Tagged ‘freebase’

Creating Netflix Widgets from Freebase Queries

Posted in Geek Stuff on July 16th, 2010 by admin – Be the first to comment

Freebase has just finished creating a process to import Netflix film data on a daily basis. Freebase now includes in their movie metadata the key for the Netflix API. For Netflix API developers, this makes it possible to leverage Freebase’s powerful query engine and create amazing application interfaces. But even for those people who have never used the Netflix API, this functionality allows developers to leverage Netflix’ widgets to create interfaces within their existing applications, without the hassle of OAuth. I’ll walk through the process of creating a Netflix widget based on a freebase query here.

Getting the Movie

Mel Gibson is a popular guy, who’s done a bunch of movies. But what has he done for us lately? The following freebase query asks what movies he’s done since January 1, 2009. I’ll go ahead and ask for the Netflix “Tiny URL” as that’s what we’ll need to create the Netflix widget.

[{
  "name" : "Mel Gibson",
  "film": [{
    "film":  [{"initial_release_date>":"2009-01-01", "name":null,
               "key":[{"namespace":"/authority/netflix/tiny", "value":null}]}],
    "id":    null
  }],
  "type":          "/film/actor"
}]​

Turns out, he’s been taking it easy recently. There’s just a couple of movies released on DVD since the beginning of last year.

{
  "code":          "/api/status/ok",
  "result": [{
    "film": [
      {
        "film": [{
          "key": [{
            "namespace": "/authority/netflix/tiny",
            "value":     "BVmIj"
          }],
          "name": "Edge of Darkness"
        }],
        "id": "/m/04lr63t"
      },
      {
        "film": [{
          "key": [{
            "namespace": "/authority/netflix/tiny",
            "value":     "BVssN"
          }],
          "name": "The Beaver"
        }],
        "id": "/m/09vnjl6"
      }
    ],
    "name": "Mel Gibson",
    "type": "/film/actor"
  }],
  "status":        "200 OK",
  "transaction_id": "cache;cache01.p01.sjc1:8101;2010-07-16T21:13:40Z;0034"
}

Creating the Widget

Now that we have the tiny URL, we can create a widget. The Netflix widget builder can be used to create a template for the widget you want to create. When you’re done configuring your widget, you’ll end up with some Javascript code that looks like this:

<script src=”http://jsapi.netflix.com/us/api/w/s/sp100.js” settings=”id=http://movi.es/BVdT5″></script>

Once you’ve got that, it’s a simple task to create new widgets. The Tiny URL you grabbed above is used to update the ID, so in the case of “Edge of Darkness” you’d put “BVmIj” in place of BVdT5 and end up with this:

<script src=”http://jsapi.netflix.com/us/api/w/s/sp100.js” settings=”id=http://movi.es/BVmIj”></script>

Which will render on your page like so:

Once you’ve gotten this all working to your satisfaction, you can even set up the widgets to include your developer key and earn money from Netflix via the developer Affilliate Program.

Graph Databases are the New Black

Posted in Uncategorized on June 19th, 2009 by synedra – 1 Comment

When I started working on computers, the main thing people used databases for was storing tabular data.  Sales reports, inventory records, lists of things.  Relational databases were cool because you could associate a transaction in your sales table with an item in your inventory table.  As the internet has grown, however, our database needs have outgrown the abilities of the standard relational database system.  Social networks are a great example of this – the type of query needed to ask for six degrees of Kevin Bacon separation in a relational database is complex, resource intensive, and extremely time consuming.  Many very smart people have come up with ways to work around this problem, but the real problem is that this type of question is not what relational databases are designed to handle.

Graph databases, on the other hand, are optimized for exactly this type of question.  The problem with graph databases is that it’s a whole different data structure that we’ve got to wrap our minds around, and it’s difficult to do that without some starting place.  Freebase is a publicly  accessible, open graph database, available for people to use as the back end for their applications.  They’ve even created a suite of tools to make it easier to build fun things on top of their extensive data. They will be giving a tutorial on Semantic Technologies at OSCON, and if you have any interest in learning about graph structure and what you can do with it, you should definitely check it out.
If you want a more data-agnostic view of graph technologies, or want to try installing a graph database on your own, you can learn about Neo4J, an open source graph database, on Wednesday afternoon.

Freebasing at Metaweb

Posted in Geek Stuff on August 24th, 2007 by synedra – Be the first to comment

I had the opportunity to spend a few hours talking with the Metaweb team yesterday, which was really fun. I’m excited to have the opportunity to contribute to this project – it’s new technology with exciting possibilities, building a community of diverse people (developers, content experts, lookie-loos). We discussed ways to deal with the various administrative issues they’re running into (having people administer the system without accidentally breaking it).
During the conversation, I contemplated the Game Browser application I’d created to learn about Metaweb and Freebase (now open for public read access! go take a look!). Don’t be bowled over by the irony, that you’re looking at the root of a site named “perlgoddess” and the application is written in Freebase. It’s not the sexiest implementation of an mjt application but you could use it to springboard all kinds of data browsers.
The backend data for the board games is a little weak (because most of it was added manually by me), so I have some notions to fix that:

  • Use the wonderful XML API offered by boardgamegeek to populate lots of useful information in freebase. I asked for permission and they haven’t gotten back to me so I think I’ll take the middle road of making the importer and importing into the sandbox and then point that out to them so they can ask me to remove it if necessary.
  • Poke around in freebase to find places where there are board games that haven’t been tagged correctly, there seem to be lots of them. I’ll probably write a tool that accepts a ruleset and then optionally adds properties onto types.

I was also tempted greatly by the notion of creating a couple of tools to make it easier to administer freebase itself, having heard about some of the challenges there:

  • User history, including things like ‘number of entries created’, ‘number of entries updated’, ‘posts to discussion boards’, ‘replies to discussion boards’ and other such things. The Metaweb team would love to be able to identify and encourage subject matter experts and this would help find them.
  • Recent posts – they have a browser for recent discussion posts, but it would be cool to make one that remembers your preferences and filters by domain so you don’t have to see all of them. It’d be a fun MJT tool to create, so maybe I’ll get to that.
    skud created a Metaweb perl module, and WWW::Metaweb was created by Hayden Stansby. They take a slightly different approach to the interface, and I’m excited to have the opportunity to work with each of them. I’m hoping the friendly competition helps us as a community figure out the best API possible.
    All that having been said, I’m *this close* to having finished the new bloggy interface for the TPF website. I need to push through and get that done so we can finish up the infrastructure changes for that. Once I do that I can play with the shiny toys above.