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!

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="" class="foo" subclass="" />
<metadata uuid="" entity_uuid="" name="Squid" >paper</metadata>
<relationship uuid1="" type="hates" uuid2="" />

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("", "foo", "");

$meta = new ODDMetaData("", "", "Squid", "paper");

$rel = new ODDRelationship("", "hates", "");

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!

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!