Integration of OWL reasoners via OWLAPI


Note: This page describes experimental code that has not been used in a while. Please try it at your own risk.

Conventional OWL reasoners like Pellet or HermiT are interfaced via the OWL API. The interface currently supports reasoning about the class ontology, especially the computation of inferred subclasses. The interface code is contained in the package knowrob_common in the module knowrob_owlapi. There is a convenience predicate for calling the subclass-of relation which initializes the OWLAPI interface, copies the current class taxonomy from KnowRob, instantiates the reasoners and returns the inferred subclasses:

?- owlapi_subclass_of(Sub, Super)

For other inference tasks or more fine-grained control over the interface, one can also call the interface predicates directly

% initialize, load test data
owl_parse('owl/knowrob_owlapi_test.owl', false, false, true), consult('prolog/owlapi.pl').

% create OWLAPI interfaces: ontology manager, data factory, create empty ontology
owlapi_manager(OWLManager),
owlapi_datafactory(OWLManager, DataFactory), 
owlapi_new_ontology('http://ias.cs.tum.edu/kb/knowrob.owl', OWLManager, OWLOntology).
 
% copy class taxonomy to the OWLAPI ontology
findall(Res, add_to_ontology($OWLManager, $DataFactory, $OWLOntology, Res), _ResS).
 
% create a reasoner based on the current ontology
owlapi_reasoner_hermit($OWLOntology, Reasoner).

% compute subclasses using the reasoner
owlapi_subClassOf(Sub, 'http://ias.cs.tum.edu/kb/knowrob_owlapi_test.owl#CreateLiquid').
owl_parse('owl/knowrob_owlapi_test.owl', false, false, true), consult('prolog/owlapi.pl').
 
owlapi_manager(OWLManager), 
owlapi_datafactory(OWLManager, DataFactory), 
owlapi_new_ontology('http://ias.cs.tum.edu/kb/knowrob.owl', OWLManager, OWLOntology).

findall(Res, add_to_ontology($OWLManager, $DataFactory, $OWLOntology, Res), _ResS).

owlapi_reasoner_hermit($OWLOntology, Reasoner).

owlapi_subClassOf(Sub, 'http://ias.cs.tum.edu/kb/knowrob_owlapi_test.owl#CreateLiquid').