diff options
Diffstat (limited to 'subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/PartialRelationTranslator.java')
-rw-r--r-- | subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/PartialRelationTranslator.java | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/PartialRelationTranslator.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/PartialRelationTranslator.java index fe8e8d6c..aee74eb3 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/PartialRelationTranslator.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/PartialRelationTranslator.java | |||
@@ -32,11 +32,11 @@ import tools.refinery.store.representation.TruthValue; | |||
32 | public final class PartialRelationTranslator extends PartialSymbolTranslator<TruthValue, Boolean> { | 32 | public final class PartialRelationTranslator extends PartialSymbolTranslator<TruthValue, Boolean> { |
33 | private final PartialRelation partialRelation; | 33 | private final PartialRelation partialRelation; |
34 | private PartialRelationRewriter rewriter; | 34 | private PartialRelationRewriter rewriter; |
35 | private Query<Boolean> query; | 35 | private RelationalQuery query; |
36 | private Query<Boolean> may; | 36 | private RelationalQuery may; |
37 | private Query<Boolean> must; | 37 | private RelationalQuery must; |
38 | private Query<Boolean> candidateMay; | 38 | private RelationalQuery candidateMay; |
39 | private Query<Boolean> candidateMust; | 39 | private RelationalQuery candidateMust; |
40 | private RoundingMode roundingMode; | 40 | private RoundingMode roundingMode; |
41 | 41 | ||
42 | private PartialRelationTranslator(PartialRelation partialRelation) { | 42 | private PartialRelationTranslator(PartialRelation partialRelation) { |
@@ -197,20 +197,41 @@ public final class PartialRelationTranslator extends PartialSymbolTranslator<Tru | |||
197 | } | 197 | } |
198 | 198 | ||
199 | private void liftQueries(ModelStoreBuilder storeBuilder) { | 199 | private void liftQueries(ModelStoreBuilder storeBuilder) { |
200 | if (query != null) { | 200 | if (rewriter instanceof QueryBasedRelationRewriter queryBasedRelationRewriter) { |
201 | var reasoningBuilder = storeBuilder.getAdapter(ReasoningBuilder.class); | 201 | liftQueriesFromQueryBasedRewriter(queryBasedRelationRewriter); |
202 | if (may == null) { | 202 | } else if (query != null) { |
203 | may = reasoningBuilder.lift(Modality.MAY, Concreteness.PARTIAL, query); | 203 | liftQueriesFromFourValuedQuery(storeBuilder); |
204 | } | 204 | } |
205 | if (must == null) { | 205 | } |
206 | must = reasoningBuilder.lift(Modality.MUST, Concreteness.PARTIAL, query); | 206 | |
207 | } | 207 | private void liftQueriesFromQueryBasedRewriter(QueryBasedRelationRewriter queryBasedRelationRewriter) { |
208 | if (candidateMay == null) { | 208 | if (may == null) { |
209 | candidateMay = reasoningBuilder.lift(Modality.MAY, Concreteness.CANDIDATE, query); | 209 | may = queryBasedRelationRewriter.getMay(); |
210 | } | 210 | } |
211 | if (candidateMust == null) { | 211 | if (must == null) { |
212 | candidateMust = reasoningBuilder.lift(Modality.MAY, Concreteness.CANDIDATE, query); | 212 | must = queryBasedRelationRewriter.getMust(); |
213 | } | 213 | } |
214 | if (candidateMay == null) { | ||
215 | candidateMay = queryBasedRelationRewriter.getCandidateMay(); | ||
216 | } | ||
217 | if (candidateMust == null) { | ||
218 | candidateMust = queryBasedRelationRewriter.getCandidateMust(); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | private void liftQueriesFromFourValuedQuery(ModelStoreBuilder storeBuilder) { | ||
223 | var reasoningBuilder = storeBuilder.getAdapter(ReasoningBuilder.class); | ||
224 | if (may == null) { | ||
225 | may = reasoningBuilder.lift(Modality.MAY, Concreteness.PARTIAL, query); | ||
226 | } | ||
227 | if (must == null) { | ||
228 | must = reasoningBuilder.lift(Modality.MUST, Concreteness.PARTIAL, query); | ||
229 | } | ||
230 | if (candidateMay == null) { | ||
231 | candidateMay = reasoningBuilder.lift(Modality.MAY, Concreteness.CANDIDATE, query); | ||
232 | } | ||
233 | if (candidateMust == null) { | ||
234 | candidateMust = reasoningBuilder.lift(Modality.MAY, Concreteness.CANDIDATE, query); | ||
214 | } | 235 | } |
215 | } | 236 | } |
216 | 237 | ||