Operator Overload

Here I’m at XTech 2007 catching up with our Europeans colleagues in a very intimate conference. At least, speaking for myself, I’d say that if it wasn’t for the vision and technically super-charged talks and the overcast weather, I’d be out in the town getting intimate with beautiful Paris, oh well, the night is long and most buildings are well-lit. The key is to make sure I’m back by 1am if not, a hefty taxi bill awaits, but I digress.

However, the raison d’être (here at least) was to give a talk on Open Data or structured data even. Mainly, speaking was to share the work developed by the community around technologies like GRDDL, eRDF and RDFa. The presentation talked mostly about RDFa and the demos which were supposed to be about our previous work on Semantic Web and our SLRP platform (Queso), ended spawning a new collaboration with Michael Kaply and his Firefox Add-on: Operator. The result being that in the current svn repository or coming soon in the latest release, you will have the chance of enhancing the content in your sites to allow your users for a switchboard style of interaction with either yours or their information through your browser and Operator actions.

The code is fresh, so Michael and I still have some work to do to pre-load Operator with a few actions so you don’t have to write them yourselves in order to get started, but they will be coming. In the meantime, let me illustrate some of the things you can do by taking a geo-encoded piece of HTML and declaring a user script you can install to operate on those HTML pages with RDFa-style geo-encoded elements.

<h1 property="rdfs:label">Genova</h1>

<div xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
  <span property="geo:lat">44.41667</span>, 
  <span property="geo:long">8.94972</span>
</div>

The fragment above allows you to mark elements up with attributes that indicate the author’s intended meaning when they published their data. This means that the page is no longer available exclusively to people, but now machines can interact with the data, which in turn, give it back to people in one way or another. The span elements have now become geographical points that can be used for input in many applications, more commonly online mapping services like Yahoo or Google Maps. Now onto the Operator script that will turn your browser on (no pun intended) every time it notices this markup (in a very flexible way) in any page during your browsing experience.

ufJSActions.actions.yahoo_maps_rdfa = {
  description: "Find with Yahoo! Maps (RDFa)",
  icon: "http://www.yahoo.com/favicon.ico",
  scope: { 
	semantic: {
	   "RDFa" :  {
        	property : "http://www.w3.org/2003/01/geo/wgs84_pos#lat",
        	defaultNS : "http://www.w3.org/2003/01/geo/wgs84_pos#"
      	    }
	}
  },
 doAction: function(geo, type) {
    var url;
    if (type != "RDFa") return;
    if (geo.lat && geo["long"])
     return "http://maps.yahoo.com/?lat="+geo.lat+"&lon="+geo["long"];
    }
};

If you are lazy or having trouble copy and pasting, just download the script. Go onto your Operator options (via the installed add-ons dialog) and in the “User Scripts” tab, install the downloaded script. Then, in the “Actions” tab, click the “New” button and you should see an action with whatever label you added in your script file (in this case “Find with Yahoo! Maps (RDFa)”). Now, if in the “General” tab you have set your display style to “Actions”, you’ll see a new a toolbar button and if you were to reload this post, you’ll be able to see the Novotel Paris Tour Eiffel, where I was while writing this entry. The toolbar button should enable and you’ll be able to see where I was when I was writing this post, in other words 48.849905, 2.283161.

I think this is enough for now, given the flaky network, but I’m looking forward to your questions and bug reports. I’ll be posting more examples from the presentation where I converted several microformats examples into RDFa and experimented with different vocabularies. Anyways, RDFa is now open for business and it works today, many thanks for the Operator.

  • co.mments
  • connotea
  • del.icio.us
  • digg
  • Ma.gnolia
  • Reddit
  • scuttle
  • Technorati
  • YahooMyWeb

About this entry