I was undertaking a project that I shouldn’t have. I was curious about analyzing some data regarding food nutrition. It wasn’t so much the nutrition facts I needed, it was the odd interest I had wondering what the hell ‘RDF’ format was. I assumed just some weird, usual tabular boring data, confined and strict. I read about it. Not quite what I was thinking. There was quite a bit of theory involved to wrap my head about the high level idea. With all the theory I was a bit lost however. My hands-on side of me was shouting to see it in action, to see CODE, to process how the browser or other applications may use RDF data…

I was viewing some frameworks on how RDF worked, one of them stood out, and I was eager to get code up and test it out. I found Graphite, created by Christopher Gutteridge (an amazing, very helpful genius). I started poking around with the clean examples provided. Regardless of receiving data and results, I still had one portion that didn’t click. I knew it was simple, perhaps I overlooked a portion of the RDF guides I have seen. Most guides online about RDF are about theory, rather than implementation and low level processes that bring it to life.

I struggled, for quite some time with this code:

<?php
include_once("arc/ARC2.php");
include_once("Graphite.php");

$graph = new Graphite();
$graph->load( "http://id.southampton.ac.uk/" );
print $graph->resource( "http://id.southampton.ac.uk/" )->get( "foaf:name" );
?>

It would output: ‘University of Southampton’. Wonderful, I thought… now where the HELL is ‘University of Southampton’ coming from? Being a complete amateur to RDF I brushed through the Southhampton HTML code via browser view source. Nothing.

I think I spent hours on that single issue. There was not much about RDF in terms of guides, and not quite the guides I was looking for. Struggling, I gave Christopher a quick email. Made my day, he was extremely helpful by answering my emails in great depth, and finally I had the aha! moment. That particular moment started a simmer when Christopher stated the following:

“If you load http://id.southampton.ac.uk/ in a normal web browser it’ll just send you to an HTML page because you didn’t “ask” for the data.On a linux or Apple command line try running these two commands and compare the results:
curl -I -H ‘accept: text/html’ http://id.southampton.ac.uk/
curl -I -H ‘accept: application/rdf+xml’ http://id.southampton.ac.uk/

Well that explained much more than I thought from an initial glance. The theory transitioned into a ‘hands-on’ moment when I saw that RDF data was being gathered by any client that explicitly requests for any RDF data. In turn, Apache (or IIS or what have you) would be configured to return the RDF data through rewrites/definitions/etc. All in all, the closest document I was looking for  after I found Graphite, would have been this:

Best Practice Recipes for Publishing RDF Vocabularies

I originally found the title a bit misleading, but it shows the down and dirty of the RDF data and Apache working together. That was EXACTLY what I needed after Christopher pushed me in the right direction. I suggest reading this to see how it works under the hood.

Useful Tools

Christopher developed two tools that helped me understand more about RDF.

Quick and Dirty RDF browser
Stuff 2 RDF

Other

Unfortunately I did not go any further into RDF. I was happy with what I had learned and my curiosity was quenched. I do like the idea of RDF — “Data about data”.  I just hope that with the latest trends that it picks up again.

No Comments

There are no comments related to this article.