Skip to content

Instantly share code, notes, and snippets.

@sneumann
Created December 2, 2022 13:04
Show Gist options
  • Save sneumann/c488bc91d3aea448897b38dd935ca0a4 to your computer and use it in GitHub Desktop.
Save sneumann/c488bc91d3aea448897b38dd935ca0a4 to your computer and use it in GitHub Desktop.
Import Metadata from MassBank DataDump to FIZ-OAI provider
#!/usr/bin/env bash
export BACKEND=http://localhost:8081/oai-backend
jq -c '.[]' DataDump-IPB.jsonld | \
while read i; do
IDENTIFIER=`echo "$i" | jq '.identifier'`
(
cat <<EOF
<json xmlns="http://denbi.de/schemas/json-container">
<![CDATA[
EOF
echo "$i"
cat <<EOF
]]>
</json>
EOF
) | curl -v -X POST -H 'Content-Type: multipart/form-data' \
-i "$BACKEND/item" \
-F "item={\"identifier\":$IDENTIFIER,\"deleteFlag\":false,\"ingestFormat\":\"json_container\"};type=application/json" \
-F content=@- ;\
done # while read
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment