SparQL is Wicked Sick G
I have begun to really use Protege-OWL. If you’ve never heard of this application, definitely check it out. It’s where the semantic web begins really. Protege is a very mature knowledge aquisition and management system that was developed as part of a large bioinformatics project. It spun off to become it’s own project at Stanford an it has huge userbase. The Web Ontology Language (OWL) was designed by the folks at the World Wide Web Consortium (W3C). OWL is an XML dialect designed to describe things. Protege-OWL is an extremely interactive editor for creating OWL documents. OWL is one of the main languages of the Semantic Web. The Semantic Web is an architecture designed to get data to link together in a way that documents link together on the regular web. The difference is that the data is linked together in a way that will let other computer programs understand somewhat what the data actually means (a stepping stone to artificial intelligence).
Once I started putting things together in OWL, my skills as a database application designer started kicking in and I immediatedly wanted to get information out of OWL. This seemed to be a bit daunting. My first inclination was to learn a goodly amount of XSTL but it got kind of hairy. Some of the pain was alleviated by learning about the OWL XML Presentation Syntax (a W3C suggested syntax) and by using a little program called owlrdf2owlxml which is part of the excellent Kaon2 OWL Tools. OWL XML makes the OWL files almost readable. And owlrdf2owlxml gets the OWL file into a shape that is very easy to use XSLT with.
All the while I was doing this work, though, I kept thinking in the back of my mind that there was a query language for OWL.
One day at work, I found myself opening Microsoft Notepad one more time, writting some notes (again), saving that text file to my desktop, yet again for the umpteenth time and I thought “this is wack”. From now on, the first thing I’m going in the morning is to open up Protege and start putting notes and stuff in that. Then I could link things together and maybe get a little bit more organized.
And that’s exactly what I did.
Things just started to happen. I created a class called Person and tacked on a bunch of properties for phone numbers, email addresses and other notes and stuff. After a few days of doing this, I had a really cool little knowledgebase and I was actually capturing some important information and Protege was actually saving me time from looking through emails, spreadsheets, Word documents and text documents. Well, I just had to figure out how to query my little knowledge base to get even more information out of it. Desparately, I started to learn SparQL.
What a weird freaking little language. Here’s a sample of some SparQL I wrote (Using the Protege-OWL SparQL enabled beta).
SELECT ?PCN ?ProfitCenter ?ContractType ?FSAVersion ?Director ?Phone ?EmailWHERE { ?District :hasProfitCenters ?PC . ?District rdfs:label ?DM . ?PC rdfs:label ?ProfitCenter . ?PC :hasDirector ?CDirector . ?PC :hasPCNumber ?PCN . ?PC :hasFSAContractType ?CT . ?PC :hasFSAVersion ?FSAV . ?CT rdfs:label ?ContractType . ?FSAV rdfs:label ?FSAVersion . ?CDirector rdfs:label ?Director . ?CDirector :hasOfficePhone ?Phone . ?CDirector :hasEmailAddress ?Email FILTER ?DM='Some Guy'}I’ll probably look back at this query some day in the future and laugh and think, that’s the worst query every written. But there you go. Gives me a nice pretty listing of all of the phone numbers, emails and stuff of the directors at some profit centers I have to worry about sometimes.
There it is. My first piece on real world usage of OWL and stuff. Not much, huh? But it’s a start. After a while, you have to put away the endless PDFs and books and stuff and just play with this stuff. It took me a really long time to get to this point. I’m happy. I’m hoping some other folks out there can appreciate this.
I’m not foolin’ around. This stuff is like buildings the pyramids.

