@wazootech/worlds-sdk 0.11.3 → 0.11.5

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 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-BGCOUBxK.js";
2
+ import { h as hashQuad } from "./quad-store-oBgXOONP.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-BGCOUBxK.js";
1
+ import { _ as isTextualLiteral, h as hashQuad } from "./quad-store-oBgXOONP.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-ClDFMN-C.js";
2
- import { c as SparqlRequest, i as SparqlResponse, s as SparqlEngineInterface } from "./mod-8Zh1f9vW.js";
3
- import { C as ReindexResponse, D as SearchRequest, O as SearchResponse, S as ReindexRequest, w as SearchIndexInterface } from "./mod-BuF_B_xU.js";
1
+ import { $ as ImportRequest, X as ExportRequest, Z as ExportResponse, ct as ProvenanceQueryResponse, ot as ProvenanceQueryHandler, st as ProvenanceQueryRequest, tt as QuadStoreInterface } from "./mod-CH7Hc3EE.js";
2
+ import { c as SparqlRequest, i as SparqlResponse, s as SparqlEngineInterface } from "./mod-C_Is4DOx.js";
3
+ import { C as ReindexResponse, D as SearchRequest, O as SearchResponse, S as ReindexRequest, w as SearchIndexInterface } from "./mod-CfzcRVcL.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-BJ45zmXU.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-ClDFMN-C.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-8Zh1f9vW.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-BuF_B_xU.js";
3
+ import { n as WorldsSdkInterface, r as WorldsSdkOptions, t as WorldsSdk } from "./client-B1oktOm6.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-CH7Hc3EE.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-C_Is4DOx.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-CfzcRVcL.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-BGCOUBxK.js";
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-BkGt5RDB.js";
4
- import { t as buildSearchResultId } from "./build-search-result-id-qxdmXp0V.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-oBgXOONP.js";
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-DPlgkWyi.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-0crm0xLl.js";
6
+ import { n as chunkQuads, t as chunkAndEmbedQuads } from "./chunk-and-embed-BlB2v4-2.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-BJ45zmXU.js";
9
+ import { t as WorldsSdk } from "./client-B1oktOm6.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-BNVjLSNL.js";
2
+ import { r as RdfjsSearchIndex, t as RdfjsQuadStore } from "./rdfjs-DodYvbzF.js";
3
3
  import { MemoryStore, WazooSparqlEngine } from "@wazootech/sparql-engine";
4
4
  // src/memory/create-memory-sdk.ts
5
5
  /**
@@ -436,6 +436,8 @@ declare function parseQuads(data: string, contentType?: string): rdfjs.Stream<rd
436
436
  declare function collectQuadsFromStream(stream: rdfjs.Stream<rdfjs.Quad>): Promise<rdfjs.Quad[]>;
437
437
  /**
438
438
  * materializeImportQuads collects quads from an import source into an array.
439
+ * Blank nodes of a serialized document get labels that no other document has;
440
+ * quads and datasets keep the labels they come with.
439
441
  */
440
442
  declare function materializeImportQuads(source: ImportRequest["source"]): Promise<rdfjs.Quad[]>;
