Skip to content

Type Alias: SparqlQueryResults

@kortexya/reasoninglayer


@kortexya/reasoninglayer / Sparql / SparqlQueryResults

Type Alias: SparqlQueryResults

SparqlQueryResults = SparqlSelectResults | SparqlAskResults

Defined in: src/types/sparql.ts:182

The results of an executed SPARQL query.

Remarks

Discriminated by resultType: select carries variables and bindings, ask carries a boolean. CONSTRUCT / DESCRIBE queries answer with an RDF graph document (Turtle by default), not a results document, and are therefore not representable here.

Example

const results = await client.sparql.executeQuery({ query: 'ASK { ?s ?p ?o }' });
if (results.resultType === 'ask') {
console.log(results.boolean);
} else {
console.log(results.vars, results.bindings.length);
}