You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Ekaputra Fajar Juang <fa...@tuwien.ac.at> on 2015/03/31 13:32:07 UTC

Find *exact* triple differences between two ontologies

Hi All,

I’m using both model.difference(model) and model.remove(model) to get all differences in triples between two ontologies.
It works fine when I don’t have cardinality restriction within the ontology; however, when I put in cardinality restriction (min/max cardinality), the method also return all the triples saying that the classes in the ontology are subclasses of this cardinality restriction.

Is this intended? is it a side effect of reasoning(which I am not intending to use)? is it a bug in Jena? or maybe I model the data in a wrong way?

I attached the small maven project sample. In the examples folder, Version1 and Version2 are ontologies without cardinality restriction, while Version3 and Version 4 using this cardinality restriction. The differences between v1&v2 or v3&v4 are only in the A-Box level. Therefore, In my opinion, the model.difference() method result should be same/similar between these two comparison.

Thanks in advance and best regards,
--
Fajar J. Ekaputra



Re: Find *exact* triple differences between two ontologies

Posted by Fajar Juang Ekaputra <fa...@gmail.com>.
Hi Dave, 

Thank you for your fast reply. 

> On 31 Mar 2015, at 14:41, Dave Reynolds <da...@gmail.com> wrote:
> 
> On 31/03/15 12:32, Ekaputra Fajar Juang wrote:
>> I’m using both model.difference(model) and model.remove(model) to get
>> all differences in triples between two ontologies.
> 
> Triple level differences are unlikely to be what you want. They are not a useful way of comparing OWL ontologies.

The idea is trying to built a meaningful differences (e.g., addition and deletion of instances) between two ontology versions from the triple diffs to produce something similar (to limited extent) with EMFCompare for Ecore models [1]. Several papers are showing the possibility to do this [2][3]. I wonder if I could replicate their approach using Jena as the basic building block for detecting triple diffs. 

Are there any Jena issues / sub-projects are currently working in this diff engine? Or, it will be also helpful for me if you know any external project / source code that is dealing with this issue. 

>> It works fine when I don’t have cardinality restriction within the
>> ontology; however, when I put in cardinality restriction (min/max
>> cardinality), the method also return all the triples saying that the
>> classes in the ontology are subclasses of this cardinality restriction.
> 
> What "method"? At a quick glance I don't see anything in your code which tests for subclasses.
> 
> It would be more helpful to provide a complete minimal example. Not a dump of your whole project with no indication of the specific call you are asking about or the specific unexpected result.

Thanks for the input, I’ll try to do it next time to be precise with my code samples.

>> The differences between v1&v2 or v3&v4 are only in the A-Box level.
>> Therefore, In my opinion, the model.difference() method result should be
>> same/similar between these two comparison.
> 
> No.
> 
> The reason you can't easily use triple level differencing is down the blank nodes. Two blanks nodes in two different files, or even two different loads of the the same file, will be distinct.
> 
> OWL uses blank nodes to encode restrictions (not just cardinality restrictions, but that is the case you are looking at here).
> 
> Which means that two copies of identical OWL ontologies that include restrictions will use different blank nodes to encode all those restrictions and those differences will show up in model.difference.

This is the explanation that I am looking for. The problem with the blank node is something that I previously overlooked, since it is not visible in the turtle syntax when I compared to two files manually. I’ll think on how to address this problem.

Thanks!
--
Fajar.

[1] https://www.eclipse.org/emf/compare/ <https://www.eclipse.org/emf/compare/>
[2] http://link.springer.com/chapter/10.1007%2F978-3-642-04930-9_30 <http://link.springer.com/chapter/10.1007/978-3-642-04930-9_30>
[3] http://www.cs.ox.ac.uk/boris.motik/pubs/smms02userdriven.pdf <http://www.cs.ox.ac.uk/boris.motik/pubs/smms02userdriven.pdf>




Re: Find *exact* triple differences between two ontologies

Posted by Dave Reynolds <da...@gmail.com>.
On 31/03/15 12:32, Ekaputra Fajar Juang wrote:
> Hi All,
>
> I’m using both model.difference(model) and model.remove(model) to get
> all differences in triples between two ontologies.

Triple level differences are unlikely to be what you want. They are not 
a useful way of comparing OWL ontologies.

> It works fine when I don’t have cardinality restriction within the
> ontology; however, when I put in cardinality restriction (min/max
> cardinality), the method also return all the triples saying that the
> classes in the ontology are subclasses of this cardinality restriction.

What "method"? At a quick glance I don't see anything in your code which 
tests for subclasses.

It would be more helpful to provide a complete minimal example. Not a 
dump of your whole project with no indication of the specific call you 
are asking about or the specific unexpected result.

> Is this intended? is it a side effect of reasoning(which I am not
> intending to use)? is it a bug in Jena? or maybe I model the data in a
> wrong way?
>
> I attached the small maven project sample. In the examples folder,
> Version1 and Version2 are ontologies without cardinality restriction,
> while Version3 and Version 4 using this cardinality restriction. The
> differences between v1&v2 or v3&v4 are only in the A-Box level.
> Therefore, In my opinion, the model.difference() method result should be
> same/similar between these two comparison.

No.

The reason you can't easily use triple level differencing is down the 
blank nodes. Two blanks nodes in two different files, or even two 
different loads of the the same file, will be distinct.

OWL uses blank nodes to encode restrictions (not just cardinality 
restrictions, but that is the case you are looking at here).

Which means that two copies of identical OWL ontologies that include 
restrictions will use different blank nodes to encode all those 
restrictions and those differences will show up in model.difference.

Dave