441
443
  /**
@@ -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-ClDFMN-C.js";
2
+ import { rt as ImportProvenance } from "./mod-CH7Hc3EE.js";
3
3
  /**
4
4
  * SparqlRequest is the engine's request plus what the SDK needs to say about an
5
5
  * update.
@@ -1,4 +1,4 @@
1
- import { B as QuadFilter, U as TransactionContext, Y as Patch, n as PreparedPatch, t as NovelQuads } from "./mod-ClDFMN-C.js";
1
+ import { B as QuadFilter, U as TransactionContext, Y as Patch, n as PreparedPatch, t as NovelQuads } from "./mod-CH7Hc3EE.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 +1 @@
1
- export { t as chunkAndEmbedQuads, n as chunkQuads } from "./chunk-and-embed-0crm0xLl.js";
1
+ export { t as chunkAndEmbedQuads, n as chunkQuads } from "./chunk-and-embed-BlB2v4-2.js";
@@ -1,4 +1,4 @@
1
- import { i as exportQuadsResponse, o as materializeImportQuads, r as collectQuadsFromStream } from "./rdf-formats-BkGt5RDB.js";
1
+ import { i as exportQuadsResponse, o as materializeImportQuads, r as collectQuadsFromStream } from "./rdf-formats-C2znopLM.js";
2
2
  import { sha256Hex } from "@wazootech/sparql-engine/term";
3
3
  import { DataFactory } from "@wazootech/sparql-engine/data-model";
4
4
  import { EventEmitter } from "node:events";
@@ -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-ClDFMN-C.js";
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-CH7Hc3EE.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 };
@@ -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-BGCOUBxK.js";
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-BkGt5RDB.js";
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-oBgXOONP.js";
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,4 +1,41 @@
1
1
  import { MemoryStream, parseTurtleQuads, serializeTurtle } from "@wazootech/sparql-engine";
2
+ import { DataFactory } from "@wazootech/sparql-engine/data-model";
3
+ import { sha256Hex } from "@wazootech/sparql-engine/term";
4
+ // src/client/quad-store/label-document-blank-nodes.ts
5
+ const { blankNode, quad: createQuad } = DataFactory;
6
+ /**
7
+ * labelDocumentBlankNodes gives the blank nodes of one parsed document labels
8
+ * that no other document has. A label only means something inside its own
9
+ * document, and the parser starts at `b1` for each one, so storing labels
10
+ * unchanged joins unrelated nodes.
11
+ *
12
+ * A label is made from the document's text and the order its nodes first appear.
13
+ * Importing the same text again therefore adds nothing, even from another
14
+ * process, while any other text gets its own nodes.
15
+ */
16
+ function labelDocumentBlankNodes(quads, text) {
17
+ const labels = /* @__PURE__ */ new Map();
18
+ let prefix;
19
+ function relabel(term) {
20
+ if (term.termType === "Quad") return relabelQuad(term);
21
+ if (term.termType !== "BlankNode") return term;
22
+ let node = labels.get(term.value);
23
+ if (node === void 0) {
24
+ prefix ??= `d${sha256Hex(text).slice(0, 32)}n`;
25
+ node = blankNode(prefix + labels.size);
26
+ labels.set(term.value, node);
27
+ }
28
+ return node;
29
+ }
30
+ function relabelQuad(quad) {
31
+ const subject = relabel(quad.subject);
32
+ const object = relabel(quad.object);
33
+ const graph = relabel(quad.graph);
34
+ if (subject === quad.subject && object === quad.object && graph === quad.graph) return quad;
35
+ return createQuad(subject, quad.predicate, object, graph);
36
+ }
37
+ return quads.map(relabelQuad);
38
+ }
2
39
  // src/client/quad-store/rdf-formats.ts
3
40
  /**
4
41
  * FORMATS is a map of content types to supported RdfFormats. The engine's
@@ -52,11 +89,13 @@ function collectQuadsFromStream(stream) {
52
89
  }
53
90
  /**
54
91
  * materializeImportQuads collects quads from an import source into an array.
92
+ * Blank nodes of a serialized document get labels that no other document has;
93
+ * quads and datasets keep the labels they come with.
55
94
  */
56
95
  async function materializeImportQuads(source) {
57
96
  if (source.kind === "quads") return Array.from(source.quads);
58
97
  if (source.kind === "dataset") return Array.from(source.dataset);
59
- if (source.kind === "serialized") return await collectQuadsFromStream(parseQuads(source.data, source.contentType));
98
+ if (source.kind === "serialized") return labelDocumentBlankNodes(await collectQuadsFromStream(parseQuads(source.data, source.contentType)), source.data);
60
99
  throw new Error("Unsupported import source kind");
61
100
  }
62
101
  /**
@@ -1,6 +1,6 @@
1
- import { t as buildSearchResultId } from "./build-search-result-id-qxdmXp0V.js";
2
- import { r as collectQuadsFromStream } from "./rdf-formats-BkGt5RDB.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-BGCOUBxK.js";
1
+ import { t as buildSearchResultId } from "./build-search-result-id-DPlgkWyi.js";
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-oBgXOONP.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-BuF_B_xU.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-ClDFMN-C.js";
1
+ import { C as ReindexResponse, D as SearchRequest, O as SearchResponse, S as ReindexRequest, w as SearchIndexInterface } from "./mod-CfzcRVcL.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-CH7Hc3EE.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-BNVjLSNL.js";
1
+ export { t as RdfjsQuadStore, r as RdfjsSearchIndex, n as recordPatchProvenance } from "./rdfjs-DodYvbzF.js";
@@ -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-BuF_B_xU.js";
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-CfzcRVcL.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 };
@@ -1,6 +1,6 @@
1
- import { t as buildSearchResultId } from "./build-search-result-id-qxdmXp0V.js";
2
- import { b as isImportCommit, g as hashQuads, n as preparePatch, r as selectNovelQuads, v as filterQuads, x as isReplaceImportCommit } from "./quad-store-BGCOUBxK.js";
3
- import { t as chunkAndEmbedQuads } from "./chunk-and-embed-0crm0xLl.js";
1
+ import { t as buildSearchResultId } from "./build-search-result-id-DPlgkWyi.js";
2
+ import { b as isImportCommit, g as hashQuads, n as preparePatch, r as selectNovelQuads, v as filterQuads, x as isReplaceImportCommit } from "./quad-store-oBgXOONP.js";
3
+ import { t as chunkAndEmbedQuads } from "./chunk-and-embed-BlB2v4-2.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.
@@ -0,0 +1,101 @@
1
+ import { J as RdfjsStoreLike, U as TransactionContext, Y as Patch } from "./mod-CH7Hc3EE.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 };