diff options
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | build.sbt | 2 | ||||
-rw-r--r-- | project/Dependencies.scala | 4 | ||||
-rw-r--r-- | project/build.properties | 2 | ||||
-rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala | 9 | ||||
-rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala | 12 | ||||
-rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverter.scala | 2 | ||||
-rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala | 12 | ||||
-rw-r--r-- | src/test/scala/uk/ac/ox/cs/rsacomb/CanonicalModelSpec.scala | 6 | ||||
-rw-r--r-- | src/test/scala/uk/ac/ox/cs/rsacomb/FilteringProgramSpecs.scala | 2 | ||||
-rw-r--r-- | src/test/scala/uk/ac/ox/cs/rsacomb/converter/OWLAxiomSpec.scala (renamed from src/test/scala/uk/ac/ox/cs/rsacomb/OWLAxiomSpec.scala) | 2 | ||||
-rw-r--r-- | src/test/scala/uk/ac/ox/cs/rsacomb/converter/OWLClassSpec.scala (renamed from src/test/scala/uk/ac/ox/cs/rsacomb/OWLClassSpec.scala) | 2 | ||||
-rw-r--r-- | src/test/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverterSpec.scala (renamed from src/test/scala/uk/ac/ox/cs/rsacomb/RDFoxConverterSpec.scala) | 2 |
13 files changed, 40 insertions, 24 deletions
@@ -71,8 +71,11 @@ The following is a summary of fixes (🔧), changes (🔄) and improvements (⚡ | |||
71 | ``` | 71 | ``` |
72 | where `rsa:named` is an internal predicate keeping track of all constants in the original ontology. | 72 | where `rsa:named` is an internal predicate keeping track of all constants in the original ontology. |
73 | 73 | ||
74 | + âš¡ Both in the canonical model and the filtering program computations, | 74 | + âš¡ In Def. 3, regarding the generation of the logic program used for the RSA checkk, only T5 axioms involving an unsafe role will introduce the internal predicates `PE` and `U`. |
75 | rules without a body are loaded into RDFox as facts. | 75 | |
76 | + âš¡ Both in the canonical model and the filtering program computations, rules without a body are loaded into RDFox as facts. | ||
77 | |||
78 | + ⚡ 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. | ||
76 | 79 | ||
77 | ## References | 80 | ## References |
78 | 81 | ||
@@ -1,6 +1,6 @@ | |||
1 | import Dependencies._ | 1 | import Dependencies._ |
2 | 2 | ||
3 | ThisBuild / scalaVersion := "2.13.3" | 3 | ThisBuild / scalaVersion := "2.13.4" |
4 | ThisBuild / version := "0.1.0" | 4 | ThisBuild / version := "0.1.0" |
5 | ThisBuild / organization := "uk.ac.ox.cs.rsacomb" | 5 | ThisBuild / organization := "uk.ac.ox.cs.rsacomb" |
6 | ThisBuild / organizationName := "Department of Computer Science - University of Oxford" | 6 | ThisBuild / organizationName := "Department of Computer Science - University of Oxford" |
diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 1cafe11..39e8e2e 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala | |||
@@ -2,8 +2,8 @@ import sbt._ | |||
2 | 2 | ||
3 | object Dependencies { | 3 | object Dependencies { |
4 | // Versions | 4 | // Versions |
5 | lazy val scalatestVersion = "3.2.2" | 5 | lazy val scalatestVersion = "3.2.3" |
6 | lazy val owlapiVersion = "5.1.16" | 6 | lazy val owlapiVersion = "5.1.17" |
7 | lazy val scalagraphVersion = "1.13.2" | 7 | lazy val scalagraphVersion = "1.13.2" |
8 | 8 | ||
9 | // Libraries | 9 | // Libraries |
diff --git a/project/build.properties b/project/build.properties index 0837f7a..7de0a93 100644 --- a/project/build.properties +++ b/project/build.properties | |||
@@ -1 +1 @@ | |||
sbt.version=1.3.13 | sbt.version=1.4.4 | ||
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala index c605e51..5001c8a 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala | |||
@@ -247,11 +247,10 @@ class CanonicalModel(val ontology: RSAOntology) { | |||
247 | } | 247 | } |
248 | 248 | ||
249 | case a: OWLSubObjectPropertyOfAxiom => { | 249 | case a: OWLSubObjectPropertyOfAxiom => { |
250 | val (factsF, rulesF) = | 250 | val (facts, rules) = List(Empty, Forward, Backward) |
251 | super.convert(a, term, unsafe, NoSkolem, Forward) | 251 | .map(super.convert(a, term, unsafe, NoSkolem, _)) |
252 | val (factsB, rulesB) = | 252 | .unzip |
253 | super.convert(a, term, unsafe, NoSkolem, Backward) | 253 | (facts.flatten, rules.flatten) |
254 | (factsF ::: factsB, rulesF ::: rulesB) | ||
255 | } | 254 | } |
256 | 255 | ||
257 | case a => super.convert(a, term, unsafe, skolem, suffix) | 256 | case a => super.convert(a, term, unsafe, skolem, suffix) |
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala index 79f2ef3..dc64c79 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala | |||
@@ -11,6 +11,7 @@ import org.semanticweb.owlapi.model.{OWLOntology, OWLAxiom, OWLLogicalAxiom} | |||
11 | import org.semanticweb.owlapi.model.{ | 11 | import org.semanticweb.owlapi.model.{ |
12 | OWLClass, | 12 | OWLClass, |
13 | OWLClassExpression, | 13 | OWLClassExpression, |
14 | OWLDataPropertyAssertionAxiom, | ||
14 | OWLObjectProperty, | 15 | OWLObjectProperty, |
15 | OWLSubObjectPropertyOfAxiom, | 16 | OWLSubObjectPropertyOfAxiom, |
16 | OWLObjectPropertyExpression, | 17 | OWLObjectPropertyExpression, |
@@ -35,7 +36,8 @@ import tech.oxfordsemantic.jrdfox.logic.expression.{ | |||
35 | Term, | 36 | Term, |
36 | Variable, | 37 | Variable, |
37 | IRI, | 38 | IRI, |
38 | Resource | 39 | Resource, |
40 | Literal | ||
39 | } | 41 | } |
40 | import tech.oxfordsemantic.jrdfox.logic.sparql.statement.SelectQuery | 42 | import tech.oxfordsemantic.jrdfox.logic.sparql.statement.SelectQuery |
41 | 43 | ||
@@ -122,6 +124,12 @@ class RSAOntology(val ontology: OWLOntology) { | |||
122 | .map(implicits.RDFox.owlapiToRdfoxIri) | 124 | .map(implicits.RDFox.owlapiToRdfoxIri) |
123 | .toList | 125 | .toList |
124 | 126 | ||
127 | val literals: List[Literal] = | ||
128 | abox | ||
129 | .collect { case a: OWLDataPropertyAssertionAxiom => a } | ||
130 | .map(_.getObject) | ||
131 | .map(implicits.RDFox.owlapiToRdfoxLiteral) | ||
132 | |||
125 | val concepts: List[OWLClass] = | 133 | val concepts: List[OWLClass] = |
126 | ontology.getClassesInSignature().asScala.toList | 134 | ontology.getClassesInSignature().asScala.toList |
127 | 135 | ||
@@ -298,7 +306,7 @@ class RSAOntology(val ontology: OWLOntology) { | |||
298 | 306 | ||
299 | def filteringProgram(query: ConjunctiveQuery): FilteringProgram = | 307 | def filteringProgram(query: ConjunctiveQuery): FilteringProgram = |
300 | Logger.timed( | 308 | Logger.timed( |
301 | new FilteringProgram(query, individuals), | 309 | new FilteringProgram(query, individuals ++ literals), |
302 | "Generating filtering program", | 310 | "Generating filtering program", |
303 | Logger.DEBUG | 311 | Logger.DEBUG |
304 | ) | 312 | ) |
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverter.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverter.scala index 6c83caf..6193296 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverter.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverter.scala | |||
@@ -225,7 +225,7 @@ trait RDFoxConverter { | |||
225 | * @see [[org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom OWLDataPropertyAssertionAxiom]] | 225 | * @see [[org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom OWLDataPropertyAssertionAxiom]] |
226 | */ | 226 | */ |
227 | case a: OWLDataPropertyAssertionAxiom => | 227 | case a: OWLDataPropertyAssertionAxiom => |
228 | if (!a.getSubject.isNamed || !a.getObject.isNamed) | 228 | if (!a.getSubject.isNamed) |
229 | Result() | 229 | Result() |
230 | else { | 230 | else { |
231 | val subj = a.getSubject.asOWLNamedIndividual.getIRI | 231 | val subj = a.getSubject.asOWLNamedIndividual.getIRI |
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala index 50cbb86..667defc 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala | |||
@@ -1,6 +1,11 @@ | |||
1 | package uk.ac.ox.cs.rsacomb.sparql | 1 | package uk.ac.ox.cs.rsacomb.sparql |
2 | 2 | ||
3 | import tech.oxfordsemantic.jrdfox.logic.expression.{IRI, Resource, Variable} | 3 | import tech.oxfordsemantic.jrdfox.logic.expression.{ |
4 | IRI, | ||
5 | Literal, | ||
6 | Resource, | ||
7 | Variable | ||
8 | } | ||
4 | 9 | ||
5 | /** A collections of answers to a query. | 10 | /** A collections of answers to a query. |
6 | * | 11 | * |
@@ -30,8 +35,9 @@ class ConjunctiveQueryAnswers( | |||
30 | val header = variables map (_.getName) mkString "\t" | 35 | val header = variables map (_.getName) mkString "\t" |
31 | val body = answers | 36 | val body = answers |
32 | .map(_.map { | 37 | .map(_.map { |
33 | case x: IRI => x.getIRI | 38 | case x: IRI => x.getIRI |
34 | case x => x.toString | 39 | case x: Literal => x.getLexicalForm |
40 | case x => x.toString | ||
35 | }.mkString("\t")) | 41 | }.mkString("\t")) |
36 | .mkString("\n") | 42 | .mkString("\n") |
37 | s"$header\n$body" | 43 | s"$header\n$body" |
diff --git a/src/test/scala/uk/ac/ox/cs/rsacomb/CanonicalModelSpec.scala b/src/test/scala/uk/ac/ox/cs/rsacomb/CanonicalModelSpec.scala index a7d7f27..0d18e66 100644 --- a/src/test/scala/uk/ac/ox/cs/rsacomb/CanonicalModelSpec.scala +++ b/src/test/scala/uk/ac/ox/cs/rsacomb/CanonicalModelSpec.scala | |||
@@ -1,4 +1,4 @@ | |||
1 | package rsacomb | 1 | package uk.ac.ox.cs.rsacomb |
2 | 2 | ||
3 | import java.io.File | 3 | import java.io.File |
4 | import org.scalatest.LoneElement | 4 | import org.scalatest.LoneElement |
@@ -218,13 +218,13 @@ class Ontology1_CanonicalModelSpec | |||
218 | 218 | ||
219 | renderer.render( | 219 | renderer.render( |
220 | SsubPropertyOfT | 220 | SsubPropertyOfT |
221 | ) should "produce 2 rules" in { | 221 | ) should "produce 3 rules" in { |
222 | val term = Variable.create("X") | 222 | val term = Variable.create("X") |
223 | val unsafe = ontology.unsafeRoles | 223 | val unsafe = ontology.unsafeRoles |
224 | val (facts, rules) = | 224 | val (facts, rules) = |
225 | converter.convert(SsubPropertyOfT, term, unsafe, NoSkolem, Empty) | 225 | converter.convert(SsubPropertyOfT, term, unsafe, NoSkolem, Empty) |
226 | facts shouldBe empty | 226 | facts shouldBe empty |
227 | rules should have length 2 | 227 | rules should have length 3 |
228 | } | 228 | } |
229 | 229 | ||
230 | } | 230 | } |
diff --git a/src/test/scala/uk/ac/ox/cs/rsacomb/FilteringProgramSpecs.scala b/src/test/scala/uk/ac/ox/cs/rsacomb/FilteringProgramSpecs.scala index 93e312c..e627bf7 100644 --- a/src/test/scala/uk/ac/ox/cs/rsacomb/FilteringProgramSpecs.scala +++ b/src/test/scala/uk/ac/ox/cs/rsacomb/FilteringProgramSpecs.scala | |||
@@ -1,4 +1,4 @@ | |||
1 | package rsacomb | 1 | package uk.ac.ox.cs.rsacomb |
2 | 2 | ||
3 | import org.scalatest.flatspec.AnyFlatSpec | 3 | import org.scalatest.flatspec.AnyFlatSpec |
4 | import org.scalatest.matchers.should.Matchers | 4 | import org.scalatest.matchers.should.Matchers |
diff --git a/src/test/scala/uk/ac/ox/cs/rsacomb/OWLAxiomSpec.scala b/src/test/scala/uk/ac/ox/cs/rsacomb/converter/OWLAxiomSpec.scala index e1ece62..eb49c7d 100644 --- a/src/test/scala/uk/ac/ox/cs/rsacomb/OWLAxiomSpec.scala +++ b/src/test/scala/uk/ac/ox/cs/rsacomb/converter/OWLAxiomSpec.scala | |||
@@ -1,4 +1,4 @@ | |||
1 | package rsacomb | 1 | package uk.ac.ox.cs.rsacomb.converter |
2 | 2 | ||
3 | import java.util.{ArrayList => JList} | 3 | import java.util.{ArrayList => JList} |
4 | import org.scalatest.LoneElement | 4 | import org.scalatest.LoneElement |
diff --git a/src/test/scala/uk/ac/ox/cs/rsacomb/OWLClassSpec.scala b/src/test/scala/uk/ac/ox/cs/rsacomb/converter/OWLClassSpec.scala index def864b..09ab6eb 100644 --- a/src/test/scala/uk/ac/ox/cs/rsacomb/OWLClassSpec.scala +++ b/src/test/scala/uk/ac/ox/cs/rsacomb/converter/OWLClassSpec.scala | |||
@@ -1,4 +1,4 @@ | |||
1 | package rsacomb | 1 | package uk.ox.ac.cs.rsacomb.converter |
2 | 2 | ||
3 | import java.util.{ArrayList => JList} | 3 | import java.util.{ArrayList => JList} |
4 | 4 | ||
diff --git a/src/test/scala/uk/ac/ox/cs/rsacomb/RDFoxConverterSpec.scala b/src/test/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverterSpec.scala index 5c9fa96..a401abf 100644 --- a/src/test/scala/uk/ac/ox/cs/rsacomb/RDFoxConverterSpec.scala +++ b/src/test/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverterSpec.scala | |||
@@ -1,4 +1,4 @@ | |||
1 | package rsacomb | 1 | package uk.ac.ox.cs.rsacomb.converter |
2 | 2 | ||
3 | import org.scalatest.LoneElement | 3 | import org.scalatest.LoneElement |
4 | import org.scalatest.flatspec.AnyFlatSpec | 4 | import org.scalatest.flatspec.AnyFlatSpec |