Skip to content

Interface: SparqlTranslation

@kortexya/reasoninglayer


@kortexya/reasoninglayer / Sparql / SparqlTranslation

Interface: SparqlTranslation

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

The full SPARQL → OSFQL translation of a query, rendered without executing it.

Remarks

The runnable OSFQL leaf statements plus the algebra plan tree and the solution modifiers (DISTINCT, ORDER BY, LIMIT, OFFSET) the query carries. projection is undefined for SELECT *.

Example

const translation = await client.sparql.translateQuery({ query: 'SELECT * WHERE { ?s ?p ?o }' });
console.log(translation.form); // 'select'
console.log(translation.osfql.map((l) => l.osfql));

Properties

constructTemplate

constructTemplate: string[]

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

Rendered CONSTRUCT template triples (empty unless the form is construct).


distinct

distinct: boolean

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

Whether the query is a SELECT DISTINCT.


entailment

entailment: SparqlEntailmentRegime

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

Entailment regime the translation was performed under.


form

form: SparqlQueryForm

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

Query form: select / ask / construct / describe.


limit?

optional limit: number

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

LIMIT, when the query carries one.


offset

offset: number

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

OFFSET (0 when the query carries none).


orderBy

orderBy: SparqlOrderByKey[]

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

ORDER BY keys, in order.


osfql

osfql: SparqlOsfqlLeaf[]

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

Every OSFQL leaf statement, in plan order.


plan

plan: SparqlPlanNode

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

The algebra plan tree.


projection?

optional projection: string[]

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

Projected variables (without the leading ?); undefined for SELECT *.