• Home
  • Consultancy
  • Contact
  • OpenDD over Atom

    May 20th, 2008 by Marcus Povey

    One of the often repeated comments that people have had regarding OpenDD was that we should do a version of it embedded in Atom 1.

    I would therefore like to introduce the first draft of OpenDD over Atom, submitted for discussion.

    In a nutshell, OpenDD over Atom makes use of Atom’s ability to embed other formats within the content tag and simply wraps a OpenDD element within an Atom entry with some additional data from the ODD element used in the Atom “envelope”

    This seemed like the simplest solution, but let me know what you think!

    OpenDD PHP library

    May 9th, 2008 by Marcus Povey

    I have just uploaded a PHP library for importing and exporting OpenDD documents. It is version 0.1 so it is still very much under development, but it should still be usable.

    Import example

    The import function accepts an OpenDD XML document and returns an ODDDocument object, which can then be iterated through to obtain access to the ODD* classes.

    The XML file:

    <odd version="1.0" generated="Fri, 09 May 2008 18:53:37 +0100">
    <entity uuid="http://www.example.com/a" class="foo" subclass="http://www.example.com/b" />
    <metadata uuid="http://www.example.com/c" entity_uuid="http://www.example.com/a" name="Squid" >paper</metadata>
    <relationship uuid1="http://www.example.com/a" type="hates" uuid2="http://www.example.com/b" />
    </odd>

    Example code to process it:

    $doc = ODD_Import($in);

    foreach ($doc as $element)
    print_r($element); // Just echo, but you should probably do something meaningful.

    Export example

    Export involves constructing an ODDDocument object and populating it with various classes, each one representing one of the OpenDD elements.

    This object is then serialised.

    Here is some example code:

    $out = new ODDDocument(); // Create new document

    $entity = new ODDEntity("http://www.example.com/a", "foo", "http://www.example.com/b");
    $out->addElement($entity);

    $meta = new ODDMetaData("http://www.example.com/c", "http://www.example.com/a", "Squid", "paper");
    $out->addElement($meta);

    $rel = new ODDRelationship("http://www.example.com/a", "hates", "http://www.example.com/b");
    $out->addElement($rel);

    echo ODD_Export($out); // Export

    When I get a chance I’ll upload some libraries in other languages, but if you feel inclined then feel free to implement your own!

    More on OpenDD

    May 8th, 2008 by Marcus Povey

    Just a quick note to join Ben in thanking Marc Canter for inviting us up to his home to discuss (among other things) the Open Data Definition.

    Marc made an excellent blog post on the subject which clearly illustrates that he completely groks what we are trying to do.

    We have some exciting times ahead of us, and are going to try and move this forward as fast as we can.

    As always, if you want to be a part of it then please get involved!

    ODD + OpenID

    May 7th, 2008 by Marcus Povey

    The Elgg team are out in San-Francisco this week meeting up with some of the guys out here and talking about Elgg and ODD.

    I will blog a bit more about it when I can, its been a bit mad so this is the first chance I’ve actually had to sit down at the computer since getting here (and I’m only able to do that because the combination of jet lag and the steak the size of my head I had for dinner last night has given me a case of insomnia).

    I just wanted to share with you a thought that me and Ben had while enjoying the Californian sunshine inbetween meetings, namely a way to link ODD documents with OpenID.

    For descovery of ODD documents, I was planning to use the meta / link approach similar to the way RSS is picked up. Now, it occurs to me that if we modify the spec slightly to say that a UUID should point to a page that can either be an ODD representation of the thing that it’s referring to or knows where to get it – i.e. has the appropriate header tag pointing to the url – then it becomes a trivial matter to turn a UUID into an OpenID URL.

    Potentially quite useful.

    ODD and Import / Export

    April 30th, 2008 by Marcus Povey

    I have just uploaded the latest draft of the ODD specification to OpenDD.net, so pop over and take a look.

    Since the last release of the draft I’ve done a fair amount of work to simplify the format even further; simplifying terminology, clearing up some inconsistencies and dropping namespaces altogether.

    You’ll notice that we still don’t define any terms. As Ben touched on in a recent post, we decided to not confuse the format by trying to tie it to any one application, while keeping it as easy as possibly to actually use. I’ll cover this in more detail a bit later…

    So, lets talk about how I’m using ODD to implement full data import and export in the upcoming release of ElggElgg 1.

    For those who don’t already know, Elgg is an Open source social networking application engine. The previous version has been downloaded over 100K times, and Import and export was one of the most frequently requested enhancements.

    Export

    Export was a fairly trivial matter. The new version of Elgg employs a flexible event system, so all I had to do was trigger an “export” event.

    This event is passed a GUID – an identifier identifying the thing you are exporting, and elements of the system (and thirdparty plugins) can listen for this event and react accordingly.

    The event is essentially asking all parts of the Elgg application – core and plugins – “Tell me all you know about X”. The export listens to the answers and converts it into an ODD document that looks something like this:

    <odd version="1.0" generated="Wed, 30 Apr 2008 22:21:55 +0100">


    <entity uuid="http://example.com/odd/78/" class="object" subclass="blog" published="Fri, 18 Apr 2008 11:45:50 +0100" />


    <metadata uuid="http://example.com/odd/78/attr/owner_uuid/" entity_uuid="http://example.com/odd/78/" name="owner_uuid" published="Fri, 18 Apr 2008 11:45:50 +0100" >http://example.com/odd/77/</metadata>


    <metadata uuid="http://example.com/odd/78/attr/title/" entity_uuid="http://example.com/odd/78/" name="title" published="Fri, 18 Apr 2008 11:45:50 +0100" >test</metadata>


    <metadata uuid="http://example.com/odd/78/attr/description/" entity_uuid="http://example.com/odd/78/" name="post" published="Fri, 18 Apr 2008 11:45:50 +0100" >First post</metadata>


    <metadata uuid="http://example.com/odd/78/metadata/35/" entity_uuid="http://hexample.com/odd/78/" name="tags" type="metadata" owner_uuid="http://example.com/odd/77/" published="Fri, 18 Apr 2008 11:45:50 +0100" >wibble</metadata>


    </odd>

    Here we see an entity (in this case a blog post), and some details about it (the metadata).

    Import

    Import is traditionally the more complicated part of the equation. ODD is trivial to parse, each tag is atomic and represents exactly one thing, this is a big advantage from the point of view of anyone implementing a reader for it since it makes the whole thing pretty much stateless.

    ODD tags arrive, whether as a file to import or as a live feed, and an event is triggered. This event passes around the tag and essentially asks the question “Does anyone know how to handle this?”.

    The stateless nature of ODD of course meaning that you don’t have to process the entire file, making it a trivial matter to implement a reader using a SAX parser.

    That just about covers it, I’ll be posting some example code in a few days (workload permitting) so hopefully people can start getting stuck in. If you want to get involved in development, please head over to the ODD group.

    A final note: I will be in San-Francisco all next week, so if you are in the bay area and feel like having a chat about ODD or Elgg, then please get in touch!

    Next Page »
    All content is © Copyright Marcus Povey 2008-2010 and released under a Creative Commons licence unless otherwise stated.

    Creative Commons License