-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest-curl.sh
executable file
·585 lines (441 loc) · 18.1 KB
/
test-curl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
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
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
#!/bin/bash
set -e # exit on any error
DATASETS="http://localhost:8080/datasets"
function checkResponse {
# read first line (eliminate carriage returns and skip '100 Continue' blocks)
read str < <(tr -d '\r' | sed -e '/HTTP\/1.1 100/,+1d')
if [[ $str != "HTTP/1.1 $1"* ]]; then
>&2 echo $str "did not match expected ($1)"
exit 1
fi
}
function extractVersion {
str=$(grep "X-EventSource-Version: " | sed 's/X-EventSource-Version: //')
if [ -z "$str" ]; then
>&2 echo "NULL version"
exit 1
fi
echo "$str" | tr -d '\r'
}
function extractLocation {
str=$(grep "Location: " | sed 's/Location: //')
if [ -z "$str" ]; then
>&2 echo "NULL location"
exit 1
fi
echo "$str" | tr -d '\r'
}
function checkEmpty {
if [[ ! -z $(<&0) ]]; then
echo "expected empty response"
exit 1
fi
}
function checkVersion {
expect=$1
actual=$(extractVersion)
if [ "$expect" != "$actual" ]; then
echo "expected versions to be equal"
exit 1
fi
}
function checkEqual {
expect="$1"
actual="$2"
if [ "$actual" != "$expect" ]; then
echo "Expected \'$expect\', got \'$actual\'"; exit 1;
fi
}
echo "== Create a dataset =="
curl -s -D 00-headers -o 00-body -X POST $DATASETS
checkResponse 201 < 00-headers
DATASET=$(extractLocation < 00-headers)
V0=$(extractVersion < 00-headers)
echo $DATASET
echo $V0
DATA="$DATASET/data"
QUERY=${DATASET}/query
UPDATE=${DATASET}/update
GRAPH=http://example.com/graph1
echo "== Get (empty) content =="
curl -s -D 01-headers -H "Accept: text/turtle" $DATA?graph=$GRAPH > 01-body
checkResponse 200 < 01-headers
checkVersion $V0 < 01-headers
checkEmpty < 01-body
echo "== Upload content =="
curl -s -D 02-headers -H "Content-Type: text/turtle" $DATA?graph=$GRAPH \
--data "<a> <b> <c>, <d>" > 02-body
checkResponse 200 < 02-headers
checkEmpty < 02-body
V1=$(extractVersion < 02-headers)
echo $V1
echo "== Get new content =="
curl -s -D 03-headers -H "Accept: text/turtle" $DATA?graph=$GRAPH
checkResponse 200 < 03-headers
checkVersion $V1 < 03-headers
echo "== Version negotiation =="
curl -s -D 04-headers -H "Accept: text/turtle" -H "X-Accept-EventSource-Version: $V0" $DATA?graph=$GRAPH
checkResponse 200 < 04-headers
checkVersion $V0 < 04-headers
curl -s -D 05-headers -H "Accept: text/turtle" -H "X-Accept-EventSource-Version: $V1" $DATA?graph=$GRAPH
checkResponse 200 < 05-headers
checkVersion $V1 < 05-headers
curl -s -D 06-headers -H "Accept: text/turtle" -H "X-Accept-EventSource-Version: http://example.com/nonversion" $DATA?graph=$GRAPH
checkResponse 406 < 06-headers
echo "== Content-type negotiation =="
curl -s -D 07-headers -H "Accept: application/rdf+xml" $DATA?graph=$GRAPH
checkResponse 200 < 07-headers
curl -s -D 08-headers -H "Accept: audio/ogg" $DATA?graph=$GRAPH
checkResponse 406 < 08-headers
echo "== SPARQL query =="
curl -G -s -D 09-headers $QUERY \
--data-urlencode "query=SELECT * WHERE { GRAPH <$GRAPH> { ?s ?p ?o } }"
checkResponse 200 < 09-headers
checkVersion $V1 < 09-headers
echo "== SPARQL query version negotiation =="
curl -G -s -D 10-headers $QUERY -H "X-Accept-EventSource-Version: $V1" \
--data-urlencode "query=SELECT * WHERE { GRAPH <$GRAPH> { ?s ?p ?o } }"
checkResponse 200 < 10-headers
checkVersion $V1 < 10-headers
curl -G -s -D 11-headers $QUERY -H "X-Accept-EventSource-Version: $V0" \
--data-urlencode "query=SELECT * WHERE { GRAPH <$GRAPH> { ?s ?p ?o } }"
checkResponse 200 < 11-headers
checkVersion $V0 < 11-headers
curl -G -s -D 12-headers $QUERY -H "X-Accept-EventSource-Version: http://example.com/nonversion" \
--data-urlencode "query=SELECT * WHERE { GRAPH <$GRAPH> { ?s ?p ?o } }" > 12-body
checkResponse 406 < 12-headers
echo "== SPARQL query content-type negotiation =="
curl -G -s -D 13-headers $QUERY -H "Accept: application/sparql-results+json" \
--data-urlencode "query=SELECT * WHERE { GRAPH <$GRAPH> { ?s ?p ?o } }"
checkResponse 200 < 13-headers
checkVersion $V1 < 13-headers
curl -G -s -D 14-headers $QUERY -H "Accept: application/sparql-results+xml" \
--data-urlencode "query=SELECT * WHERE { GRAPH <$GRAPH> { ?s ?p ?o } }"
checkResponse 200 < 14-headers
checkVersion $V1 < 14-headers
curl -G -s -D 15-headers $QUERY -H "Accept: text/plain" \
--data-urlencode "query=SELECT * WHERE { GRAPH <$GRAPH> { ?s ?p ?o } }"
checkResponse 200 < 15-headers
checkVersion $V1 < 15-headers
curl -G -s -D 16-headers $QUERY -H "Accept: audio/ogg" \
--data-urlencode "query=SELECT * WHERE { GRAPH <$GRAPH> { ?s ?p ?o } }"
checkResponse 406 < 16-headers
echo "== CONSTRUCT query =="
curl -G -s -D 17-headers $QUERY \
--data-urlencode "query=CONSTRUCT { ?s <x> 3 } WHERE { GRAPH <$GRAPH> { ?s <b> <d> } }"
checkResponse 200 < 17-headers
checkVersion $V1 < 17-headers
curl -G -s -D 18-headers $QUERY -H "Accept: application/rdf+xml" \
-H "X-Accept-EventSource-Version: $V0" \
--data-urlencode "query=CONSTRUCT { ?s <x> 3 } WHERE { GRAPH <$GRAPH> { ?s <b> <d> } }"
checkResponse 200 < 18-headers
checkVersion $V0 < 18-headers
echo "== ASK query =="
curl -G -s -D 19-headers $QUERY -H "Accept: text/plain" \
-H "X-Accept-EventSource-Version: $V0" \
--data-urlencode "query=ASK { GRAPH <$GRAPH> { ?s <b> <d> } }" > 19-body
checkResponse 200 < 19-headers
checkVersion $V0 < 19-headers
checkEqual "no" $(< 19-body)
curl -G -s -D 20-headers $QUERY -H "Accept: text/plain" \
-H "X-Accept-EventSource-Version: $V1" \
--data-urlencode "query=ASK { GRAPH <$GRAPH> { ?s <b> <d> } }" > 20-body
checkResponse 200 < 20-headers
checkVersion $V1 < 20-headers
checkEqual "yes" $(< 20-body)
curl -G -s -D 21-headers $QUERY -H "Accept: application/sparql-results+json" \
--data-urlencode "query=ASK { GRAPH <$GRAPH> { ?s <b> <d> } }" > 21-body
checkResponse 200 < 21-headers
checkVersion $V1 < 21-headers
curl -G -s -D 22-headers $QUERY -H "Accept: application/sparql-results+xml" \
--data-urlencode "query=ASK { GRAPH <$GRAPH> { ?s <b> <d> } }" > 22-body
checkResponse 200 < 22-headers
checkVersion $V1 < 22-headers
echo "== DESCRIBE query =="
curl -G -H "Accept: text/turtle" $QUERY \
--data-urlencode "query=DESCRIBE <$GRAPH>"
# TODO
echo "== Invalid query =="
curl -G -s -D 24-headers $QUERY \
--data-urlencode "query=PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name WHERE { ?x foaf:name ?name ORDER BY ?name }"
checkResponse 400 < 24-headers
echo "== Invalid update =="
curl -D 25-headers $UPDATE -H "Content-Type: application/sparql-update" \
--data "PREFIX foaf: <http://xmlns.com/foa/> SELECT ?name WHERE { ?x foaf:name ?name ORDER BY ?name }"
checkResponse 400 < 25-headers
echo "== Update conflict =="
curl -D 26-headers $UPDATE \
-H "X-Accept-EventSource-Version: $V0" -H "Content-Type: application/sparql-update" \
--data "INSERT DATA { <a> <b> <c> }"
echo
checkResponse 409 < 26-headers
echo "== Update query =="
curl -D 27-headers $UPDATE \
-H "X-Accept-EventSource-Version: $V1" -H "Content-Type: application/sparql-update" \
--data "INSERT DATA { GRAPH <$GRAPH> { <a> <b> <e> } }"
checkResponse 200 < 27-headers
V2=$(extractVersion < 27-headers)
echo $V2
curl -G -s -D 28-headers $QUERY -H "Accept: text/plain" \
--data-urlencode "query=ASK { GRAPH <$GRAPH> { ?s <b> <e> } }" > 28-body
checkResponse 200 < 28-headers
checkVersion $V2 < 28-headers
checkEqual "yes" $(< 28-body)
echo "== Graph store PUT =="
curl -s -D 29-headers -X PUT $DATA?graph=$GRAPH \
-H "Content-Type: text/turtle" -H "X-Accept-EventSource-Version: $V2" \
--data "<x> <y> <z>"
checkResponse 200 < 29-headers
V3=$(extractVersion < 29-headers)
echo $V3
curl -G -s -D 30-headers $QUERY -H "Accept: text/plain" \
--data-urlencode "query=ASK { GRAPH <$GRAPH> { ?s <b> <e> } }" > 30-body
checkResponse 200 < 30-headers
checkVersion $V3 < 30-headers
checkEqual "no" $(< 30-body)
curl -G -s -D 31-headers $QUERY -H "Accept: text/plain" \
--data-urlencode "query=ASK { GRAPH <$GRAPH> { <x> <y> <z> } }" > 31-body
checkResponse 200 < 31-headers
checkVersion $V3 < 31-headers
checkEqual "yes" $(< 31-body)
echo "== Graph store POST =="
curl -s -D 32-headers -X POST $DATA?graph=$GRAPH \
-H "Content-Type: text/turtle" -H "X-Accept-EventSource-Version: $V3" \
--data "<d> <e> <f>"
checkResponse 200 < 32-headers
V4=$(extractVersion < 32-headers)
echo $V4
curl -G -s -D 33-headers $QUERY -H "Accept: text/plain" \
--data-urlencode "query=ASK { GRAPH <$GRAPH> { <x> <y> <z> . <d> <e> <f> . } }" > 33-body
checkResponse 200 < 33-headers
checkVersion $V4 < 33-headers
checkEqual "yes" $(< 33-body)
echo "== Graph store GET =="
curl -s -D 34-headers -X GET $DATA?graph=$GRAPH \
-H "Accept: text/turtle" -H "X-Accept-EventSource-Version: $V3"
checkResponse 200 < 34-headers
curl -s -D 35-headers -X GET $DATA?graph=$GRAPH \
-H "Accept: text/turtle" -H "X-Accept-EventSource-Version: $V4"
checkResponse 200 < 35-headers
curl -s -D 36-headers -X GET $DATA?graph=$GRAPH \
-H "Accept: application/rdf+xml" -H "X-Accept-EventSource-Version: $V4"
checkResponse 200 < 36-headers
echo "== Graph store HEAD =="
curl -s -D 37-headers -I $DATA?graph=$GRAPH \
-H "Accept: application/rdf+xml" -H "X-Accept-EventSource-Version: $V4"
checkResponse 200 < 37-headers
echo "== Graph store DELETE =="
curl -s -D 38-headers -X DELETE $DATA?graph=$GRAPH \
-H "X-Accept-EventSource-Version: $V4"
checkResponse 200 < 38-headers
V5=$(extractVersion < 38-headers)
echo $V5
curl -s -D 39-headers -X GET $DATA?graph=$GRAPH \
-H "Accept: application/rdf+xml" > 39-body
checkResponse 200 < 39-headers
checkVersion $V5 < 39-headers
checkEmpty < 39-body
echo "== GET default graph =="
curl -s -D 40-headers -X GET $DATA?default \
-H "Accept: text/turtle" -H "X-Accept-EventSource-Version: $V3"
checkResponse 200 < 40-headers
echo "== PUT default graph =="
curl -s -D 41-headers -X PUT $DATA?default \
-H "Content-Type: text/turtle" -H "X-Accept-EventSource-Version: $V5" \
--data "<x> <y> <z>"
checkResponse 200 < 41-headers
V6=$(extractVersion < 41-headers)
echo $V6
curl -s -D 42-headers -X GET $DATA?default \
-H "Accept: text/turtle"
checkResponse 200 < 42-headers
checkVersion $V6 < 42-headers
echo "== POST default graph =="
curl -s -D 43-headers -X PUT $DATA?default \
-H "Content-Type: text/turtle" -H "X-Accept-EventSource-Version: $V6" \
--data "<x> <y> <a>"
checkResponse 200 < 43-headers
V7=$(extractVersion < 43-headers)
echo $V7
curl -s -D 44-headers -X GET $DATA?default \
-H "Accept: text/turtle"
checkResponse 200 < 44-headers
checkVersion $V7 < 44-headers
echo "== DELETE default graph =="
curl -s -D 45-headers -X DELETE $DATA?default \
-H "X-Accept-EventSource-Version: $V7"
checkResponse 200 < 45-headers
V8=$(extractVersion < 45-headers)
echo $V8
curl -s -D 46-headers -X GET $DATA?default \
-H "Accept: text/turtle"
checkResponse 200 < 46-headers
checkVersion $V8 < 46-headers
echo "== Create dataset with default graph content"
curl -s -D 47-headers -H "Content-Type: text/turtle" $DATASETS \
--data "<d> <e> <f>" > 47-body
checkResponse 201 < 47-headers
checkEmpty < 47-body
D2=$(extractLocation < 47-headers)
D2_V0=$(extractVersion < 47-headers)
echo $D2
echo $D2_V0
curl -s -D 48-headers -X GET $D2/data?default \
-H "Accept: text/turtle"
checkResponse 200 < 48-headers
checkVersion $D2_V0 < 48-headers
echo "== Create dataset with commit meta-data"
CREATOR="http://example.com/SomeAuthor"
TITLE=$(echo -n "This is a title brå" | base64)
DESCRIPTION=$(echo -e "This is a long description\nWith newlines!" | base64)
curl -s -D 49-headers -X POST $DATASETS \
-H "X-EventSource-Creator: $CREATOR" \
-H "X-EventSource-Title: $TITLE" \
-H "X-EventSource-Description: $DESCRIPTION"
D3=$(extractLocation < 49-headers)
D3_V0=$(extractVersion < 49-headers)
curl $D3
echo "== Testing with a larger dataset =="
GRAPH=http://example.com/sp2b
curl -s -D 50-headers -X POST $DATASET/data?graph=$GRAPH \
-H "Content-Type: text/turtle" \
--data-binary @sp2b.n3
checkResponse 200 < 50-headers
V9=$(extractVersion < 50-headers)
curl -G -s -D 51-headers $DATASET/query \
-H "Accept: application/sparql-results+json" \
--data-urlencode "query=PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT * WHERE { GRAPH <$GRAPH> { ?s a foaf:Person . ?s ?p ?o . } }" > 51-body
checkResponse 200 < 51-headers
echo "== Query with OPTIONAL (triggers delayed processing of ResultSet) =="
curl -s -D 52-headers -X POST $DATASET/data?graph=http://example.com/study \
-H "Content-Type: text/turtle" \
--data " @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . <http://example.com/study> rdfs:label \"Name\" ; rdfs:comment \"Title\" ."
checkResponse 200 < 52-headers
QUERYSTR="PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?obj ?label ?comment
WHERE {
GRAPH ?obj {
?obj rdfs:label ?label .
OPTIONAL { ?obj rdfs:comment ?comment . }
}
}"
curl -G -s -D 53-headers $DATASET/query \
-H "Accept: application/sparql-results+json" \
--data-urlencode "query=$QUERYSTR"
checkResponse 200 < 53-headers
echo "== SPARQL Update default graph =="
curl -s -D 54-headers -X POST $D2/update \
-H "Content-Type: application/sparql-update" \
--data "INSERT DATA { <a> <b> <c> }"
checkResponse 200 < 54-headers
curl -G -s -D 55-headers $D2/query \
-H "Content-Type: application/sparql-query" -H "Accept: text/plain" \
--data-urlencode "query=ASK { <a> <b> <c> . <d> <e> <f> . }" > 55-body
checkResponse 200 < 55-headers
checkEqual "yes" $(< 55-body)
echo "== Graph store version conflict =="
curl -s -D 56-headers -X PUT $DATA?default \
-H "Content-Type: text/turtle" -H "X-Accept-EventSource-Version: $D2_V0" \
--data "<g> <h> <i>"
checkResponse 409 < 56-headers
echo "== Graph store invalid request =="
curl -s -D 57-headers -X PUT $DATA?default \
-H "Content-Type: text/turtle" \
--data "<g> <h> ."
checkResponse 400 < 57-headers
echo "== History =="
curl $DATASET/history > 58-body
echo `wc -l 58-body` "lines"
echo "== Blank nodes =="
GRAPH=http://example.com/blankNodes
curl -s -D 59-headers -X PUT $DATA?graph=$GRAPH \
-H "Content-Type: text/turtle" \
--data " @prefix foaf: <http://xmlns.com/foaf/0.1/> . <x> foaf:knows [ foaf:name \"Alice\" ] , [ foaf:name \"Bob\" ] ."
checkResponse 200 < 59-headers
V10=$(extractVersion < 59-headers)
echo $V10
curl -G -s -D 60-headers $DATASET/query \
-H "Content-Type: application/sparql-query" -H "Accept: text/plain" \
--data-urlencode "query=PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT * { GRAPH <$GRAPH> { ?x foaf:knows ?node . ?node foaf:name ?name } }"
checkResponse 200 < 60-headers
echo "== Via ?default-graph-uri and ?named-graph-uri =="
curl -G -s -D 61-headers $DATASET/query \
-H "Content-Type: application/sparql-query" -H "Accept: text/plain" \
--data-urlencode "query=PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT * { ?x foaf:knows ?node . ?node foaf:name ?name }" \
--data-urlencode "default-graph-uri=$GRAPH"
checkResponse 200 < 61-headers
curl -G -s -D 62-headers $DATASET/query \
-H "Content-Type: application/sparql-query" -H "Accept: text/plain" \
--data-urlencode "query=PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT * { GRAPH <$GRAPH> { ?x foaf:knows ?node . ?node foaf:name ?name } }" \
--data-urlencode "named-graph-uri=http://example.com/nonGraph"
checkResponse 200 < 62-headers
curl -G -s -D 63-headers $DATASET/query \
-H "Content-Type: application/sparql-query" -H "Accept: text/plain" \
--data-urlencode "query=PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT * { GRAPH <$GRAPH> { ?x foaf:knows ?node . ?node foaf:name ?name } }" \
--data-urlencode "named-graph-uri=$GRAPH"
checkResponse 200 < 63-headers
curl -s -D 64-headers -X PUT $DATA?graph=$GRAPH- \
-H "Content-Type: text/turtle" \
--data " @prefix foaf: <http://xmlns.com/foaf/0.1/> . <x> foaf:knows [ foaf:name \"Carol\" ] . [ foaf:name \"Eve\" ] foaf:knows <x> ."
checkResponse 200 < 64-headers
# V11
curl -G -s -D 65-headers $DATASET/query \
-H "Content-Type: application/sparql-query" -H "Accept: text/plain" \
--data-urlencode "query=PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT * { ?x foaf:knows ?node . ?node foaf:name ?name }" \
--data-urlencode "default-graph-uri=$GRAPH" \
--data-urlencode "default-graph-uri=$GRAPH-"
checkResponse 200 < 65-headers
curl -G -s -D 66-headers $DATASET/query \
-H "Content-Type: application/sparql-query" -H "Accept: text/plain" \
--data-urlencode "query=PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?node ?name { GRAPH ?g { ?x foaf:knows ?node . ?node foaf:name ?name } }" \
--data-urlencode "named-graph-uri=$GRAPH" \
--data-urlencode "named-graph-uri=$GRAPH-"
checkResponse 200 < 66-headers
echo "=== Non-existent dataset should 404 ==="
curl -G -s -D 67-headers $DATASETS/not-a-dataset/data?graph=http://example.com/ >/dev/null
checkResponse 404 < 67-headers
curl -G -s -D 68-headers $DATASET/data?graph=http://example.com/
checkResponse 200 < 68-headers
curl -G -s -D 69-headers $DATASETS/not-a-dataset/query \
--data-urlencode "query=SELECT * WHERE { GRAPH <$GRAPH> { ?s ?p ?o } }"
checkResponse 404 < 69-headers
curl -G -s -D 70-headers $DATASETS/not-a-dataset
checkResponse 404 < 70-headers
curl -G -s -D 71-headers $DATASETS/not-a-dataset/history
checkResponse 404 < 71-headers
# Copy a graph from another dataset
echo "=== Copying of graphs ==="
curl -s -D 72-headers -o 72-body -X POST $DATASETS
checkResponse 201 < 72-headers
DSOURCE=$(extractLocation < 72-headers)
curl -s -D 73-headers -H "Content-Type: text/turtle" $DSOURCE/data?graph=$GRAPH \
--data "<a> <b> <c>, <d>" > 73-body
checkResponse 200 < 73-headers
function extractRevisions {
str=$(grep "^<.*/revisions/.*>$" | sed 's/<//' | sed 's/>//')
if [ -z "$str" ]; then
>&2 echo "NULL revision"
exit 1
fi
echo "$str" | tr -d '\r'
}
curl -s -D 74-headers -o 74-body $DSOURCE
checkResponse 200 < 74-headers
RSOURCE=$(extractRevisions < 74-body)
curl -s -D 75-headers -o 75-body -X POST $DATASETS
checkResponse 201 < 75-headers
DSINK=$(extractLocation < 75-headers)
curl -s -D 76-headers -X POST "$DSINK/data?graph=$GRAPH©Of=$RSOURCE" > 76-body
checkResponse 200 < 76-headers
curl $DSINK
curl $DSINK/data?graph=$GRAPH
# TODO: update query with using list
exit 0
# Get latest version info
curl $DATASET
# Get history
# Commit meta-data
curl -s -D - -X POST -H "Content-Type: text/turtle" \
-H "X-EventSource-Creator: http://example.com/PeterParker" \
-H "X-EventSource-Title: Q29weSBHcmVlbkdvYmxpbi9TcGlkZXJtYW4=" \
--data "<a> <b> <f>" $DATA?graph=$GRAPH