Sunday, June 08, 2008

How to extract useful OWL from Freebase schemas

So, I like Freebase a lot, but the biggest stumbling block for me was the MQL abbreviation.

It was immediately shuffled off into the too hard basket; and neglected to read the "its just JSON" bit.

Today, I went back to Freebase and started creating my own ontologies; which is actually pretty neat - the authoring tools, though a little slow, are clearly the exact kind of thing needed to make the Semantic Web a reality.

(As a side note, the importing tools for lists coupled with having slow internet is a horrible experience - I want that bit of my life back please!)

After finishing all of that useful schema authoring, I've been a bit glum: I can't use this outside of Freebase easily - There are no Freebase to OWL tools that exist, so I
decided to write some.

To use it you'll need:

It's a first run, and doesn't deal with errors at all. Later on, I'll actually throw a web frontend to it perhaps.

Using it is pretty easy:

// 1. Show me all of the types (Classes) in the Music domain (Ontology)
$domain = new FreebaseDomain('/music');

// 2. Show me the details of all types (classes) in doconnor's mortgage industry domain (ontology)
$domain = new FreebaseDomain('/user/doconnor/mortgage_industry');
$types = $domain->listTypes();

foreach ($types as $key) {
$type = new FreebaseType($key);

print $key . ":\n";
print $type->toOWL("") . "\n\n";

No comments: