-
Notifications
You must be signed in to change notification settings - Fork 0
/
no-ldp-pcdm-create.sh
executable file
·55 lines (43 loc) · 2.37 KB
/
no-ldp-pcdm-create.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
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
curl -is -X PUT -H "Content-Type: text/turtle" --data-binary @$DIR/pcdm-collection.ttl $FEDORA_BASE/noldp > /dev/null
START=`date +%s`
COUNT=${START_COUNT:-0}
OBJECTS=${NUM_OBJS:-1000}
OBJECTS=$((OBJECTS + COUNT))
echo -n "NO-LDP CREATE $COUNT $OBJECTS "
while [ $COUNT -lt $OBJECTS ]; do
curl -is -X PUT -H "Content-Type: text/turtle" --data-binary @$DIR/pcdm-object.ttl $FEDORA_BASE/noldp/obj$COUNT > /dev/null
echo "PREFIX pcdm: <http://pcdm.org/models#>
INSERT {
<> pcdm:hasMember <$FEDORA_BASE/noldp/obj$COUNT> .
} WHERE {}
" | curl -is -X PATCH -H "Content-Type: application/sparql-update" --data-binary @- $FEDORA_BASE/noldp > /dev/null
curl -is -X PUT -H "Content-Type: text/turtle" --data-binary @$DIR/pcdm-object.ttl $FEDORA_BASE/noldp/obj$COUNT/file0 > /dev/null
curl -is -X PUT -H "Content-Type: text/turtle" --data-binary @$DIR/pcdm-object.ttl $FEDORA_BASE/noldp/obj$COUNT/file1 > /dev/null
echo "PREFIX pcdm: <http://pcdm.org/models#>
INSERT {
<> pcdm:hasMember <$FEDORA_BASE/noldp/obj$COUNT/file0> .
<> pcdm:hasMember <$FEDORA_BASE/noldp/obj$COUNT/file1>
} WHERE {}
" | curl -is -X PATCH -H "Content-Type: application/sparql-update" --data-binary @- $FEDORA_BASE/noldp/obj$COUNT > /dev/null
curl -is -X PUT $FEDORA_BASE/noldp/obj$COUNT/file0/data-file > /dev/null
curl -is -X PATCH -H "Content-Type: application/sparql-update" --data-binary @$DIR/original-file.ru $FEDORA_BASE/noldp/obj$COUNT/file0/data-file > /dev/null
echo "PREFIX pcdm: <http://pcdm.org/models#>
INSERT {
<> pcdm:hasFile <$FEDORA_BASE/noldp/obj$COUNT/file0/data-file>
} WHERE {}
" | curl -is -X PATCH -H "Content-Type: application/sparql-update" --data-binary @- $FEDORA_BASE/noldp/obj$COUNT/file0 > /dev/null
curl -is -X PUT $FEDORA_BASE/noldp/obj$COUNT/file1/data-file > /dev/null
curl -is -X PATCH -H "Content-Type: application/sparql-update" --data-binary @$DIR/original-file.ru $FEDORA_BASE/noldp/obj$COUNT/file1/data-file > /dev/null
echo "PREFIX pcdm: <http://pcdm.org/models#>
INSERT {
<> pcdm:hasFile <$FEDORA_BASE/noldp/obj$COUNT/file1/data-file>
} WHERE {}
" | curl -is -X PATCH -H "Content-Type:application/sparql-update" --data-binary @- $FEDORA_BASE/noldp/obj$COUNT/file1 > /dev/null
# echo "$COUNT"
COUNT=$(( COUNT + 1 ))
done
END=`date +%s`
TOTAL=$(( $END - $START ))
echo "$TOTAL"