smwsync -u -t ceur-ws --context CeurwsSchema --topic Volume -pk 3355 -p acronym title description url date dblp k10plus urn --progress
smwsync -u -t ceur-ws --context CeurwsSchema --topic Paper -pkv Q117337714 -p title
#!/bin/bash
# WF 2023-03-30
#Vol-2644/paper35
#
# import a paper to the wiki
#
paper2wiki() {
local paperid="$1"
target_wiki=/tmp/$paperid.wiki
target_wb=/tmp/$paperid.wbjson
dir=$(dirname $target_wiki)
echo $dir
mkdir -p $dir
echo "getting markup from $paperid"
curl -s http://ceurspt.wikidata.dbis.rwth-aachen.de/$paperid.smw -o $target_wiki
echo "checking whether paper $paperid is already in wikidata"
qid=$(wd q -p P953 -o https://ceur-ws.org/$paperid.pdf)
if [ $? -eq 0 ]
then
echo "$qid ✅"
else
echo "getting wikibase-cli json from $paperid"
curl -s http://ceurspt.wikidata.dbis.rwth-aachen.de/$paperid.wbjson -o $target_wb
#wikirestore -t ceur-ws --backupPath /tmp -p "$paperid"
cat $target_wb | jq .
echo "shall i add the paper to wikidata y/ys/n?"
read answer
case $answer in
y*)
wd create-entity $target_wb > /tmp/$paperid.cjson
qid=$(cat /tmp/$paperid.cjson | jq --raw-output .entity.id)
wd_url="https://www.wikidata.org/wiki/$qid"
echo "created wikidata entry $qid"
if [ "$answer" = "ys" ]
then
open $wd_url
fi
wikiedit -t ceur-ws --template Paper --property wikidataid --value $qid -p $paperid --force
;;
esac
fi
}
#
#
#
volume2wiki() {
local l_volume="$1"
target_wiki=/tmp/Vol-$l_volume.wiki
dir=$(dirname $target_wiki)
mkdir -p $dir
curl -s http://ceurspt.wikidata.dbis.rwth-aachen.de/Vol-$l_volume.smw -o $target_wiki
wikirestore -t ceur-ws --backupPath /tmp -p "Vol-$l_volume"
}
#
# handle the volume
#
handle_volume() {
local l_volume="$1"
echo "getting volume $l_volume ..." 1>&2
for paper in $(curl -s http://cvb.bitplan.com/dblp/volume/$l_volume/paper | jq --raw-output ".[].pdf_id")
do
paper2wiki $paper
done
}
volume2wiki $1
handle_volume $1