@littlebigbrain/client 0.2.0 → 0.4.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.
@@ -43,6 +43,29 @@ export class GraphNamespace {
43
43
  query: { confirm },
44
44
  });
45
45
  }
46
+ embeddingConfig(opts = {}) {
47
+ return this.client.request("GET", "/v1/graph/embedding", opts);
48
+ }
49
+ setEmbeddingConfig(body, opts = {}) {
50
+ return this.client.request("POST", "/v1/graph/embedding", {
51
+ ...opts,
52
+ body,
53
+ });
54
+ }
55
+ backfillEmbeddings(options = {}) {
56
+ const { batchSize, limit, full, ...request } = options;
57
+ return this.client.request("POST", "/v1/graph/embedding/backfill", {
58
+ ...request,
59
+ query: { batch_size: batchSize, limit, full },
60
+ });
61
+ }
62
+ promoteEmbedding(options) {
63
+ const { runId, allowRegression, ...request } = options;
64
+ return this.client.request("POST", "/v1/graph/embedding/promote", {
65
+ ...request,
66
+ query: { run_id: runId, allow_regression: allowRegression },
67
+ });
68
+ }
46
69
  /** Retract edges/entities from the scoped graph. See {@link LbbClient.retract}. */
47
70
  retract(body, opts = {}) {
48
71
  return this.client.request("POST", "/v1/graph/retract", {
@@ -51,6 +74,10 @@ export class GraphNamespace {
51
74
  body,
52
75
  });
53
76
  }
77
+ /** Export this graph's current snapshot as Turtle, N-Triples, TriG, or N-Quads. */
78
+ exportRdf(opts = {}) {
79
+ return this.client.exportRdf(opts);
80
+ }
54
81
  }
55
82
  export class FactsNamespace {
56
83
  client;
@@ -79,23 +106,31 @@ export class FactsNamespace {
79
106
  });
80
107
  }
81
108
  /**
82
- * Bulk-load N-Triples through the native RDF import endpoint.
109
+ * Bulk-load N-Triples, Turtle, N-Quads, or TriG through the native RDF import endpoint.
83
110
  *
84
111
  * Statements are committed through the fixed RDF_TRIPLE relation; source RDF
85
112
  * predicates and literal term details are preserved as edge metadata.
86
113
  */
87
- importRdf(ntriples, opts = {}) {
88
- const { batch, strict, observedAt, resourceType, edgeIdempotency, ...request } = opts;
114
+ importRdf(rdf, opts = {}) {
115
+ const { format = "ntriples", baseIri, graphUri, blankNodeScope, batch, strict, observedAt, resourceType, edgeIdempotency, ...request } = opts;
89
116
  return this.client.request("POST", "/v1/graph/import/rdf", {
90
117
  ...request,
91
118
  idempotencyKey: request.idempotencyKey ?? this.client.idempotencyKey("import-rdf"),
92
- rawBody: ntriples,
93
- contentType: "application/n-triples",
119
+ rawBody: rdf,
120
+ contentType: {
121
+ ntriples: "application/n-triples",
122
+ turtle: "text/turtle",
123
+ nquads: "application/n-quads",
124
+ trig: "application/trig",
125
+ }[format],
94
126
  query: {
95
127
  batch,
96
128
  strict,
97
129
  observed_at: observedAt,
98
- format: "ntriples",
130
+ format,
131
+ base_iri: baseIri,
132
+ graph_uri: graphUri,
133
+ blank_node_scope: blankNodeScope,
99
134
  resource_type: resourceType,
100
135
  edge_idempotency: edgeIdempotency,
101
136
  },
@@ -401,6 +436,13 @@ export class OntologyNamespace {
401
436
  body,
402
437
  });
403
438
  }
439
+ induce(body, opts = {}) {
440
+ return this.client.request("POST", "/v1/ontology/induce", {
441
+ ...opts,
442
+ retry: opts.retry ?? true,
443
+ body,
444
+ });
445
+ }
404
446
  }
405
447
  /** Structured, SPARQL-text, reasoning, and analytical query operations. */
406
448
  export class QueryNamespace {
@@ -455,28 +497,3 @@ export class QueryNamespace {
455
497
  });
456
498
  }
457
499
  }
458
- /** Database administration. Keep stack credentials on trusted servers only. */
459
- export class AdminNamespace {
460
- client;
461
- constructor(client) {
462
- this.client = client;
463
- }
464
- createStack(body) {
465
- return this.client.adminCreateStack(body);
466
- }
467
- stack(slug) {
468
- return this.client.adminStack(slug);
469
- }
470
- rotateStackKey(slug) {
471
- return this.client.adminRotateStackKey(slug);
472
- }
473
- deleteStack(slug) {
474
- return this.client.adminDeleteStack(slug);
475
- }
476
- mintSession(accountId, ttlSeconds) {
477
- return this.client.adminMintSession(accountId, ttlSeconds);
478
- }
479
- stackActivity(slug, window = "24h") {
480
- return this.client.adminStackActivity(slug, window);
481
- }
482
- }