1
0
mirror of https://github.com/gsi-upm/sitc synced 2024-11-05 15:31:42 +00:00
sitc/lod/upload.sh
2020-02-20 11:28:55 +01:00

54 lines
1.1 KiB
Bash

#!/bin/sh
# This is a bit messy
if [ "$#" -lt 1 ]; then
graph="http://example.com/sitc/submission/"
endpoint="http://fuseki.gsi.upm.es/hotels/data"
else if [ "$#" -lt 2 ]; then
endpoint=$1
graph_base="http://example.com/sitc"
else
if [ "$#" -lt 3 ]; then
endpoint=$1
graph=$2
else
echo "Usage: $0 [<endpoint>] [<graph_base_uri>]"
echo
exit 1
fi
fi
fi
upload(){
name=$1
file=$2
echo '###'
echo "Uploading: $graph"
echo "Graph: $graph"
echo "Endpoint: $endpoint"
curl -X POST \
--digest -u admin:$PASSWORD \
-H Content-Type:text/turtle \
-T "$file" \
--data-urlencode graph=$graph_base/$name \
-G $endpoint
}
total=0
echo -n "Password: "
read -s PASSWORD
echo "Uploading synthethic"
upload "synthetic" synthetic/reviews.ttl || exit 1
for i in *.ttl; do
identifier=$(echo ${i%.ttl} | md5sum | awk '{print $1}')
echo "Uploading $i"
upload $identifier $i
total=$((total + 1))
done
echo Uploaded $total