Is there a simple tool (written in Java?) that compares two almost identical ontologies in TTL format and shows the differences in them? I have two ontologies which should be ABSOLUTELY identical but there are some relationships missing in one of them and this is exactly what I need to find.

I know that one could write such a thing for example in Jena, but I would like to avoid that work. The tool does not have to match the ontologies, I'm only interested in the differences.

Thanks a lot.

asked 11 Aug '11, 08:53

str's gravatar image

accept rate: 0%


Just to clarify: From your comments below I can see that you are looking for a tool to compare RDF graphs on the syntactic graph level.

This should be made clear, because there are different notions of "identical ontologies". For example, we can talk about semantic similarity of OWL ontologies: they may be semantically equivalent while syntactically consisting of different axioms. It is even possible for two OWL 2 DL ontologies to consist of the same set of (abstract) axioms, while still having different RDF graphs, as the mapping between the OWL 2 DL syntax and RDF is not exactly unique.

(13 Aug '11, 04:59) Michael Schn... ♦ Michael%20Schneider's gravatar image

Thank you for that clarification. Do you know a tool to compare TTL files on the syntactic level then?

(13 Aug '11, 05:10) str str's gravatar image

The Jena Model interface has a "difference" method, which you can use to compute what's changed between two models. E.g. for model A and B, first computing A.difference(B), then computing D.difference(A), will show you all the statements you're after.

I used this in some code last year to highlight any differences between what my code was producing and what it was expected to produce.

permanent link

answered 11 Aug '11, 09:40

ajtucker's gravatar image

accept rate: 50%

Thanks, this seems to be what I was looking for :)

(11 Aug '11, 10:07) str str's gravatar image

One problem I found so far: Jena difference seems to think blank nodes are different from each other, even when they both got the same properties.

(12 Aug '11, 03:42) str str's gravatar image

In the code I used, I first checked to see if the two models were isomorphic -- essentially the same modulo bNodes -- before then looking for differences. Actually, as far as I remember, the equals method on models defers to checking isomorphism.

(13 Aug '11, 03:05) ajtucker ajtucker's gravatar image

Sounds like jena.rdfcompare may be what you are looking for, not sure how verbose the output is in terms of what differences it shows as never used it myself so whether it meets your use case or not is hard to tell.

I have code that is in my APIs that can be used to diff two RDF graphs and I could provide a minimal example program to you if you are interested and jena.rdfcompare does not meet your needs

permanent link

answered 11 Aug '11, 09:02

Rob%20Vesse's gravatar image

Rob Vesse ♦
accept rate: 29%

Unfortunately jena.rdfcompare only shows whether the models are equal or unequal, no diff. I'm interested in a minimal example program :)

(11 Aug '11, 09:30) str str's gravatar image

Hello Rob, I'm also interested in such an example program.

(11 Aug '11, 09:36) B777 B777's gravatar image

@B777 @str Looks like ajtucker has given you just such a Java based example where my example would have been .Net based so perhaps not so useful to yourselves

(11 Aug '11, 12:17) Rob Vesse ♦ Rob%20Vesse's gravatar image

There are a couple of ways to diff two ontologies in TopBraid Suite. The first is to use the TBC UI. This returns triples defined by a diff ontology that shows 'old' and 'new' triples. Bnode differences can be turned off to avoid confusing actual changes with differences in bnode values between sessions.

The second way is to run this as a SPARQLMotion script, meaning the diff can be run as a Web service (or SPARQL endpoint) and return the change model.

permanent link

answered 13 Aug '11, 13:17

scotthenninger's gravatar image

scotthenninger ♦
accept rate: 17%

I am the author of owl2diff tool which is a part of the OntoVCS project. I have written it because there was no tool which could compare ontologies adequately. It is implemented on top of OWL API and operates statements (in particular, axioms), not triples. This eliminates the problem with blank nodes.

I think that it is just what you are looking for.


OntoVCS has been almost completely rewritten. It is now called owl2vcs and hosted at GitHub.

permanent link

answered 08 Dec '11, 06:03

utapyngo's gravatar image

accept rate: 19%

edited 04 Jan '13, 08:41

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 11 Aug '11, 08:53

question was seen: 3,668 times

last updated: 04 Jan '13, 08:41