diff options
| author | RncLsn <rnc.lsn@gmail.com> | 2015-06-16 15:54:53 +0100 |
|---|---|---|
| committer | RncLsn <rnc.lsn@gmail.com> | 2015-06-26 12:04:49 +0100 |
| commit | 29eecb27c7f91de92b21bbd646d8b7a55e526833 (patch) | |
| tree | 233481bccd68e4b718598320f121024db16ff0e5 /src/uk/ac/ox/cs/pagoda/query/rollup | |
| parent | 3a276b7c7836e56a171ab753b018913ce022ba8e (diff) | |
| download | ACQuA-29eecb27c7f91de92b21bbd646d8b7a55e526833.tar.gz ACQuA-29eecb27c7f91de92b21bbd646d8b7a55e526833.zip | |
Maybe fixed bug in internalisation.
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/query/rollup')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java b/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java index a567699..a09cf5b 100644 --- a/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java +++ b/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java | |||
| @@ -81,6 +81,44 @@ public class QueryGraph { | |||
| 81 | return axioms; | 81 | return axioms; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | // public Set<OWLClassExpression> getExistentialConditions(Map<Variable, Term> assignment) { | ||
| 85 | // if(!rollable_edges.isEmpty()) return null; | ||
| 86 | // | ||
| 87 | // OWLIndividual sub; | ||
| 88 | // Visitor visitor = new Visitor(factory, assignment); | ||
| 89 | // Set<OWLClassExpression> axioms = new HashSet<>(); | ||
| 90 | // for(Map.Entry<Term, Set<OWLClassExpression>> entry : concepts.map.entrySet()) { | ||
| 91 | // // TODO check correctness!!! | ||
| 92 | // if(existVars.contains(entry.getKey())) { | ||
| 93 | // OWLClassExpression conjunction = | ||
| 94 | // factory.getOWLObjectIntersectionOf(factory.getOWLThing()); | ||
| 95 | // for(OWLClassExpression owlClassExpression : entry.getValue()) { | ||
| 96 | // conjunction = factory.getOWLObjectIntersectionOf(conjunction, owlClassExpression.accept(visitor)); | ||
| 97 | // } | ||
| 98 | // axioms.add(conjunction); | ||
| 99 | //// continue; // previously the "then" contained only this | ||
| 100 | // } | ||
| 101 | // } | ||
| 102 | // return axioms; | ||
| 103 | // } | ||
| 104 | |||
| 105 | public Set<OWLAxiom> getExistentialAxioms() { | ||
| 106 | if(!rollable_edges.isEmpty()) return null; | ||
| 107 | |||
| 108 | Set<OWLAxiom> axioms = new HashSet<>(); | ||
| 109 | for(Map.Entry<Term, Set<OWLClassExpression>> entry : concepts.map.entrySet()) { | ||
| 110 | if(existVars.contains(entry.getKey())) { | ||
| 111 | OWLClassExpression conjunction = | ||
| 112 | factory.getOWLObjectIntersectionOf(factory.getOWLThing()); | ||
| 113 | for(OWLClassExpression owlClassExpression : entry.getValue()) { | ||
| 114 | conjunction = factory.getOWLObjectIntersectionOf(conjunction, owlClassExpression); | ||
| 115 | } | ||
| 116 | axioms.add(factory.getOWLSubClassOfAxiom(conjunction, factory.getOWLNothing())); | ||
| 117 | } | ||
| 118 | } | ||
| 119 | return axioms; | ||
| 120 | } | ||
| 121 | |||
| 84 | public Set<OWLAxiom> getAssertions(Map<Variable, Term> assignment) { | 122 | public Set<OWLAxiom> getAssertions(Map<Variable, Term> assignment) { |
| 85 | if(!rollable_edges.isEmpty()) return null; | 123 | if(!rollable_edges.isEmpty()) return null; |
| 86 | 124 | ||
| @@ -88,10 +126,21 @@ public class QueryGraph { | |||
| 88 | Visitor visitor = new Visitor(factory, assignment); | 126 | Visitor visitor = new Visitor(factory, assignment); |
| 89 | Set<OWLAxiom> axioms = getPropertyAssertions(assignment); | 127 | Set<OWLAxiom> axioms = getPropertyAssertions(assignment); |
| 90 | for(Map.Entry<Term, Set<OWLClassExpression>> entry : concepts.map.entrySet()) { | 128 | for(Map.Entry<Term, Set<OWLClassExpression>> entry : concepts.map.entrySet()) { |
| 91 | if(existVars.contains(entry.getKey())) continue; | 129 | // TODO check correctness!!! |
| 92 | sub = factory.getOWLNamedIndividual(IRI.create(getIndividual(entry.getKey(), assignment).getIRI())); | 130 | if(existVars.contains(entry.getKey())) { |
| 93 | for(OWLClassExpression clsExp : entry.getValue()) { | 131 | // OWLClassExpression conjunction = |
| 94 | axioms.add(factory.getOWLClassAssertionAxiom(clsExp.accept(visitor), sub)); | 132 | // factory.getOWLObjectIntersectionOf(factory.getOWLThing()); |
| 133 | // for(OWLClassExpression owlClassExpression : entry.getValue()) { | ||
| 134 | // conjunction = factory.getOWLObjectIntersectionOf(conjunction, owlClassExpression.accept(visitor)); | ||
| 135 | // } | ||
| 136 | // axioms.add(factory.getOWLSubClassOfAxiom(conjunction, factory.getOWLNothing())); | ||
| 137 | continue; // previously the "then" contained only this | ||
| 138 | } | ||
| 139 | else { | ||
| 140 | sub = factory.getOWLNamedIndividual(IRI.create(getIndividual(entry.getKey(), assignment).getIRI())); | ||
| 141 | for(OWLClassExpression clsExp : entry.getValue()) { | ||
| 142 | axioms.add(factory.getOWLClassAssertionAxiom(clsExp.accept(visitor), sub)); | ||
| 143 | } | ||
| 95 | } | 144 | } |
| 96 | } | 145 | } |
| 97 | return axioms; | 146 | return axioms; |
