Home

Awesome

Python bindings for FaCT++ reasoner

DOI PyPI FOSSA Status

FaCT++ is a well-optimized open-source reasoner for SROIQ(D) description logic with simple datatypes (OWL 2), written in C++. FaCT++ was created in 2003-2015 by Dmitry Tsarkov and Ian Horrocks in the University of Manchester, UK.

The pyfactxx links the FaCT++ reasoner to the Python's RDFLib package. The code is based on the works of Artur Wroblewski: factpp and coras interfaces.

Reasoner details

The FaCT++ implements the atomic decomposition algorithms (i.e. represents the ontologies as terse directed acyclic graphs). A tableaux decision procedure is applied for SROIQ(D) together with the set of optimisation heuristics, such as:

To tackle the OWL 2 computational complexity (double exponential in time for the worst case), the FaCT++ presents persistent and incremental reasoning. In the persistent mode, FaCT++ saves the inferred information together with its internal state into a file, which can be reloaded later with much less computational effort than reasoning would require. In the incremental mode, FaCT++ determines which parts of the precomputed inferences may be affected by an incoming change and only recomputes a subset of the inferences.

The mentioned above allows to achieve a very good performance on such known ontologies as FHKB, SNOMED CT, and Thesaurus.

Apart of our present work, the FaCT++ supports Java OWL-API, Lisp API, and DIG interface. It can also be used in C. There is also a work of Levin and Cowell on C++ usage (unmaintained).

Reasoner optimizations for RDFLib

The pyfactxx presents the following updates to FaCT++:

Installation

pip install pyfactxx

NB the PyPI releases plus wheels are done via GitHub action.

Usage

See examples folder. In essense:

from pyfactxx import coras

crs = coras.Coras()
crs.load(ontology_file, format='turtle')

crs.parse()
crs.realise()

result = crs.query('SELECT ?a ?b ?c WHERE {?a ?b ?c}')

Authors of Python part

Authors of C++ part

License

FOSSA Status