Search documentation

Type a word or phrase to search documentation.

    Reference

    CLI: query

    Read data from a workspace with legra graph query.

    legra graph query <statement-or-file> [--format json|tsv] [--async]
    

    Pass a SPARQL statement or the path to a file containing one:

    legra graph query 'SELECT ?g ?s ?p ?o WHERE { GRAPH ?g { ?s ?p ?o } } LIMIT 20'
    legra graph query people.rq --format tsv --workspace research --branch main
    

    JSON is the default result format. TSV is useful for reading tabular results in a terminal or processing them with other tools.

    Example results

    After the Quickstart, query the sample names:

    legra graph query names.rq --branch main --format json
    

    Expected JSON result, indented here for readability:

    JSON output · Legra
    {
      "head": { "vars": ["name"] },
      "results": {
        "bindings": [
          { "name": { "type": "literal", "value": "Alice" } },
          { "name": { "type": "literal", "value": "Bob" } }
        ]
      }
    }
    

    To show the same result as a table:

    legra graph query names.rq --branch main --format tsv
    

    Expected TSV output:

    TSV output · Legra
    ?name
    "Alice"
    "Bob"
    

    Long-running queries

    --async submits a query and returns a task identifier. Add --disconnect-policy persist when the query should continue after the CLI disconnects. Use Tasks to check progress and get results.

    An empty result can mean that your query targets the wrong graph, workspace, or branch. See Querying for named-graph examples.