blob: 7d5401c623991e8c3ed98d1c143e2f37deae3fb7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/*
* SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
*
* SPDX-License-Identifier: EPL-2.0
*/
package tools.refinery.store.query.viatra.internal.localsearch;
import tools.refinery.viatra.runtime.localsearch.matcher.integration.AbstractLocalSearchResultProvider;
import tools.refinery.viatra.runtime.localsearch.matcher.integration.LocalSearchBackend;
import tools.refinery.viatra.runtime.localsearch.matcher.integration.LocalSearchHints;
import tools.refinery.viatra.runtime.localsearch.plan.IPlanProvider;
import tools.refinery.viatra.runtime.localsearch.plan.SimplePlanProvider;
import tools.refinery.viatra.runtime.matchers.backend.IMatcherCapability;
import tools.refinery.viatra.runtime.matchers.backend.IQueryBackend;
import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactory;
import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint;
import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext;
import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery;
public class RelationalLocalSearchBackendFactory implements IQueryBackendFactory {
public static final RelationalLocalSearchBackendFactory INSTANCE = new RelationalLocalSearchBackendFactory();
private RelationalLocalSearchBackendFactory() {
}
@Override
public IQueryBackend create(IQueryBackendContext context) {
return new LocalSearchBackend(context) {
// Create a new {@link IPlanProvider}, because the original {@link LocalSearchBackend#planProvider} is not
// accessible.
private final IPlanProvider planProvider = new SimplePlanProvider(context.getLogger());
@Override
protected AbstractLocalSearchResultProvider initializeResultProvider(PQuery query,
QueryEvaluationHint hints) {
return new RelationalLocalSearchResultProvider(this, context, query, planProvider, hints);
}
@Override
public IQueryBackendFactory getFactory() {
return RelationalLocalSearchBackendFactory.this;
}
};
}
@Override
public Class<? extends IQueryBackend> getBackendClass() {
return LocalSearchBackend.class;
}
@Override
public IMatcherCapability calculateRequiredCapability(PQuery pQuery, QueryEvaluationHint queryEvaluationHint) {
return LocalSearchHints.parse(queryEvaluationHint);
}
@Override
public boolean isCaching() {
return false;
}
}
|