-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
9,769 additions
and
2,600 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Experiments for KR 2024 | ||
|
||
This document contains all information needed to reproduce the experiments of the paper "Nemo: Your Friendly and Versatile Rule Reasoning Toolkit". The individual times that were measured for each reasoner can be found in `runtimes.ods`. | ||
|
||
## Rule Sets | ||
|
||
All rule sets have been automatically translated from the internal representation of Nemo into the file formats of the other reasoners. The resulting rule files are uploaded in `programs/<benchmark>/<reasoner>`. | ||
|
||
## Data | ||
|
||
To run the benchmarks, | ||
the input data has to be placed inside of `programs/data`. | ||
|
||
### Benchmarking the Chase | ||
|
||
The datasets for the scenarios "Benchmarking the Chase" or instructions on how to obtain them can be found in: https://github.com/knowsys/nemo-examples/tree/main/chasebench | ||
|
||
### EL-Reasoning | ||
|
||
The preproessed Galen ontology can be found here: https://github.com/knowsys/nemo-examples/tree/main/examples/owl-el/from-preprocessed-csv/data | ||
|
||
Note that SNOMED is not freely available. | ||
|
||
### Gringo | ||
|
||
For Gringo, the input files have to be translated into a series of facts, which is appended to the rule file. For this, we created a simple python script: | ||
|
||
```sh | ||
cd programs/<benchmark>/gringo | ||
cp program.lp run.lp | ||
python3 ../../../data_gringo.py ../data >> run.lp | ||
``` | ||
|
||
## Reasoners | ||
|
||
### Nemo | ||
|
||
Build instructions for Nemo are available on its [github page](https://github.com/knowsys/nemo?tab=readme-ov-file#installation). To run a benchmark, execute the following commands: | ||
|
||
```sh | ||
cd programs/<benchmark>/nemo | ||
nmo run.rls | ||
``` | ||
|
||
### Gringo | ||
|
||
Build instructions for Gringo are available on its [github page](https://github.com/potassco/clingo/blob/master/INSTALL.md). | ||
To run a benchmark, execute the following commands: | ||
|
||
```sh | ||
cd programs/<benchmark>/gringo | ||
gringo run.lp > /dev/null | ||
``` | ||
|
||
### Souffle | ||
|
||
Build instructins for Souffle can be found [here](https://souffle-lang.github.io/build). | ||
To run Souffle in interpreted mode, use the following commands: | ||
|
||
```sh | ||
cd programs/<benchmark>/souffle | ||
souffle run.dl | ||
``` | ||
|
||
To use it in compiled mode, run: | ||
|
||
```sh | ||
cd programs/<benchmark>/souffle | ||
souffle run.dl --dl-program=compiled | ||
./compiled | ||
``` | ||
|
||
### VLog | ||
|
||
Build instructions for VLog are available on its [github page](https://github.com/knowsys/nemo?tab=readme-ov-file#installation). To run a benchmark, execute the following commands: | ||
|
||
```sh | ||
cd programs/<benchmark>/vlog | ||
vlog mat --edb edb.conf --rules run.dlog -l error | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
|
||
# Script that turns the contents of a CSV file into logic programming facts | ||
# that are compatible with other logic programming tools. The mapping is a simple | ||
# one-way sanitisation that replaces problematic symbols in constants with _. | ||
# It is not meant to be reversible, but it should be bijective on real-world | ||
# databases. | ||
|
||
import csv | ||
import sys | ||
import gzip | ||
import os | ||
|
||
def transformConstant(csvString): | ||
if csvString == "not": | ||
csvString = "constant_not" | ||
|
||
outstring = csvString.lstrip('<').rstrip('>').replace(',','_').replace('#','_').replace(':','_').replace('.','_').replace('/','_').replace('-','_').replace('@','_') | ||
if outstring[0].isdigit(): | ||
outstring = "c" + outstring | ||
if outstring[0].isupper() : | ||
outstring = outstring[0].lower() + outstring[1:] | ||
|
||
if outstring == "_": | ||
return "constant_underscore" | ||
|
||
return outstring | ||
|
||
def processCsvFile(csvfile,predname): | ||
csvreader = csv.reader(csvfile, delimiter=',') | ||
for row in csvreader: | ||
print(predname + "(", end='') | ||
first = True | ||
for value in row: | ||
if first: | ||
first = False | ||
else: | ||
print(',', end='') | ||
print(transformConstant(value), end='') | ||
print(') .') | ||
|
||
if len(sys.argv) != 2: | ||
print("Usage: csv2facts.py <directory>") | ||
sys.exit() | ||
|
||
directory = sys.argv[1] | ||
|
||
for filename in os.listdir(directory): | ||
full_path = os.path.join(directory, filename) | ||
|
||
if os.path.isfile(full_path): | ||
if filename.endswith('.gz'): | ||
filename = filename[:-3] | ||
|
||
predname = os.path.splitext(filename)[0] | ||
# predname = "nf_" + predname | ||
|
||
with gzip.open(full_path, mode="rt") as csvfile: | ||
try: | ||
processCsvFile(csvfile,predname) | ||
except OSError: | ||
with open(full_path, 'r') as csvfile: | ||
processCsvFile(csvfile,predname) | ||
|
||
|
5,342 changes: 4,242 additions & 1,100 deletions
5,342
evaluations/kr2024/programs/deep-100/gringo/program.lp
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.