NAME
wdq - command line access to Wikidata Query Service
USAGE
Access Wikidata Query Service via command line. A SPARQL query is read from STDIN or option query
. Default namespaces are added automatically. If a query starts with {
a SELECT
clause is added.
EXAMPLES
# get all parts of the solar system
wdq -q '{ ?c wdt:P361 wd:Q544 }'
OPTIONS
- --query|-q QUERY
-
File with query (
-
for STDIN as default). If query begins with{
it is used as WHERE clause of a SPARQL query. PREFIX definitions are included automatically. - --format|-f FORMAT
-
Output format. Supported formats include
json
,xml
,tsv
, andcsv
SPARQL result format,simple
for flat JSON without language tags (default), andldjson
for line delimited flat json. For more flexible output options pipe to another tool such as jq, miller, and catmandu. If Catmandu is installed, its exporters can directly be used with optionexport
. - --export EXPORTER
-
Use a Catmandu exporter as output format, for instance
XLS
(Excel) and Markdown tables (Table
). The following produce same output:wdq --export Foo wdq --format ldjson | catmandu convert to Foo
Use Catmandu config file (
catmandu.yml
) to further configure export. - --ids|-i
-
Return Wikidata identifiers as strings instead of URIs (except for output format
xml
andjson
). - --color|-C
-
By default output is colored if writing to a terminal. Disable this with
--no-color
or force color with--color
or-C
. - --api URL
-
SPARQL endpoint. Default value:
https://query.wikidata.org/bigdata/namespace/wdq/sparql
- --no-execute|-n
-
Don't execute query but show it in expanded form. Useful to validate and pretty-print queries.
- --no-default-prefixes
-
Don't add default namespace prefixes to the SPARQL query
- --help|-h|-?
-
Show usage help
- --man
-
Show detailled manual
- --version|-V
-
Show version if this script
COPYRIGHT AND LICENSE
Copyright by Jakob Voss voss@gbv.de
Based on a PHP script by Marius Hoch hoo@online.de
at https://github.com/mariushoch/asparagus.
Licensed under GPL 2.0+