1 package de.tud.plt.r43ples.dataset;
2
3 import de.tud.plt.r43ples.core.MergeTypes;
4 import de.tud.plt.r43ples.core.R43plesCoreInterface;
5 import de.tud.plt.r43ples.core.R43plesCoreSingleton;
6 import de.tud.plt.r43ples.exception.InternalErrorException;
7 import de.tud.plt.r43ples.existentobjects.*;
8 import de.tud.plt.r43ples.iohelper.ResourceManagement;
9 import org.apache.logging.log4j.LogManager;
10 import org.apache.logging.log4j.Logger;
11
12
13
14
15
16
17
18
19 public class SampleDataSet {
20
21
22 private static Logger logger = LogManager.getLogger(SampleDataSet.class);
23
24
25 private static final String user = "butler";
26
27
28
29 public static DataSetGenerationResult createSampleDataset1() throws InternalErrorException {
30
31 R43plesCoreInterface r43plesCore = R43plesCoreSingleton.getInstance();
32
33 DataSetGenerationResult result = new DataSetGenerationResult();
34 String graphName = "http://test.com/r43ples-dataset-1";
35 result.graphName = graphName;
36 RevisionGraph graph = new RevisionGraph(graphName);
37 graph.purgeRevisionInformation();
38
39 String masterBranch = "master";
40
41 InitialCommit initialCommit = r43plesCore.createInitialCommit(graphName, null, null, user, "Create graph");
42 String revisionNumber0 = initialCommit.getGeneratedRevision().getRevisionIdentifier();
43 result.revisions.put("master-0", revisionNumber0);
44
45 UpdateCommit commit1 = r43plesCore.createUpdateCommit(graphName,
46 ResourceManagement.getContentFromResource("samples/dataset1/added-1.nt"),
47 ResourceManagement.getContentFromResource("samples/dataset1/removed-1.nt"),
48 user,
49 "test commit message 1",
50 masterBranch);
51 String revisionNumber1 = commit1.getGeneratedRevision().getRevisionIdentifier();
52 result.revisions.put("master-1", revisionNumber1);
53
54 UpdateCommit commit2 = r43plesCore.createUpdateCommit(graphName,
55 ResourceManagement.getContentFromResource("samples/dataset1/added-2.nt"),
56 ResourceManagement.getContentFromResource("samples/dataset1/removed-2.nt"),
57 user,
58 "test commit message 2",
59 masterBranch);
60 String revisionNumber2 = commit2.getGeneratedRevision().getRevisionIdentifier();
61 result.revisions.put("master-2", revisionNumber2);
62
63 UpdateCommit commit3 = r43plesCore.createUpdateCommit(graphName,
64 ResourceManagement.getContentFromResource("samples/dataset1/added-3.nt"),
65 ResourceManagement.getContentFromResource("samples/dataset1/removed-3.nt"),
66 user,
67 "test commit message 3",
68 masterBranch);
69 String revisionNumber3 = commit3.getGeneratedRevision().getRevisionIdentifier();
70 result.revisions.put("master-3", revisionNumber3);
71
72 UpdateCommit commit4 = r43plesCore.createUpdateCommit(graphName,
73 ResourceManagement.getContentFromResource("samples/dataset1/added-4.nt"),
74 ResourceManagement.getContentFromResource("samples/dataset1/removed-4.nt"),
75 user,
76 "test commit message 4",
77 masterBranch);
78 String revisionNumber4 = commit4.getGeneratedRevision().getRevisionIdentifier();
79 result.revisions.put("master-4", revisionNumber4);
80
81 UpdateCommit commit5 = r43plesCore.createUpdateCommit(graphName,
82 ResourceManagement.getContentFromResource("samples/dataset1/added-5.nt"),
83 ResourceManagement.getContentFromResource("samples/dataset1/removed-5.nt"),
84 user,
85 "test commit message 5",
86 masterBranch);
87 String revisionNumber5 = commit5.getGeneratedRevision().getRevisionIdentifier();
88 result.revisions.put("master-5", revisionNumber5);
89 return result;
90 }
91
92 public static DataSetGenerationResult createSampleDataset2() throws InternalErrorException {
93
94 R43plesCoreInterface r43plesCore = R43plesCoreSingleton.getInstance();
95
96 DataSetGenerationResult result = new DataSetGenerationResult();
97 String graphName = "http://test.com/r43ples-dataset-2";
98 result.graphName = graphName;
99 RevisionGraph graph = new RevisionGraph(graphName);
100 graph.purgeRevisionInformation();
101
102 InitialCommit initialCommit = r43plesCore.createInitialCommit(graphName, null, null, user, "Create graph");
103 String revisionNumber0 = initialCommit.getGeneratedRevision().getRevisionIdentifier();
104 result.revisions.put("master-0", revisionNumber0);
105
106 UpdateCommit commit1 = r43plesCore.createUpdateCommit(graphName,
107 ResourceManagement.getContentFromResource("samples/dataset2/added-1.nt"),
108 ResourceManagement.getContentFromResource("samples/dataset2/removed-1.nt"), user,
109 "test commit message 1", "master");
110 String revisionNumber1 = commit1.getGeneratedRevision().getRevisionIdentifier();
111 result.revisions.put("master-1", revisionNumber1);
112
113 UpdateCommit commit2 = r43plesCore.createUpdateCommit(graphName,
114 ResourceManagement.getContentFromResource("samples/dataset2/added-2.nt"),
115 ResourceManagement.getContentFromResource("samples/dataset2/removed-2.nt"), user,
116 "test commit message 2", "master");
117 String revisionNumber2 = commit2.getGeneratedRevision().getRevisionIdentifier();
118 result.revisions.put("master-2", revisionNumber2);
119
120 logger.info("SampleDataset2 successfully created");
121 return result;
122 }
123
124 public static DataSetGenerationResult createSampleDataset3() throws InternalErrorException {
125 R43plesCoreInterface r43plesCore = R43plesCoreSingleton.getInstance();
126
127 DataSetGenerationResult result = new DataSetGenerationResult();
128 String graphName = "http://test.com/r43ples-dataset-3";
129 result.graphName = graphName;
130 RevisionGraph graph = new RevisionGraph(graphName);
131 graph.purgeRevisionInformation();
132
133 InitialCommit initialCommit = r43plesCore.createInitialCommit(graphName, null, null, user, "Create graph");
134 String revisionNumber0 = initialCommit.getGeneratedRevision().getRevisionIdentifier();
135 result.revisions.put("master-0", revisionNumber0);
136
137 UpdateCommit commit1 = r43plesCore.createUpdateCommit(graphName,
138 ResourceManagement.getContentFromResource("samples/dataset3/added-1.nt"),
139 ResourceManagement.getContentFromResource("samples/dataset3/removed-1.nt"), user,
140 "test commit message 1", "master");
141 String revisionNumber1 = commit1.getGeneratedRevision().getRevisionIdentifier();
142 result.revisions.put("master-1", revisionNumber1);
143
144 String branchNameB1 = "b1";
145 DatasetGenerationManagement.createNewBranch(user, "Create a new branch B1", graphName, revisionNumber1, branchNameB1);
146
147 UpdateCommit commitB1_0 = r43plesCore.createUpdateCommit(graphName,
148 ResourceManagement.getContentFromResource("samples/dataset3/added-2.nt"),
149 ResourceManagement.getContentFromResource("samples/dataset3/removed-2.nt"), user,
150 "test commit message 2", branchNameB1);
151 String revisionB1_0 = commitB1_0.getGeneratedRevision().getRevisionIdentifier();
152 result.revisions.put("b1-0", revisionB1_0);
153
154 UpdateCommit commit3 = r43plesCore.createUpdateCommit(graphName,
155 ResourceManagement.getContentFromResource("samples/dataset3/added-3.nt"),
156 ResourceManagement.getContentFromResource("samples/dataset3/removed-3.nt"), user,
157 "test commit message 3", "master");
158 String revisionNumber3 = commit3.getGeneratedRevision().getRevisionIdentifier();
159 result.revisions.put("master-3", revisionNumber3);
160
161 UpdateCommit commit4 = r43plesCore.createUpdateCommit(graphName,
162 ResourceManagement.getContentFromResource("samples/dataset3/added-4.nt"),
163 ResourceManagement.getContentFromResource("samples/dataset3/removed-4.nt"), user,
164 "test commit message 4", "master");
165 String revisionNumber4 = commit4.getGeneratedRevision().getRevisionIdentifier();
166 result.revisions.put("master-4", revisionNumber4);
167
168 ThreeWayMergeCommit mergeCommit5 = r43plesCore.createThreeWayMergeCommit(graphName,
169 branchNameB1, "master",
170 user, "test commit message 5",
171 null, null, MergeTypes.AUTO, false);
172 String revisionNumber5 = mergeCommit5.getGeneratedRevision().getRevisionIdentifier();
173 result.revisions.put("master-5", revisionNumber5);
174
175 return result;
176 }
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196 public static DataSetGenerationResult createSampleDataSetMerging() throws InternalErrorException {
197 R43plesCoreInterface r43plesCore = R43plesCoreSingleton.getInstance();
198
199 DataSetGenerationResult result = new DataSetGenerationResult();
200 String graphName = "http://test.com/r43ples-dataset-merging";
201 result.graphName = graphName;
202
203 RevisionGraph graph = new RevisionGraph(graphName);
204
205
206 graph.purgeRevisionInformation();
207
208 InitialCommit initialCommit = r43plesCore.createInitialCommit(graphName, null, null, user, "Create graph");
209 String revision0 = initialCommit.getGeneratedRevision().getRevisionIdentifier();
210 result.revisions.put("master-0", revision0);
211
212
213 String triples = "<http://example.com/testS> <http://example.com/testP> \"A\". \n"
214 + "<http://example.com/testS> <http://example.com/testP> \"B\". \n"
215 + "<http://example.com/testS> <http://example.com/testP> \"C\". \n";
216 UpdateCommit commit1 = r43plesCore.createUpdateCommit(graphName, triples, null, user, "Initial commit", "master");
217 String revision1 = commit1.getGeneratedRevision().getRevisionIdentifier();
218 result.revisions.put("master-1", revision1);
219
220
221 String branchNameB1 = "b1";
222 DatasetGenerationManagement.createNewBranch(user, "Create a new branch B1", graphName, revision1, branchNameB1);
223
224
225 String branchNameB2 = "b2";
226 DatasetGenerationManagement.createNewBranch(user, "Create a new branch B2", graphName, revision1, branchNameB2);
227
228
229 String triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"D\". \n"
230 + "<http://example.com/testS> <http://example.com/testP> \"E\". \n";
231 String triplesDelete = "<http://example.com/testS> <http://example.com/testP> \"A\". \n";
232 UpdateCommit commitB1_0 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user, "First commit to B1", branchNameB1);
233 String revisionB1_0 = commitB1_0.getGeneratedRevision().getRevisionIdentifier();
234 result.revisions.put("b1-0", revisionB1_0);
235
236
237 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"G\". \n";
238 triplesDelete = "<http://example.com/testS> <http://example.com/testP> \"D\". \n";
239 UpdateCommit commitB1_1 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user, "Second commit to B1", branchNameB1);
240 String revisionB1_1 = commitB1_1.getGeneratedRevision().getRevisionIdentifier();
241 result.revisions.put("b1-1", revisionB1_1);
242
243
244 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"D\". \n"
245 + "<http://example.com/testS> <http://example.com/testP> \"H\". \n";
246 triplesDelete = "<http://example.com/testS> <http://example.com/testP> \"C\". \n";
247 UpdateCommit commitB2_0 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user, "First commit to B2", branchNameB2);
248 String revisionB2_0 = commitB2_0.getGeneratedRevision().getRevisionIdentifier();
249 result.revisions.put("b2-0", revisionB2_0);
250
251
252 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"I\". \n";
253 UpdateCommit commitB2_1 = r43plesCore.createUpdateCommit(graphName, triplesInsert, null, user, "Second commit to B2", branchNameB2);
254 String revisionB2_1 = commitB2_1.getGeneratedRevision().getRevisionIdentifier();
255 result.revisions.put("b2-1", revisionB2_1);
256
257
258 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"J\". \n";
259 UpdateCommit commitB2_2 = r43plesCore.createUpdateCommit(graphName, triplesInsert, null, user, "Third commit to B2", branchNameB2);
260 String revisionB2_2 = commitB2_2.getGeneratedRevision().getRevisionIdentifier();
261 result.revisions.put("b2-2", revisionB2_2);
262
263 logger.info("Example graph <" + graphName +"> created.");
264 return result;
265 }
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285 public static String createSampleDataSetRebase() throws InternalErrorException {
286 R43plesCoreInterface r43plesCore = R43plesCoreSingleton.getInstance();
287
288 String graphName = "http://test.com/r43ples-dataset-rebase";
289
290 RevisionGraph graph = new RevisionGraph(graphName);
291
292
293 graph.purgeRevisionInformation();
294
295 InitialCommit initialCommit = r43plesCore.createInitialCommit(graphName, null, null, user, "Create graph");
296 String revision0 = initialCommit.getGeneratedRevision().getRevisionIdentifier();
297
298
299 String triples = "<http://example.com/testS> <http://example.com/testP> \"A\". \n"
300 + "<http://example.com/testS> <http://example.com/testP> \"B\". \n"
301 + "<http://example.com/testS> <http://example.com/testP> \"C\". \n";
302 UpdateCommit commit1 = r43plesCore.createUpdateCommit(graphName, triples, null, user, "Initial commit", "master");
303 String revision1 = commit1.getGeneratedRevision().getRevisionIdentifier();
304
305
306 String branchNameB1 = "b1";
307 DatasetGenerationManagement.createNewBranch(user, "Create a new branch B1", graphName, revision1, branchNameB1);
308
309
310 String branchNameB2 = "b2";
311 DatasetGenerationManagement.createNewBranch(user, "Create a new branch B2", graphName, revision1, branchNameB2);
312
313
314 String triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"D\". \n"
315 + "<http://example.com/testS> <http://example.com/testP> \"E\". \n";
316 UpdateCommit commitB1_0 = r43plesCore.createUpdateCommit(graphName, triplesInsert, null, user, "First commit to B1", branchNameB1);
317 String revisionB1_0 = commitB1_0.getGeneratedRevision().getRevisionIdentifier();
318
319
320 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"H\". \n";
321 String triplesDelete = "<http://example.com/testS> <http://example.com/testP> \"C\". \n";
322 UpdateCommit commitB2_0 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user, "First commit to B2", branchNameB2);
323 String revisionB2_0 = commitB2_0.getGeneratedRevision().getRevisionIdentifier();
324
325
326 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"G\". \n";
327 UpdateCommit commitB1_1 = r43plesCore.createUpdateCommit(graphName, triplesInsert, null, user, "Second commit to B1", branchNameB1);
328 String revisionB1_1 = commitB1_1.getGeneratedRevision().getRevisionIdentifier();
329
330
331 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"I\". \n";
332 UpdateCommit commitB2_1 = r43plesCore.createUpdateCommit(graphName, triplesInsert, null, user, "Second commit to B2", branchNameB2);
333 String revisionB2_1 = commitB2_1.getGeneratedRevision().getRevisionIdentifier();
334
335
336 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"J\". \n";
337 UpdateCommit commitB2_2 = r43plesCore.createUpdateCommit(graphName, triplesInsert, null, user, "Third commit to B2", branchNameB2);
338 String revisionB2_2 = commitB2_2.getGeneratedRevision().getRevisionIdentifier();
339
340 logger.info("Example graph <" + graphName + "> created.");
341
342 return graphName;
343 }
344
345
346
347
348
349
350
351 public static String createSampleDataSetMergingClasses() throws InternalErrorException {
352 R43plesCoreInterface r43plesCore = R43plesCoreSingleton.getInstance();
353
354 String graphName = "http://test.com/r43ples-dataset-merging-classes";
355
356 RevisionGraph graph = new RevisionGraph(graphName);
357
358
359 String initialContentFilePath = "verification/ExampleGraphClasses_initial.triples";
360
361
362 String initialContent = ResourceManagement.getContentFromResource(initialContentFilePath);
363
364
365 graph.purgeRevisionInformation();
366
367 InitialCommit initialCommit = r43plesCore.createInitialCommit(graphName, null, null, user, "Create graph");
368 String revision0 = initialCommit.getGeneratedRevision().getRevisionIdentifier();
369
370
371 UpdateCommit commit1 = r43plesCore.createUpdateCommit(graphName, initialContent, null, user, "Initial commit", "master");
372 String revision1 = commit1.getGeneratedRevision().getRevisionIdentifier();
373
374
375 String branchNameB1 = "b1";
376 DatasetGenerationManagement.createNewBranch(user, "Create a new branch B1", graphName, revision1, branchNameB1);
377
378
379 String branchNameB2 = "b2";
380 DatasetGenerationManagement.createNewBranch(user, "Create a new branch B2", graphName, revision1, branchNameB2);
381
382
383 String insertT4 = "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://eatld.et.tu-dresden.de/mso/Unit> . \n"
384 + "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://www.w3.org/2000/01/rdf-schema#label> \"T4\"@en . \n"
385 + "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://eatld.et.tu-dresden.de/mso/rfid> \"E00401007837683C\"@en . \n"
386 + "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://eatld.et.tu-dresden.de/mso/hasEquipment> <http://eatld.et.tu-dresden.de/batch/A3A5R02ZZU> . \n"
387 + "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://eatld.et.tu-dresden.de/mso/isPartOfProcessCell> <http://eatld.et.tu-dresden.de/batch/A3A5R03UZU> . \n"
388 + "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://eatld.et.tu-dresden.de/mso/hasEquipment> <http://eatld.et.tu-dresden.de/batch/A3A5R06OZU> . \n"
389 + "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://eatld.et.tu-dresden.de/mso/hasEquipment> <http://eatld.et.tu-dresden.de/batch/A3A5R01ZZU> . \n"
390 + "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://eatld.et.tu-dresden.de/mso/comosUid> \"A3A5R07QZU\"@en . \n"
391 + "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://eatld.et.tu-dresden.de/mso/plantID> \"=TUDPLT.A1.T4\"@en . \n"
392 + "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://eatld.et.tu-dresden.de/mso/hasEquipment> <http://eatld.et.tu-dresden.de/batch/A3A5R02BZU> . \n"
393 + "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://eatld.et.tu-dresden.de/mso/hasEquipment> <http://eatld.et.tu-dresden.de/batch/A3A5R1AMZU> . \n"
394 + "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://eatld.et.tu-dresden.de/mso/hasEquipment> <http://eatld.et.tu-dresden.de/batch/A3A5R05NZU> . \n"
395 + "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://eatld.et.tu-dresden.de/mso/hasEquipment> <http://eatld.et.tu-dresden.de/batch/A3A5R01PZU> . \n"
396 + "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> <http://www.w3.org/2000/01/rdf-schema#comment> \"Subplant flush\"@en . \n";
397 UpdateCommit commitB1_0 = r43plesCore.createUpdateCommit(graphName, insertT4, null, user, "First commit to B1", branchNameB1);
398 String revisionB1_0 = commitB1_0.getGeneratedRevision().getRevisionIdentifier();
399
400
401 DatasetGenerationManagement.executeDeleteWhereQuery(user, "Second commit to B1", graphName, branchNameB1,
402 "<http://eatld.et.tu-dresden.de/batch/A3A5R07QZU> ?p ?o . \n");
403
404
405 UpdateCommit commitB2_0 = r43plesCore.createUpdateCommit(graphName, insertT4, null, user, "First commit to B2", branchNameB2);
406 String revisionB2_0 = commitB2_0.getGeneratedRevision().getRevisionIdentifier();
407
408
409 DatasetGenerationManagement.executeDeleteWhereQuery(user, "Second commit to B2", graphName,branchNameB2,
410 "<http://eatld.et.tu-dresden.de/batch/A3A5R01TZU> ?p ?o . \n");
411
412 logger.info("Example graph <" + graphName +"> created.");
413 return graphName;
414 }
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435 public static String createSampleDataSetRenaming() throws InternalErrorException {
436 R43plesCoreInterface r43plesCore = R43plesCoreSingleton.getInstance();
437
438 String graphName = "http://test.com/r43ples-dataset-renaming";
439
440 RevisionGraph graph = new RevisionGraph(graphName);
441
442
443 graph.purgeRevisionInformation();
444
445 InitialCommit initialCommit = r43plesCore.createInitialCommit(graphName, null, null, user, "Create graph");
446 String revision0 = initialCommit.getGeneratedRevision().getRevisionIdentifier();
447
448
449 String triples = "<http://example.com/testS> <http://example.com/testP1> \"A\". \n"
450 + "<http://example.com/testS> <http://example.com/testP1> \"B\". \n"
451 + "<http://example.com/testS> <http://example.com/testP2> \"C\". \n";
452 UpdateCommit commit1 = r43plesCore.createUpdateCommit(graphName, triples, null, user, "Initial commit", "master");
453 String revision1 = commit1.getGeneratedRevision().getRevisionIdentifier();
454
455
456 String branchNameB1 = "b1";
457 DatasetGenerationManagement.createNewBranch(user, "Create a new branch B1", graphName, revision1, branchNameB1);
458
459
460 String branchNameB2 = "b2";
461 DatasetGenerationManagement.createNewBranch(user, "Create a new branch B2", graphName, revision1, branchNameB2);
462
463
464 String triplesInsert = "<http://example.com/testS> <http://example.com/testP2> \"D\". \n";
465
466 String triplesDelete = "<http://example.com/testS> <http://example.com/testP1> \"A\". \n";
467 UpdateCommit commitB1_0 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user, "First commit to B1", branchNameB1);
468 String revisionB1_0 = commitB1_0.getGeneratedRevision().getRevisionIdentifier();
469
470
471 triplesInsert = "<http://example.com/testS> <http://example.com/testP2> \"D\". \n"
472 + "<http://example.com/testS> <http://example.com/testP2> \"H\". \n";
473 triplesDelete = "<http://example.com/testS> <http://example.com/testP2> \"C\". \n";
474 UpdateCommit commitB2_0 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user, "First commit to B2", branchNameB2);
475 String revisionB2_0 = commitB2_0.getGeneratedRevision().getRevisionIdentifier();
476
477
478 triplesInsert = "<http://example.com/testS> <http://example.com/testP1> \"G\". \n";
479 triplesDelete = "<http://example.com/testS> <http://example.com/testP2> \"D\". \n";
480 UpdateCommit commitB1_1 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user, "Second commit to B1", branchNameB1);
481 String revisionB1_1 = commitB1_1.getGeneratedRevision().getRevisionIdentifier();
482
483
484 triplesInsert = "<http://example.com/testS> <http://example.com/testP2> \"I\". \n";
485 UpdateCommit commitB2_1 = r43plesCore.createUpdateCommit(graphName, triplesInsert, null, user, "Second commit to B2", branchNameB2);
486 String revisionB2_1 = commitB2_1.getGeneratedRevision().getRevisionIdentifier();
487 logger.info("Example graph <" + graphName + "> created.");
488
489 return graphName;
490 }
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520 public static DataSetGenerationResult createSampleDataSetComplexStructure() throws InternalErrorException {
521 R43plesCoreInterface r43plesCore = R43plesCoreSingleton.getInstance();
522
523 String graphName = "http://test.com/r43ples-dataset-complex-structure";
524
525 DataSetGenerationResult result = new DataSetGenerationResult();
526
527
528 String masterBranch = "master";
529 String b1Branch = "B1";
530 String b2Branch = "B2";
531 String b1XBranch = "B1X";
532 String b2XBranch = "B2X";
533
534 RevisionGraph graph = new RevisionGraph(graphName);
535 result.graphName = graphName;
536
537
538 graph.purgeRevisionInformation();
539
540
541 String triples = "<http://example.com/testS> <http://example.com/testP> \"A\". \n"
542 + "<http://example.com/testS> <http://example.com/testP> \"B\". \n"
543 + "<http://example.com/testS> <http://example.com/testP> \"C\". \n";
544 InitialCommit initialCommit = r43plesCore.createInitialCommit(graphName, triples, null, user, "Initial commit");
545 Revision revisionMaster_1 = initialCommit.getGeneratedRevision();
546 String revisionIdentifierMaster_1 = revisionMaster_1.getRevisionIdentifier();
547 result.revisions.put("master-1", revisionIdentifierMaster_1);
548
549
550 BranchCommit b1Commit = r43plesCore.createBranchCommit(graph, b1Branch, revisionMaster_1, user, "Create a new branch B1");
551
552 BranchCommit b2Commit = r43plesCore.createBranchCommit(graph, b2Branch, revisionMaster_1, user, "Create a new branch B2");
553
554
555 String triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"D\". \n"
556 + "<http://example.com/testS> <http://example.com/testP> \"E\". \n";
557 String triplesDelete = "<http://example.com/testS> <http://example.com/testP> \"A\". \n";
558 UpdateCommit b1Commit1 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user,"First commit to B1", b1Branch);
559 String revisionIdentifierB1_1 = b1Commit1.getGeneratedRevision().getRevisionIdentifier();
560 result.revisions.put("b1-1", revisionIdentifierB1_1);
561
562
563 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"G\". \n";
564 triplesDelete = "<http://example.com/testS> <http://example.com/testP> \"D\". \n";
565 UpdateCommit b1Commit2 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user,"Second commit to B1", b1Branch);
566 Revision revisionB1_2 = b1Commit2.getGeneratedRevision();
567 String revisionIdentifierB1_2 = revisionB1_2.getRevisionIdentifier();
568 result.revisions.put("b1-2", revisionIdentifierB1_2);
569
570
571 BranchCommit b1XCommit = r43plesCore.createBranchCommit(graph, b1XBranch, revisionB1_2, user, "Create a new branch B1X");
572
573
574 triplesDelete = "<http://example.com/testS> <http://example.com/testP> \"B\". \n";
575 UpdateCommit b1XCommit1 = r43plesCore.createUpdateCommit(graphName, null, triplesDelete, user,"First commit to B1X", b1XBranch);
576 String revisionIdentifierB1X_1 = b1XCommit1.getGeneratedRevision().getRevisionIdentifier();
577 result.revisions.put("b1X-1", revisionIdentifierB1X_1);
578
579
580 triplesDelete = "<http://example.com/testS> <http://example.com/testP> \"C\". \n";
581 UpdateCommit b1XCommit2 = r43plesCore.createUpdateCommit(graphName, null, triplesDelete, user,"Second commit to B1X", b1XBranch);
582 String revisionIdentifierB1X_2 = b1XCommit2.getGeneratedRevision().getRevisionIdentifier();
583 result.revisions.put("b1X-2", revisionIdentifierB1X_2);
584
585
586 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"F\". \n";
587 UpdateCommit b1Commit3 = r43plesCore.createUpdateCommit(graphName, triplesInsert, null, user,"Third commit to B1", b1Branch);
588 String revisionIdentifierB1_3 = b1Commit3.getGeneratedRevision().getRevisionIdentifier();
589 result.revisions.put("b1-3", revisionIdentifierB1_3);
590
591
592 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"D\". \n"
593 + "<http://example.com/testS> <http://example.com/testP> \"H\". \n";
594 triplesDelete = "<http://example.com/testS> <http://example.com/testP> \"C\". \n";
595 UpdateCommit b2Commit1 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user,"First commit to B2", b2Branch);
596 String revisionIdentifierB2_1 = b2Commit1.getGeneratedRevision().getRevisionIdentifier();
597 result.revisions.put("b2-1", revisionIdentifierB2_1);
598
599
600 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"I\". \n";
601 UpdateCommit b2Commit2 = r43plesCore.createUpdateCommit(graphName, triplesInsert, null, user,"Second commit to B2", b2Branch);
602 Revision revisionB2_2 = b2Commit2.getGeneratedRevision();
603 String revisionIdentifierB2_2 = revisionB2_2.getRevisionIdentifier();
604 result.revisions.put("b2-2", revisionIdentifierB2_2);
605
606
607 BranchCommit b2XCommit = r43plesCore.createBranchCommit(graph, b2XBranch, revisionB2_2, user, "Create a new branch B2X");
608
609
610 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"J\". \n";
611 UpdateCommit b2XCommit1 = r43plesCore.createUpdateCommit(graphName, triplesInsert, null, user,"First commit to B2X", b2XBranch);
612 Revision revisionB2X_1 = b2XCommit1.getGeneratedRevision();
613 String revisionIdentifierB2X_1 = revisionB2X_1.getRevisionIdentifier();
614 result.revisions.put("b2X-1", revisionIdentifierB2X_1);
615
616
617 TagCommit tagCommit = r43plesCore.createTagCommit(graph, "v0.2", revisionB2X_1, user, "tag version v0.2");
618
619
620 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"C\". \n";
621 triplesDelete = "<http://example.com/testS> <http://example.com/testP> \"I\". \n";
622 UpdateCommit b2XCommit2 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user,"Second commit to B2X", b2XBranch);
623 String revisionIdentifierB2X_2 = b2XCommit2.getGeneratedRevision().getRevisionIdentifier();
624 result.revisions.put("b2X-2", revisionIdentifierB2X_2);
625
626
627 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"K\". \n"
628 + "<http://example.com/testS> <http://example.com/testP> \"L\". \n";
629 triplesDelete = "<http://example.com/testS> <http://example.com/testP> \"I\". \n";
630 UpdateCommit b2Commit3 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user,"Third commit to B2", b2Branch);
631 String revisionIdentifierB2_3 = b2Commit3.getGeneratedRevision().getRevisionIdentifier();
632 result.revisions.put("b2-3", revisionIdentifierB2_3);
633
634
635 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"M\". \n";
636 UpdateCommit b2Commit4 = r43plesCore.createUpdateCommit(graphName, triplesInsert, null, user,"Fourth commit to B2", b2Branch);
637 String revisionIdentifierB2_4 = b2Commit4.getGeneratedRevision().getRevisionIdentifier();
638 result.revisions.put("b2-4", revisionIdentifierB2_4);
639
640
641 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"M\". \n"
642 + "<http://example.com/testS> <http://example.com/testP> \"N\". \n";
643 triplesDelete = "<http://example.com/testS> <http://example.com/testP> \"C\". \n";
644 UpdateCommit masterCommit2 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user,"Second commit to MASTER", masterBranch);
645 String revisionIdentifierMaster_2 = masterCommit2.getGeneratedRevision().getRevisionIdentifier();
646 result.revisions.put("master-2", revisionIdentifierMaster_2);
647
648
649 triplesInsert = "<http://example.com/testS> <http://example.com/testP> \"P\". \n"
650 + "<http://example.com/testS> <http://example.com/testP> \"R\". \n"
651 + "<http://example.com/testS> <http://example.com/testP> \"S\". \n";
652 triplesDelete = "<http://example.com/testS> <http://example.com/testP> \"M\". \n";
653 UpdateCommit masterCommit3 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user,"Third commit to MASTER", masterBranch);
654 String revisionIdentifierMaster_3 = masterCommit3.getGeneratedRevision().getRevisionIdentifier();
655 result.revisions.put("master-3", revisionIdentifierMaster_3);
656
657 logger.info("Example graph <" + graphName +"> created.");
658 return result;
659 }
660
661
662
663
664
665
666
667 public static DataSetGenerationResult createSampleDataSetHLCAggregation() throws InternalErrorException {
668 R43plesCoreInterface r43plesCore = R43plesCoreSingleton.getInstance();
669
670 DataSetGenerationResult result = new DataSetGenerationResult();
671 String graphName = "http://test.com/r43ples-dataset-hlc-aggregation";
672 result.graphName = graphName;
673 String masterBranch = "master";
674
675 RevisionGraph graph = new RevisionGraph(graphName);
676
677
678 graph.purgeRevisionInformation();
679
680 InitialCommit initialCommit = r43plesCore.createInitialCommit(graphName, null, null, user, "Create graph");
681 String revision0 = initialCommit.getGeneratedRevision().getRevisionIdentifier();
682 result.revisions.put("master-0", revision0);
683
684
685 String triples = "<http://example.com/house> a <http://www.w3.org/2000/01/rdf-schema#Class>. \n"
686 + "<http://example.com/house> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://example.com/building>. \n"
687 + "<http://example.com/building> a <http://www.w3.org/2000/01/rdf-schema#Class>. \n";
688 UpdateCommit commit1 = r43plesCore.createUpdateCommit(graphName, triples, null, user, "Initial commit", "master");
689 String revision1 = commit1.getGeneratedRevision().getRevisionIdentifier();
690 result.revisions.put("master-1", revision1);
691
692
693 String triplesInsert = "<http://example.com/myhouse> a <http://www.w3.org/2000/01/rdf-schema#Class>. \n"
694 + "<http://example.com/myhouse> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://example.com/building>. \n"
695 + "<http://example.com/myhouse> <http://example.com/hasDoor> \"BigDoor\". \n";
696 String triplesDelete = "<http://example.com/house> a <http://www.w3.org/2000/01/rdf-schema#Class>. \n"
697 + "<http://example.com/house> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://example.com/building>. \n";
698 UpdateCommit commit2 = r43plesCore.createUpdateCommit(graphName, triplesInsert, triplesDelete, user, "Rename class", masterBranch);
699 String revision2 = commit2.getGeneratedRevision().getRevisionIdentifier();
700 result.revisions.put("master-2", revision2);
701
702 logger.info("Example graph <" + graphName +"> created.");
703 return result;
704 }
705
706
707
708
709
710
711
712 public static DataSetGenerationResult createSampleDataSetCoEvolution() throws InternalErrorException {
713 R43plesCoreInterface r43plesCore = R43plesCoreSingleton.getInstance();
714
715 DataSetGenerationResult result = new DataSetGenerationResult();
716 String graphName = "http://test.com/r43ples-dataset-coevolution";
717 result.graphName = graphName;
718
719 RevisionGraph graph = new RevisionGraph(graphName);
720
721
722 graph.purgeRevisionInformation();
723
724 InitialCommit initialCommit = r43plesCore.createInitialCommit(graphName, null, null, user, "Create graph");
725 String revision0 = initialCommit.getGeneratedRevision().getRevisionIdentifier();
726 result.revisions.put("master-0", revision0);
727
728
729 String triples = "<http://example-house.com/yellowhouse> a <http://example.com/house>. \n"
730 + "<http://example-house.com/yellowhouse> <http://www.w3.org/2000/01/rdf-schema#label> \"a yellow house\". \n";
731 UpdateCommit commit1 = r43plesCore.createUpdateCommit(graphName, triples, null, user, "Initial commit", "master");
732 String revision1 = commit1.getGeneratedRevision().getRevisionIdentifier();
733 result.revisions.put("master-1", revision1);
734
735 logger.info("Example graph <" + graphName +"> created.");
736 return result;
737 }
738
739 }