Skip to content

Package: Statement$StatementOntology

Statement$StatementOntology

nameinstructionbranchcomplexitylinemethod
static {...}
M: 0 C: 24
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%

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: * <p>
56: * The return value is optional and implementations may choose to return 0 by default.
57: *
58: * @param sparql The statement to execute
59: * @param contexts Specifies contexts against which to run the query. Since this parameter is optional, it is
60: * defined as varargs.
61: * @throws OntoDriverException If an error occurs during query execution
62: */
63: void executeUpdate(String sparql, URI... contexts) throws OntoDriverException;
64:
65: /**
66: * Sets which ontology is used to evaluate this statement.
67: * <p>
68: * {@link Statement.StatementOntology#TRANSACTIONAL} ontology is the transactional
69: * snapshot. It may contain uncommitted changes and thus the query results may differ from evaluation against {@link
70: * Statement.StatementOntology#CENTRAL}.
71: *
72: * @param ontology Which ontology to use
73: */
74: void useOntology(StatementOntology ontology);
75:
76: /**
77: * Gets information about which ontology will be used to evaluate the statement.
78: *
79: * @return Which ontology will be used for evaluation
80: * @see #useOntology(StatementOntology)
81: */
82: StatementOntology getStatementOntology();
83: }