diff options
| -rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/approximation/Upperbound.scala | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/approximation/Upperbound.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/approximation/Upperbound.scala index 2c3bdc4..567691f 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/approximation/Upperbound.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/approximation/Upperbound.scala | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | package uk.ac.ox.cs.rsacomb.approximation | 1 | package uk.ac.ox.cs.rsacomb.approximation |
| 2 | 2 | ||
| 3 | // import java.io.File | ||
| 4 | |||
| 5 | import org.semanticweb.owlapi.apibinding.OWLManager | 3 | import org.semanticweb.owlapi.apibinding.OWLManager |
| 6 | import org.semanticweb.owlapi.model.{IRI => _, _} | 4 | import org.semanticweb.owlapi.model.{IRI => _, _} |
| 7 | 5 | ||
| @@ -52,34 +50,28 @@ class Upperbound(implicit fresh: DataFactory) | |||
| 52 | toRSA( | 50 | toRSA( |
| 53 | new Ontology( | 51 | new Ontology( |
| 54 | ontology.origin, | 52 | ontology.origin, |
| 55 | ontology.axioms flatMap toConjuncts, | 53 | ontology.axioms map chooseDisjunct, |
| 56 | ontology.datafiles | 54 | ontology.datafiles |
| 57 | ) | 55 | ) |
| 58 | ) | 56 | ) |
| 59 | 57 | ||
| 60 | /** Turn disjuncts into conjuncts | 58 | /** Choose a single disjunct |
| 61 | * | 59 | * |
| 62 | * This is a very naïve way of getting rid of disjunction preserving | 60 | * This is a very naïve way of getting rid of disjunction preserving |
| 63 | * completeness of CQ answering. | 61 | * completeness of CQ answering. |
| 64 | * | ||
| 65 | * @todo implement a choice function that decides which disjunct to | ||
| 66 | * keep instead of keeping all of them. Note that PAGOdA is currently | ||
| 67 | * doing something similar. | ||
| 68 | */ | 62 | */ |
| 69 | private def toConjuncts(axiom: OWLLogicalAxiom): List[OWLLogicalAxiom] = | 63 | private def chooseDisjunct(axiom: OWLLogicalAxiom): OWLLogicalAxiom = |
| 70 | axiom match { | 64 | axiom match { |
| 71 | case a: OWLSubClassOfAxiom => { | 65 | case a: OWLSubClassOfAxiom => { |
| 72 | val sub = a.getSubClass.getNNF | 66 | val sub = a.getSubClass.getNNF |
| 73 | val sup = a.getSuperClass.getNNF | 67 | val sup = a.getSuperClass.getNNF |
| 74 | sup match { | 68 | sup match { |
| 75 | case sup: OWLObjectUnionOf => | 69 | case sup: OWLObjectUnionOf => |
| 76 | sup.asDisjunctSet.map( | 70 | Upperbound.factory.getOWLSubClassOfAxiom(sub, sup.asDisjunctSet.head) |
| 77 | Upperbound.factory.getOWLSubClassOfAxiom(sub, _) | 71 | case _ => axiom |
| 78 | ) | ||
| 79 | case _ => List(axiom) | ||
| 80 | } | 72 | } |
| 81 | } | 73 | } |
| 82 | case _ => List(axiom) | 74 | case _ => axiom |
| 83 | } | 75 | } |
| 84 | 76 | ||
| 85 | /** Approximate a Horn-ALCHOIQ ontology to RSA | 77 | /** Approximate a Horn-ALCHOIQ ontology to RSA |
