Skip to content

Resolution-based rewriting algorithm from Guarded Tuple Generating Dependencies (GTGDs) to Datalog

License

Notifications You must be signed in to change notification settings

KRR-Oxford/Guarded-saturation

Repository files navigation

Guarded-saturation

The software implements a Resolution-based rewriting algorithm from Guarded Tuple Generating Dependencies (GTGDs) to Datalog, along with some functions for running the resulting Datalog rules.

Saturating

The main functionality of GSat is to compute the saturation of a set of GTGDs. To do this, download the JAR file available with the releases and use the command line:

java -jar guarded-saturation-1.0.0-jar-with-dependencies.jar <syntax> <TGD file>

where <syntax> is the one of the syntax dlgp, owl and <TGD file> is a file containing the input GTGDs in the syntax <syntax>.

By default, the output saturation is printed in the console, it can be written to a file instead by setting write_output to true in the file config.properties.

Example

Consider a DLGP file example.dlgp that contains the following two TGDs:

b(X, Y), c(Y) :-  a(X).
d(X) :- b(X, Y), c(Y).

Calling:

java -jar guarded-saturation-1.0.0-jar-with-dependencies.jar dlgp example.dlgp

returns the saturation containing:

b(X, Y), c(Y) :-  a(X).
d(X) :- a(X).

The choice of the saturation algorithm

This project implements different saturation algorithms. You can set the algorithm to use by changing saturation_alg's value in the file config.properties to either:

  • gsat (default) corresponding to ExbDR in the article
  • skolem_sat corresponding to SkolemDR
  • hyper_sat corresponding to HyperDR
  • simple_sat corresponding to SimDR
  • ordered_skolem_sat also called KAON3

Additionally, KAON2 can be used to get the saturation of the set of TGDs in an OWL file using the following command:

java -cp guarded-saturation-1.0.0-jar-with-dependencies.jar "uk.ac.ox.cs.gsat.ExecutorOWL" <OWL file> <timeout>

where the <timeout> is expressed in seconds.

Compilation (For developers)

Prerequisites

To build the software we require

Kaon2 is only relevant for some experiments, and is not part of the delivered product.

Installing PDQ in Maven

  1. Download from PDQ releases
    • pdq-common-1.0.0.jar
  2. Install as in the official documentation
    • mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile="pdq-common-1.0.0.jar"

Installing KAON 2

Install the JAR of KAON2 using:

mvn install:install-file -Dfile=./gsat-kaon2/src/main/resources/kaon2.jar -DgroupId=org.semanticweb.kaon2 -DartifactId=kaon2 -Dversion=2008-06-29 -Dpackaging=jar -DgeneratePom=true

Installing

If you are a developer and you want to run the tests, you need to:

  1. Download the "test-all.zip" file from GSat test datasets
  2. Extract it in the root of the project

Otherwise, you can simply run the download-test-datasets.sh script.

Build the project:

mvn verify

That's it! If you look in the target subdirectory, you should find the build output.

Running the saturation on Chase Bench

In addition to what have been said in the usage section ChaseBench format can also be used for the input.

To run on a ChaseBench scenario, you need to specify the cb option and add:

  • <NAME OF THE SCENARIO> the name of the scenario as in the ChaseBench format
    • example: doctors
  • <PATH OF THE BASE FOLDER> the directory that contains this scenario
    • example: test/ChaseBench/scenarios/doctors
  • [<FACT/QUERY SIZE>] (optional) the size of the scenario that you want to test
    • example: 100k

Useful Maven commands for developers

Check PDM violations and bugs in code:

mvn pmd:check

mvn spotbugs:check

Update Maven dependencies and Plugins:

mvn versions:display-dependency-updates

mvn versions:display-plugin-updates

Generate Javadoc:

mvn javadoc:javadoc

Experiments

Experiments are available in a submodule, which may be large. You can initialize the experiments folder using:

git submodule init

Here you can download the files used in our experiments.

Credits

Information Systems GroupDepartment of Computer ScienceUniversity of Oxford

License

This project is licensed under the MIT License