From 39b60d4225f5efa4e0287a2c6ce69d90391c69db Mon Sep 17 00:00:00 2001 From: RncLsn Date: Fri, 3 Jul 2015 19:09:31 +0100 Subject: Many little changes. --- src/uk/ac/ox/cs/pagoda/query/QueryRecord.java | 26 ++++++++++++++++------ .../ac/ox/cs/pagoda/query/rollup/QueryGraph.java | 5 +++-- 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'src/uk/ac/ox/cs/pagoda/query') diff --git a/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java b/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java index 291af27..d88376f 100644 --- a/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java +++ b/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java @@ -171,14 +171,10 @@ public class QueryRecord extends Disposable { } public String getQueryText() { - if(isDisposed()) throw new DisposedException(); - return queryText; } public String getQueryID() { - if(isDisposed()) throw new DisposedException(); - return stringQueryID; } @@ -193,8 +189,6 @@ public class QueryRecord extends Disposable { } public String toString() { - if(isDisposed()) throw new DisposedException(); - return queryText; } @@ -281,6 +275,20 @@ public class QueryRecord extends Disposable { } } + public Map getStatistics() { + HashMap result = new HashMap<>(); + + double totalTime = 0.0; + for(Step step : Step.values()) { + result.put(step.toString(), Double.toString(timer[step.ordinal()])); + totalTime += timer[step.ordinal()]; + } + result.put("totalTime", Double.toString(totalTime)); + result.put("difficulty", difficulty.toString()); + + return result; + } + public String outputSoundAnswerTuple() { if(isDisposed()) throw new DisposedException(); @@ -359,6 +367,8 @@ public class QueryRecord extends Disposable { Utility.logError("The answer (" + answer + ") cannot be removed, because it is not in the upper bound."); gapAnswerTuples.remove(answer); } + int numOfUpperBoundAnswers = soundAnswerTuples.size() + gapAnswerTuples.size(); + Utility.logInfo("Upper bound answers updated: " + numOfUpperBoundAnswers); } public void addLowerBoundAnswers(Collection answers) { @@ -722,7 +732,9 @@ public class QueryRecord extends Disposable { @Override public String toString() { - return WordUtils.capitalizeFully(super.toString(), new char[]{'_'}).replace("_", ""); + String s = super.toString(); + if(s == null) return null; + return WordUtils.capitalizeFully(s, new char[]{'_'}).replace("_", ""); } } 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 a09cf5b..116e724 100644 --- a/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java +++ b/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java @@ -102,16 +102,17 @@ public class QueryGraph { // return axioms; // } - public Set getExistentialAxioms() { + public Set getExistentialAxioms(Map assignment) { if(!rollable_edges.isEmpty()) return null; + Visitor visitor = new Visitor(factory, assignment); 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); + conjunction = factory.getOWLObjectIntersectionOf(conjunction, owlClassExpression.accept(visitor)); } axioms.add(factory.getOWLSubClassOfAxiom(conjunction, factory.getOWLNothing())); } -- cgit v1.2.3