Type Alias: SparqlRdfTerm
@kortexya/reasoninglayer / Sparql / SparqlRdfTerm
Type Alias: 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 Declaration
{ type: "uri"; value: string; }
type
type:
"uri"
An IRI.
value
value:
string
The IRI string.
{ type: "bnode"; value: string; }
type
type:
"bnode"
A blank node.
value
value:
string
The blank-node label.
{ datatype?: string; lang?: string; type: "literal"; value: string; }
datatype?
optionaldatatype:string
Datatype IRI, for a typed literal.
lang?
optionallang:string
Language tag, for a language-tagged string (wire field xml:lang).
type
type:
"literal"
An RDF literal.
value
value:
string
The literal’s lexical form.
{ type: "triple"; value: SparqlTripleTermValue; }
type
type:
"triple"
An RDF 1.2 triple term.
value
value:
SparqlTripleTermValue
The nested subject / predicate / object of the quoted triple.
Remarks
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.
Example
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' };