diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/query')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java | 51 |
1 files changed, 45 insertions, 6 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 01336ba..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,22 +81,61 @@ public class QueryGraph { | |||
| 81 | return axioms; | 81 | return axioms; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | public Set<OWLAxiom> getAssertions(Map<Variable, Term> assignment) { | 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() { | ||
| 85 | if(!rollable_edges.isEmpty()) return null; | 106 | if(!rollable_edges.isEmpty()) return null; |
| 86 | 107 | ||
| 87 | OWLIndividual sub; | 108 | Set<OWLAxiom> axioms = new HashSet<>(); |
| 88 | Visitor visitor = new Visitor(factory, assignment); | ||
| 89 | Set<OWLAxiom> axioms = getPropertyAssertions(assignment); | ||
| 90 | for(Map.Entry<Term, Set<OWLClassExpression>> entry : concepts.map.entrySet()) { | 109 | for(Map.Entry<Term, Set<OWLClassExpression>> entry : concepts.map.entrySet()) { |
| 91 | // TODO check correctness!!! | ||
| 92 | if(existVars.contains(entry.getKey())) { | 110 | if(existVars.contains(entry.getKey())) { |
| 93 | OWLClassExpression conjunction = | 111 | OWLClassExpression conjunction = |
| 94 | factory.getOWLObjectIntersectionOf(factory.getOWLThing()); | 112 | factory.getOWLObjectIntersectionOf(factory.getOWLThing()); |
| 95 | for(OWLClassExpression owlClassExpression : entry.getValue()) { | 113 | for(OWLClassExpression owlClassExpression : entry.getValue()) { |
| 96 | conjunction = factory.getOWLObjectIntersectionOf(conjunction, owlClassExpression.accept(visitor)); | 114 | conjunction = factory.getOWLObjectIntersectionOf(conjunction, owlClassExpression); |
| 97 | } | 115 | } |
| 98 | axioms.add(factory.getOWLSubClassOfAxiom(conjunction, factory.getOWLNothing())); | 116 | axioms.add(factory.getOWLSubClassOfAxiom(conjunction, factory.getOWLNothing())); |
| 99 | } | 117 | } |
| 118 | } | ||
| 119 | return axioms; | ||
| 120 | } | ||
| 121 | |||
| 122 | public Set<OWLAxiom> getAssertions(Map<Variable, Term> assignment) { | ||
| 123 | if(!rollable_edges.isEmpty()) return null; | ||
| 124 | |||
| 125 | OWLIndividual sub; | ||
| 126 | Visitor visitor = new Visitor(factory, assignment); | ||
| 127 | Set<OWLAxiom> axioms = getPropertyAssertions(assignment); | ||
| 128 | for(Map.Entry<Term, Set<OWLClassExpression>> entry : concepts.map.entrySet()) { | ||
| 129 | // TODO check correctness!!! | ||
| 130 | if(existVars.contains(entry.getKey())) { | ||
| 131 | // OWLClassExpression conjunction = | ||
| 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 | } | ||
| 100 | else { | 139 | else { |
| 101 | sub = factory.getOWLNamedIndividual(IRI.create(getIndividual(entry.getKey(), assignment).getIRI())); | 140 | sub = factory.getOWLNamedIndividual(IRI.create(getIndividual(entry.getKey(), assignment).getIRI())); |
| 102 | for(OWLClassExpression clsExp : entry.getValue()) { | 141 | for(OWLClassExpression clsExp : entry.getValue()) { |
