diff options
| author | RncLsn <rnc.lsn@gmail.com> | 2015-05-29 18:35:51 +0100 |
|---|---|---|
| committer | RncLsn <rnc.lsn@gmail.com> | 2015-05-29 18:35:51 +0100 |
| commit | 4b7253559c290b6fdd1c4122830f153fda85dd62 (patch) | |
| tree | 37c1487e4682be719dec532ca3d7e1af353fb9a1 /src/uk/ac/ox/cs/pagoda/reasoner/RLUQueryReasoner.java | |
| parent | 6a559a415b3bdb3048021839e5bcf5bbf5aa4bbd (diff) | |
| download | ACQuA-4b7253559c290b6fdd1c4122830f153fda85dd62.tar.gz ACQuA-4b7253559c290b6fdd1c4122830f153fda85dd62.zip | |
Disposable.
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/reasoner/RLUQueryReasoner.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/reasoner/RLUQueryReasoner.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/RLUQueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/RLUQueryReasoner.java index 547140a..d0712e1 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/RLUQueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/RLUQueryReasoner.java | |||
| @@ -10,6 +10,7 @@ import uk.ac.ox.cs.pagoda.reasoner.light.BasicQueryEngine; | |||
| 10 | import uk.ac.ox.cs.pagoda.rules.DatalogProgram; | 10 | import uk.ac.ox.cs.pagoda.rules.DatalogProgram; |
| 11 | import uk.ac.ox.cs.pagoda.util.Timer; | 11 | import uk.ac.ox.cs.pagoda.util.Timer; |
| 12 | import uk.ac.ox.cs.pagoda.util.Utility; | 12 | import uk.ac.ox.cs.pagoda.util.Utility; |
| 13 | import uk.ac.ox.cs.pagoda.util.disposable.DisposedException; | ||
| 13 | 14 | ||
| 14 | class RLUQueryReasoner extends QueryReasoner { | 15 | class RLUQueryReasoner extends QueryReasoner { |
| 15 | 16 | ||
| @@ -19,7 +20,7 @@ class RLUQueryReasoner extends QueryReasoner { | |||
| 19 | 20 | ||
| 20 | boolean multiStageTag, equalityTag; | 21 | boolean multiStageTag, equalityTag; |
| 21 | Timer t = new Timer(); | 22 | Timer t = new Timer(); |
| 22 | 23 | ||
| 23 | public RLUQueryReasoner(boolean multiStageTag, boolean considerEqualities) { | 24 | public RLUQueryReasoner(boolean multiStageTag, boolean considerEqualities) { |
| 24 | this.multiStageTag = multiStageTag; | 25 | this.multiStageTag = multiStageTag; |
| 25 | this.equalityTag = considerEqualities; | 26 | this.equalityTag = considerEqualities; |
| @@ -32,6 +33,7 @@ class RLUQueryReasoner extends QueryReasoner { | |||
| 32 | 33 | ||
| 33 | @Override | 34 | @Override |
| 34 | public void evaluate(QueryRecord queryRecord) { | 35 | public void evaluate(QueryRecord queryRecord) { |
| 36 | if(isDisposed()) throw new DisposedException(); | ||
| 35 | AnswerTuples ans = null; | 37 | AnswerTuples ans = null; |
| 36 | t.reset(); | 38 | t.reset(); |
| 37 | try { | 39 | try { |
| @@ -60,6 +62,7 @@ class RLUQueryReasoner extends QueryReasoner { | |||
| 60 | 62 | ||
| 61 | @Override | 63 | @Override |
| 62 | public void evaluateUpper(QueryRecord queryRecord) { | 64 | public void evaluateUpper(QueryRecord queryRecord) { |
| 65 | if(isDisposed()) throw new DisposedException(); | ||
| 63 | AnswerTuples ans = null; | 66 | AnswerTuples ans = null; |
| 64 | try { | 67 | try { |
| 65 | ans = rlUpperStore.evaluate(queryRecord.getQueryText(), queryRecord.getAnswerVariables()); | 68 | ans = rlUpperStore.evaluate(queryRecord.getQueryText(), queryRecord.getAnswerVariables()); |
| @@ -72,13 +75,14 @@ class RLUQueryReasoner extends QueryReasoner { | |||
| 72 | 75 | ||
| 73 | @Override | 76 | @Override |
| 74 | public void dispose() { | 77 | public void dispose() { |
| 78 | super.dispose(); | ||
| 75 | if (rlLowerStore != null) rlLowerStore.dispose(); | 79 | if (rlLowerStore != null) rlLowerStore.dispose(); |
| 76 | if (rlUpperStore != null) rlUpperStore.dispose(); | 80 | if (rlUpperStore != null) rlUpperStore.dispose(); |
| 77 | super.dispose(); | ||
| 78 | } | 81 | } |
| 79 | 82 | ||
| 80 | @Override | 83 | @Override |
| 81 | public void loadOntology(OWLOntology o) { | 84 | public void loadOntology(OWLOntology o) { |
| 85 | if(isDisposed()) throw new DisposedException(); | ||
| 82 | if (!equalityTag) { | 86 | if (!equalityTag) { |
| 83 | EqualitiesEliminator eliminator = new EqualitiesEliminator(o); | 87 | EqualitiesEliminator eliminator = new EqualitiesEliminator(o); |
| 84 | o = eliminator.getOutputOntology(); | 88 | o = eliminator.getOutputOntology(); |
| @@ -92,6 +96,7 @@ class RLUQueryReasoner extends QueryReasoner { | |||
| 92 | 96 | ||
| 93 | @Override | 97 | @Override |
| 94 | public boolean preprocess() { | 98 | public boolean preprocess() { |
| 99 | if(isDisposed()) throw new DisposedException(); | ||
| 95 | String datafile = importedData.toString(); | 100 | String datafile = importedData.toString(); |
| 96 | rlLowerStore.importRDFData("data", datafile); | 101 | rlLowerStore.importRDFData("data", datafile); |
| 97 | rlLowerStore.materialise("lower program", program.getLower().toString()); | 102 | rlLowerStore.materialise("lower program", program.getLower().toString()); |
| @@ -105,6 +110,7 @@ class RLUQueryReasoner extends QueryReasoner { | |||
| 105 | 110 | ||
| 106 | @Override | 111 | @Override |
| 107 | public boolean isConsistent() { | 112 | public boolean isConsistent() { |
| 113 | if(isDisposed()) throw new DisposedException(); | ||
| 108 | String[] X = new String[] { "X" }; | 114 | String[] X = new String[] { "X" }; |
| 109 | AnswerTuples ans = null; | 115 | AnswerTuples ans = null; |
| 110 | try { | 116 | try { |
| @@ -125,6 +131,5 @@ class RLUQueryReasoner extends QueryReasoner { | |||
| 125 | Utility.logDebug("The consistency of the data has not been determined yet."); | 131 | Utility.logDebug("The consistency of the data has not been determined yet."); |
| 126 | return true; | 132 | return true; |
| 127 | } | 133 | } |
| 128 | 134 | ||
| 129 | |||
| 130 | } | 135 | } |
