Created
October 10, 2016 12:31
-
-
Save jindrichmynarz/ee1a011104244e2ec0d0c0d386d8cb49 to your computer and use it in GitHub Desktop.
Stažení dumpů CEDRu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Stažení dumpů CEDRu | |
| set -e | |
| # URL SPARQL endpointu CEDRu | |
| ENDPOINT="http://cedropendata.mfcr.cz/c3lod/cedr/sparql" | |
| # SPARQL dotaz pro získání URL dumpů | |
| QUERY=$(cat <<-END | |
| PREFIX void: <http://rdfs.org/ns/void#> | |
| SELECT ?dump | |
| WHERE { | |
| <http://cedropendata.mfcr.cz/c3lod/cedr#cedrDataSet> void:dataDump ?dump . | |
| } | |
| END | |
| ) | |
| curl -sH "Accept:text/csv" --data-urlencode "query=$QUERY" $ENDPOINT | | |
| tr " | |
| " "\n" | # Ořezání Windowsího zalomení řádku | |
| tail -n +2 | # Přeskočení 1. řádku s hlavičkou | |
| xargs -n 1 -P 3 curl -O # Stažení dumpů po 3 paralelně | |
| # Rozbalení dumpů | |
| for dump in *.7z | |
| do | |
| 7z e $dump | |
| rm $dump | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment