mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-03 15:01:00 +02:00
41 lines
704 B
TypeScript
41 lines
704 B
TypeScript
|
|
// Term type discriminators matching the wire format
|
||
|
|
// i = IRI, b = BLANK node, l = LITERAL, t = TRIPLE (reified)
|
||
|
|
export type TermType = "i" | "b" | "l" | "t";
|
||
|
|
|
||
|
|
export interface IriTerm {
|
||
|
|
t: "i";
|
||
|
|
i: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface BlankTerm {
|
||
|
|
t: "b";
|
||
|
|
d: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface LiteralTerm {
|
||
|
|
t: "l";
|
||
|
|
v: string;
|
||
|
|
dt?: string; // datatype
|
||
|
|
ln?: string; // language
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface TripleTerm {
|
||
|
|
t: "t";
|
||
|
|
tr?: Triple;
|
||
|
|
}
|
||
|
|
|
||
|
|
export type Term = IriTerm | BlankTerm | LiteralTerm | TripleTerm;
|
||
|
|
|
||
|
|
export interface PartialTriple {
|
||
|
|
s?: Term;
|
||
|
|
p?: Term;
|
||
|
|
o?: Term;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface Triple {
|
||
|
|
s: Term;
|
||
|
|
p: Term;
|
||
|
|
o: Term;
|
||
|
|
g?: string; // graph (renamed from direc to match backend)
|
||
|
|
}
|