Peter Hansen

Department of Mathematics and Computer Science, University of Bremen

User Tools

Site Tools


“Gracefully Rewriting Into Non-recursive Datalog.”



Grind is a software tool to check for FO-rewritability of concepts in ELH ontologies, and to produce non-recursive datalog rewritings, if possible.

Grind is developed at the Theory of Artificial Intelligence group of University of Bremen.


Please contact the authors here.


Peter Hansen, Carsten Lutz, İnanç Seylan, and Frank Wolter. Efficient Query Rewriting in the Description Logic EL and Beyond. In Proceedings of the 24th International Joint Conference on Artificial Intelligence (IJCAI 2015), 2015.
Paper (PDF)BibTex entry – The Grind query rewriting system

Peter Hansen, Carsten Lutz, İnanç Seylan, and Frank Wolter. Query Rewriting under EL TBoxes: Efficient Algorithms. In Proceedings of the 27th International Workshop on Description Logics (DL 2014), 2014.
Paper (PDF)BibTex entry – Test ontologies: dl2014-onto.tgz (0.5 MB)


The picture above is a derivative of "A skateboarder performing a nosegrind" by MattLaws, used under CC BY 2.0.


(The following is contained in the file README.txt distributed with Grind.)

         Grind -- Gracefully Rewriting Into Non-recursive Datalog      

                       Version 1.0 2015-04-24.

           Copyright 2014, 2015 Peter Hansen and İnanç Seylan.
                 This software is released under GPL 3.

Welcome to version 1.0 of Grind!


Download grind.tgz and grind-test-ontologies.tgz to the same directory, then

 $ tar xzf grind.tgz 
 $ tar xzf grind-test-ontologies.tgz
 $ cd grind
 $ java -jar Grind.jar ../grind-test-ontologies/MOHSE.owl Bacillus Fungus Virus
Rewrite all concepts, log details to ./grind-logs:

 $ java -jar Grind.jar -al ../grind-test-ontologies/ENVO.owl


In this folder, you find a Java archive Grind.jar, and accompanying libraries
in the lib folder. Please download also the test ontologies, and expand 
them to a suitable place.

The file Grind.jar contains the source code, which can be extracted by
 $ unzip Grind.jar

Grind can be run e.g. on the ontology MOHSE.owl to produce rewritings of 
concept names like Bacillus, Fungus, Virus:

 $ java -jar Grind.jar ../grind-test-ontologies/MOHSE.owl Bacillus Fungus Virus
(Please change the path pointing to the test ontologies, if need be.)

Grind will output non-recursive datalog rewritings, if they exist:


    Q(?0)  <-  Bacillus(?0)
    Q(?0)  <-  BacillusAnthracis(?0)
    Q(?0)  <-  BacillusCereus(?0)


    Q(?0)  <-  Candida(?0)
    Q(?0)  <-  CandidaAlbicans(?0)
    Q(?0)  <-  Cryptococcaceae(?0)
    Q(?0)  <-  CryptococcusNeoformans(?0)
    Q(?0)  <-  Fungus(?0)


    Q(?0)  <-  Virus(?0)

Grind offers several command line options, it can e.g. rewrite a given set
of concept names, or work on all concept names (--all) in the ontology.

The flags --verbose, --logging, and --norewrite give access to some 

Find some more info by calling Grind with the --help parameter:

usage: grind [-h] [-v] [-l] [-a] [-n] ontology [concept [concept ...]]

Rewrite the concept to non-recursive datalog with respect to the ontology. 
Result is written to stdout.

positional arguments:
  ontology               an OWL ontology (e.g. 'MOHSE.owl')
  concept                one or more concept queries 
                         (e.g. 'Bacillus Fungus Virus')
optional arguments:
  -h, --help             show this help message and exit
  -v, --verbose          dump internals to stdout
  -l, --logging          dump some more internals to ./grind-logs/ 
                         (only with --all)
  -a, --all              rewrite all concept names in ontology
  -n, --norewrite        only check FO-rewritability, do not construct 
                         an actual rewriting
Grind -- Gracefully Rewriting Into Non-recursive Datalog.
1.0 (2015-04-24).
Copyright 2014, 2015 Peter Hansen and İnanç Seylan.
University of Bremen, AG TdKI.
This software is released under GPL 3 licence.
Supports the following types of axioms in an ontology:
  * <SubClassOf>
  * <EquivalentClasses>
  * <SubObjectPropertyOf>
  * <EquivalentObjectProperties>
  * <ObjectPropertyDomain>
and the following concept constructors:
  * <ObjectIntersectionOf>
  * <ObjectSomeValuesFrom>
grind.txt · Last modified: 2017/03/21 14:43 by peter

Page Tools