@lde/pipeline-shacl-validator 0.6.3 → 0.6.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.
@@ -24,6 +24,7 @@ export declare class ShaclValidator implements Validator {
24
24
  private readonly reportFormat;
25
25
  private shapesDataset;
26
26
  private readonly accumulators;
27
+ private readonly initializedFiles;
27
28
  constructor(options: ShaclValidatorOptions);
28
29
  validate(quads: Quad[], dataset: Dataset): Promise<ValidationResult>;
29
30
  report(dataset: Dataset): Promise<ValidationReport>;
@@ -1 +1 @@
1
- {"version":3,"file":"shacl-validator.d.ts","sourceRoot":"","sources":["../src/shacl-validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAezE,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC,6FAA6F;IAC7F,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAQD;;;;;;GAMG;AACH,qBAAa,cAAe,YAAW,SAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAsB;IAEnD,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAyC;gBAE1D,OAAO,EAAE,qBAAqB;IAMpC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,GA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27
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
28
  shapesDataset;
29
29
  accumulators = new Map();
30
+ initializedFiles = new Set();
30
31
  constructor(options) {
31
32
  this.shapesFile = options.shapesFile;
32
33
  this.reportDir = options.reportDir;
@@ -92,12 +93,12 @@ export class ShaclValidator {
92
93
  const filePath = join(this.reportDir, `${datasetName}.validation${extension}`);
93
94
  const reportQuads = [...report.dataset];
94
95
  const serialized = await serializeQuads(reportQuads, this.reportFormat);
95
- // Append to existing file or create a new one.
96
- try {
96
+ if (this.initializedFiles.has(filePath)) {
97
97
  await appendFile(filePath, '\n' + serialized);
98
98
  }
99
- catch {
99
+ else {
100
100
  await writeFile(filePath, serialized);
101
+ this.initializedFiles.add(filePath);
101
102
  }
102
103
  return filePath;
103
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/pipeline-shacl-validator",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "description": "SHACL validation for @lde/pipeline",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/ldelements/lde.git",
@@ -35,7 +35,7 @@
35
35
  "n3": "^2.0.3"
36
36
  },
37
37
  "peerDependencies": {
38
- "@lde/dataset": "0.7.1",
39
- "@lde/pipeline": "0.24.3"
38
+ "@lde/dataset": "0.7.2",
39
+ "@lde/pipeline": "0.24.4"
40
40
  }
41
41
  }