-
Notifications
You must be signed in to change notification settings - Fork 0
/
createCrosswalks.sh
executable file
·28 lines (22 loc) · 1.15 KB
/
createCrosswalks.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
#! /bin/bash
##
## Optionally specify the backend as argument, e.g.
## ./createCrosswalks.sh http://10.22.13.12:6081/oai-backend
##
BACKEND="${1:-http://localhost:8081/oai-backend}"
#The examples below use the linux command jq for encoding the XSLT to JSON for adding it into the curl command
#The package can be installed via yum install jq
# Create Crosswalk from embedded JSON+LD to oai_dc
XSLT_JSON_ENCODED=`cat json_container2oai_dc.xslt | jq -Rsa .`
curl -X POST -H 'Content-Type: application/json' \
-i "$BACKEND/crosswalk" \
--data '{"name":"json_container2OAI_DC_v09","formatFrom":"json_container","formatTo":"oai_dc","xsltStylesheet":'"$XSLT_JSON_ENCODED}"'}'
# Create Crosswalk from embedded JSON+LD to oai_datacite
XSLT_JSON_ENCODED=`cat json_container2oai_datacite3.xslt | jq -Rsa .`
curl -X POST -H 'Content-Type: application/json' \
-i "$BACKEND/crosswalk" \
--data '{"name":"json_container2OAI_DATACITE_v3","formatFrom":"json_container","formatTo":"oai_datacite","xsltStylesheet":'"$XSLT_JSON_ENCODED}"'}'
#Read all crosswalk
curl -X GET "$BACKEND/crosswalk"
# Delete specific crosswalk
# curl -v -X DELETE $BACKEND/crosswalk/Radar2OAI_DC_v09