@lde/pipeline-shacl-sampler 0.4.18 → 0.4.20

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.
@@ -1 +1 @@
1
- {"version":3,"file":"pathExtractor.d.ts","sourceRoot":"","sources":["../src/pathExtractor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAQ,MAAM,cAAc,CAAC;AAsBpD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,WAAW,EAAE,SAAS,CAAC;IACvB;;;;;;;;;;;;;;OAcG;IACH,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,WAAW,EAAE,CAAC,CAkCxB"}
1
+ {"version":3,"file":"pathExtractor.d.ts","sourceRoot":"","sources":["../src/pathExtractor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAQ,MAAM,cAAc,CAAC;AAMpD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,WAAW,EAAE,SAAS,CAAC;IACvB;;;;;;;;;;;;;;OAcG;IACH,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,WAAW,EAAE,CAAC,CAkCxB"}
@@ -1,20 +1,7 @@
1
1
  import { DataFactory, Store } from 'n3';
2
2
  import { rdfDereferencer } from 'rdf-dereference';
3
+ import { rdf, sh } from '@tpluscode/rdf-ns-builders';
3
4
  const { namedNode } = DataFactory;
4
- const SHACL = 'http://www.w3.org/ns/shacl#';
5
- const RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
6
- const sh = {
7
- targetClass: namedNode(`${SHACL}targetClass`),
8
- property: namedNode(`${SHACL}property`),
9
- path: namedNode(`${SHACL}path`),
10
- node: namedNode(`${SHACL}node`),
11
- class: namedNode(`${SHACL}class`),
12
- or: namedNode(`${SHACL}or`),
13
- qualifiedValueShape: namedNode(`${SHACL}qualifiedValueShape`),
14
- };
15
- const rdfFirst = namedNode(`${RDF}first`);
16
- const rdfRest = namedNode(`${RDF}rest`);
17
- const rdfNil = namedNode(`${RDF}nil`);
18
5
  /**
19
6
  * Load a SHACL shapes file and extract its `sh:targetClass` shapes into
20
7
  * {@link TargetShape}s.
@@ -114,15 +101,15 @@ function valueShapeAnalysis(store, constraintShape, classToShapes) {
114
101
  function orListBranches(store, listHead) {
115
102
  const branches = [];
116
103
  let current = listHead;
117
- while (!(current.termType === 'NamedNode' && current.value === rdfNil.value)) {
104
+ while (!(current.termType === 'NamedNode' && current.value === rdf.nil.value)) {
118
105
  if (current.termType !== 'NamedNode' && current.termType !== 'BlankNode') {
119
106
  break;
120
107
  }
121
- const firsts = store.getQuads(current, rdfFirst, null, null);
108
+ const firsts = store.getQuads(current, rdf.first, null, null);
122
109
  if (firsts.length === 0)
123
110
  break;
124
111
  branches.push(firsts[0].object);
125
- const rests = store.getQuads(current, rdfRest, null, null);
112
+ const rests = store.getQuads(current, rdf.rest, null, null);
126
113
  if (rests.length === 0)
127
114
  break;
128
115
  current = rests[0].object;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/pipeline-shacl-sampler",
3
- "version": "0.4.18",
3
+ "version": "0.4.20",
4
4
  "description": "Per-class sampling stages for @lde/pipeline, derived from SHACL shapes",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/ldelements/lde.git",
@@ -26,12 +26,13 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@rdfjs/types": "^2.0.1",
29
+ "@tpluscode/rdf-ns-builders": "^5.0.0",
29
30
  "n3": "^2.0.3",
30
31
  "rdf-dereference": "^5.0.0",
31
32
  "tslib": "^2.3.0"
32
33
  },
33
34
  "peerDependencies": {
34
35
  "@lde/dataset": "0.7.7",
35
- "@lde/pipeline": "0.30.17"
36
+ "@lde/pipeline": "0.30.19"
36
37
  }
37
38
  }