@lde/dataset 0.7.6 → 0.7.7

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/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './dataset.js';
2
2
  export * from './distribution.js';
3
3
  export * from './mediaType.js';
4
+ export * from './skolem.js';
4
5
  export * from './validation.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './dataset.js';
2
2
  export * from './distribution.js';
3
3
  export * from './mediaType.js';
4
+ export * from './skolem.js';
4
5
  export * from './validation.js';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Mint a deterministic IRI for an otherwise-anonymous structural node — a PROV
3
+ * `Activity`/`Usage`, a DQV measurement, a `void:Linkset`, a `void:subset` or a
4
+ * `void:*Partition` — by extending a `base` IRI that is already unique within
5
+ * the dataset's graph (typically the dataset IRI or one of its subsets) with
6
+ * `-`-joined `suffixes`.
7
+ *
8
+ * Use this instead of a blank node for any such node. A dataset's graph is
9
+ * assembled from the output of several independent pipeline stages, and
10
+ * blank-node labels are not preserved across separately serialised documents:
11
+ * two stages' `_:b0` collapse into one node when the documents are merged into
12
+ * one graph, silently fusing unrelated provenance, measurements and linksets
13
+ * (see dataset-knowledge-graph issue #352). IRIs are never relabelled, so
14
+ * deriving every structural node from a unique base keeps distinct nodes
15
+ * distinct across stages and makes a re-run idempotent rather than additive —
16
+ * and lets a later stage address (and extend) a subset or partition another
17
+ * stage emitted.
18
+ *
19
+ * Pass opaque, possibly non-IRI-safe `suffixes` (e.g. a URL) through
20
+ * {@link hashSuffix} first.
21
+ */
22
+ export declare function skolemIri(base: string, ...suffixes: string[]): string;
23
+ /**
24
+ * An md5 hex digest, for embedding an opaque value (e.g. a URL) as a stable,
25
+ * IRI-safe segment in a {@link skolemIri}.
26
+ */
27
+ export declare function hashSuffix(value: string): string;
28
+ //# sourceMappingURL=skolem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skolem.d.ts","sourceRoot":"","sources":["../src/skolem.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAErE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD"}
package/dist/skolem.js ADDED
@@ -0,0 +1,32 @@
1
+ import { createHash } from 'node:crypto';
2
+ /**
3
+ * Mint a deterministic IRI for an otherwise-anonymous structural node — a PROV
4
+ * `Activity`/`Usage`, a DQV measurement, a `void:Linkset`, a `void:subset` or a
5
+ * `void:*Partition` — by extending a `base` IRI that is already unique within
6
+ * the dataset's graph (typically the dataset IRI or one of its subsets) with
7
+ * `-`-joined `suffixes`.
8
+ *
9
+ * Use this instead of a blank node for any such node. A dataset's graph is
10
+ * assembled from the output of several independent pipeline stages, and
11
+ * blank-node labels are not preserved across separately serialised documents:
12
+ * two stages' `_:b0` collapse into one node when the documents are merged into
13
+ * one graph, silently fusing unrelated provenance, measurements and linksets
14
+ * (see dataset-knowledge-graph issue #352). IRIs are never relabelled, so
15
+ * deriving every structural node from a unique base keeps distinct nodes
16
+ * distinct across stages and makes a re-run idempotent rather than additive —
17
+ * and lets a later stage address (and extend) a subset or partition another
18
+ * stage emitted.
19
+ *
20
+ * Pass opaque, possibly non-IRI-safe `suffixes` (e.g. a URL) through
21
+ * {@link hashSuffix} first.
22
+ */
23
+ export function skolemIri(base, ...suffixes) {
24
+ return [base, ...suffixes].join('-');
25
+ }
26
+ /**
27
+ * An md5 hex digest, for embedding an opaque value (e.g. a URL) as a stable,
28
+ * IRI-safe segment in a {@link skolemIri}.
29
+ */
30
+ export function hashSuffix(value) {
31
+ return createHash('md5').update(value).digest('hex');
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/dataset",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/ldelements/lde.git",
6
6
  "directory": "packages/dataset"