From 29eecb27c7f91de92b21bbd646d8b7a55e526833 Mon Sep 17 00:00:00 2001 From: RncLsn Date: Tue, 16 Jun 2015 15:54:53 +0100 Subject: Maybe fixed bug in internalisation. --- .../ac/ox/cs/pagoda/query/rollup/QueryGraph.java | 57 ++++++++++++++++++++-- 1 file changed, 53 insertions(+), 4 deletions(-) (limited to 'src/uk/ac/ox/cs/pagoda/query/rollup') 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 { return axioms; } +// public Set getExistentialConditions(Map assignment) { +// if(!rollable_edges.isEmpty()) return null; +// +// OWLIndividual sub; +// Visitor visitor = new Visitor(factory, assignment); +// Set axioms = new HashSet<>(); +// for(Map.Entry> entry : concepts.map.entrySet()) { +// // TODO check correctness!!! +// if(existVars.contains(entry.getKey())) { +// OWLClassExpression conjunction = +// factory.getOWLObjectIntersectionOf(factory.getOWLThing()); +// for(OWLClassExpression owlClassExpression : entry.getValue()) { +// conjunction = factory.getOWLObjectIntersectionOf(conjunction, owlClassExpression.accept(visitor)); +// } +// axioms.add(conjunction); +//// continue; // previously the "then" contained only this +// } +// } +// return axioms; +// } + + public Set getExistentialAxioms() { + if(!rollable_edges.isEmpty()) return null; + + Set axioms = new HashSet<>(); + for(Map.Entry> entry : concepts.map.entrySet()) { + if(existVars.contains(entry.getKey())) { + OWLClassExpression conjunction = + factory.getOWLObjectIntersectionOf(factory.getOWLThing()); + for(OWLClassExpression owlClassExpression : entry.getValue()) { + conjunction = factory.getOWLObjectIntersectionOf(conjunction, owlClassExpression); + } + axioms.add(factory.getOWLSubClassOfAxiom(conjunction, factory.getOWLNothing())); + } + } + return axioms; + } + public Set getAssertions(Map assignment) { if(!rollable_edges.isEmpty()) return null; @@ -88,10 +126,21 @@ public class QueryGraph { Visitor visitor = new Visitor(factory, assignment); Set axioms = getPropertyAssertions(assignment); for(Map.Entry> entry : concepts.map.entrySet()) { - if(existVars.contains(entry.getKey())) continue; - sub = factory.getOWLNamedIndividual(IRI.create(getIndividual(entry.getKey(), assignment).getIRI())); - for(OWLClassExpression clsExp : entry.getValue()) { - axioms.add(factory.getOWLClassAssertionAxiom(clsExp.accept(visitor), sub)); + // TODO check correctness!!! + if(existVars.contains(entry.getKey())) { +// OWLClassExpression conjunction = +// factory.getOWLObjectIntersectionOf(factory.getOWLThing()); +// for(OWLClassExpression owlClassExpression : entry.getValue()) { +// conjunction = factory.getOWLObjectIntersectionOf(conjunction, owlClassExpression.accept(visitor)); +// } +// axioms.add(factory.getOWLSubClassOfAxiom(conjunction, factory.getOWLNothing())); + continue; // previously the "then" contained only this + } + else { + sub = factory.getOWLNamedIndividual(IRI.create(getIndividual(entry.getKey(), assignment).getIRI())); + for(OWLClassExpression clsExp : entry.getValue()) { + axioms.add(factory.getOWLClassAssertionAxiom(clsExp.accept(visitor), sub)); + } } } return axioms; -- cgit v1.2.3