Archive for August, 2006

Baroque Cycle

“It seems to us indeed that this block of marble brought from Genoa would have been exactly the same if it had been left there, because our senses make us judge only superficially, but at bottom because of the connection of things the whole universe with all of its parts would be entirely different, and would have been another from the beginning, if the least thing in it went otherwise than it does.”

Leibniz

… I’m currently (re-)reading the Baroque Cycle by Neal Stephenson. But what I really should be reading is Leibniz.

Ontology versions: just a thought… (and a script)

I actively use the Subversion version management system for all my projects. I use it while writing papers (in LaTeX), e.g. to merge different versions (of co-authors) with a main file, I use it for my Java projects, but I use it for my OWL ontologies as well.

A couple of weeks ago I found out that the TortoiseSVN Subversion client GUI for Windows is able to use Microsoft Word for performing diffs and merges on Word documents. While composing today’s post on the OWL Tools of Denny Vrandecic, something went ‘click’: why not use his diff and merge algorithms for resolving conflincts between different versions of an ontology stored using Subversion?
The SVN book says the following:

Subversion uses its internal diff engine, which produces unified diff format, by default. If you want diff output in a different format, specify an external diff program using --diff-cmd and pass any flags you’d like to it using the --extensions switch. For example, to see local differences in file foo.c in context output format while ignoring whitespace changes, you might run svn diff --diff-cmd /usr/bin/diff --extensions '-bc' foo.c.

Rewriting this to OWL Tool format results in something like:

svn diff --diff-cmd '../owltools/owl diff' lricore.owl

However, subversion calls the diff program as if it were GNU diff, and Denny’s diff does not understand the standard GNU diff commandline options. We therefore need to write a diff wrapper (see the manual):

#!/bin/sh

# Configure your favorite OWL Tools diff program here.
# That's Denny's! (his 'owl' script assumes that kaon2.jar and
# owltools.jar are in the path)
DIFF="owl diff "

# Subversion provides the paths we need as the sixth and seventh
# parameters.
LEFT=${6}
RIGHT=${7}

# Call the diff command.
$DIFF $LEFT $RIGHT

# Return an errorcode of 0 if no differences were detected,
# 1 if some were.
# Any other errorcode will be treated as fatal.

Caveat: So far so good… were it not for the last two lines. The OWL tools diff always returns 1: if differences are found, it generates an owl file containing the differences, and if no differences are found, it generates an owl file with headers, but no triples.

Ah well… this works fine for me. I’ll use the standard diff for checking whether anything has changed, and the OWL Tools diff to see what has changed. If the above script is saved as ‘owldiff’, we can now use it to find the differences between my working copy of LRI-Core and the one stored in my subversion repository:

svn diff --diff-cmd owldiff lricore.owl

Remember this is just as powerful as svn diff itself: we can also use it to compare different revisions. And when a difference is found, we can use Denny’s merge, or the Prompt Tab of Protege-OWL to merge the differences into an ontology of our choice! (you can tell I’m happy now)

You can download the script (and a batch file for Win32) here: owldiff.zip

OWL Tools

Denny Vrandecic (at AIFB) has built and assembled a convenient set of commandline tools for those frequently working with OWL files. A few of my favorites are:

  • Generate LaTeX from OWL files
  • Perform a diff or merge on two OWL files
  • Convert between different OWL syntaxes
  • Make all individuals owl:differentFrom (introduce a local unique name assumption)
  • … etc. etc. etc.

The tools can be downloaded from http://owltools.ontoware.org

Visor

Visor allows you to open a drop-down terminal window overlay thingy from any application (on a Mac, that is).

Why would I post this link here? Ah well, maybe because it’s cool… and perhaps because I am a little afraid I will forget to use it.

Ontology Definitions

So what is an ontology actually…?

Well, you won’t (really) find the answer here.