Skip to contentPackage: Statement$StatementOntology
Statement$StatementOntology
Coverage
1: /**
2: * Copyright (C) 2016 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;
16:
17: import cz.cvut.kbss.ontodriver.exception.OntoDriverException;
18:
19: import java.net.URI;
20:
21: /**
22: * This interface represents a SPARQL statement.
23: *
24: * @author kidney
25: */
26: public interface Statement extends AutoCloseable {
27:
28: /**
29: * Specifies which ontology is used for statement evaluation.
30: */
31: enum StatementOntology {
32: /**
33: * Transactional ontology. May contain uncommitted changes which influence the statement evaluation.
34: */
35: TRANSACTIONAL,
36: /**
37: * The main ontology in the current state. No uncommitted changes are present in it.
38: */
39: CENTRAL
40: }
41:
42: /**
43: * Execute the specified SPARQL query.
44: *
45: * @param sparql The statement to execute
46: * @param contexts Specifies contexts against which to run the query. Since this parameter is optional, it is
47: * defined as varargs.
48: * @return {@code ResultSet} containing results of the query
49: * @throws OntoDriverException If an error occurs during query execution
50: */
51: ResultSet executeQuery(String sparql, URI... contexts) throws OntoDriverException;
52:
53: /**
54: * Execute the specified SPARQL update query. </p>
55: *
56: * @param sparql The statement to execute
57: * @param contexts Specifies contexts against which to run the query. Since this parameter is optional, it is
58: * defined as varargs.
59: * @throws OntoDriverException If an error occurs during query execution
60: */
61: void executeUpdate(String sparql, URI... contexts) throws OntoDriverException;
62:
63: /**
64: * Sets which ontology is used to evaluate this statement.
65: * <p>
66: * {@link Statement.StatementOntology#TRANSACTIONAL} ontology is the transactional
67: * snapshot. It may contain uncommitted changes and thus the query results may differ from evaluation against {@link
68: * Statement.StatementOntology#CENTRAL}.
69: *
70: * @param ontology Which ontology to use
71: */
72: void useOntology(StatementOntology ontology);
73:
74: /**
75: * Gets information about which ontology will be used to evaluate the statement.
76: *
77: * @return Which ontology will be used for evaluation
78: * @see #useOntology(StatementOntology)
79: */
80: StatementOntology getStatementOntology();
81: }