SYNOPSIS
toquet [options] QUERY-URI [QUERY-BASE-URI]
toquet [options] -e QUERY-STRING [QUERY-BASE-URI]
toquet [options] --describe URI
Options:
--exec Q, -e Q Provide query as a string
--describe U Describe URI <U>
--input L, -i L Set query language to L
--output F, -o F Set result format to F
--endpoint U, -E U SPARQL Protocol endpoint
--data U, -D U Data to query
--named U, -G U Named graph to query
--dump-query F, -d F Dump query in format F
--count, -c Count results only
--quiet, -q No extra information messages
--help, -h Show this help
--version, -v Show module versions
Query languages: sparql, sparql11 (default), rdql.
Graph output formats: rdfxml, n3, turtle, ntriples, rdfa,
nquads, rdfjson, canonical.
Binding output formats: xml, json, text, csv, excel, ods,
html, xhtml, ssw-xml, ssw-json.
Boolean output formats: xml, json, text.
Dump formats: sparql, sse, parsed, pattern.
OPTIONS
- --exec, -e
-
Provides the string to use as a query. May be in SPARQL or
RDQL. (RDQL is even supported on remote endpoints which only
speak SPARQL!)
If omitted, a query URI must be provided instead. This URI will be dereferenced (fetched) and a query is expected to be found inside (the HTTP Content-Type header is ignored).
The query base URI may be provided to allow the resolution of any relative URI references in the query.
- --describe
- Request a description of a particular URI. This overrides --exec. Multiple URIs can be provided.
- --input
- Query language. Default is 'sparql11' (SPARQL 1.1). Others are 'sparql' (SPARQL 1.0) and 'rdql'.
- --results, -r, --output, -o
-
Specifies the output format. The synopsis of this manual page
shows a list of input formats. Some output formats require
Spreadsheet::Wright and additional modules to be installed.
Defaults are 'ntriples' (for graphs) and 'text' (for bindings and booleans).
- --endpoint, -E
- A SPARQL Protocol 1.0 endpoint to query.
- --data, -D
-
Adds data from a URL to the default (unnamed) graph to be queried.
This option can be used multiple times, but cannot be used in conjunction with --endpoint.
- --named, -G, --source, -s
-
Adds data from a URL to a named graph to be queried.
This option can be used multiple times, but cannot be used in conjunction with --endpoint.
- --dump-query, -d
-
Dump the query itself (not the results).
Queries can be dumped as a SPARQL string (useful for interpolating relative URIs, or converting from RDQL), or as SSE. The parsed query (or just the graph pattern within it) can be dumped in YAML.
- --count, -c
-
Suppresses the output of the data, and just shows a count
of triples/bindings instead.
Boolean results (i.e. ASK queries) always return a count of 1.
- --quiet, -q
- Hides useless debugging messages.
- --help, -h
- Shows a short help message.
- --version, -v
- Shows the version of various Perl modules used by toquet. toquet itself doesn't have a version number, but is distributed along with RDF::TrineShortcuts, so could be considered to have the same version number as that.
SHEBANG!!
toquet can be used as a shebang line of a SPARQL query file. e.g.:
#!/usr/local/bin/toquet OPTS: -E http://dbpedia.org/sparql -o json PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?person ?name WHERE { ?person a foaf:Person ; foaf:name ?name . }
Note that you need the ``OPTS:'' bit to pass command-line options. This is a workaround for a limitation in Linux's shebang handling.
NOTE
When possible, toquet attempts to use the same command-line options as the 'roqet' tool that is distributed with librasqal. However, full compatibility with roqet is not a goal, and is certainly not guaranteed.A toquet is a small bonnet-like hat.
AUTHOR
Toby Inkster, <[email protected]>COPYRIGHT AND LICENCE
Copyright (C) 2010 by Toby InksterThis program is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8 or, at your option, any later version of Perl 5 you may have available.