@oslo-flanders/core 1.0.12 → 1.0.14

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.
@@ -21,14 +21,16 @@ async function getPrefixes() {
21
21
  throw new Error('Invalid context format received from prefix.cc');
22
22
  }
23
23
  catch (error) {
24
- console.error(`Error fetching prefixes: ${String(error)}`);
24
+ console.warn(`Error fetching prefixes: ${String(error)}`);
25
25
  // Fallback to a minimal set of prefixes if the fetch fails
26
26
  return {
27
- skos: core_1.ns.skos(''),
28
- rdf: core_1.ns.rdf(''),
29
- rdfs: core_1.ns.rdfs(''),
30
- dct: core_1.ns.dcterms(''),
31
- xsd: core_1.ns.xsd(''),
27
+ skos: core_1.ns.skos('').value,
28
+ rdf: core_1.ns.rdf('').value,
29
+ rdfs: core_1.ns.rdfs('').value,
30
+ dct: core_1.ns.dcterms('').value,
31
+ xsd: core_1.ns.xsd('').value,
32
+ cpov: core_1.ns.cpov('').value,
33
+ locn: core_1.ns.locn('').value,
32
34
  };
33
35
  }
34
36
  }
@@ -17,7 +17,9 @@ declare enum Prefixes {
17
17
  prov = "http://www.w3.org/ns/prov#",
18
18
  oslo = "https://implementatie.data.vlaanderen.be/ns/oslo-toolchain#",
19
19
  vl = "https://data.vlaanderen.be/ns/shacl#",
20
- schema = "https://schema.org/"
20
+ schema = "https://schema.org/",
21
+ cpov = "http://data.europa.eu/m8g/",
22
+ locn = "http://www.w3.org/ns/locn#"
21
23
  }
22
24
  export type Namespace = {
23
25
  [T in keyof typeof Prefixes]: Function;
@@ -24,6 +24,8 @@ var Prefixes;
24
24
  Prefixes["oslo"] = "https://implementatie.data.vlaanderen.be/ns/oslo-toolchain#";
25
25
  Prefixes["vl"] = "https://data.vlaanderen.be/ns/shacl#";
26
26
  Prefixes["schema"] = "https://schema.org/";
27
+ Prefixes["cpov"] = "http://data.europa.eu/m8g/";
28
+ Prefixes["locn"] = "http://www.w3.org/ns/locn#";
27
29
  })(Prefixes || (Prefixes = {}));
28
30
  const vocab = () => {
29
31
  const namespaces = {};
@@ -11,3 +11,4 @@ export declare function getMinCount(subject: RDF.Term, store: QuadStore): string
11
11
  export declare function getMaxCount(subject: RDF.Term, store: QuadStore): string | undefined;
12
12
  export declare function createList(items: RDF.Term[], store: QuadStore, df: DataFactory): RDF.BlankNode | RDF.NamedNode;
13
13
  export declare function findAllAttributes(subject: RDF.Term, attributeIds: RDF.Term[], store: QuadStore): RDF.Term[];
14
+ export declare function areStoresEqual(store1: QuadStore, store2: QuadStore): boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findAllAttributes = exports.createList = exports.getMaxCount = exports.getMinCount = exports.getVocabularyUsageNote = exports.getApplicationProfileUsageNote = exports.getVocabularyDefinition = exports.getApplicationProfileDefinition = exports.getVocabularyLabel = exports.getApplicationProfileLabel = void 0;
3
+ exports.areStoresEqual = exports.findAllAttributes = exports.createList = exports.getMaxCount = exports.getMinCount = exports.getVocabularyUsageNote = exports.getApplicationProfileUsageNote = exports.getVocabularyDefinition = exports.getApplicationProfileDefinition = exports.getVocabularyLabel = exports.getApplicationProfileLabel = void 0;
4
4
  const namespaces_1 = require("./namespaces");
5
5
  function getApplicationProfileLabel(subject, store, language = null) {
6
6
  var _a, _b, _c;
@@ -128,4 +128,26 @@ function findAllAttributes(subject, attributeIds, store) {
128
128
  return attributeIds;
129
129
  }
130
130
  exports.findAllAttributes = findAllAttributes;
131
+ function areStoresEqual(store1, store2) {
132
+ var _a, _b, _c, _d;
133
+ const quads1 = store1.findQuads(null, null, null, null);
134
+ const quads2 = store2.findQuads(null, null, null, null);
135
+ // Quick check: different sizes means not equal
136
+ // Second check allows store2 to have more quads than store1 if it has all quads of store1 plus more
137
+ if (quads1.length !== quads2.length) {
138
+ console.log(`[QUadStore]: Store1 has a length of ${quads1.length} whilst Store2 has a length of ${quads2.length}.`);
139
+ return false;
140
+ }
141
+ // Check if every quad in store1 exists in store2
142
+ // If there is a variation in quads, we know something is up
143
+ for (const quad1 of quads1) {
144
+ const matchingQuad = store2.findQuad(quad1.subject, quad1.predicate, quad1.object, quad1.graph);
145
+ if (!matchingQuad) {
146
+ console.log(`[QUadStore]: Quad not found in store2: ${(_a = quad1.subject) === null || _a === void 0 ? void 0 : _a.value} ${(_b = quad1.predicate) === null || _b === void 0 ? void 0 : _b.value} ${(_c = quad1.object) === null || _c === void 0 ? void 0 : _c.value} ${(_d = quad1.graph) === null || _d === void 0 ? void 0 : _d.value}`);
147
+ return false;
148
+ }
149
+ }
150
+ return true;
151
+ }
152
+ exports.areStoresEqual = areStoresEqual;
131
153
  //# sourceMappingURL=storeUtils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslo-flanders/core",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Core interfaces and utilities",
5
5
  "author": "Digitaal Vlaanderen <https://data.vlaanderen.be/id/organisatie/OVO002949>",
6
6
  "homepage": "https://github.com/informatievlaanderen/OSLO-UML-Transformer/tree/main/packages/oslo-core#readme",