Table of Contents

Name

ts-query - execute query on 3store knowledge-base.

Synopsis

ts-query [-h] [-u <user>] [-p <passwd>] [-d <db>] [-r <host>] [-l language] [-f format] [-O level] <query>

Description

The ts-query command executes a query passed on the command line and outputs the results in a variety of formats. ts-explain shows the steps that would be used to a execute query on 3store knowledge-base.

Options

-h, --help
Show brief help message.
-u, --username
Set the username for the connection to the knowledge-base. This is optional, if it is not given a default will be used, generally 'rdf' unless it was changed at build time.
-p, --password
Set the password for the connection to the knowledge-base. This is optional, if it is not given a default will be used, generally 'rdf' unless it was changed at build time.
-d, --database
Set the database name used for the connection to the knowledge-base. If this parameter is not specified the default will be used.
-r, --remote
Give a remote host to connect to. If not given it will use the local machine.
-l, --language
Specifies the query language that the query is given in. Options are ``sparql'' an ``rdql''. ``sparql'' is recommended and is the default. Details of the SPARQL query language can be found at http://www.w3.org/TR/rdf-sparql-query/.
-f, --format
Set the result format. This controls the output format, it is one of ``sparql'' (the SPARQL XML result format for SELECT and ASK queries and RDF/XML for CONSTRUCT queries), ``testcase'' the DAWG testcase format, or ``v2'' the 3store version 2 result format.

This option is ignored in ts-explain.

-O, --optimise
Set the optimisation level. 0 is for no optimisation, 1 is normal, 2 is higher and 3 is experimental optimisations, which may reduce overall performance.
<query>
The query is given as the last command line argument. Only a single query may be specified, and if it must be escaped (either with shell quotes or backslashes) to pass the whitespace characters.

Example

ts-query "SELECT ?s WHERE { ?s ?p ?o . }"
-
Return every subject in the knowledge-base using the SPARQL XML results format.
ts-query "CONSTRUCT { ?s ?p ?o . }
WHERE { GRAPH <http://example.com/foo.rdf > { ?s ?p ?o . } }"
-
Dump the contents of the http://example.com/foo.rdf model as an RDF graph.

See Also

ts-setup(1) , ts-import(1) , ts-remove(1) , ts-util(1)


Table of Contents