hackdiary

Using OpenOffice Draw to author RDF

OpenOffice's vector-drawing app has a very nice Visio-like 'connector' tool that can link objects together with lines. It's very easy to put together labelled directed graph diagrams and have the lines re-flow as you move the nodes around. It also has a well-documented XML file format, which got me thinking that graph drawings could be converted into RDF automatically. I wrote some python code to read in OO files and print out n-triples.

A sample RDF graph drawn in OpenOffice looks like this:


(original file)

The output of the script run over this file is:

_:a11055796046 <http://example.com#pred2> <http://example.com#1> .
_:a11055796046 <http://example.com#pred1> "text" .
<http://example.com#1> <http://example.com#foo> <http://example.com#bar> .

Rectangles or ellipses with no text on them are taken to be bNodes. Those with text have URIs if they look like URIs (start with http:// or similar) and those with "quoted text" are literals (the quotes are discarded). Predicate URIs are taken from the text on the connectors.

The code uses the xpath processor from PyXML and is written for python 2.2. It's worth setting up the 'Default' style in OpenOffice Draw so that it puts arrows on the end of each connector, otherwise it's easy to get confused about which way round the connectors are.

python rdf xml Posted by Matt Biddulph at June 16, 2003 09:38 PM

→ NedBlog 'only so much writing in the air': Creating RDF in OOo Draw
→ Raw Blog: Graphic RDF authoring with OpenOffice
→ dfc: far out...
→ captsolo weblog: Using OpenOffice Draw to author RDF

Marvellous piece of work. Enough to inspire me to go and get the latest OO.

Posted by: Danny on June 19, 2003 11:04 AM

ps. D'oh! Already got it installed on a Debian machine.

Posted by: Danny on June 19, 2003 11:18 AM

Good work, interresting and informative! OpenOffice ROCKS!

Posted by: David Hodges on January 3, 2004 01:56 PM

Cool! Would be interesting to see this for OmniGraffle too, since OO doesn't do *so* well on OSX... Should be a pretty straightforward transform.

Posted by: Mark Nottingham on March 30, 2004 06:33 PM