TechArticle

wiki query

Infobox

headline
wiki query
description
Run SPARQL SELECT or CONSTRUCT against the wiki graph.

Execute SPARQL against the loaded wiki graph (with OWL-RL inference unless --no-inference).

Usage

wiki query "SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10"
wiki query --pretty "SELECT ?given ?family WHERE { ?s schema:givenName ?given ; schema:familyName ?family }"
cat query.sparql | wiki query -f json
wiki query "SELECT ?given WHERE { ?s schema:givenName ?given }" --jq 'results.bindings[].given.value'
wiki query "..." --reload -v
wiki query "..." --cache

Options

Flag Description
QUERY SPARQL string, or omit to read stdin
-f, --format table (default), json, csv, tsv, turtle, n3, markdown
-o, --output Write results to a file
--pretty Rich table for SELECT results (stdout only; incompatible with -o and --jq)
--no-inference Skip OWL-RL
--reload Rebuild in-memory graph in this process
--cache Persist a warm graph under .wiki/cache/ for reuse across new processes
--jq Filter JSON output (implies -f json)
-v, --verbose Print triple/subject counts first

Inspect one document

Use --pretty with a subject-focused SELECT to peek at frontmatter triples in the terminal. Markdown body and typed infobox layout are not reproduced — use Wiki Subcommand serve for full page preview.

wiki query --pretty "SELECT ?property ?value WHERE {
  wiki:Gregory_Davidson ?property ?value .
}"

Graph reuse

See Graph Cache — one graph per process unless --reload, plus optional cross-process warm-start via --cache.

HTTP endpoint

The same query engine backs an optional read-only SPARQL HTTP route when sparql_service.enabled is on in wiki.yaml. Configure keys and path collision rules in Wiki Configuration; request forms and Accept negotiation in Wiki Subcommand serve.

Backlinks