Using cURL to Experiment with SPARQL and TQL
cURL is an excellent command-line tool you can use to experiment with Mulgara. Detailed documentation of the tool is available at its website. You can use its logging capabilities to inspect the details of an http transaction with Mulgara; see the --trace options. Another web page with examples is Debugging Semantic Web sites with cURL
A simple method for using cURL:
- In your working directory, create an rc file (I use "sparql.curlrc" and "tql.curlrc") and add your desired cURL options. My sparql.curlrc file looks like this:
-G url = "http://localhost:8088/sparql/" -H "Content-Type: application/sparql-query" --trace-ascii curl.log
If you have various servers you can create an rc file for each.
- For each query create a specific rc file. For example, my "query1.sparql" looks like:
--data-urlencode "query=SELECT * from <rmi://localhost/server1#sampledata> WHERE {?x ?y ?z}" --data-urlencode "format=json"
CAVEAT: versions of cURL earlier than 7.18.0 do not support --data-urlencode.
- Now run the query from the command line:
$ curl -K sparql.curl -K query1.curl > query1.result
CAVEAT: curl does not seem to support the rmi protocol as the host address. You can query rmi: graphs using curl, but you have to set the host URL to an http: address.
