The
pip install -r requirements.txt
infer.py
is the main entry point to the inference engine. It takes two parameters :
- The
directory
in which OWL files are localted, including thecall.owl
file as well as any OWL file involved in the reasoning task to be carried out. - The
IRI of the main ontology
to use. The file for this ontology must be located in the directory provided, and might import other ontologies (includingcall.owl
).
It produces on stdout
the triples (in NTriples format) that are generated from calls to external functions.
The samples
repository contains an ontology (equations.owl
), using the call ontology (call.owl
), that describes classes of equations (polynomial equations, quadratic equations, etc.) and three examples of equations to be classified. It includes two definitions of calls to functions written in python to recognise whether an equation is polynomial and to compute the degree of a polynomial equation.
To run the example, apply the command line:
python infer.py samples/ 'https://k.loria.fr/ontologies/examples/equations'
This should produce the following output:
<https://k.loria.fr/ontologies/examples/equations#eq2> <https://k.loria.fr/ontologies/examples/equations#degree> "2" . <https://k.loria.fr/ontologies/examples/equations#eq3> <https://k.loria.fr/ontologies/examples/equations#isAPolynomialEquation> "True" . <https://k.loria.fr/ontologies/examples/equations#eq1> <https://k.loria.fr/ontologies/examples/equations#isAPolynomialEquation> "True" . <https://k.loria.fr/ontologies/examples/equations#eq2> <https://k.loria.fr/ontologies/examples/equations#isAPolynomialEquation> "True" . <https://k.loria.fr/ontologies/examples/equations#eq1> <https://k.loria.fr/ontologies/examples/equations#degree> "2" . <https://k.loria.fr/ontologies/examples/equations#eq3> <https://k.loria.fr/ontologies/examples/equations#degree> "1" .
Therefore indicating that all three equations are polynomial, that eq1 and eq2 are of degree 2 and that eq3 is of degree 1. Adding those triples to the ontology would therefore enable classifying eq1 and eq2 as quadratic equations.