Using OpenOffice Draw to author RDF

June 16th, 2003  |  Published in python, rdf, xml  |  8 Comments

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 <https://example.com#pred2> <https://example.com#1> .
_:a11055796046 <https://example.com#pred1> "text" .
<https://example.com#1> <https://example.com#foo> <https://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 https:// 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.

Responses

  1. NedBlog 'only so much writing in the air' says:

    June 17th, 2003 at 10:35 am (#)

    Creating RDF in OOo Draw

    Every so often I like to get a little h4x00r so when I saw this blog entry on how to create RDF with OpenOffice.org Draw I was totally impressed. It’s these sort of things that you do not expect yourself that make having open file formats a good plan. …

  2. Raw Blog says:

    June 19th, 2003 at 10:51 am (#)

    Graphic RDF authoring with OpenOffice

    Wow, this is a cunning trick from Matt Biddulph. OpenOffice’s vector-drawing app has a very nice Visio-like ‘connector’ tool that…

  3. Danny says:

    June 19th, 2003 at 11:04 am (#)

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

  4. Danny says:

    June 19th, 2003 at 11:18 am (#)

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

  5. dfc says:

    June 24th, 2003 at 6:08 am (#)

    far out…

    I have to write a paper tonight. Which means I will spend four hours reading a weeks worth of RDF backlog. Here are some of…

  6. David Hodges says:

    January 3rd, 2004 at 1:56 pm (#)

    Good work, interresting and informative! OpenOffice ROCKS!

  7. Mark Nottingham says:

    March 30th, 2004 at 6:33 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.

  8. captsolo weblog says:

    April 10th, 2004 at 9:35 pm (#)

    Using OpenOffice Draw to author RDF

    A wonderful idea from hackdiary.com to author RDF using OpenOffice vector drawing application! :idea:
    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 …