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

Reply via email to