1 /*
2 * Copyright 2018-2022 Medical Information Systems Research Group (https://medical.zcu.cz),
3 * Department of Computer Science and Engineering, University of West Bohemia.
4 * Address: Univerzitni 8, 306 14 Plzen, Czech Republic.
5 *
6 * Author Petr Vcelak (vcelak@kiv.zcu.cz).
7 *
8 * This file is part of MRECore project.
9 *
10 * MRECore is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License.
13 *
14 * MRECore is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with MRECore. If not, see <http://www.gnu.org/licenses/>.
21 */
22 package cz.zcu.mre.service.data;
23
24 import cz.zcu.mre.data.core.MREData;
25 import org.apache.jena.rdf.model.Resource;
26
27 /**
28 *
29 * String SPARQL Builder Interface for MREData or/and Java Beans.
30 *
31 * @author Petr Vcelak (vcelak@kiv.zcu.cz)
32 */
33 public interface SPARQLBuilderString extends SPARQLBuilderVariables {
34
35 String ask(Object instance);
36
37 String ask(String queryTriples);
38
39 /**
40 * Build ASK query for test if the instance is persistent/exist.
41 *
42 * @param instance MREData instance.
43 * @return String with ASK query with only one triple (instance URI,
44 * rdf:type property and class URI for object).
45 */
46 String askExist(MREData instance);
47
48 String delete(Object instance);
49
50 String deleteAll(Object instance);
51
52 String getGraph();
53
54 String insert(Object instance);
55
56 String insertAll(Object instance);
57
58 /**
59 * Generate SELECT for list of instances that is based on the instance
60 * (type) and its attributes.
61 *
62 * This can work as query for "select all instances" and "select instance(s)
63 * with value of one/more attributes".
64 *
65 * @param instance Instance that defines member attributes and rdf:type.
66 * @return Generated SELECT query.
67 */
68 String select(Object instance);
69
70 String selectType(String resourceURI);
71
72 String selectType(Resource resource);
73
74 void setGraph(String graph);
75
76 String update(Object instanceOld, Object instanceNew);
77
78 String updateAll(Object instanceOld, Object instanceNew);
79
80 }