The arq
package contains some command line applications to
run queries, parse queries, process result sets and run test sets.
You will need to set the classpath, or use the helper scripts, to run these
applications from the command line. The helper scripts are in
bin/
(Linux, Unix, Cygwin) and bat/
(Windows) directories.
There are ancillary scripts in the directories that the main
commands need - you should put the relevant directory on your command path and
set the ARQROOT
environment variable after
checking these scripts are suitable.
arq.query
is the main query driver.
It can be called for SPARQL, ARQ or RDQL queries and there are wrapper commands for each language:
arq.sparql
,
arq.arq
and
arq.rdql
.
arq.remote
: execute a query by HTTP
arq.qparse
: parse and print a query.
arq.update
: execute SPARQL/Update requests.
arq
: run a test set.
arq.rset
: transform result sets.
arq.qexpr
: evaluate and print an expression.
All commands have a --help
command for a summary of the arguments.
When using a query in a file, if the query file ends .rq, it is assumed to be a SPARQL query. If it ends .arq, it is assumed to be an ARQ query (extensions to SPARQL) and if it ends .rdql, it is assumed to be an RDQL query. You can specify the syntax explicitly.
The commands jena.query
, jena.sparql
, jena.qtest
and
jena.rset
are equivalent and just call to these commands.
arq.query
This is the main command for executing queries on data. The wrappers just set the query language.
arq.sparql
: wrapper for SPARQL queriesarq.arq
: wrapper for ARQ queriesRunning arq.query --help
prints the usage message.
The main arguments are:
--query FILE
: The file with the query to execute--data FILE
: The data to query. It will be included in the
default graph.--namedgraph FILE
: The data to query. It will be included
as a named graph.--desc/--dataset
:
Jena Assembler description of the dataset to be queried, augmented with
vocabulary for datasets, not just graphs. See etc/
for
examples.--service URL
: Remote service locationThe file extension is used to guess the file serialization format. If a data file ends
.n3
, it is assumed to be N3; if it ends .ttl
is
Turtle; if it is .nt
is N-Triples; otherwise it is assumed to be RDF/XML.
The data serialization can be explicitly specified on the command line.
arq.qparse
Parse a query and print it out. Can be used to translate between syntaxes (but not perfectly - specifically, RDQL value constraints need further conversion as complete mechanical translation is not possible).
arq.qparse
will parse the query, print it out again
(with line numbers by default) and then parse the serialized query again.
If your query has a syntax error, a message is printed but no query is printed.
If a query is printed then you get a syntax error message, then your
query was syntactically correct but the ARQ serialization is broken.
The command arq.qparse --print=op --file queryFile
will print the
SPARQL algebra for the query in SSE format.
arq.update
Execute one or more SPARQL/Update requests.
SPARQL/Update is an update language based on SPARQL syntax.
--desc
:
Jena Assembler description of the dataset or graph store to be updated.
See etc/
for examples.arq.qtest
Execute a test set. In the ARQ directory, qtest --all
runs
the whole ARQ test suite.
To run a specific test suite, use qtest manifest
.
See the working group page
DAWG Testcases for details.
arq.rset
Read and write result sets.
In particular,
java -cp ... arq.rset --in xml --out text
will translate a SPARQL XML Result Set into a tabular text form.
arq.qexpr
Read and print an expression (something that can go in a FILTER
clause). Indicates whether an evaluation exception occured.
The -v
argument prints the parsed expression.
arq.remote
Execute a query using HTTP to contact a remote service:
--service URL
: The endpoint.--data FILE
: The data to query. It will be included in the
default graph.--namedgraph FILE
: The data to query. It will be included
as a named graph.