From 155f04db8138d62b3abc2eb777b8453560bbb594 Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Mon, 29 Nov 2021 15:02:15 +0000 Subject: Fix bug in normalisation This would not produce a completely normalised ontology. --- .../scala/uk/ac/ox/cs/rsacomb/approximation/Lowerbound.scala | 12 ++++-------- .../scala/uk/ac/ox/cs/rsacomb/converter/Normalizer.scala | 5 ++--- 2 files changed, 6 insertions(+), 11 deletions(-) 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 e261bce..3cc8fc3 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 @@ -48,14 +48,10 @@ class Lowerbound(implicit fresh: DataFactory) import uk.ac.ox.cs.rsacomb.implicits.RDFox._ /** Main entry point for the approximation algorithm */ - def approximate(ontology: Ontology): RSAOntology = - toRSA( - new Ontology( - ontology.origin, - ontology.axioms filter inALCHOIQ flatMap shift, - ontology.datafiles - ) - ) + def approximate(ontology: Ontology): RSAOntology = { + val axioms = ontology.axioms filter inALCHOIQ flatMap shift + toRSA(new Ontology(ontology.origin, axioms, ontology.datafiles)) + } /** Discards all axioms outside ALCHOIQ */ private def inALCHOIQ(axiom: OWLLogicalAxiom): Boolean = diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/converter/Normalizer.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/converter/Normalizer.scala index 33cb715..98e4dd0 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/converter/Normalizer.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/converter/Normalizer.scala @@ -198,7 +198,7 @@ class Normalizer() { * forall R . B c A * ¬ A c ¬∀forall R . B * ¬ A c exists R . ¬ B - * ¬ A c C, C c R . ¬ B + * ¬ A c C, C c exists R . ¬ B * top c A u C, D c ¬ B, C c exists R . D * top c A u C, D n B c bot, C c exists R . D */ @@ -219,7 +219,7 @@ class Normalizer() { c, factory.getOWLObjectSomeValuesFrom(role, d) ) - ) + ).flatMap(normalize(_)(fresh)) } /** Object/Data universal quantification on the lhs */ case (sub: OWLDataAllValuesFrom, _) => notSupported(a) @@ -468,7 +468,6 @@ class Normalizer() { /** Self-restriction over an object property */ case (sub: OWLObjectHasSelf, _) => notSupported(a) case (_, sup: OWLObjectHasSelf) => notSupported(a) - /** Axiom is already normalized */ case _ => Seq(a) } -- cgit v1.2.3