The
pip install -r requirements.txt
infer.py
is the main entry point to the inference engine. It takes two required 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
).
And an optional one :
- A
namefile
where the new ontology will be saved (under the directory provided in the first argument) if you want to save the inferred assertions in a new file
It produces on stdout
the triples (in NTriples format) that are generated from calls to external functions. (not accurate)
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'
It should output this :
eq1 <isAPolynomialEquation> "True" .
eq2 <isAPolynomialEquation> "True" .
eq3 <isAPolynomialEquation> "True" .
mat1 <isASquareMatrix> "True" .
mat2 <isASquareMatrix> "True" .
mat3 <isASquareMatrix> "False" .
pb3 <hasSubProblem> "equationsolving1" .
equations.EquationSolving(equationsolving1) .
equationsolving1 <hasEquation> "equation1" .
equations.Equation(equation1) .
equation1 <hasEquality> "t**2 - 4*t + 3 = 0" .
equation1 <hasUnknown> "unknown1" .
equations.Unknown(unknown1) .
unknown1 <hasName> "t" .
unknown1 <hasType> "real" .
eq1 <degree> "2" .
eq2 <degree> "2" .
eq3 <degree> "1" .
equation1 <isAPolynomialEquation> "True" .
pb1 <hasSolutionSet> "solutionset1" .
equations.SolutionSet(solutionset1) .
solutionset1 <hasValue> "-2" .
solutionset1 <hasValue> "-1" .
pb1 <hasSolutionSet> "solutionset2" .
equations.SolutionSet(solutionset2) .
solutionset2 <hasValue> "-1" .
solutionset2 <hasValue> "-2" .
pb2 <hasSolutionSet> "solutionset3" .
equations.SolutionSet(solutionset3) .
solutionset3 <hasValue> "-2 + sqrt(3)" .
solutionset3 <hasValue> "-2 - sqrt(3)" .
equation1 <degree> "2" .
equationsolving1 <hasSolutionSet> "solutionset4" .
equations.SolutionSet(solutionset4) .
solutionset4 <hasValue> "1" .
solutionset4 <hasValue> "3" .
equationsolving1 <hasSolutionSet> "solutionset5" .
equations.SolutionSet(solutionset5) .
solutionset5 <hasValue> "1" .
solutionset5 <hasValue> "3" .
Currently the program can find real roots to quadratic equations and eigen values of 2x2 matrix.