From 7d619706551117a485d93d0d6847a25afa6a359d Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Tue, 27 Jul 2021 10:30:07 +0100 Subject: Rework class structure to match more general workflow The major change is the introduction of a new class Ontology (superclass of RSAOntology) that contains all those operation that we would like to perform on *any* OWL 2 ontology. Approximation is also generic on the return type, allowing for example intermediate steps (or chaining of approximations). --- src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala | 24 +++++++++++----------- .../ox/cs/rsacomb/approximation/Lowerbound.scala | 2 +- .../uk/ac/ox/cs/rsacomb/ontology/Ontology.scala | 2 ++ 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src/main/scala/uk/ac/ox') diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala index 8e5169d..713a9e8 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala @@ -131,18 +131,18 @@ object RSAComb extends App { Logger.print(s"$answers", Logger.VERBOSE) Logger print s"Number of answers: ${answers.length} (${answers.lengthWithMultiplicity})" // Retrieve unfiltered answers - val unfiltered = rsa.queryDataStore( - """ - SELECT (count(?K) as ?COUNT) - WHERE { - ?K a rsa:QM . - } - """, - RSA.Prefixes - ) - unfiltered.foreach((u) => - Logger print s"Number of unfiltered answers: ${u.head._2}" - ) + // val unfiltered = rsa.queryDataStore( + // """ + // SELECT (count(?K) as ?COUNT) + // WHERE { + // ?K a rsa:QM . + // } + // """, + // RSA.Prefixes + // ) + // unfiltered.foreach((u) => + // Logger print s"Number of unfiltered answers: ${u.head._2}" + // ) } case None => throw new RuntimeException("Submitted query is not conjunctive") diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/approximation/Lowerbound.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/approximation/Lowerbound.scala index 3fc4988..60a88fb 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/approximation/Lowerbound.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/approximation/Lowerbound.scala @@ -50,7 +50,7 @@ class LowerBound extends Approximation[RSAOntology] { def approximate(ontology: Ontology): RSAOntology = toRSA( new Ontology( - ontology.axioms filterNot inALCHOIQ flatMap shift, + ontology.axioms filter inALCHOIQ flatMap shift, ontology.datafiles ) ) diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/ontology/Ontology.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/ontology/Ontology.scala index d73704f..ba44605 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/ontology/Ontology.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/ontology/Ontology.scala @@ -216,6 +216,8 @@ class Ontology(val axioms: List[OWLLogicalAxiom], val datafiles: List[File]) { /** Simplify conversion between Java and Scala collections */ import uk.ac.ox.cs.rsacomb.implicits.JavaCollections._ + println(s"Axioms: ${axioms.length}") + /** OWLOntology based on input axioms * * This is mainly used to instantiate a new reasoner to be used in -- cgit v1.2.3