@wazootech/worlds-sdk 0.11.4 → 0.11.6
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 +1 -0
- package/dist/{build-search-result-id-DPlgkWyi.js → build-search-result-id-owYEv-UZ.js} +1 -1
- package/dist/{chunk-and-embed-BlB2v4-2.js → chunk-and-embed-CNYO49kB.js} +1 -1
- package/dist/{client-B1oktOm6.d.ts → client-DHhpNpi6.d.ts} +3 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/memory.d.ts +1 -1
- package/dist/memory.js +1 -1
- package/dist/{mod-CfzcRVcL.d.ts → mod-Du9mzmwt.d.ts} +1 -1
- package/dist/{mod-C_Is4DOx.d.ts → mod-Q0-ml33V.d.ts} +1 -1
- package/dist/{mod-CH7Hc3EE.d.ts → mod-aUvsYiTJ.d.ts} +10 -5
- package/dist/quad-chunker.js +1 -1
- package/dist/{quad-store-oBgXOONP.js → quad-store-CT8YQQky.js} +55 -23
- package/dist/quad-store.d.ts +1 -1
- package/dist/quad-store.js +1 -1
- package/dist/{rdfjs-DodYvbzF.js → rdfjs-CN2lccto.js} +2 -2
- package/dist/rdfjs.d.ts +2 -2
- package/dist/rdfjs.js +1 -1
- package/dist/search-index.d.ts +1 -1
- package/dist/search-index.js +3 -3
- package/dist/shacl.d.ts +101 -0
- package/dist/shacl.js +970 -0
- package/dist/sparql-engine.d.ts +1 -1
- package/dist/testing.d.ts +6 -4
- package/dist/testing.js +39 -2
- package/dist/wazoo.d.ts +4 -4
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -143,6 +143,7 @@ for structured traversal and reasoning, powered by the zero-dependency
|
|
|
143
143
|
| `@wazootech/worlds-sdk/search-index` | Search index interface and types |
|
|
144
144
|
| `@wazootech/worlds-sdk/sparql-engine` | SPARQL engine interface |
|
|
145
145
|
| `@wazootech/worlds-sdk/rdfjs` | In-memory `RdfjsQuadStore` and `RdfjsSearchIndex` |
|
|
146
|
+
| `@wazootech/worlds-sdk/shacl` | Checks a write against a world's SHACL shapes |
|
|
146
147
|
| `@wazootech/worlds-sdk/ai-sdk` | Vercel AI SDK tool bindings |
|
|
147
148
|
|
|
148
149
|
The SPARQL engine is the external
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataFactory } from "@wazootech/sparql-engine/data-model";
|
|
2
|
-
import { h as hashQuad } from "./quad-store-
|
|
2
|
+
import { h as hashQuad } from "./quad-store-CT8YQQky.js";
|
|
3
3
|
// src/client/search-index/build-search-result-id.ts
|
|
4
4
|
const { literal, namedNode, quad: createQuad, defaultGraph } = DataFactory;
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as isTextualLiteral, h as hashQuad } from "./quad-store-
|
|
1
|
+
import { _ as isTextualLiteral, h as hashQuad } from "./quad-store-CT8YQQky.js";
|
|
2
2
|
// src/client/search-index/quad-chunker/chunk-quads.ts
|
|
3
3
|
/**
|
|
4
4
|
* chunkQuads filters literal payload candidates from a collection of RDF Quads
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as ImportRequest, X as ExportRequest, Z as ExportResponse, ct as ProvenanceQueryResponse, ot as ProvenanceQueryHandler, st as ProvenanceQueryRequest, tt as QuadStoreInterface } from "./mod-
|
|
2
|
-
import { c as SparqlRequest, i as SparqlResponse, s as SparqlEngineInterface } from "./mod-
|
|
3
|
-
import { C as ReindexResponse, D as SearchRequest, O as SearchResponse, S as ReindexRequest, w as SearchIndexInterface } from "./mod-
|
|
1
|
+
import { $ as ImportRequest, X as ExportRequest, Z as ExportResponse, ct as ProvenanceQueryResponse, ot as ProvenanceQueryHandler, st as ProvenanceQueryRequest, tt as QuadStoreInterface } from "./mod-aUvsYiTJ.js";
|
|
2
|
+
import { c as SparqlRequest, i as SparqlResponse, s as SparqlEngineInterface } from "./mod-Q0-ml33V.js";
|
|
3
|
+
import { C as ReindexResponse, D as SearchRequest, O as SearchResponse, S as ReindexRequest, w as SearchIndexInterface } from "./mod-Du9mzmwt.js";
|
|
4
4
|
/**
|
|
5
5
|
* WorldsSdkInterface is the public contract for the Worlds SDK.
|
|
6
6
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as EmbeddingService } from "./embedding-service-DebRMVmn.js";
|
|
2
2
|
import { t as FakeEmbeddingService } from "./mod-Dmrdrb03.js";
|
|
3
|
-
import { n as WorldsSdkInterface, r as WorldsSdkOptions, t as WorldsSdk } from "./client-
|
|
4
|
-
import { $ as ImportRequest, A as fromRdfjsTerm, B as QuadFilter, C as getFormat, D as fromRdfjsQuad, E as Quad, F as HexastoreIndexDescriptor, G as isImportCommit, H as PatchableStore, I as hashQuad, J as RdfjsStoreLike, K as isReplaceImportCommit, L as hashQuads, M as QuadRowReader, N as quadFromRow, O as toRdfjsQuad, P as HEXASTORE_INDEXES, Q as ImportMode, R as isTextualLiteral, S as exportQuadsResponse, T as parseQuads, U as TransactionContext, V as filterQuads, W as deduplicateBuffers, X as ExportRequest, Y as Patch, Z as ExportResponse, _ as createRdfjsStoreCommitHandler, a as preparePatch, at as ProvenanceListQuery, b as awaitDrainRemoveMatches, c as TransactionalRdfjsStore, ct as ProvenanceQueryResponse, d as RdfjsExportSource, dt as ProvenanceRecordInput, et as ImportSource, f as exportFromRdfjsStore, ft as ProvenanceRecordType, g as TransactionOptions, h as Transaction, i as computeNovelQuads, it as ProvenanceHistory, j as toRdfjsTerm, k as Term, l as TransactionalRdfjsStoreOptions, lt as ProvenanceQueryResult, m as MatchFunction, n as PreparedPatch, nt as InMemoryProvenanceStore, o as selectNovelQuads, ot as ProvenanceQueryHandler, p as importViaTransaction, pt as ProvenanceStore, q as RdfjsEventSource, r as SelectNovelQuadsOptions, rt as ImportProvenance, s as ReadonlyStore, st as ProvenanceQueryRequest, t as NovelQuads, tt as QuadStoreInterface, u as ImportViaTransactionOptions, ut as ProvenanceRecord, v as FORMATS, w as materializeImportQuads, x as collectQuadsFromStream, y as RdfFormat, z as QuadCriteria } from "./mod-
|
|
5
|
-
import { a as SparqlSelectResults, c as SparqlRequest, i as SparqlResponse, n as SparqlBinding, o as SparqlValue, r as SparqlConstructResults, s as SparqlEngineInterface, t as SparqlAskResults } from "./mod-
|
|
6
|
-
import { A as DEFAULT_RRF_K, C as ReindexResponse, D as SearchRequest, E as SearchMode, M as normalizeRrfScore, O as SearchResponse, S as ReindexRequest, T as SearchIndexOnImport, _ as extractRdfLocalLabel, a as RebuildSearchIndexResult, b as BuildSearchResultIdOptions, c as PreparedCommit, d as PlanSearchIndexingOptions, f as SearchIndexPlan, g as buildChunkFtsValue, h as DEFAULT_LABEL_PREDICATES, i as RebuildSearchIndexOptions, j as SearchScoreType, k as SearchResult, l as prepareCommit, m as BuildChunkFtsValueOptions, n as RebuildPage, o as rebuildSearchIndex, p as planSearchIndexing, r as RebuildScope, s as PrepareCommitOptions, t as ChunkRebuildDriver, u as DEFAULT_SEARCH_INDEX_ON_IMPORT, v as formatPredicatePhrase, w as SearchIndexInterface, x as buildSearchResultId, y as resolveLabelPredicates } from "./mod-
|
|
3
|
+
import { n as WorldsSdkInterface, r as WorldsSdkOptions, t as WorldsSdk } from "./client-DHhpNpi6.js";
|
|
4
|
+
import { $ as ImportRequest, A as fromRdfjsTerm, B as QuadFilter, C as getFormat, D as fromRdfjsQuad, E as Quad, F as HexastoreIndexDescriptor, G as isImportCommit, H as PatchableStore, I as hashQuad, J as RdfjsStoreLike, K as isReplaceImportCommit, L as hashQuads, M as QuadRowReader, N as quadFromRow, O as toRdfjsQuad, P as HEXASTORE_INDEXES, Q as ImportMode, R as isTextualLiteral, S as exportQuadsResponse, T as parseQuads, U as TransactionContext, V as filterQuads, W as deduplicateBuffers, X as ExportRequest, Y as Patch, Z as ExportResponse, _ as createRdfjsStoreCommitHandler, a as preparePatch, at as ProvenanceListQuery, b as awaitDrainRemoveMatches, c as TransactionalRdfjsStore, ct as ProvenanceQueryResponse, d as RdfjsExportSource, dt as ProvenanceRecordInput, et as ImportSource, f as exportFromRdfjsStore, ft as ProvenanceRecordType, g as TransactionOptions, h as Transaction, i as computeNovelQuads, it as ProvenanceHistory, j as toRdfjsTerm, k as Term, l as TransactionalRdfjsStoreOptions, lt as ProvenanceQueryResult, m as MatchFunction, n as PreparedPatch, nt as InMemoryProvenanceStore, o as selectNovelQuads, ot as ProvenanceQueryHandler, p as importViaTransaction, pt as ProvenanceStore, q as RdfjsEventSource, r as SelectNovelQuadsOptions, rt as ImportProvenance, s as ReadonlyStore, st as ProvenanceQueryRequest, t as NovelQuads, tt as QuadStoreInterface, u as ImportViaTransactionOptions, ut as ProvenanceRecord, v as FORMATS, w as materializeImportQuads, x as collectQuadsFromStream, y as RdfFormat, z as QuadCriteria } from "./mod-aUvsYiTJ.js";
|
|
5
|
+
import { a as SparqlSelectResults, c as SparqlRequest, i as SparqlResponse, n as SparqlBinding, o as SparqlValue, r as SparqlConstructResults, s as SparqlEngineInterface, t as SparqlAskResults } from "./mod-Q0-ml33V.js";
|
|
6
|
+
import { A as DEFAULT_RRF_K, C as ReindexResponse, D as SearchRequest, E as SearchMode, M as normalizeRrfScore, O as SearchResponse, S as ReindexRequest, T as SearchIndexOnImport, _ as extractRdfLocalLabel, a as RebuildSearchIndexResult, b as BuildSearchResultIdOptions, c as PreparedCommit, d as PlanSearchIndexingOptions, f as SearchIndexPlan, g as buildChunkFtsValue, h as DEFAULT_LABEL_PREDICATES, i as RebuildSearchIndexOptions, j as SearchScoreType, k as SearchResult, l as prepareCommit, m as BuildChunkFtsValueOptions, n as RebuildPage, o as rebuildSearchIndex, p as planSearchIndexing, r as RebuildScope, s as PrepareCommitOptions, t as ChunkRebuildDriver, u as DEFAULT_SEARCH_INDEX_ON_IMPORT, v as formatPredicatePhrase, w as SearchIndexInterface, x as buildSearchResultId, y as resolveLabelPredicates } from "./mod-Du9mzmwt.js";
|
|
7
7
|
import { a as ChunkRowPayload, c as chunkQuads, i as chunkAndEmbedQuads, n as ChunkAndEmbedResult, o as Document, r as EmbeddedChunk, s as TextSplitterInterface, t as ChunkAndEmbedOptions } from "./mod-CHiiyEER.js";
|
|
8
8
|
export { BuildChunkFtsValueOptions, BuildSearchResultIdOptions, ChunkAndEmbedOptions, ChunkAndEmbedResult, ChunkRebuildDriver, ChunkRowPayload, DEFAULT_LABEL_PREDICATES, DEFAULT_RRF_K, DEFAULT_SEARCH_INDEX_ON_IMPORT, Document, EmbeddedChunk, EmbeddingService, ExportRequest, ExportResponse, FORMATS, FakeEmbeddingService, HEXASTORE_INDEXES, HexastoreIndexDescriptor, ImportMode, ImportProvenance, ImportRequest, ImportSource, ImportViaTransactionOptions, InMemoryProvenanceStore, MatchFunction, NovelQuads, Patch, PatchableStore, PlanSearchIndexingOptions, PrepareCommitOptions, PreparedCommit, PreparedPatch, ProvenanceHistory, ProvenanceListQuery, ProvenanceQueryHandler, ProvenanceQueryRequest, ProvenanceQueryResponse, ProvenanceQueryResult, ProvenanceRecord, ProvenanceRecordInput, ProvenanceRecordType, ProvenanceStore, Quad, QuadCriteria, QuadFilter, QuadRowReader, QuadStoreInterface, RdfFormat, RdfjsEventSource, RdfjsExportSource, RdfjsStoreLike, ReadonlyStore, RebuildPage, RebuildScope, RebuildSearchIndexOptions, RebuildSearchIndexResult, ReindexRequest, ReindexResponse, SearchIndexInterface, SearchIndexOnImport, SearchIndexPlan, SearchMode, SearchRequest, SearchResponse, SearchResult, SearchScoreType, SelectNovelQuadsOptions, type SparqlAskResults, type SparqlBinding, type SparqlConstructResults, type SparqlEngineInterface, type SparqlRequest, type SparqlResponse, type SparqlSelectResults, type SparqlValue, Term, TextSplitterInterface, Transaction, TransactionContext, TransactionOptions, TransactionalRdfjsStore, TransactionalRdfjsStoreOptions, WorldsSdk, WorldsSdkInterface, WorldsSdkOptions, awaitDrainRemoveMatches, buildChunkFtsValue, buildSearchResultId, chunkAndEmbedQuads, chunkQuads, collectQuadsFromStream, computeNovelQuads, createRdfjsStoreCommitHandler, deduplicateBuffers, exportFromRdfjsStore, exportQuadsResponse, extractRdfLocalLabel, filterQuads, formatPredicatePhrase, fromRdfjsQuad, fromRdfjsTerm, getFormat, hashQuad, hashQuads, importViaTransaction, isImportCommit, isReplaceImportCommit, isTextualLiteral, materializeImportQuads, normalizeRrfScore, parseQuads, planSearchIndexing, prepareCommit, preparePatch, quadFromRow, rebuildSearchIndex, resolveLabelPredicates, selectNovelQuads, toRdfjsQuad, toRdfjsTerm };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as WorldsSdk } from "./client-BWh0UAM0.js";
|
|
2
|
-
import { S as InMemoryProvenanceStore, _ as isTextualLiteral, a as Transaction, b as isImportCommit, c as importViaTransaction, d as quadFromRow, f as fromRdfjsTerm, g as hashQuads, h as hashQuad, i as TransactionalRdfjsStore, l as fromRdfjsQuad, m as HEXASTORE_INDEXES, n as preparePatch, o as createRdfjsStoreCommitHandler, p as toRdfjsTerm, r as selectNovelQuads, s as exportFromRdfjsStore, t as computeNovelQuads, u as toRdfjsQuad, v as filterQuads, x as isReplaceImportCommit, y as deduplicateBuffers } from "./quad-store-
|
|
2
|
+
import { S as InMemoryProvenanceStore, _ as isTextualLiteral, a as Transaction, b as isImportCommit, c as importViaTransaction, d as quadFromRow, f as fromRdfjsTerm, g as hashQuads, h as hashQuad, i as TransactionalRdfjsStore, l as fromRdfjsQuad, m as HEXASTORE_INDEXES, n as preparePatch, o as createRdfjsStoreCommitHandler, p as toRdfjsTerm, r as selectNovelQuads, s as exportFromRdfjsStore, t as computeNovelQuads, u as toRdfjsQuad, v as filterQuads, x as isReplaceImportCommit, y as deduplicateBuffers } from "./quad-store-CT8YQQky.js";
|
|
3
3
|
import { a as getFormat, i as exportQuadsResponse, n as awaitDrainRemoveMatches, o as materializeImportQuads, r as collectQuadsFromStream, s as parseQuads, t as FORMATS } from "./rdf-formats-C2znopLM.js";
|
|
4
|
-
import { t as buildSearchResultId } from "./build-search-result-id-
|
|
4
|
+
import { t as buildSearchResultId } from "./build-search-result-id-owYEv-UZ.js";
|
|
5
5
|
import { DEFAULT_LABEL_PREDICATES, DEFAULT_RRF_K, DEFAULT_SEARCH_INDEX_ON_IMPORT, buildChunkFtsValue, extractRdfLocalLabel, formatPredicatePhrase, normalizeRrfScore, planSearchIndexing, prepareCommit, rebuildSearchIndex, resolveLabelPredicates } from "./search-index.js";
|
|
6
|
-
import { n as chunkQuads, t as chunkAndEmbedQuads } from "./chunk-and-embed-
|
|
6
|
+
import { n as chunkQuads, t as chunkAndEmbedQuads } from "./chunk-and-embed-CNYO49kB.js";
|
|
7
7
|
import { FakeEmbeddingService } from "./embedding-service.js";
|
|
8
8
|
import "./quad-chunker.js";
|
|
9
9
|
export { DEFAULT_LABEL_PREDICATES, DEFAULT_RRF_K, DEFAULT_SEARCH_INDEX_ON_IMPORT, FORMATS, FakeEmbeddingService, HEXASTORE_INDEXES, InMemoryProvenanceStore, Transaction, TransactionalRdfjsStore, WorldsSdk, awaitDrainRemoveMatches, buildChunkFtsValue, buildSearchResultId, chunkAndEmbedQuads, chunkQuads, collectQuadsFromStream, computeNovelQuads, createRdfjsStoreCommitHandler, deduplicateBuffers, exportFromRdfjsStore, exportQuadsResponse, extractRdfLocalLabel, filterQuads, formatPredicatePhrase, fromRdfjsQuad, fromRdfjsTerm, getFormat, hashQuad, hashQuads, importViaTransaction, isImportCommit, isReplaceImportCommit, isTextualLiteral, materializeImportQuads, normalizeRrfScore, parseQuads, planSearchIndexing, prepareCommit, preparePatch, quadFromRow, rebuildSearchIndex, resolveLabelPredicates, selectNovelQuads, toRdfjsQuad, toRdfjsTerm };
|
package/dist/memory.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* store), so the @wazootech/worlds-sdk/testing harness and every backend's phase-4
|
|
7
7
|
* parity suite can run against a zero-dependency in-memory reference.
|
|
8
8
|
*/
|
|
9
|
-
import { t as WorldsSdk } from "./client-
|
|
9
|
+
import { t as WorldsSdk } from "./client-DHhpNpi6.js";
|
|
10
10
|
/**
|
|
11
11
|
* createMemoryWorldsSdk builds a portable in-memory WorldsSdk backed by the Wazoo
|
|
12
12
|
* engine's MemoryStore (the in-memory baseline, per the durable-backend map's
|
package/dist/memory.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as WorldsSdk } from "./client-BWh0UAM0.js";
|
|
2
|
-
import { r as RdfjsSearchIndex, t as RdfjsQuadStore } from "./rdfjs-
|
|
2
|
+
import { r as RdfjsSearchIndex, t as RdfjsQuadStore } from "./rdfjs-CN2lccto.js";
|
|
3
3
|
import { MemoryStore, WazooSparqlEngine } from "@wazootech/sparql-engine";
|
|
4
4
|
// src/memory/create-memory-sdk.ts
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as QuadFilter, U as TransactionContext, Y as Patch, n as PreparedPatch, t as NovelQuads } from "./mod-
|
|
1
|
+
import { B as QuadFilter, U as TransactionContext, Y as Patch, n as PreparedPatch, t as NovelQuads } from "./mod-aUvsYiTJ.js";
|
|
2
2
|
import { a as ChunkRowPayload, r as EmbeddedChunk, t as ChunkAndEmbedOptions } from "./mod-CHiiyEER.js";
|
|
3
3
|
import * as rdfjs from "@rdfjs/types";
|
|
4
4
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SparqlAskResults, SparqlBinding, SparqlConstructResults, SparqlRequest as SparqlRequest$1, SparqlResponse, SparqlResponse as SparqlResponse$1, SparqlSelectResults, SparqlValue } from "@wazootech/sparql-engine";
|
|
2
|
-
import { rt as ImportProvenance } from "./mod-
|
|
2
|
+
import { rt as ImportProvenance } from "./mod-aUvsYiTJ.js";
|
|
3
3
|
/**
|
|
4
4
|
* SparqlRequest is the engine's request plus what the SDK needs to say about an
|
|
5
5
|
* update.
|
|
@@ -273,6 +273,10 @@ declare function isImportCommit(context?: TransactionContext): boolean;
|
|
|
273
273
|
declare function isReplaceImportCommit(context?: TransactionContext): boolean;
|
|
274
274
|
/**
|
|
275
275
|
* deduplicateBuffers removes quads that appear in both insert and delete buffers.
|
|
276
|
+
*
|
|
277
|
+
* @deprecated The two buffers don't say which operation came last, so this can
|
|
278
|
+
* lose a delete or an insert. Transaction keeps the last operation on each quad
|
|
279
|
+
* and no longer calls this function.
|
|
276
280
|
*/
|
|
277
281
|
declare function deduplicateBuffers(insertBuffer: rdfjs.Quad[], deleteBuffer: rdfjs.Quad[]): void;
|
|
278
282
|
/**
|
|
@@ -462,20 +466,21 @@ type MatchFunction = (subject?: rdfjs.Term | null, predicate?: rdfjs.Term | null
|
|
|
462
466
|
* TransactionOptions configures the handlers used when a transaction commits.
|
|
463
467
|
*/
|
|
464
468
|
interface TransactionOptions {
|
|
465
|
-
/** commit persists the
|
|
469
|
+
/** commit persists the net patch: the last operation on each quad. */
|
|
466
470
|
commit?: (patch: Patch, context?: TransactionContext) => Promise<void>;
|
|
467
471
|
/** fallbackCommit runs when commit is omitted. */
|
|
468
472
|
fallbackCommit?: (patch: Patch, context?: TransactionContext) => Promise<void>;
|
|
469
473
|
}
|
|
470
474
|
/**
|
|
471
|
-
* Transaction collects mutations natively before flushing them as
|
|
475
|
+
* Transaction collects mutations natively before flushing them as one Patch. The
|
|
476
|
+
* last operation on a quad wins, whether or not the quad is stored.
|
|
472
477
|
* It deeply implements the mutation boundary for an rdfjs.Store, providing rich bulk
|
|
473
478
|
* ingestion without requiring wrapper classes.
|
|
474
479
|
*/
|
|
475
480
|
declare class Transaction {
|
|
476
481
|
private readonly options;
|
|
477
|
-
|
|
478
|
-
private
|
|
482
|
+
/** changes are the buffered operations in the order they were made. */
|
|
483
|
+
private changes;
|
|
479
484
|
constructor(options: TransactionOptions);
|
|
480
485
|
/** add buffers a single quad for insertion on the next commit. */
|
|
481
486
|
add(quad: rdfjs.Quad): this;
|
|
@@ -497,7 +502,7 @@ declare class Transaction {
|
|
|
497
502
|
removeMatches(match: MatchFunction, subject?: rdfjs.Term | null, predicate?: rdfjs.Term | null, object?: rdfjs.Term | null, graph?: rdfjs.Term | null): EventEmitter;
|
|
498
503
|
/** deleteGraph buffers all quads in the named graph for deletion on commit. */
|
|
499
504
|
deleteGraph(match: MatchFunction, graph: rdfjs.Term | string): EventEmitter;
|
|
500
|
-
/** commit
|
|
505
|
+
/** commit persists the net patch through the configured commitHandler. */
|
|
501
506
|
commit(context?: TransactionContext): Promise<void>;
|
|
502
507
|
/** rollback discards any uncommitted insertions and deletions. */
|
|
503
508
|
rollback(): void;
|
package/dist/quad-chunker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as chunkAndEmbedQuads, n as chunkQuads } from "./chunk-and-embed-
|
|
1
|
+
export { t as chunkAndEmbedQuads, n as chunkQuads } from "./chunk-and-embed-CNYO49kB.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as exportQuadsResponse, o as materializeImportQuads, r as collectQuadsFromStream } from "./rdf-formats-C2znopLM.js";
|
|
2
|
-
import { sha256Hex } from "@wazootech/sparql-engine/term";
|
|
2
|
+
import { sha256Hex, termKey } from "@wazootech/sparql-engine/term";
|
|
3
3
|
import { DataFactory } from "@wazootech/sparql-engine/data-model";
|
|
4
4
|
import { EventEmitter } from "node:events";
|
|
5
5
|
// src/client/quad-store/provenance/in-memory-provenance-store.ts
|
|
@@ -90,6 +90,10 @@ function isReplaceImportCommit(context) {
|
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
92
|
* deduplicateBuffers removes quads that appear in both insert and delete buffers.
|
|
93
|
+
*
|
|
94
|
+
* @deprecated The two buffers don't say which operation came last, so this can
|
|
95
|
+
* lose a delete or an insert. Transaction keeps the last operation on each quad
|
|
96
|
+
* and no longer calls this function.
|
|
93
97
|
*/
|
|
94
98
|
function deduplicateBuffers(insertBuffer, deleteBuffer) {
|
|
95
99
|
const removeFromInsert = [];
|
|
@@ -611,6 +615,32 @@ async function exportFromRdfjsStore(rdfjsStore, request) {
|
|
|
611
615
|
const quads = await collectQuadsFromStream(stream);
|
|
612
616
|
return await exportQuadsResponse(quads, request);
|
|
613
617
|
}
|
|
618
|
+
// src/client/quad-store/net-patch.ts
|
|
619
|
+
/**
|
|
620
|
+
* buildNetPatch turns operations, in the order they were made, into the patch
|
|
621
|
+
* with the same result. The last operation on a quad wins, whether or not the
|
|
622
|
+
* store holds it, so no quad is in both halves of the patch.
|
|
623
|
+
*/
|
|
624
|
+
function buildNetPatch(changes) {
|
|
625
|
+
const net = changes.some(({ insert }) => insert !== changes[0].insert) ? [...lastChanges(changes).values()] : changes;
|
|
626
|
+
return {
|
|
627
|
+
insertions: net.filter(({ insert }) => insert).map(({ quad }) => quad),
|
|
628
|
+
deletions: net.filter(({ insert }) => !insert).map(({ quad }) => quad)
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
/** lastChanges maps each quad's key to the last operation on it. */
|
|
632
|
+
function lastChanges(changes) {
|
|
633
|
+
return new Map(changes.map((change) => [quadKey(change.quad), change]));
|
|
634
|
+
}
|
|
635
|
+
/** quadKey identifies a quad by its four terms. */
|
|
636
|
+
function quadKey(quad) {
|
|
637
|
+
return JSON.stringify([
|
|
638
|
+
quad.subject,
|
|
639
|
+
quad.predicate,
|
|
640
|
+
quad.object,
|
|
641
|
+
quad.graph
|
|
642
|
+
].map(termKey));
|
|
643
|
+
}
|
|
614
644
|
// src/client/quad-store/rdfjs-store-commit-handler.ts
|
|
615
645
|
/**
|
|
616
646
|
* createRdfjsStoreCommitHandler returns a commit function that applies Patches
|
|
@@ -641,20 +671,24 @@ function createRdfjsStoreCommitHandler(store) {
|
|
|
641
671
|
// src/client/quad-store/transaction.ts
|
|
642
672
|
const { namedNode } = DataFactory;
|
|
643
673
|
/**
|
|
644
|
-
* Transaction collects mutations natively before flushing them as
|
|
674
|
+
* Transaction collects mutations natively before flushing them as one Patch. The
|
|
675
|
+
* last operation on a quad wins, whether or not the quad is stored.
|
|
645
676
|
* It deeply implements the mutation boundary for an rdfjs.Store, providing rich bulk
|
|
646
677
|
* ingestion without requiring wrapper classes.
|
|
647
678
|
*/
|
|
648
679
|
var Transaction = class {
|
|
649
680
|
options;
|
|
650
|
-
|
|
651
|
-
|
|
681
|
+
/** changes are the buffered operations in the order they were made. */
|
|
682
|
+
changes = [];
|
|
652
683
|
constructor(options) {
|
|
653
684
|
this.options = options;
|
|
654
685
|
}
|
|
655
686
|
/** add buffers a single quad for insertion on the next commit. */
|
|
656
687
|
add(quad) {
|
|
657
|
-
this.
|
|
688
|
+
this.changes.push({
|
|
689
|
+
quad,
|
|
690
|
+
insert: true
|
|
691
|
+
});
|
|
658
692
|
return this;
|
|
659
693
|
}
|
|
660
694
|
/** addQuad buffers a single quad for insertion on the next commit. */
|
|
@@ -663,17 +697,20 @@ var Transaction = class {
|
|
|
663
697
|
}
|
|
664
698
|
/** addQuads buffers multiple quads for insertion on the next commit. */
|
|
665
699
|
addQuads(quads) {
|
|
666
|
-
for (const quad of quads) this.
|
|
700
|
+
for (const quad of quads) this.add(quad);
|
|
667
701
|
return this;
|
|
668
702
|
}
|
|
669
703
|
/** removeQuads buffers multiple quads for deletion on the next commit. */
|
|
670
704
|
removeQuads(quads) {
|
|
671
|
-
for (const quad of quads) this.
|
|
705
|
+
for (const quad of quads) this.delete(quad);
|
|
672
706
|
return this;
|
|
673
707
|
}
|
|
674
708
|
/** delete buffers a single quad for deletion on the next commit. */
|
|
675
709
|
delete(quad) {
|
|
676
|
-
this.
|
|
710
|
+
this.changes.push({
|
|
711
|
+
quad,
|
|
712
|
+
insert: false
|
|
713
|
+
});
|
|
677
714
|
return this;
|
|
678
715
|
}
|
|
679
716
|
/** removeQuad buffers a single quad for deletion on the next commit. */
|
|
@@ -682,29 +719,25 @@ var Transaction = class {
|
|
|
682
719
|
}
|
|
683
720
|
/** import consumes an RDF/JS stream, buffering all quads for later commit. */
|
|
684
721
|
import(stream) {
|
|
685
|
-
return
|
|
722
|
+
return bridgeStream(stream, (quad) => this.add(quad));
|
|
686
723
|
}
|
|
687
724
|
/** remove consumes a stream and buffers all quads from it for deletion on commit. */
|
|
688
725
|
remove(stream) {
|
|
689
|
-
return
|
|
726
|
+
return bridgeStream(stream, (quad) => this.delete(quad));
|
|
690
727
|
}
|
|
691
728
|
/** removeMatches buffers all quads matching the given quad pattern for deletion on commit. */
|
|
692
729
|
removeMatches(match, subject, predicate, object, graph) {
|
|
693
|
-
return
|
|
730
|
+
return bridgeStream(match(subject, predicate, object, graph), (quad) => this.delete(quad));
|
|
694
731
|
}
|
|
695
732
|
/** deleteGraph buffers all quads in the named graph for deletion on commit. */
|
|
696
733
|
deleteGraph(match, graph) {
|
|
697
734
|
const graphTerm = typeof graph === "string" ? namedNode(graph) : graph;
|
|
698
735
|
return this.removeMatches(match, null, null, null, graphTerm);
|
|
699
736
|
}
|
|
700
|
-
/** commit
|
|
737
|
+
/** commit persists the net patch through the configured commitHandler. */
|
|
701
738
|
async commit(context) {
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
const patch = {
|
|
705
|
-
insertions: this.insertBuffer,
|
|
706
|
-
deletions: this.deleteBuffer
|
|
707
|
-
};
|
|
739
|
+
if (this.changes.length === 0) return;
|
|
740
|
+
const patch = buildNetPatch(this.changes);
|
|
708
741
|
if (this.options.commit) await this.options.commit(patch, context);
|
|
709
742
|
else if (this.options.fallbackCommit) await this.options.fallbackCommit(patch, context);
|
|
710
743
|
this.clearBuffer();
|
|
@@ -714,17 +747,16 @@ var Transaction = class {
|
|
|
714
747
|
this.clearBuffer();
|
|
715
748
|
}
|
|
716
749
|
clearBuffer() {
|
|
717
|
-
this.
|
|
718
|
-
this.deleteBuffer = [];
|
|
750
|
+
this.changes = [];
|
|
719
751
|
}
|
|
720
752
|
};
|
|
721
753
|
/**
|
|
722
|
-
*
|
|
754
|
+
* bridgeStream passes every quad of an RDF/JS stream to `receive`.
|
|
723
755
|
*/
|
|
724
|
-
function
|
|
756
|
+
function bridgeStream(stream, receive) {
|
|
725
757
|
const emitter = new EventEmitter();
|
|
726
758
|
stream.on("data", (quad) => {
|
|
727
|
-
|
|
759
|
+
receive(quad);
|
|
728
760
|
});
|
|
729
761
|
stream.on("end", () => {
|
|
730
762
|
emitter.emit("end");
|
package/dist/quad-store.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as ImportRequest, A as fromRdfjsTerm, B as QuadFilter, C as getFormat, D as fromRdfjsQuad, E as Quad, F as HexastoreIndexDescriptor, G as isImportCommit, H as PatchableStore, I as hashQuad, J as RdfjsStoreLike, K as isReplaceImportCommit, L as hashQuads, M as QuadRowReader, N as quadFromRow, O as toRdfjsQuad, P as HEXASTORE_INDEXES, Q as ImportMode, R as isTextualLiteral, S as exportQuadsResponse, T as parseQuads, U as TransactionContext, V as filterQuads, W as deduplicateBuffers, X as ExportRequest, Y as Patch, Z as ExportResponse, _ as createRdfjsStoreCommitHandler, a as preparePatch, at as ProvenanceListQuery, b as awaitDrainRemoveMatches, c as TransactionalRdfjsStore, ct as ProvenanceQueryResponse, d as RdfjsExportSource, dt as ProvenanceRecordInput, et as ImportSource, f as exportFromRdfjsStore, ft as ProvenanceRecordType, g as TransactionOptions, h as Transaction, i as computeNovelQuads, it as ProvenanceHistory, j as toRdfjsTerm, k as Term, l as TransactionalRdfjsStoreOptions, lt as ProvenanceQueryResult, m as MatchFunction, n as PreparedPatch, nt as InMemoryProvenanceStore, o as selectNovelQuads, ot as ProvenanceQueryHandler, p as importViaTransaction, pt as ProvenanceStore, q as RdfjsEventSource, r as SelectNovelQuadsOptions, rt as ImportProvenance, s as ReadonlyStore, st as ProvenanceQueryRequest, t as NovelQuads, tt as QuadStoreInterface, u as ImportViaTransactionOptions, ut as ProvenanceRecord, v as FORMATS, w as materializeImportQuads, x as collectQuadsFromStream, y as RdfFormat, z as QuadCriteria } from "./mod-
|
|
1
|
+
import { $ as ImportRequest, A as fromRdfjsTerm, B as QuadFilter, C as getFormat, D as fromRdfjsQuad, E as Quad, F as HexastoreIndexDescriptor, G as isImportCommit, H as PatchableStore, I as hashQuad, J as RdfjsStoreLike, K as isReplaceImportCommit, L as hashQuads, M as QuadRowReader, N as quadFromRow, O as toRdfjsQuad, P as HEXASTORE_INDEXES, Q as ImportMode, R as isTextualLiteral, S as exportQuadsResponse, T as parseQuads, U as TransactionContext, V as filterQuads, W as deduplicateBuffers, X as ExportRequest, Y as Patch, Z as ExportResponse, _ as createRdfjsStoreCommitHandler, a as preparePatch, at as ProvenanceListQuery, b as awaitDrainRemoveMatches, c as TransactionalRdfjsStore, ct as ProvenanceQueryResponse, d as RdfjsExportSource, dt as ProvenanceRecordInput, et as ImportSource, f as exportFromRdfjsStore, ft as ProvenanceRecordType, g as TransactionOptions, h as Transaction, i as computeNovelQuads, it as ProvenanceHistory, j as toRdfjsTerm, k as Term, l as TransactionalRdfjsStoreOptions, lt as ProvenanceQueryResult, m as MatchFunction, n as PreparedPatch, nt as InMemoryProvenanceStore, o as selectNovelQuads, ot as ProvenanceQueryHandler, p as importViaTransaction, pt as ProvenanceStore, q as RdfjsEventSource, r as SelectNovelQuadsOptions, rt as ImportProvenance, s as ReadonlyStore, st as ProvenanceQueryRequest, t as NovelQuads, tt as QuadStoreInterface, u as ImportViaTransactionOptions, ut as ProvenanceRecord, v as FORMATS, w as materializeImportQuads, x as collectQuadsFromStream, y as RdfFormat, z as QuadCriteria } from "./mod-aUvsYiTJ.js";
|
|
2
2
|
export { ExportRequest, ExportResponse, FORMATS, HEXASTORE_INDEXES, HexastoreIndexDescriptor, ImportMode, ImportProvenance, ImportRequest, ImportSource, ImportViaTransactionOptions, InMemoryProvenanceStore, MatchFunction, NovelQuads, Patch, PatchableStore, PreparedPatch, ProvenanceHistory, ProvenanceListQuery, ProvenanceQueryHandler, ProvenanceQueryRequest, ProvenanceQueryResponse, ProvenanceQueryResult, ProvenanceRecord, ProvenanceRecordInput, ProvenanceRecordType, ProvenanceStore, Quad, QuadCriteria, QuadFilter, QuadRowReader, QuadStoreInterface, RdfFormat, RdfjsEventSource, RdfjsExportSource, RdfjsStoreLike, ReadonlyStore, SelectNovelQuadsOptions, Term, Transaction, TransactionContext, TransactionOptions, TransactionalRdfjsStore, TransactionalRdfjsStoreOptions, awaitDrainRemoveMatches, collectQuadsFromStream, computeNovelQuads, createRdfjsStoreCommitHandler, deduplicateBuffers, exportFromRdfjsStore, exportQuadsResponse, filterQuads, fromRdfjsQuad, fromRdfjsTerm, getFormat, hashQuad, hashQuads, importViaTransaction, isImportCommit, isReplaceImportCommit, isTextualLiteral, materializeImportQuads, parseQuads, preparePatch, quadFromRow, selectNovelQuads, toRdfjsQuad, toRdfjsTerm };
|
package/dist/quad-store.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { S as InMemoryProvenanceStore, _ as isTextualLiteral, a as Transaction, b as isImportCommit, c as importViaTransaction, d as quadFromRow, f as fromRdfjsTerm, g as hashQuads, h as hashQuad, i as TransactionalRdfjsStore, l as fromRdfjsQuad, m as HEXASTORE_INDEXES, n as preparePatch, o as createRdfjsStoreCommitHandler, p as toRdfjsTerm, r as selectNovelQuads, s as exportFromRdfjsStore, t as computeNovelQuads, u as toRdfjsQuad, v as filterQuads, x as isReplaceImportCommit, y as deduplicateBuffers } from "./quad-store-
|
|
1
|
+
import { S as InMemoryProvenanceStore, _ as isTextualLiteral, a as Transaction, b as isImportCommit, c as importViaTransaction, d as quadFromRow, f as fromRdfjsTerm, g as hashQuads, h as hashQuad, i as TransactionalRdfjsStore, l as fromRdfjsQuad, m as HEXASTORE_INDEXES, n as preparePatch, o as createRdfjsStoreCommitHandler, p as toRdfjsTerm, r as selectNovelQuads, s as exportFromRdfjsStore, t as computeNovelQuads, u as toRdfjsQuad, v as filterQuads, x as isReplaceImportCommit, y as deduplicateBuffers } from "./quad-store-CT8YQQky.js";
|
|
2
2
|
import { a as getFormat, i as exportQuadsResponse, n as awaitDrainRemoveMatches, o as materializeImportQuads, r as collectQuadsFromStream, s as parseQuads, t as FORMATS } from "./rdf-formats-C2znopLM.js";
|
|
3
3
|
export { FORMATS, HEXASTORE_INDEXES, InMemoryProvenanceStore, Transaction, TransactionalRdfjsStore, awaitDrainRemoveMatches, collectQuadsFromStream, computeNovelQuads, createRdfjsStoreCommitHandler, deduplicateBuffers, exportFromRdfjsStore, exportQuadsResponse, filterQuads, fromRdfjsQuad, fromRdfjsTerm, getFormat, hashQuad, hashQuads, importViaTransaction, isImportCommit, isReplaceImportCommit, isTextualLiteral, materializeImportQuads, parseQuads, preparePatch, quadFromRow, selectNovelQuads, toRdfjsQuad, toRdfjsTerm };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as buildSearchResultId } from "./build-search-result-id-
|
|
1
|
+
import { t as buildSearchResultId } from "./build-search-result-id-owYEv-UZ.js";
|
|
2
2
|
import { r as collectQuadsFromStream } from "./rdf-formats-C2znopLM.js";
|
|
3
|
-
import { S as InMemoryProvenanceStore, _ as isTextualLiteral, a as Transaction, c as importViaTransaction, h as hashQuad, o as createRdfjsStoreCommitHandler, s as exportFromRdfjsStore, v as filterQuads } from "./quad-store-
|
|
3
|
+
import { S as InMemoryProvenanceStore, _ as isTextualLiteral, a as Transaction, c as importViaTransaction, h as hashQuad, o as createRdfjsStoreCommitHandler, s as exportFromRdfjsStore, v as filterQuads } from "./quad-store-CT8YQQky.js";
|
|
4
4
|
import { MemoryStore } from "@wazootech/sparql-engine";
|
|
5
5
|
// src/rdfjs/rdfjs-search-index.ts
|
|
6
6
|
/**
|
package/dist/rdfjs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ReindexResponse, D as SearchRequest, O as SearchResponse, S as ReindexRequest, w as SearchIndexInterface } from "./mod-
|
|
2
|
-
import { $ as ImportRequest, J as RdfjsStoreLike, U as TransactionContext, X as ExportRequest, Y as Patch, Z as ExportResponse, ct as ProvenanceQueryResponse, pt as ProvenanceStore, st as ProvenanceQueryRequest, tt as QuadStoreInterface } from "./mod-
|
|
1
|
+
import { C as ReindexResponse, D as SearchRequest, O as SearchResponse, S as ReindexRequest, w as SearchIndexInterface } from "./mod-Du9mzmwt.js";
|
|
2
|
+
import { $ as ImportRequest, J as RdfjsStoreLike, U as TransactionContext, X as ExportRequest, Y as Patch, Z as ExportResponse, ct as ProvenanceQueryResponse, pt as ProvenanceStore, st as ProvenanceQueryRequest, tt as QuadStoreInterface } from "./mod-aUvsYiTJ.js";
|
|
3
3
|
import * as rdfjs from "@rdfjs/types";
|
|
4
4
|
/**
|
|
5
5
|
* RdfjsSearchIndex is the implementation of SearchIndexInterface that uses an RDF/JS store.
|
package/dist/rdfjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as RdfjsQuadStore, r as RdfjsSearchIndex, n as recordPatchProvenance } from "./rdfjs-
|
|
1
|
+
export { t as RdfjsQuadStore, r as RdfjsSearchIndex, n as recordPatchProvenance } from "./rdfjs-CN2lccto.js";
|
package/dist/search-index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as DEFAULT_RRF_K, C as ReindexResponse, D as SearchRequest, E as SearchMode, M as normalizeRrfScore, O as SearchResponse, S as ReindexRequest, T as SearchIndexOnImport, _ as extractRdfLocalLabel, a as RebuildSearchIndexResult, b as BuildSearchResultIdOptions, c as PreparedCommit, d as PlanSearchIndexingOptions, f as SearchIndexPlan, g as buildChunkFtsValue, h as DEFAULT_LABEL_PREDICATES, i as RebuildSearchIndexOptions, j as SearchScoreType, k as SearchResult, l as prepareCommit, m as BuildChunkFtsValueOptions, n as RebuildPage, o as rebuildSearchIndex, p as planSearchIndexing, r as RebuildScope, s as PrepareCommitOptions, t as ChunkRebuildDriver, u as DEFAULT_SEARCH_INDEX_ON_IMPORT, v as formatPredicatePhrase, w as SearchIndexInterface, x as buildSearchResultId, y as resolveLabelPredicates } from "./mod-
|
|
1
|
+
import { A as DEFAULT_RRF_K, C as ReindexResponse, D as SearchRequest, E as SearchMode, M as normalizeRrfScore, O as SearchResponse, S as ReindexRequest, T as SearchIndexOnImport, _ as extractRdfLocalLabel, a as RebuildSearchIndexResult, b as BuildSearchResultIdOptions, c as PreparedCommit, d as PlanSearchIndexingOptions, f as SearchIndexPlan, g as buildChunkFtsValue, h as DEFAULT_LABEL_PREDICATES, i as RebuildSearchIndexOptions, j as SearchScoreType, k as SearchResult, l as prepareCommit, m as BuildChunkFtsValueOptions, n as RebuildPage, o as rebuildSearchIndex, p as planSearchIndexing, r as RebuildScope, s as PrepareCommitOptions, t as ChunkRebuildDriver, u as DEFAULT_SEARCH_INDEX_ON_IMPORT, v as formatPredicatePhrase, w as SearchIndexInterface, x as buildSearchResultId, y as resolveLabelPredicates } from "./mod-Du9mzmwt.js";
|
|
2
2
|
export { BuildChunkFtsValueOptions, BuildSearchResultIdOptions, ChunkRebuildDriver, DEFAULT_LABEL_PREDICATES, DEFAULT_RRF_K, DEFAULT_SEARCH_INDEX_ON_IMPORT, PlanSearchIndexingOptions, PrepareCommitOptions, PreparedCommit, RebuildPage, RebuildScope, RebuildSearchIndexOptions, RebuildSearchIndexResult, ReindexRequest, ReindexResponse, SearchIndexInterface, SearchIndexOnImport, SearchIndexPlan, SearchMode, SearchRequest, SearchResponse, SearchResult, SearchScoreType, buildChunkFtsValue, buildSearchResultId, extractRdfLocalLabel, formatPredicatePhrase, normalizeRrfScore, planSearchIndexing, prepareCommit, rebuildSearchIndex, resolveLabelPredicates };
|
package/dist/search-index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as buildSearchResultId } from "./build-search-result-id-
|
|
2
|
-
import { b as isImportCommit, g as hashQuads, n as preparePatch, r as selectNovelQuads, v as filterQuads, x as isReplaceImportCommit } from "./quad-store-
|
|
3
|
-
import { t as chunkAndEmbedQuads } from "./chunk-and-embed-
|
|
1
|
+
import { t as buildSearchResultId } from "./build-search-result-id-owYEv-UZ.js";
|
|
2
|
+
import { b as isImportCommit, g as hashQuads, n as preparePatch, r as selectNovelQuads, v as filterQuads, x as isReplaceImportCommit } from "./quad-store-CT8YQQky.js";
|
|
3
|
+
import { t as chunkAndEmbedQuads } from "./chunk-and-embed-CNYO49kB.js";
|
|
4
4
|
// src/client/search-index/search-chunk-fts.ts
|
|
5
5
|
/**
|
|
6
6
|
* buildChunkFtsValue composes space-separated discovery tokens for FTS and semantic indexing.
|
package/dist/shacl.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { J as RdfjsStoreLike, U as TransactionContext, Y as Patch } from "./mod-aUvsYiTJ.js";
|
|
2
|
+
import * as rdfjs from "@rdfjs/types";
|
|
3
|
+
/** SHAPES_GRAPH is the named graph that holds a world's SHACL shapes. */
|
|
4
|
+
export declare const SHAPES_GRAPH = "https://wazoo.dev/ns/worlds#shapes";
|
|
5
|
+
/**
|
|
6
|
+
* ShaclSource reads a world as it is before a write. Return each quad in every
|
|
7
|
+
* graph it is stored in, inferred ones included. Once a call has found more than
|
|
8
|
+
* `limit` quads it may stop: the check is refused either way.
|
|
9
|
+
*/
|
|
10
|
+
interface ShaclSource {
|
|
11
|
+
/** shapes returns the quads in {@link SHAPES_GRAPH}. */
|
|
12
|
+
shapes(): Promise<rdfjs.Quad[]>;
|
|
13
|
+
/** outgoing returns the facts of these subjects, all of them or only some properties. */
|
|
14
|
+
outgoing(request: {
|
|
15
|
+
subjects: rdfjs.Term[];
|
|
16
|
+
predicates?: string[];
|
|
17
|
+
limit: number;
|
|
18
|
+
}): Promise<rdfjs.Quad[]>;
|
|
19
|
+
/** incoming returns the facts with this property whose object is one of these. */
|
|
20
|
+
incoming(request: {
|
|
21
|
+
objects: rdfjs.Term[];
|
|
22
|
+
predicate: string;
|
|
23
|
+
limit: number;
|
|
24
|
+
}): Promise<rdfjs.Quad[]>;
|
|
25
|
+
}
|
|
26
|
+
/** createRdfjsShaclSource reads from an RDF/JS store, one pattern at a time. */
|
|
27
|
+
export declare function createRdfjsShaclSource(store: Pick<RdfjsStoreLike, "match">): ShaclSource;
|
|
28
|
+
/** DEFAULT_MAX_CHECKED_FACTS is how many stored quads one check may read by default. */
|
|
29
|
+
export declare const DEFAULT_MAX_CHECKED_FACTS = 50000;
|
|
30
|
+
/** ValidateWriteRequest describes a write that hasn't happened yet. */
|
|
31
|
+
interface ValidateWriteRequest {
|
|
32
|
+
/** patch is what the write adds and removes. */
|
|
33
|
+
patch: Patch;
|
|
34
|
+
/** context says whether the write replaces everything that is stored. */
|
|
35
|
+
context?: TransactionContext;
|
|
36
|
+
/** source reads the world as it is before the write. */
|
|
37
|
+
source: ShaclSource;
|
|
38
|
+
/** maxCheckedFacts is how many stored quads the check may read. */
|
|
39
|
+
maxCheckedFacts?: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* validateWrite rejects when a write would add new violations of the world's own
|
|
43
|
+
* shapes, which are the quads in {@link SHAPES_GRAPH}. Call it before writing.
|
|
44
|
+
*
|
|
45
|
+
* It checks only the nodes the write can affect, and reads only the facts those
|
|
46
|
+
* checks look at. A violation is new when the checked node didn't have it before, so
|
|
47
|
+
* shapes can be added to a world whose data breaks them. Linking another node to
|
|
48
|
+
* one that is broken gives the linking node a new violation.
|
|
49
|
+
*
|
|
50
|
+
* A world without shapes costs one read. A change to the class tree
|
|
51
|
+
* (`rdfs:subClassOf`) is treated like a change to the shapes: it applies to later
|
|
52
|
+
* writes and doesn't check existing nodes.
|
|
53
|
+
*
|
|
54
|
+
* @throws {ShaclViolationError} when the write adds violations.
|
|
55
|
+
* @throws {InvalidShapesError} when the shapes themselves can't be used.
|
|
56
|
+
* @throws {ShaclLimitError} when the check would read too much.
|
|
57
|
+
*/
|
|
58
|
+
export declare function validateWrite(request: ValidateWriteRequest): Promise<void>;
|
|
59
|
+
/** ShaclViolation is one way in which a write would break a world's shapes. */
|
|
60
|
+
interface ShaclViolation {
|
|
61
|
+
/** focusNode is the node that breaks the shape: an IRI, a `_:` label or a literal's text. */
|
|
62
|
+
focusNode: string;
|
|
63
|
+
/** path is the checked property, written like a SPARQL path without angle brackets. */
|
|
64
|
+
path?: string;
|
|
65
|
+
/** value is the offending value, when one value is to blame. */
|
|
66
|
+
value?: string;
|
|
67
|
+
/** constraint is the local name of the broken constraint, such as `MaxCount`. */
|
|
68
|
+
constraint: string;
|
|
69
|
+
/** shape is the IRI of the broken shape; absent when the shape has none. */
|
|
70
|
+
shape?: string;
|
|
71
|
+
/** message is the shape's `sh:message`, or a description of the constraint. */
|
|
72
|
+
message: string;
|
|
73
|
+
}
|
|
74
|
+
/** ShaclViolationError rejects a write that would add new violations. Nothing was written. */
|
|
75
|
+
export declare class ShaclViolationError extends Error {
|
|
76
|
+
/** violations are the new violations, in no particular order. */
|
|
77
|
+
readonly violations: ShaclViolation[];
|
|
78
|
+
readonly name = "ShaclViolationError";
|
|
79
|
+
constructor(
|
|
80
|
+
/** violations are the new violations, in no particular order. */
|
|
81
|
+
violations: ShaclViolation[]);
|
|
82
|
+
}
|
|
83
|
+
/** InvalidShapesError rejects a write because the world's shapes can't be used. Nothing was written. */
|
|
84
|
+
export declare class InvalidShapesError extends Error {
|
|
85
|
+
/** problems say what is wrong with the shapes, one sentence each. */
|
|
86
|
+
readonly problems: string[];
|
|
87
|
+
readonly name = "InvalidShapesError";
|
|
88
|
+
constructor(
|
|
89
|
+
/** problems say what is wrong with the shapes, one sentence each. */
|
|
90
|
+
problems: string[]);
|
|
91
|
+
}
|
|
92
|
+
/** ShaclLimitError rejects a write whose check would read too many facts. Nothing was written. */
|
|
93
|
+
export declare class ShaclLimitError extends Error {
|
|
94
|
+
/** limit is how many facts one check may read. */
|
|
95
|
+
readonly limit: number;
|
|
96
|
+
readonly name = "ShaclLimitError";
|
|
97
|
+
constructor(
|
|
98
|
+
/** limit is how many facts one check may read. */
|
|
99
|
+
limit: number);
|
|
100
|
+
}
|
|
101
|
+
export type { ShaclSource, ShaclViolation, ValidateWriteRequest };
|