aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md173
1 files changed, 102 insertions, 71 deletions
diff --git a/README.md b/README.md
index 6fcd98d..d8c782e 100644
--- a/README.md
+++ b/README.md
@@ -19,13 +19,16 @@ Combined approach for Conjunctive Query answering in RSA
19<a href="https://github.com/KRR-Oxford/RSAComb/issues">Report bug</a> 19<a href="https://github.com/KRR-Oxford/RSAComb/issues">Report bug</a>
20<br/><br/> 20<br/><br/>
21<a href="https://github.com/KRR-Oxford/RSAComb/releases/latest"> 21<a href="https://github.com/KRR-Oxford/RSAComb/releases/latest">
22<img src="https://img.shields.io/github/release/KRR-Oxford/RSAComb.svg?style=for-the-badge" alt="Release badge"> 22 <img src="https://img.shields.io/github/release/KRR-Oxford/RSAComb.svg?style=for-the-badge" alt="Release badge">
23</a> 23</a>
24<a href="https://github.com/KRR-Oxford/RSAComb/issues"> 24<a href="https://github.com/KRR-Oxford/RSAComb/issues">
25<img src="https://img.shields.io/github/issues/KRR-Oxford/RSAComb.svg?style=for-the-badge" alt="Issues badge"> 25 <img src="https://img.shields.io/github/issues/KRR-Oxford/RSAComb.svg?style=for-the-badge" alt="Issues badge">
26</a>
27<a href="https://github.com/KRR-Oxford/RSAComb/actions">
28 <img src="https://img.shields.io/github/workflow/status/KRR-Oxford/RSAComb/Scala%20CI/develop?label=TESTS&style=for-the-badge" alt="GitHub Actions badge">
26</a> 29</a>
27<a href="LICENSE"> 30<a href="LICENSE">
28<img src="https://img.shields.io/github/license/KRR-Oxford/RSAComb.svg?style=for-the-badge" alt="License badge"> 31 <img src="https://img.shields.io/github/license/KRR-Oxford/RSAComb.svg?style=for-the-badge" alt="License badge">
29</a> 32</a>
30<a href="https://doi.org/10.5281/zenodo.5047811"> 33<a href="https://doi.org/10.5281/zenodo.5047811">
31 <img src="https://img.shields.io/badge/DOI-10.5281/zenodo.5047811-blue?style=for-the-badge" alt="DOI badge"> 34 <img src="https://img.shields.io/badge/DOI-10.5281/zenodo.5047811-blue?style=for-the-badge" alt="DOI badge">
@@ -34,32 +37,11 @@ Combined approach for Conjunctive Query answering in RSA
34 37
35</p> 38</p>
36 39
37<!-- TABLE OF CONTENTS -->
38<details close="close">
39<summary>Table of Contents</summary>
40<ol>
41 <li><a href="#about">About</a></li>
42 <li><a href="#preliminaries">Preliminaries</a></li>
43 <li>
44 <a href="#using-the-software">Using the software</a>
45 <ul>
46 <li><a href="#provide-rdfox-license">Provide RDFox license</a></li>
47 <li><a href="#compiling-and-running-the-project">Compiling and running the project</a></li>
48 <li><a href="#running-tests">Running tests</a></li>
49 </ul>
50 </li>
51 <li><a href="#changes-introduced">Changes introduced</a></li>
52 <li><a href="#acknowledgements">Acknowledgements</a></li>
53 <li><a href="#credits">Credits</a></li>
54 <li><a href="#license">License</a></li>
55</ol>
56</details>
57
58## About 40## About
59 41
60This is a re-implementation of the combined approach for CQ answering over RSA ontologies described in [[1](#references)]. 42This is an *improved* re-implementation of the combined approach for CQ answering over RSA ontologies described in [[1](#references)].
61 43
62> Please note that the prototype mentioned in [[1](#references)] is not available (and the contributors of this repository have never seen it); 44> Please note that the prototype mentioned in [[1](#references)] is not available (and the contributors to this repository have never seen it);
63> therefore, this "re-implementation" could be completely different from that prototype (potentially using different tools and programming language). 45> therefore, this "re-implementation" could be completely different from that prototype (potentially using different tools and programming language).
64 46
65## Preliminaries 47## Preliminaries
@@ -68,7 +50,58 @@ In order to use this program you need to have [RDFox](https://www.oxfordsemantic
68RDFox is proprietary software and as such we are not able to distribute it along with our code. 50RDFox is proprietary software and as such we are not able to distribute it along with our code.
69Please refer to [this link](https://www.oxfordsemantic.tech/tryrdfoxforfree) to request a free trial. 51Please refer to [this link](https://www.oxfordsemantic.tech/tryrdfoxforfree) to request a free trial.
70 52
71This software has been developed and tested with RDFox v.4.1 53This software has been developed and tested with RDFox v5.2.1
54
55## Changes introduced
56
57We tried to implement the system as close as possible to the theoretical description provided in [[1](#references)].
58Regardless, we had to deal with the fact that we are using different tools to carry out reasoning tasks and we are probably using a different language to implement the system.
59The following is a (non exhaustive) summary of fixes (🔧), changes (🔄) and improvements (⚡), we introduced along the way:
60
61+ 🔄 [RDFox](https://www.oxfordsemantic.tech/product) is used instead of DLV as the underlying LP engine.
62
63+ âš¡ The system accepts unrestricted OWL ontologies as input and takes care of normalising and approximating the ontology to RSA.
64 At the time of writing, two approximation algorithms are provided, to compute a sound (or complete) set of answer to the input queries, respectively.
65
66+ âš¡ The different steps of the combined approach (namely, the canonical model computation and the filtering step) are executed in isolation using different *named graphs*.
67 This allows us to reuse partial products of the computation and can even be used to parellalise filtering and answering steps.
68
69+ 🔧 In Def.4, the definition of built-in predicate `notIn` is wrong and should reflect the implicit semantics implied by the name, i.e.,
70
71 > let [...] `notIn` be a built-in predicate which holds when the first argument is **not** an element of the set given as second argument
72
73 This has been fixed by (1) introducing a built-in predicate `In` (note that instances of `In` can be computed beforehand since they only depend on the input ontology), and (2) implement `notIn` as the negation of `In` using RDFox *NaF* built-in support.
74
75+ 🔄 Top (`owl:Thing`) axiomatisation is performed introducing rules as follows.
76 Given `p` predicate (arity *n*) *in the original ontology*, the following rule is introduced:
77 ```
78 owl:Thing[?X1], ..., owl:Thing[?Xn] :- p(?X1, ..., ?Xn) .
79 ```
80 Note that, by definition, arity can be either 1 or 2.
81
82+ 🔄 Equality axiomatisation is performed introducing the following rules:
83 ```
84 rsacomb:congruent[?X, ?X] :- owl:Thing[?X] .
85 rsacomb:congruent[?Y, ?X] :- rsacomb:congruent[?X, ?Y] .
86 rsacomb:congruent[?X, ?Z] :- rsacomb:congruent[?X, ?Y], rsacomb:congruent[?Y, ?Z] .
87 ```
88 defining equivalence as a congruence relation over terms in the ontology.
89 Substitution rules propagate the equivalence to all existing atoms.
90
91+ 🔧 In Def. 4, the definition of built-in predicate `NI` is not consistent with its use in Table 3 and related description in Sec. 4.2.
92 We redefined `NI` as the set of all constants that are *equal* to a constant in the original ontology (according to the internal equality predicate `rsa:congruent`).
93 Note that, in this scenario, there is no need to introduce `NI` instances as facts in the system;
94 instead we can add a rule to populate the new predicate:
95 ```
96 rsa:NI[?X] :- rsa:congruent[?X, ?Y], rsa:named[?Y] .
97 ```
98 where `rsa:named` is an internal predicate keeping track of all constants in the original ontology.
99
100+ âš¡ In Def. 3, regarding the generation of the logic program used for the RSA check, only T5 axioms involving an unsafe role will introduce the internal predicates `PE` and `U`.
101
102+ âš¡ Both in the canonical model and the filtering program computations, rules without a body are loaded into RDFox as facts.
103
104+ ⚡ The `cycle` function introduced in Def.4 establishing the direction of the *unraveling* of loops is defined over triples `(A,R,B)`. We are currently limiting the triple only to those appearing in a T5 axiom `A ⊑ ∃R.B`. Note that this greatly limits the size of cycle for a given triple, and as a consequence limits the number of rules used to compute the canonical model.
72 105
73## Using the software 106## Using the software
74 107
@@ -79,9 +112,9 @@ Download links for specific versions and operating systems can be found [here](h
79 112
80```{.bash} 113```{.bash}
81mkdir -p lib && pushd lib 114mkdir -p lib && pushd lib
82wget https://rdfox-distribution.s3.eu-west-2.amazonaws.com/release/v4.2.0/RDFox-linux-4.2.0.zip 115wget https://rdfox-distribution.s3.eu-west-2.amazonaws.com/release/v5.2.1/RDFox-linux-x86_64-5.2.1.zip
83unzip RDFox-linux-4.2.0.zip 116unzip RDFox-linux-x86_64-5.2.1.zip
84ln -s RDFox-linux-4.2.0.zip/lib/JRDFox.jar 117ln -s RDFox-linux-x86_64-5.2.1.zip/lib/JRDFox.jar
85popd 118popd
86``` 119```
87 120
@@ -106,11 +139,7 @@ Run the following from the base directory of the project to produce a standalone
106sbt assembly 139sbt assembly
107``` 140```
108 141
109The output of the command will print the location of the produced jar. Execute it with 142The output of the command will print the location of the produced jar.
110```
111java -jar <path/to/fat.jar> [<option> ...]
112```
113
114Note that the fat jar file distributed with this repository excludes the RDFox as a dependency. Provided that you have the RDFox setup on your machine, you can run the program as follows 143Note that the fat jar file distributed with this repository excludes the RDFox as a dependency. Provided that you have the RDFox setup on your machine, you can run the program as follows
115``` 144```
116java -cp <path/to/JRDFox.jar>:<path/to/fat.jar> uk.ac.ox.cs.rsacomb.RSAComb [<option> ...] 145java -cp <path/to/JRDFox.jar>:<path/to/fat.jar> uk.ac.ox.cs.rsacomb.RSAComb [<option> ...]
@@ -118,55 +147,57 @@ java -cp <path/to/JRDFox.jar>:<path/to/fat.jar> uk.ac.ox.cs.rsacomb.RSAComb [<op
118 147
119### Running tests 148### Running tests
120 149
121To run the suit of unit test provided along with the code run 150To run the suites of tests provided along with the code run
122``` 151```
123sbt test 152sbt test
124``` 153```
125 154
126## Changes introduced 155This will run all [unit tests](https://en.wikipedia.org/wiki/Unit_testing) and [functional tests](https://en.wikipedia.org/wiki/Functional_testing).
127 156If you want to limit the scope of the tests and run only a particular suite use
128We tried to implement the system as close as possible to the theoretical description provided in [[1](#references)]. 157```
129Regardless, we had to deal with the fact that we where using different tools to carry out reasoning tasks and we where probably using a different language to implement the system. 158sbt "testOnly <test-class>"
130The following is a (non exhaustive) summary of fixes (🔧), changes (🔄) and improvements (⚡), we introduced along the way: 159```
131
132+ 🔄 [RDFox](https://www.oxfordsemantic.tech/product) is used instead of DLV as the underlying LP engine.
133
134+ 🔧 In Def.4, the definition of built-in predicate `notIn` is wrong and should reflect the implicit semantics implied by the name, i.e.,
135 160
136 > let [...] `notIn` be a built-in predicate which holds when the first argument is **not** an element of the set given as second argument 161For example, to execute only unit tests concerning the canonical model computation, run
162```
163sbt "testOnly uk.ac.ox.cs.rsacomb.CanonicalModelSpec"
164```
137 165
138 This has been fixed by (1) introducing a built-in predicate `In` (note that instances of `In` can be computed beforehand since they only depend on the input ontology), and (2) implement `notIn` as the negation of `In` using RDFox *NaF* built-in support. 166or alternatively
167```
168sbt "testOnly *CanonicalModelSpec"
169```
139 170
140+ 🔄 Top (`owl:Thing`) axiomatisation is performed introducing rules as follows. 171To run only functional tests for LUBM, excluding tests tagged as *slow* (that require more resources), run
141 Given `p` predicate (arity *n*) *in the original ontology*, the following rule is introduced: 172```
142 ``` 173sbt "testOnly *functional.LUBM -- -l org.scalatest.tags.Slow"
143 owl:Thing[?X1], ..., owl:Thing[?Xn] :- p(?X1, ..., ?Xn) . 174```
144 ```
145 Note that, by definition, arity can be either 1 or 2.
146 175
147+ 🔄 Equality axiomatisation is performed introducing the following rules: 176### Debugging
148 ```
149 rsa:congruent[?X, ?X] :- owl:Thing[?X] .
150 rsa:congruent[?Y, ?X] :- rsa:congruent[?X, ?Y] .
151 rsa:congruent[?X, ?Z] :- rsa:congruent[?X, ?Y], rsa:congruent[?Y, ?Z] .
152 ```
153 defining equivalence as a congruence relation over terms in the ontology.
154 177
155+ 🔧 In Def. 4, the definition of built-in predicate `NI` is not consistent with its use in Table 3 and related description in Sec. 4.2. 178You can set the logging level of RSAComb using the `-l | --logger` flag (see the help screen for more information).
156 We redefined `NI` as the set of all constants that are *equal* to a constant in the original ontology (according to the internal equality predicate `rsa:congruent`). 179When the logger is set to `verbose`, RSAComb will generate a set of files that contain the intermediate products of the program execution (these include the set of rules to generate the canonical model for the input ontology and the filtering rules derived from the input query).
157 Note that, in this scenario, there is no need to introduce `NI` instances as facts in the system; 180These files are stored in the working directory, in a new folder named `rsacomb-<timestamp>`.
158 instead we can add a rule to populate the new predicate:
159 ```
160 rsa:NI[?X] :- rsa:congruent[?X, ?Y], rsa:named[?Y] .
161 ```
162 where `rsa:named` is an internal predicate keeping track of all constants in the original ontology.
163 181
164+ âš¡ In Def. 3, regarding the generation of the logic program used for the RSA check, only T5 axioms involving an unsafe role will introduce the internal predicates `PE` and `U`. 182You can load these files directly into RDFox to simulate the same environment used by RSAComb, leaving you in a state just before the answer gathering process.
183We also provide a convenient `simulate.rdfox` RDFox script that can be used to load all the necessary files in RDFox for you.
165 184
166+ âš¡ Both in the canonical model and the filtering program computations, rules without a body are loaded into RDFox as facts. 185Let's suppose you run the following command from the root of the project
186```{.sh}
187java -cp lib/JRDFox.jar:target/scala-2.13/RSAComb-assembly-0.2.0.jar uk.ac.ox.cs.rsacomb.RSAComb -l verbose -o tests/lubm/univ-bench.owl -d tests/lubm/data/lubm1.ttl -q tests/lubm/queries.sparql
188```
167 189
168+ ⚡ The `cycle` function introduced in Def.4 establishing the direction of the *unraveling* of loops is defined over triples `(A,R,B)`. We are currently limiting the triple only to those appearing in a T5 axiom `A ⊑ ∃R.B`. Note that this greatly limits the size of cycle for a given triple, and as a consequence limits the number of rules used to compute the canonical model. 190This will answers all the queries in `tests/lubm/queries.sparql` and generate debug information in a new folder in the current working directory (let's say, `rsacomb-20211005120845/`).
191You can run the provided RDFox script as follows
192```{.sh}
193path/to/RDFox sandbox <debug-folder> "simulate <query-id>"
194```
195where
196- `debug-folder` is the newly generated folder (`rsacomb-20211005120845` in this example)
197- `query-id` is the identifier of the query we want to simulate (if we want to simulate query 16 we will pass `16` as an argument). We can pass `all` to simulate all queries.
169 198
199This will launch a sandboxed RDFox console, where you will be able to explore a simulation of the datastore used by RSAComb.
200You can also access the same datastore from the web interface at [http://localhost:12110/console/](http://localhost:12110/console/).
170 201
171## References 202## References
172 203