Skip to content

Method: executeAskQuery(Query, Statement.StatementOntology)

1: /**
2: * Copyright (C) 2020 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.ontodriver.jena.connector;
16:
17: import cz.cvut.kbss.ontodriver.jena.exception.JenaDriverException;
18: import cz.cvut.kbss.ontodriver.jena.query.AbstractResultSet;
19: import org.apache.jena.query.Query;
20: import org.apache.jena.rdf.model.Property;
21: import org.apache.jena.rdf.model.RDFNode;
22: import org.apache.jena.rdf.model.Resource;
23: import org.apache.jena.rdf.model.Statement;
24:
25: import java.util.Collection;
26:
27: /**
28: * This connector does not support inference, it wraps a regular {@link StorageConnector} and calls its regular methods
29: * instead of performing any inference, e.g. {@link StorageConnector#contains(Resource, Property, RDFNode, String)} for
30: * {@link #containsWithInference(Resource, Property, RDFNode, String)}.
31: * <p>
32: * Thus, inference-based methods give the same results as regular connector methods.
33: */
34: class DummyInferredStorageConnector implements InferredStorageConnector {
35:
36: private final StorageConnector connector;
37:
38: DummyInferredStorageConnector(StorageConnector connector) {
39: this.connector = connector;
40: }
41:
42: @Override
43: public Collection<Statement> findWithInference(Resource subject, Property property, RDFNode value, String context) {
44: return connector.find(subject, property, value, context);
45: }
46:
47: @Override
48: public boolean containsWithInference(Resource subject, Property property, RDFNode value, String context) {
49: return connector.contains(subject, property, value, context);
50: }
51:
52: @Override
53: public boolean isConsistent(String context) {
54: return true;
55: }
56:
57: @Override
58: public AbstractResultSet executeSelectQuery(Query query,
59: cz.cvut.kbss.ontodriver.Statement.StatementOntology target) throws
60: JenaDriverException {
61: return connector.executeSelectQuery(query, target);
62: }
63:
64: @Override
65: public AbstractResultSet executeAskQuery(Query query,
66: cz.cvut.kbss.ontodriver.Statement.StatementOntology target) throws
67: JenaDriverException {
68: return connector.executeAskQuery(query, target);
69: }
70:
71: @Override
72: public void executeUpdate(String query, cz.cvut.kbss.ontodriver.Statement.StatementOntology target) throws
73: JenaDriverException {
74: connector.executeUpdate(query, target);
75: }
76: }