@littlebigbrain/client 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -5
- package/dist/client.d.ts +55 -176
- package/dist/client.js +184 -236
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/namespaces.d.ts +15 -84
- package/dist/namespaces.js +31 -190
- package/dist/schema.d.ts +1164 -5164
- package/dist/transport.d.ts +9 -2
- package/dist/transport.js +9 -0
- package/dist/types.d.ts +6 -17
- package/package.json +1 -1
package/dist/namespaces.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { LbbClient } from "./client.js";
|
|
2
2
|
import type { CallOptions } from "./transport.js";
|
|
3
|
-
import { type EntityAttributeFilterOptions, type ImportLine, type
|
|
3
|
+
import { type EntityAttributeFilterOptions, type ImportLine, type ReadConsistencyOptions, type RdfImportOptions, type Schemas } from "./types.js";
|
|
4
4
|
export interface HybridSearchOptions extends CallOptions {
|
|
5
5
|
topK?: number;
|
|
6
|
-
source?: string;
|
|
7
6
|
consistency?: string;
|
|
8
7
|
/** A5 read-your-writes floor (`min_indexed_seq`): the committed sequence a
|
|
9
8
|
* write returned; under eventual, an uncovered floor yields a retryable
|
|
@@ -14,10 +13,6 @@ export interface HybridSearchOptions extends CallOptions {
|
|
|
14
13
|
vector?: boolean;
|
|
15
14
|
targets?: string[];
|
|
16
15
|
profile?: string;
|
|
17
|
-
/** Valid-time cursor (RFC 3339): results reflect facts true at this instant. */
|
|
18
|
-
asOf?: string;
|
|
19
|
-
/** Snapshot pin: results reproduce the graph as of this commit sequence. */
|
|
20
|
-
asOfCommitSeq?: number;
|
|
21
16
|
/** Opt-in impression logging for later relevance feedback. */
|
|
22
17
|
logImpression?: boolean;
|
|
23
18
|
}
|
|
@@ -26,7 +21,6 @@ export declare class GraphNamespace {
|
|
|
26
21
|
readonly facts: FactsNamespace;
|
|
27
22
|
readonly context: ContextNamespace;
|
|
28
23
|
readonly entities: EntityNamespace;
|
|
29
|
-
readonly indexes: IndexNamespace;
|
|
30
24
|
readonly ontology: OntologyNamespace;
|
|
31
25
|
readonly query: QueryNamespace;
|
|
32
26
|
readonly schema: SchemaNamespace;
|
|
@@ -68,8 +62,6 @@ export declare class GraphNamespace {
|
|
|
68
62
|
}): Promise<Schemas["ManagedEmbeddingPromoteResponse"]>;
|
|
69
63
|
/** Retract edges/entities from the scoped graph. See {@link LbbClient.retract}. */
|
|
70
64
|
retract(body: Schemas["GraphRetractRequest"], opts?: CallOptions): Promise<Schemas["GraphRetractResponse"]>;
|
|
71
|
-
/** Export this graph's current snapshot as Turtle, N-Triples, TriG, or N-Quads. */
|
|
72
|
-
exportRdf(opts?: RdfExportOptions): Promise<string>;
|
|
73
65
|
}
|
|
74
66
|
export declare class FactsNamespace {
|
|
75
67
|
private readonly client;
|
|
@@ -80,7 +72,6 @@ export declare class FactsNamespace {
|
|
|
80
72
|
batch?: number;
|
|
81
73
|
strict?: boolean;
|
|
82
74
|
observedAt?: string;
|
|
83
|
-
index?: boolean;
|
|
84
75
|
idempotencyKey?: string;
|
|
85
76
|
}): Promise<Schemas["GraphImportResponse"]>;
|
|
86
77
|
/**
|
|
@@ -103,71 +94,18 @@ export declare class SearchNamespace {
|
|
|
103
94
|
fullText(body: Schemas["FullTextSearchRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["FullTextSearchResponse"]>;
|
|
104
95
|
vector(body: Schemas["EmbeddingSearchRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["EmbeddingSearchResponse"]>;
|
|
105
96
|
}
|
|
106
|
-
export declare class SchemaNamespace {
|
|
107
|
-
private readonly client;
|
|
108
|
-
constructor(client: LbbClient);
|
|
109
|
-
/** Active graph schema bundle: ontology plus activated SHACL shapes. */
|
|
110
|
-
view(opts?: {
|
|
111
|
-
audit?: boolean;
|
|
112
|
-
} & CallOptions): Promise<Schemas["SchemaBundleView"]>;
|
|
113
|
-
/** Preview a proposed RDF/SHACL schema bundle and audit current data. */
|
|
114
|
-
preview(body: Schemas["SchemaPreviewRequest"], opts?: CallOptions): Promise<Schemas["SchemaPreviewResponse"]>;
|
|
115
|
-
/** Activate a previewed SHACL schema bundle for this graph branch. */
|
|
116
|
-
publish(body: Schemas["SchemaPublishRequest"], opts?: CallOptions): Promise<Schemas["SchemaPublishResponse"]>;
|
|
117
|
-
/** Audit current data against the active SHACL schema bundle. */
|
|
118
|
-
audit(opts?: CallOptions): Promise<Schemas["SchemaAuditReport"]>;
|
|
119
|
-
}
|
|
120
|
-
export declare class IndexNamespace {
|
|
121
|
-
private readonly client;
|
|
122
|
-
constructor(client: LbbClient);
|
|
123
|
-
run(opts?: {
|
|
124
|
-
wait?: boolean;
|
|
125
|
-
background?: boolean;
|
|
126
|
-
body?: unknown;
|
|
127
|
-
} & CallOptions): Promise<unknown>;
|
|
128
|
-
build(opts?: {
|
|
129
|
-
background?: boolean;
|
|
130
|
-
} & CallOptions): Promise<unknown>;
|
|
131
|
-
delta(opts?: CallOptions): Promise<Schemas["IndexDeltaResponse"]>;
|
|
132
|
-
submit(body: Partial<Schemas["IndexBuildOptions"]> | undefined, opts: CallOptions & {
|
|
133
|
-
idempotencyKey: string;
|
|
134
|
-
}): Promise<Schemas["SearchIndexJobStatusResponse"]>;
|
|
135
|
-
job(jobId: string, opts?: CallOptions): Promise<Schemas["SearchIndexJobStatusResponse"]>;
|
|
136
|
-
cancel(jobId: string, opts?: CallOptions): Promise<Schemas["SearchIndexJobStatusResponse"]>;
|
|
137
|
-
gc(opts?: {
|
|
138
|
-
keepRuns?: number;
|
|
139
|
-
dryRun?: boolean;
|
|
140
|
-
} & CallOptions): Promise<Schemas["IndexGcResponse"]>;
|
|
141
|
-
submitGc(body: Schemas["IndexGcRequest"] | undefined, opts: CallOptions & {
|
|
142
|
-
idempotencyKey: string;
|
|
143
|
-
}): Promise<Schemas["IndexGcJobStatusResponse"]>;
|
|
144
|
-
gcJob(jobId: string, opts?: CallOptions): Promise<Schemas["IndexGcJobStatusResponse"]>;
|
|
145
|
-
cancelGc(jobId: string, opts?: CallOptions): Promise<Schemas["IndexGcJobStatusResponse"]>;
|
|
146
|
-
}
|
|
147
97
|
export declare class EntityNamespace {
|
|
148
98
|
private readonly client;
|
|
149
99
|
constructor(client: LbbClient);
|
|
150
100
|
/**
|
|
151
101
|
* Return the exact type cardinality and a bounded deterministic sample from
|
|
152
|
-
* the ranged adjacency
|
|
153
|
-
* falling back to an exhaustive
|
|
102
|
+
* the ranged adjacency family pinned by the published generation. A missing
|
|
103
|
+
* family fails closed rather than falling back to an exhaustive scan.
|
|
154
104
|
*/
|
|
155
105
|
sample(opts: {
|
|
156
106
|
type: string;
|
|
157
107
|
limit?: number;
|
|
158
108
|
} & CallOptions): Promise<Schemas["EntityTypeSampleResponse"]>;
|
|
159
|
-
/**
|
|
160
|
-
* Browse entities as the unified list envelope. Pass `fields` (names or `*`)
|
|
161
|
-
* to inline each row's typed attributes as native JSON (under `attributes`) —
|
|
162
|
-
* "list entities and their titles" in one call instead of a list plus N point
|
|
163
|
-
* lookups — or `ids`
|
|
164
|
-
* to fetch a specific set. Page with `cursor` from the previous `next_cursor`.
|
|
165
|
-
*/
|
|
166
|
-
list(opts?: EntityListOptions): Promise<ListResponse<Schemas["EntityExplorerRow"]>>;
|
|
167
|
-
/** Yield list envelopes while following `next_cursor` until exhaustion. */
|
|
168
|
-
pages(opts?: EntityListOptions): AsyncGenerator<ListResponse<Schemas["EntityExplorerRow"]>>;
|
|
169
|
-
/** Yield entities directly while following the server's stable cursor. */
|
|
170
|
-
iterate(opts?: EntityListOptions): AsyncGenerator<Schemas["EntityExplorerRow"]>;
|
|
171
109
|
get(opts: {
|
|
172
110
|
id?: string;
|
|
173
111
|
type?: string;
|
|
@@ -187,23 +125,10 @@ export declare class EntityNamespace {
|
|
|
187
125
|
*/
|
|
188
126
|
filterByAttributes(opts: EntityAttributeFilterOptions): Promise<Schemas["SparqlSelectResponse"]>;
|
|
189
127
|
}
|
|
190
|
-
|
|
191
|
-
type?: string;
|
|
192
|
-
limit?: number;
|
|
193
|
-
cursor?: string | number;
|
|
194
|
-
/** @deprecated Legacy alias for `cursor`. */
|
|
195
|
-
offset?: number;
|
|
196
|
-
query?: string;
|
|
197
|
-
/** Property names to inline per row (or `"*"` / `["*"]` for all). */
|
|
198
|
-
fields?: string | string[];
|
|
199
|
-
/** Specific entity ids to fetch in one call (bulk lookup). */
|
|
200
|
-
ids?: string | string[];
|
|
201
|
-
}
|
|
202
|
-
/** Grounding and answer operations over the graph's real vocabulary. */
|
|
128
|
+
/** Grounding operations over one pinned published vocabulary. */
|
|
203
129
|
export declare class ContextNamespace {
|
|
204
130
|
private readonly client;
|
|
205
131
|
constructor(client: LbbClient);
|
|
206
|
-
ask(body: Schemas["AskRequest"], opts?: CallOptions): Promise<Schemas["AskResponse"]>;
|
|
207
132
|
suggest(body: Schemas["SearchSuggestRequest"], opts?: CallOptions): Promise<Schemas["SearchSuggestResponse"]>;
|
|
208
133
|
resolve(body: Schemas["ResolveTermRequest"], opts?: CallOptions): Promise<Schemas["ResolveTermResponse"]>;
|
|
209
134
|
decode(body: Schemas["DecodeRequest"], opts?: CallOptions): Promise<Schemas["DecodeResponse"]>;
|
|
@@ -211,6 +136,15 @@ export declare class ContextNamespace {
|
|
|
211
136
|
sample?: number;
|
|
212
137
|
} & CallOptions): Promise<Schemas["GroundabilityReport"]>;
|
|
213
138
|
}
|
|
139
|
+
/** Active ontology/SHACL bundle metadata and atomic publication. */
|
|
140
|
+
export declare class SchemaNamespace {
|
|
141
|
+
private readonly client;
|
|
142
|
+
constructor(client: LbbClient);
|
|
143
|
+
/** Read active metadata without running request-time validation. */
|
|
144
|
+
view(opts?: CallOptions): Promise<Schemas["SchemaBundleView"]>;
|
|
145
|
+
/** Atomically publish a bundle; conformance is produced asynchronously. */
|
|
146
|
+
publish(body: Schemas["SchemaPublishRequest"], opts?: CallOptions): Promise<Schemas["SchemaPublishResponse"]>;
|
|
147
|
+
}
|
|
214
148
|
/** Ontology discovery and lifecycle operations. */
|
|
215
149
|
export declare class OntologyNamespace {
|
|
216
150
|
private readonly client;
|
|
@@ -218,14 +152,14 @@ export declare class OntologyNamespace {
|
|
|
218
152
|
view(options?: {
|
|
219
153
|
counts?: boolean;
|
|
220
154
|
} & CallOptions): Promise<Schemas["OntologyView"]>;
|
|
221
|
-
conformance(opts?: CallOptions): Promise<Schemas["SchemaAuditReport"]>;
|
|
155
|
+
conformance(opts?: CallOptions & Pick<ReadConsistencyOptions, "consistency">): Promise<Schemas["SchemaAuditReport"]>;
|
|
222
156
|
search(body: Schemas["OntologySearchRequest"], opts?: CallOptions): Promise<Schemas["OntologySearchResponse"]>;
|
|
223
157
|
resolve(body: Schemas["OntologyResolveRequest"], opts?: CallOptions): Promise<Schemas["OntologyResolveResponse"]>;
|
|
224
158
|
define(body: Schemas["OntologyDefineRequest"], opts?: CallOptions): Promise<Schemas["OntologyDefineResponse"]>;
|
|
225
159
|
evolve(body: Schemas["OntologyEvolveRequest"], opts?: CallOptions): Promise<Schemas["OntologyEvolveResponse"]>;
|
|
226
160
|
induce(body: Schemas["OntologyInduceRequest"], opts?: CallOptions): Promise<Schemas["OntologyInduceResponse"]>;
|
|
227
161
|
}
|
|
228
|
-
/** Structured, SPARQL-text,
|
|
162
|
+
/** Structured, SPARQL-text, and analytical query operations. */
|
|
229
163
|
export declare class QueryNamespace {
|
|
230
164
|
private readonly client;
|
|
231
165
|
constructor(client: LbbClient);
|
|
@@ -233,7 +167,4 @@ export declare class QueryNamespace {
|
|
|
233
167
|
sparql(body: Schemas["SparqlTextRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<import("./types.js").SparqlResults>;
|
|
234
168
|
sparqlRaw(body: Schemas["SparqlTextRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["SparqlTextResponse"]>;
|
|
235
169
|
analytics(body: Schemas["AnalyticQueryRequest"], opts?: CallOptions): Promise<Schemas["AnalyticQueryResponse"]>;
|
|
236
|
-
shacl(body: Schemas["ShaclQueryRequest"], opts?: CallOptions): Promise<Schemas["ShaclQueryResponse"]>;
|
|
237
|
-
infer(body: Schemas["InferenceRunRequest"], opts?: CallOptions): Promise<Schemas["InferenceRunResponse"]>;
|
|
238
|
-
premises(body: Schemas["RetrievalPremiseRequest"], opts?: CallOptions): Promise<Schemas["RetrievalPremiseResponse"]>;
|
|
239
170
|
}
|
package/dist/namespaces.js
CHANGED
|
@@ -28,7 +28,6 @@ export class GraphNamespace {
|
|
|
28
28
|
facts;
|
|
29
29
|
context;
|
|
30
30
|
entities;
|
|
31
|
-
indexes;
|
|
32
31
|
ontology;
|
|
33
32
|
query;
|
|
34
33
|
schema;
|
|
@@ -38,7 +37,6 @@ export class GraphNamespace {
|
|
|
38
37
|
this.facts = new FactsNamespace(client);
|
|
39
38
|
this.context = client.context;
|
|
40
39
|
this.entities = client.entities;
|
|
41
|
-
this.indexes = client.indexes;
|
|
42
40
|
this.ontology = client.ontology;
|
|
43
41
|
this.query = client.query;
|
|
44
42
|
this.schema = client.schema;
|
|
@@ -130,10 +128,6 @@ export class GraphNamespace {
|
|
|
130
128
|
body,
|
|
131
129
|
});
|
|
132
130
|
}
|
|
133
|
-
/** Export this graph's current snapshot as Turtle, N-Triples, TriG, or N-Quads. */
|
|
134
|
-
exportRdf(opts = {}) {
|
|
135
|
-
return this.client.exportRdf(opts);
|
|
136
|
-
}
|
|
137
131
|
}
|
|
138
132
|
export class FactsNamespace {
|
|
139
133
|
client;
|
|
@@ -149,7 +143,7 @@ export class FactsNamespace {
|
|
|
149
143
|
}
|
|
150
144
|
/** Bulk-load a dataset as NDJSON. See {@link LbbClient.import}. */
|
|
151
145
|
import(lines, opts = {}) {
|
|
152
|
-
const { batch, strict, observedAt,
|
|
146
|
+
const { batch, strict, observedAt, ...request } = opts;
|
|
153
147
|
const ndjson = typeof lines === "string"
|
|
154
148
|
? lines
|
|
155
149
|
: lines.map((line) => JSON.stringify(line)).join("\n");
|
|
@@ -158,7 +152,7 @@ export class FactsNamespace {
|
|
|
158
152
|
idempotencyKey: request.idempotencyKey ?? this.client.idempotencyKey("import"),
|
|
159
153
|
rawBody: ndjson,
|
|
160
154
|
contentType: "application/x-ndjson",
|
|
161
|
-
query: { batch, strict, observed_at: observedAt
|
|
155
|
+
query: { batch, strict, observed_at: observedAt },
|
|
162
156
|
});
|
|
163
157
|
}
|
|
164
158
|
/**
|
|
@@ -215,7 +209,6 @@ export class SearchNamespace {
|
|
|
215
209
|
query: {
|
|
216
210
|
query: input,
|
|
217
211
|
top_k: opts.topK,
|
|
218
|
-
source: opts.source,
|
|
219
212
|
consistency: opts.consistency ?? this.client.defaultConsistency,
|
|
220
213
|
min_indexed_seq: opts.minIndexedSeq,
|
|
221
214
|
lexical: opts.lexical,
|
|
@@ -223,8 +216,6 @@ export class SearchNamespace {
|
|
|
223
216
|
vector: opts.vector,
|
|
224
217
|
targets: opts.targets?.join(","),
|
|
225
218
|
profile: opts.profile,
|
|
226
|
-
as_of: opts.asOf,
|
|
227
|
-
as_of_commit_seq: opts.asOfCommitSeq,
|
|
228
219
|
log_impression: opts.logImpression,
|
|
229
220
|
},
|
|
230
221
|
});
|
|
@@ -263,101 +254,6 @@ export class SearchNamespace {
|
|
|
263
254
|
});
|
|
264
255
|
}
|
|
265
256
|
}
|
|
266
|
-
export class SchemaNamespace {
|
|
267
|
-
client;
|
|
268
|
-
constructor(client) {
|
|
269
|
-
this.client = client;
|
|
270
|
-
}
|
|
271
|
-
/** Active graph schema bundle: ontology plus activated SHACL shapes. */
|
|
272
|
-
view(opts = {}) {
|
|
273
|
-
const { audit, ...request } = opts;
|
|
274
|
-
return this.client.request("GET", "/v1/schema", {
|
|
275
|
-
...request,
|
|
276
|
-
query: { audit: audit || undefined },
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
/** Preview a proposed RDF/SHACL schema bundle and audit current data. */
|
|
280
|
-
preview(body, opts = {}) {
|
|
281
|
-
return this.client.request("POST", "/v1/schema/preview", {
|
|
282
|
-
...opts,
|
|
283
|
-
retry: opts.retry ?? true,
|
|
284
|
-
body,
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
/** Activate a previewed SHACL schema bundle for this graph branch. */
|
|
288
|
-
publish(body, opts = {}) {
|
|
289
|
-
return this.client.request("POST", "/v1/schema/publish", { ...opts, body });
|
|
290
|
-
}
|
|
291
|
-
/** Audit current data against the active SHACL schema bundle. */
|
|
292
|
-
audit(opts = {}) {
|
|
293
|
-
return this.client.request("POST", "/v1/schema/audit", {
|
|
294
|
-
...opts,
|
|
295
|
-
retry: opts.retry ?? true,
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
export class IndexNamespace {
|
|
300
|
-
client;
|
|
301
|
-
constructor(client) {
|
|
302
|
-
this.client = client;
|
|
303
|
-
}
|
|
304
|
-
run(opts = {}) {
|
|
305
|
-
const { wait, background: requestedBackground, body, ...request } = opts;
|
|
306
|
-
const background = requestedBackground ?? (wait === false ? true : undefined);
|
|
307
|
-
return this.client.request("POST", "/v1/index/run", {
|
|
308
|
-
...request,
|
|
309
|
-
query: { background },
|
|
310
|
-
body,
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
build(opts = {}) {
|
|
314
|
-
const { background, ...request } = opts;
|
|
315
|
-
return this.client.request("POST", "/v1/index/build", {
|
|
316
|
-
...request,
|
|
317
|
-
query: { background: background || undefined },
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
delta(opts = {}) {
|
|
321
|
-
return this.client.request("POST", "/v1/index/delta", opts);
|
|
322
|
-
}
|
|
323
|
-
submit(body = {}, opts) {
|
|
324
|
-
return this.client.request("POST", "/v1/index/jobs", { ...opts, body });
|
|
325
|
-
}
|
|
326
|
-
job(jobId, opts = {}) {
|
|
327
|
-
return this.client.request("GET", "/v1/index/jobs", {
|
|
328
|
-
...opts,
|
|
329
|
-
query: { job_id: jobId },
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
cancel(jobId, opts = {}) {
|
|
333
|
-
return this.client.request("DELETE", "/v1/index/jobs", {
|
|
334
|
-
...opts,
|
|
335
|
-
query: { job_id: jobId },
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
gc(opts = {}) {
|
|
339
|
-
const { keepRuns, dryRun, ...request } = opts;
|
|
340
|
-
return this.client.request("POST", "/v1/index/gc", {
|
|
341
|
-
...request,
|
|
342
|
-
query: { keep_runs: keepRuns, dry_run: dryRun },
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
submitGc(body = {}, opts) {
|
|
346
|
-
return this.client.request("POST", "/v1/index/gc-jobs", { ...opts, body });
|
|
347
|
-
}
|
|
348
|
-
gcJob(jobId, opts = {}) {
|
|
349
|
-
return this.client.request("GET", "/v1/index/gc-jobs", {
|
|
350
|
-
...opts,
|
|
351
|
-
query: { job_id: jobId },
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
cancelGc(jobId, opts = {}) {
|
|
355
|
-
return this.client.request("DELETE", "/v1/index/gc-jobs", {
|
|
356
|
-
...opts,
|
|
357
|
-
query: { job_id: jobId },
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
257
|
export class EntityNamespace {
|
|
362
258
|
client;
|
|
363
259
|
constructor(client) {
|
|
@@ -365,61 +261,12 @@ export class EntityNamespace {
|
|
|
365
261
|
}
|
|
366
262
|
/**
|
|
367
263
|
* Return the exact type cardinality and a bounded deterministic sample from
|
|
368
|
-
* the ranged adjacency
|
|
369
|
-
* falling back to an exhaustive
|
|
264
|
+
* the ranged adjacency family pinned by the published generation. A missing
|
|
265
|
+
* family fails closed rather than falling back to an exhaustive scan.
|
|
370
266
|
*/
|
|
371
267
|
sample(opts) {
|
|
372
268
|
return this.client.entityTypeSample(opts);
|
|
373
269
|
}
|
|
374
|
-
/**
|
|
375
|
-
* Browse entities as the unified list envelope. Pass `fields` (names or `*`)
|
|
376
|
-
* to inline each row's typed attributes as native JSON (under `attributes`) —
|
|
377
|
-
* "list entities and their titles" in one call instead of a list plus N point
|
|
378
|
-
* lookups — or `ids`
|
|
379
|
-
* to fetch a specific set. Page with `cursor` from the previous `next_cursor`.
|
|
380
|
-
*/
|
|
381
|
-
list(opts = {}) {
|
|
382
|
-
const csv = (v) => Array.isArray(v) ? v.join(",") : v;
|
|
383
|
-
return this.client.request("GET", "/v1/graph/entities", {
|
|
384
|
-
...transportOptions(opts),
|
|
385
|
-
query: {
|
|
386
|
-
type: opts.type,
|
|
387
|
-
limit: opts.limit,
|
|
388
|
-
cursor: opts.cursor,
|
|
389
|
-
offset: opts.offset,
|
|
390
|
-
q: opts.query,
|
|
391
|
-
fields: csv(opts.fields),
|
|
392
|
-
ids: csv(opts.ids),
|
|
393
|
-
},
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
/** Yield list envelopes while following `next_cursor` until exhaustion. */
|
|
397
|
-
async *pages(opts = {}) {
|
|
398
|
-
let cursor = opts.cursor;
|
|
399
|
-
const seen = new Set();
|
|
400
|
-
do {
|
|
401
|
-
const page = await this.list({
|
|
402
|
-
...opts,
|
|
403
|
-
cursor,
|
|
404
|
-
offset: cursor === undefined ? opts.offset : undefined,
|
|
405
|
-
});
|
|
406
|
-
yield page;
|
|
407
|
-
if (!page.has_more || page.next_cursor === null)
|
|
408
|
-
return;
|
|
409
|
-
if (seen.has(page.next_cursor)) {
|
|
410
|
-
throw new Error(`entity pagination cursor repeated: ${page.next_cursor}`);
|
|
411
|
-
}
|
|
412
|
-
seen.add(page.next_cursor);
|
|
413
|
-
cursor = page.next_cursor;
|
|
414
|
-
} while (true);
|
|
415
|
-
}
|
|
416
|
-
/** Yield entities directly while following the server's stable cursor. */
|
|
417
|
-
async *iterate(opts = {}) {
|
|
418
|
-
for await (const page of this.pages(opts)) {
|
|
419
|
-
for (const entity of page.data)
|
|
420
|
-
yield entity;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
270
|
get(opts) {
|
|
424
271
|
return this.client.entityMetadata(opts);
|
|
425
272
|
}
|
|
@@ -444,8 +291,6 @@ export class EntityNamespace {
|
|
|
444
291
|
select: opts.select,
|
|
445
292
|
limit: opts.limit,
|
|
446
293
|
offset: opts.offset,
|
|
447
|
-
as_of_valid_time: opts.asOfValidTime,
|
|
448
|
-
as_of_commit_seq: opts.asOfCommitSeq,
|
|
449
294
|
order_by: opts.orderBy,
|
|
450
295
|
reason: opts.reason,
|
|
451
296
|
max_solutions: opts.maxSolutions,
|
|
@@ -454,19 +299,12 @@ export class EntityNamespace {
|
|
|
454
299
|
});
|
|
455
300
|
}
|
|
456
301
|
}
|
|
457
|
-
/** Grounding
|
|
302
|
+
/** Grounding operations over one pinned published vocabulary. */
|
|
458
303
|
export class ContextNamespace {
|
|
459
304
|
client;
|
|
460
305
|
constructor(client) {
|
|
461
306
|
this.client = client;
|
|
462
307
|
}
|
|
463
|
-
ask(body, opts = {}) {
|
|
464
|
-
return this.client.request("POST", "/v1/ask", {
|
|
465
|
-
...opts,
|
|
466
|
-
retry: opts.retry ?? true,
|
|
467
|
-
body,
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
308
|
suggest(body, opts = {}) {
|
|
471
309
|
return this.client.request("POST", "/v1/search/suggest", {
|
|
472
310
|
...opts,
|
|
@@ -496,6 +334,25 @@ export class ContextNamespace {
|
|
|
496
334
|
});
|
|
497
335
|
}
|
|
498
336
|
}
|
|
337
|
+
/** Active ontology/SHACL bundle metadata and atomic publication. */
|
|
338
|
+
export class SchemaNamespace {
|
|
339
|
+
client;
|
|
340
|
+
constructor(client) {
|
|
341
|
+
this.client = client;
|
|
342
|
+
}
|
|
343
|
+
/** Read active metadata without running request-time validation. */
|
|
344
|
+
view(opts = {}) {
|
|
345
|
+
return this.client.request("GET", "/v1/schema", opts);
|
|
346
|
+
}
|
|
347
|
+
/** Atomically publish a bundle; conformance is produced asynchronously. */
|
|
348
|
+
publish(body, opts = {}) {
|
|
349
|
+
return this.client.request("POST", "/v1/schema/publish", {
|
|
350
|
+
...opts,
|
|
351
|
+
idempotencyKey: opts.idempotencyKey ?? this.client.idempotencyKey("schema-publish"),
|
|
352
|
+
body,
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
}
|
|
499
356
|
/** Ontology discovery and lifecycle operations. */
|
|
500
357
|
export class OntologyNamespace {
|
|
501
358
|
client;
|
|
@@ -510,7 +367,12 @@ export class OntologyNamespace {
|
|
|
510
367
|
});
|
|
511
368
|
}
|
|
512
369
|
conformance(opts = {}) {
|
|
513
|
-
return this.client.request("GET", "/v1/ontology/conformance",
|
|
370
|
+
return this.client.request("GET", "/v1/ontology/conformance", {
|
|
371
|
+
...opts,
|
|
372
|
+
query: {
|
|
373
|
+
consistency: opts.consistency ?? this.client.defaultConsistency,
|
|
374
|
+
},
|
|
375
|
+
});
|
|
514
376
|
}
|
|
515
377
|
search(body, opts = {}) {
|
|
516
378
|
return this.client.request("POST", "/v1/ontology/search", {
|
|
@@ -546,7 +408,7 @@ export class OntologyNamespace {
|
|
|
546
408
|
});
|
|
547
409
|
}
|
|
548
410
|
}
|
|
549
|
-
/** Structured, SPARQL-text,
|
|
411
|
+
/** Structured, SPARQL-text, and analytical query operations. */
|
|
550
412
|
export class QueryNamespace {
|
|
551
413
|
client;
|
|
552
414
|
constructor(client) {
|
|
@@ -590,25 +452,4 @@ export class QueryNamespace {
|
|
|
590
452
|
body,
|
|
591
453
|
});
|
|
592
454
|
}
|
|
593
|
-
shacl(body, opts = {}) {
|
|
594
|
-
return this.client.request("POST", "/v1/query/shacl", {
|
|
595
|
-
...opts,
|
|
596
|
-
retry: opts.retry ?? true,
|
|
597
|
-
body,
|
|
598
|
-
});
|
|
599
|
-
}
|
|
600
|
-
infer(body, opts = {}) {
|
|
601
|
-
return this.client.request("POST", "/v1/inference/run", {
|
|
602
|
-
...opts,
|
|
603
|
-
retry: opts.retry ?? true,
|
|
604
|
-
body,
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
premises(body, opts = {}) {
|
|
608
|
-
return this.client.request("POST", "/v1/inference/retrieval-premises", {
|
|
609
|
-
...opts,
|
|
610
|
-
retry: opts.retry ?? true,
|
|
611
|
-
body,
|
|
612
|
-
});
|
|
613
|
-
}
|
|
614
455
|
}
|