Skip to content

Type Alias: SparqlRdfTerm

@kortexya/reasoninglayer


@kortexya/reasoninglayer / SparqlRdfTerm

SparqlRdfTerm = { type: "uri"; value: string; } | { type: "bnode"; value: string; } | { datatype?: string; lang?: string; type: "literal"; value: string; } | { type: "triple"; value: SparqlTripleTermValue; }

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

One RDF term bound to a variable in a SPARQL solution.

{ type: "uri"; value: string; }

type: "uri"

An IRI.

value: string

The IRI string.


{ type: "bnode"; value: string; }

type: "bnode"

A blank node.

value: string

The blank-node label.


{ datatype?: string; lang?: string; type: "literal"; value: string; }

optional datatype?: string

Datatype IRI, for a typed literal.

optional lang?: string

Language tag, for a language-tagged string (wire field xml:lang).

type: "literal"

An RDF literal.

value: string

The literal’s lexical form.


{ type: "triple"; value: SparqlTripleTermValue; }

type: "triple"

An RDF 1.2 triple term.

value: SparqlTripleTermValue

The nested subject / predicate / object of the quoted triple.

A discriminated union over the RDF term kinds of the W3C SPARQL 1.1 Query Results JSON Format, discriminated by type: uri, literal, bnode, or (RDF 1.2) triple.

Only a literal carries datatype (typed literal) or lang (language-tagged string); the wire form spells the language tag xml:lang and the normalizer maps it to lang. A triple term’s value is the nested SparqlTripleTermValue, not a lexical string.

This is NOT the tagged ValueDto / untagged FeatureValueDto Psi-term serialization — SPARQL results carry RDF terms, a separate wire vocabulary.

const iri: SparqlRdfTerm = { type: 'uri', value: 'http://example.org/alice' };
const age: SparqlRdfTerm = {
type: 'literal',
value: '42',
datatype: 'http://www.w3.org/2001/XMLSchema#integer',
};
const label: SparqlRdfTerm = { type: 'literal', value: 'Alice', lang: 'en' };