diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java index 1f08fdf..326bf7e 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java | |||
| @@ -1,10 +1,8 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.reasoner; | 1 | package uk.ac.ox.cs.pagoda.reasoner; |
| 2 | 2 | ||
| 3 | import com.google.gson.Gson; | 3 | import com.google.gson.Gson; |
| 4 | import com.google.gson.GsonBuilder; | ||
| 5 | import org.semanticweb.owlapi.model.OWLOntology; | 4 | import org.semanticweb.owlapi.model.OWLOntology; |
| 6 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; | 5 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; |
| 7 | import uk.ac.ox.cs.pagoda.query.AnswerTuple; | ||
| 8 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; | 6 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; |
| 9 | import uk.ac.ox.cs.pagoda.query.QueryManager; | 7 | import uk.ac.ox.cs.pagoda.query.QueryManager; |
| 10 | import uk.ac.ox.cs.pagoda.query.QueryRecord; | 8 | import uk.ac.ox.cs.pagoda.query.QueryRecord; |
| @@ -202,11 +200,7 @@ public abstract class QueryReasoner { | |||
| 202 | } | 200 | } |
| 203 | 201 | ||
| 204 | Timer t = new Timer(); | 202 | Timer t = new Timer(); |
| 205 | Gson gson = new GsonBuilder() | 203 | Gson gson = QueryRecord.GsonCreator.getInstance(); |
| 206 | .registerTypeAdapter(AnswerTuple.class, new AnswerTuple.AnswerTupleSerializer()) | ||
| 207 | .registerTypeAdapter(QueryRecord.class, new QueryRecord.QueryRecordSerializer()) | ||
| 208 | .setPrettyPrinting() | ||
| 209 | .create(); | ||
| 210 | for (QueryRecord record: queryRecords) { | 204 | for (QueryRecord record: queryRecords) { |
| 211 | // if (Integer.parseInt(record.getQueryID()) != 218) continue; | 205 | // if (Integer.parseInt(record.getQueryID()) != 218) continue; |
| 212 | Utility.logInfo("---------- start evaluating Query " + record.getQueryID() + " ----------", | 206 | Utility.logInfo("---------- start evaluating Query " + record.getQueryID() + " ----------", |
| @@ -226,7 +220,7 @@ public abstract class QueryReasoner { | |||
| 226 | } | 220 | } |
| 227 | // TODO it can handle one call only | 221 | // TODO it can handle one call only |
| 228 | // if you call twice, you will end up with a json file with multiple roots | 222 | // if you call twice, you will end up with a json file with multiple roots |
| 229 | gson.toJson(queryRecords, answerWriter); | 223 | if(answerWriter != null) gson.toJson(queryRecords, answerWriter); |
| 230 | queryRecords.stream().forEach(record -> record.dispose()); | 224 | queryRecords.stream().forEach(record -> record.dispose()); |
| 231 | } | 225 | } |
| 232 | 226 | ||
| @@ -251,5 +245,5 @@ public abstract class QueryReasoner { | |||
| 251 | public static QueryReasoner getHermiTReasoner(boolean toCheckSatisfiability) { | 245 | public static QueryReasoner getHermiTReasoner(boolean toCheckSatisfiability) { |
| 252 | return new HermiTReasoner(toCheckSatisfiability); | 246 | return new HermiTReasoner(toCheckSatisfiability); |
| 253 | } | 247 | } |
| 254 | 248 | ||
| 255 | } | 249 | } |
