Using the ARQ SPARQL processor from the command line
With the Jena extensions.
I recently described how to execute Federated SPARQL queries that use Jena extensions that we’ll hopefully see added to the SPARQL 1.1 standard. I showed a sample query and suggested that you try it at the sparql.org RDF Query Demo page.
For local, command-line use of SPARQL, I’ve used the Jena ARQ query engine for years, but my sample federated query didn’t work with it, and now I know why: the sparql.bat file that comes with the distribution invokes the processor in a strictly standards-compliant mode without the extensions enabled. I thought I’d have to write and compile some Java code to use the extensions, but my co-worker Jeremy Carroll pointed out that the sparql.bat file in ARQ’s bat subdirectory calls the arq.sparql library, like this,
java -cp %CP% arq.sparql %*
and that calling the arq.arq library instead enables the extensions. Then, I noticed the arq.bat file in the same directory as sparql.bat, and this is exactly what it does. There are more batch files in there, and a web search on their names led me to an ARQ - Command Line Applications documentation page, which will be handy.
Using arq.bat instead of sparql.bat, the sample federated query works as written (tested with ARQ 2.8.2), and so does LET assignment and extension functions, making it possible to use ARQ in real semantic web application development with no need to do Java coding around the Jena API.
(Thanks again, Jeremy!)
Share this post