wdqs_update.sh script added

This commit is contained in:
jules 2020-11-01 12:32:19 +01:00
parent 6ed1d68852
commit f00c78f127

29
scripts/wdqs_update.sh Normal file
View File

@ -0,0 +1,29 @@
#!/bin/sh
#
# a script that automatically syncs data
# between the wikibase and wqds containers
# gnd, 2020
##########################################
# generate a temp file name
TMP_FILE=`mktemp`
# dump the data:
docker exec wikibase-docker_wikibase_1 php ./extensions/Wikibase/repo/maintenance/dumpRdf.php --server http://daap.bannerrepeater.org --output $TMP_FILE
# copy from container to container (direct copying is not supported so..)
# plz note here its actually three different files having the same name
# across the host system and two containers
docker cp wikibase-docker_wikibase_1:$TMP_FILE $TMP_FILE
docker cp $TMP_FILE wikibase-docker_wdqs_1:$TMP_FILE
# import with munge using directly the java executable
docker exec -w /wdqs wikibase-docker_wdqs_1 java -cp /wdqs/lib/wikidata-query-tools-0.3.10-SNAPSHOT-jar-with-dependencies.jar org.wikidata.query.rdf.tool.Munge --from $TMP_FILE --to /tmp/mungeOut/wikidump-%09d.ttl.gz --skipSiteLinks --chunkSize 100000 -w daap.bannerrepeater.org
# load the data into the wdqs
docker exec wikibase-docker_wdqs_1 ./loadData.sh -n wdq -d /tmp/mungeOut
# cleanup
rm $TMP_FILE
docker exec wikibase-docker_wikibase_1 rm $TMP_FILE
docker exec wikibase-docker_wdqs_1 rm $TMP_FILE
docker exec wikibase-docker_wdqs_1 rm -rf /tmp/mungeOut