#!/bin/bash

# Before running this ....
# Ensure the two services "update/service" and "sparql/read" exists 
# Named graph update only works on a mutable dataset (so not an ad-hoc in-memory one)

UPDATE="${1:-update.ru}"

export  http_proxy=
echo "=== Update"

## Either a HTML form (Content-Type:application/x-www-form-urlencoded)
## Needs a "request="
#wget -q -O - --post-data="request=$(cat $UPDATE)"  'http://localhost:2020/update/service'

## Or another Content-Type and the raw request.
wget -q -O - --header "Content-Type: " --post-data="$(cat $UPDATE)"  'http://localhost:2020/update/service'

echo
echo "=== Default graph"
wget -q -O - 'http://localhost:2020/sparql/read?query=SELECT * { ?s ?p ?o}&output=text'
echo
echo "=== Named graphs"
wget -q -O - 'http://localhost:2020/sparql/read?query=SELECT * { GRAPH ?g { ?s ?p ?o}}&output=text'
