Interface: SparqlTranslation
@kortexya/reasoninglayer / SparqlTranslation
Interface: SparqlTranslation
Section titled “Interface: SparqlTranslation”Defined in: src/types/sparql.ts:366
The full SPARQL → OSFQL translation of a query, rendered without executing it.
Remarks
Section titled “Remarks”The OSFQL statements (plan fragments unless SparqlTranslation.complete) plus the
algebra plan tree and the solution modifiers (DISTINCT, ORDER BY,
LIMIT, OFFSET) the query carries. projection is undefined for
SELECT *.
Example
Section titled “Example”const translation = await client.sparql.translateQuery({ query: 'SELECT * WHERE { ?s ?p ?o }' });console.log(translation.form); // 'select'if (translation.complete) { console.log(translation.osfql[0]?.osfql); // the one statement that answers the query}Properties
Section titled “Properties”complete
Section titled “complete”complete:
boolean
Defined in: src/types/sparql.ts:381
Whether osfql ANSWERS the query when run verbatim.
Remarks
Section titled “Remarks”Check this before running anything. true means osfql holds
exactly one statement that carries the whole query (filters, negations,
OPTIONALs, aggregation and modifiers), so running it gives the same
solutions as client.sparql.executeQuery on the original query.
false means osfql is a list of plan FRAGMENTS that the engine’s
bridge executes and joins itself: running osfql[0], or all of them in
sequence, answers a different question. Some plans (a probe over a
variable graph, for example) never fold into one statement, so false is
a permanent property of those queries. Run them with executeQuery.
constructTemplate
Section titled “constructTemplate”constructTemplate:
string[]
Defined in: src/types/sparql.ts:401
Rendered CONSTRUCT template triples (empty unless the form is construct).
distinct
Section titled “distinct”distinct:
boolean
Defined in: src/types/sparql.ts:393
Whether the query is a SELECT DISTINCT.
entailment
Section titled “entailment”entailment:
SparqlEntailmentRegime
Defined in: src/types/sparql.ts:385
Entailment regime the translation was performed under.
form:
SparqlQueryForm
Defined in: src/types/sparql.ts:383
Query form: select / ask / construct / describe.
limit?
Section titled “limit?”
optionallimit?:number
Defined in: src/types/sparql.ts:397
LIMIT, when the query carries one.
offset
Section titled “offset”offset:
number
Defined in: src/types/sparql.ts:399
OFFSET (0 when the query carries none).
orderBy
Section titled “orderBy”orderBy:
SparqlOrderByKey[]
Defined in: src/types/sparql.ts:395
ORDER BY keys, in order.
osfql:
SparqlOsfqlLeaf[]
Defined in: src/types/sparql.ts:387
Every OSFQL leaf statement, in plan order.
plan:
SparqlPlanNode
Defined in: src/types/sparql.ts:389
The algebra plan tree.
projection?
Section titled “projection?”
optionalprojection?:string[]
Defined in: src/types/sparql.ts:391
Projected variables (without the leading ?); undefined for SELECT *.