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

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

Output format (json as default). Supports json, xml, tsv, and csv SPARQL result format and simple for simplified JSON.

--ids|-i

Return Wikidata identifiers as strings instead of URIs (except for output format xml and json).

--api

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

--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+