1

owlapi provides us a class merger, which allow us to load ontology from multiple files/sources and then merge them together. Now I have my ontology split into two disjoint parts, i.e., a part for TBox axioms and the other for ABox assertions. So I just use merger as the following code,

OWLOntology TBox= m.loadOntologyFromOntologyDocument(new File(("XXXXXXXX/UOBM.owl")));

OWLOntology ABox = m.loadOntologyFromOntologyDocument(new File("XXXX/test.nt"));

OWLOntologyMerger merger = new OWLOntologyMerger(m);
OWLOntology o = merger.createMergedOntology(m, null);

However, I found that only class assertions in ABox are included in the mergerd ontology o, which means all role assertions are not included. I have done a lot of attempts, and finally I solved the problem by add the type assertions of properties to my ABox file, e.g., <http://semantics.crl.ibm.com/univ-bench-dl.owl#takesCourse> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#ObjectProperty> .

It's really weird since such assertions have already been included in the TBox file, and I have merged TBox and ABox with merger. So why do I have to manually add them again? Is that a design issue of owlapi? Or is there a better and more common way for me to address this problem?

P.S:
My ABox file, namely, test.nt is fairly simple, which only contains several triples, without anything else. I didn't import TBox in my ABox either, since it only includes triples.
For example, the content of original test.nt can be:

<http://semantics.crl.ibm.com/univ-bench-dl.owl#a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://semantics.crl.ibm.com/univ-bench-dl.owl#LeisureStudent> .
<http://semantics.crl.ibm.com/univ-bench-dl.owl#a> <http://semantics.crl.ibm.com/univ-bench-dl.owl#takesCourse> <http://semantics.crl.ibm.com/univ-bench-dl.owl#c0> .

The second triple cannot be recognized as an object property assertion. While by adding another triple stating that takesCourse is an object property to test.nt, the object property can then be recognized.
However, there has already been a declaration in TBox that declares takesCourse is an object property, not anything else. So why do I have to add it to ABox again since I've already merged the TBox with my ABox?

Yu Gu
  • 2,382
  • 5
  • 18
  • 33
  • I don't think that it's correct what you're saying. Simply all axioms will be merged, the axiom type doesn't matter. What's contained in the file `test.nt`? Note, the OWL API parser needs to know the type of the properties in advance, otherwise they're getting parsed as annotation properties. – UninformedUser Sep 20 '18 at 09:33
  • And ideally, the abox file would import the tbox file - this simplifies parsing and is also recommended for OWL – UninformedUser Sep 20 '18 at 09:34
  • An ABox without TBox doesn't even have a consistent existence. – Gilles-Antoine Nys Sep 20 '18 at 09:49
  • @AKSW At the beginning, in test.nt I only included triples concerning individuals, i.e, the class assertions and role assertions. However, the object role assertions cannot be recognized. While after adding a triple which states a object property has a type object property, it works fine. So my concern is, since the declaration of object property already existed in the TBox being merged, why should I declare it again in the ABox? Since I would combine TBox and ABox with a merger. – Yu Gu Sep 20 '18 at 15:48
  • @AKSW I have edited my question to include more information. Hopefully it can be helpful. – Yu Gu Sep 20 '18 at 15:58
  • The object property declarations must be included in the imports closure - that's not just a best practice, it's an OWL requirement. Often it's impossible to parse univocally an ontology that does not respect this condition. – Ignazio Sep 20 '18 at 23:36
  • 1
    @YuGu the type of the schema entities like properties and classes has to be known in advance for the parser. it has nothing to do with the merger, each ontology is parsed separately and if the type of the property isn't declared, the parser would have to guess sometimes, thus, it will be handled as annotation property. – UninformedUser Sep 21 '18 at 07:44

1 Answers1

3

Your abox file must use owl:imports to include the tbox. Without property declarations, the abox cannot be parsed correctly otherwise.

Ignazio
  • 10,504
  • 1
  • 14
  • 25
  • For nt format ABox, how can I add the import sentence to it? – Yu Gu Sep 21 '18 at 11:34
  • You need at least two statements: a blank node of rdf:type owl:Ontology and the same blank node with owl:imports and object the tbox ontology. The simplest way is to create an empty ontology with owl api, add an AddImport change with the tbox ontology IRI and save the ontology with NTriple format. This will give you an example of the statements required. – Ignazio Sep 21 '18 at 11:38