searchQuery
Read a sealed graph with SPARQL 1.1. Query returns JSONB rows you can join straight back into regular SQL — no bridge, no second protocol.
What it is
Query parses SPARQL, translates it to SQL over the hexastore, and executes it through a per-backend plan cache. Shared variables across triple patterns become joins; the result is a set of JSONB solution rows.
How you run it
sparql — SELECT, ASK, and UPDATE
pgrdf.sparql(q TEXT) → SETOF JSONBThe main door. Runs SELECT and ASK, and dispatches the full SPARQL 1.1 UPDATE algebra, inside the caller's transaction. See Pillar 2 — Semantic query.
construct — build a graph
pgrdf.construct(q TEXT)CONSTRUCT a new RDF graph from a query. See CONSTRUCT.
describe — concise bounded description
pgrdf.describe(q TEXT)DESCRIBE a resource (W3C §16.4 Concise Bounded Description).
sparql_parse — inspect without executing
pgrdf.sparql_parse(q TEXT)Return the query algebra without running it — a static gate. See sparql_parse.
The read surface is full: multi-pattern BGPs, FILTER, OPTIONAL, UNION, MINUS, VALUES, downstream BIND, aggregates with GROUP BY / HAVING, type-aware ORDER BY, GRAPH, and property paths.
Where it sits in a chain
After Seal; usually last. Query is the output verb — it runs on a sealed graph at any time, including after Reason has written inferred quads back, so a post-reasoning query sees the entailed triples too.
Scaling class — per-query
Query is neither the parallel-ingest class nor the single-threaded reasoning class: each call plans and executes against the hexastore with a cached plan. It is not the verb that drives the carve decision — Reason and Validate are.
Example
SELECT * FROM pgrdf.sparql(
'PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?p ?n WHERE { ?p foaf:name ?n }');
-- → {"p": "http://example.com/alice", "n": "Alice"}See also
- Pillar 2 — Semantic query — the full SPARQL 1.1 surface.
- Reason — run before Query to materialize entailments first.