Skip to content

Package: QueryFactory

QueryFactory

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.jopa.sessions;
16:
17: import cz.cvut.kbss.jopa.model.query.Query;
18: import cz.cvut.kbss.jopa.model.query.TypedQuery;
19:
20: public interface QueryFactory {
21:
22: /**
23: * Creates query object representing a native SPARQL query. </p>
24: *
25: * @param sparql The query
26: * @return Query object
27: * @throws NullPointerException If {@code sparql} is {@code null}
28: */
29: Query createNativeQuery(String sparql);
30:
31: /**
32: * Creates typed query object representing a native SPARQL query. </p>
33: *
34: * @param sparql The query
35: * @param resultClass Type of the results
36: * @return Query object
37: * @throws NullPointerException If {@code sparql} or {@code resultClass} is {@code null}
38: */
39: <T> TypedQuery<T> createNativeQuery(String sparql, Class<T> resultClass);
40:
41: /**
42: * Creates query object representing a native SPARQL query. </p>
43: *
44: * @param query The query
45: * @return Query object
46: * @throws NullPointerException If {@code sparql} is {@code null}
47: */
48: Query createQuery(String query);
49:
50: /**
51: * Creates typed query object representing a native SPARQL query. </p>
52: *
53: * @param query The query
54: * @param resultClass Type of the results param URI of the ontology context against which the query will be
55: * evaluated
56: * @return Query object
57: * @throws NullPointerException If {@code sparql} or {@code resultClass} is {@code null}
58: */
59: <T> TypedQuery<T> createQuery(String query, Class<T> resultClass);
60: }