1 package de.tud.plt.r43ples.existentobjects;
2
3 import org.apache.jena.query.QuerySolution;
4 import org.apache.jena.query.ResultSet;
5 import de.tud.plt.r43ples.management.Config;
6 import de.tud.plt.r43ples.triplestoreInterface.TripleStoreInterfaceSingleton;
7 import org.apache.logging.log4j.LogManager;
8 import org.apache.logging.log4j.Logger;
9
10 import java.util.HashMap;
11
12
13
14
15
16
17 public class RevisionControl {
18
19
20 private Logger logger = LogManager.getLogger(RevisionControl.class);
21
22
23
24
25
26
27
28
29 public HashMap<String, RevisionGraph> getRevisedGraphs() {
30
31 HashMap<String, RevisionGraph> revisionGraphMap = new HashMap<>();
32 String sparqlQuery = Config.prefixes
33 + String.format(""
34 + "SELECT DISTINCT ?graph "
35 + "WHERE {"
36 + " GRAPH <%s> { ?graph a rmo:RevisionGraph }"
37 + "} ORDER BY ?graph", Config.revision_graph);
38 ResultSet results = TripleStoreInterfaceSingleton.get().executeSelectQuery(sparqlQuery);
39 while (results.hasNext()) {
40 QuerySolution qs = results.next();
41 String graphName = qs.getResource("graph").toString();
42 RevisionGraph revisionGraph = new RevisionGraph(graphName);
43 revisionGraphMap.put(graphName, revisionGraph);
44 }
45
46 return revisionGraphMap;
47 }
48
49 }