Last active
March 7, 2018 17:17
-
-
Save afs/c5623911293dd19da7f6cc1b2cf64c17 to your computer and use it in GitHub Desktop.
DER example 2
This file contains 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 | |
function dump_dataset() { | |
echo "<<<< ---- ----" | |
curl --header 'Accept: application/trig' http://localhost:3030/ds | |
echo ">>>> ---- ----" | |
} | |
echo "== Setup" | |
curl -s -d update="CLEAR ALL" http://localhost:3030/ds 1>/dev/null | |
echo "---- (should be empty)" | |
dump_dataset | |
echo "== GSP : PUT graph5" | |
G5="http://localhost:3030/graph5" | |
echo "G5=$G5" | |
G5X="$(wwwenc $G5)" | |
##s-put "http://localhost:3030/ds" "$G5" update.ttl | |
curl -T update.ttl --header 'Content-type: text/turtle' "http://localhost:3030/ds?graph=$G5X" | |
dump_dataset | |
echo "== Update" | |
#cat U.ru | |
#rupdate --service=http://localhost:3030/ds/update --file U.ru | |
curl -XPOST --header 'Content-type: application/sparql-update' \ | |
--data-binary @U.ru \ | |
http://localhost:3030/ds | |
dump_dataset | |
echo "== Query" | |
## rsparql --service http://localhost:3030/ds/query 'SELECT * WHERE {Graph ?G {?s ?p ?o}} ORDER BY ?G' | |
QSP="PREFIX : <http://localhost/test/> | |
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>" | |
QS="$QSP SELECT * WHERE {Graph ?G {?s ?p ?o}} ORDER BY ?G" | |
curl --header 'Accept: text/plain' \ | |
-d query="$QS" \ | |
http://localhost:3030/ds | |
echo "== Dump remote" | |
dump_dataset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment