@oslo-flanders/core 0.0.3-alpha.0 → 0.0.5-alpha.0

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.
Files changed (46) hide show
  1. package/README.md +75 -75
  2. package/index.d.ts +21 -17
  3. package/index.js +37 -33
  4. package/lib/ServiceIdentifier.d.ts +7 -7
  5. package/lib/ServiceIdentifier.js +14 -14
  6. package/lib/enums/PropertyTypes.d.ts +5 -5
  7. package/lib/enums/PropertyTypes.js +9 -9
  8. package/lib/enums/Scope.d.ts +6 -6
  9. package/lib/enums/Scope.js +10 -10
  10. package/lib/interfaces/AppRunner.d.ts +19 -15
  11. package/lib/interfaces/AppRunner.js +26 -14
  12. package/lib/interfaces/IConfiguration.d.ts +7 -7
  13. package/lib/interfaces/IConfiguration.js +2 -2
  14. package/lib/interfaces/IOutputHandler.d.ts +7 -7
  15. package/lib/interfaces/IOutputHandler.js +2 -2
  16. package/lib/interfaces/IService.d.ts +11 -0
  17. package/lib/interfaces/{IConversionService.js → IService.js} +3 -3
  18. package/lib/logging/LogLevel.d.ts +5 -5
  19. package/lib/logging/LogLevel.js +4 -4
  20. package/lib/logging/LogUtil.d.ts +4 -0
  21. package/lib/logging/LogUtil.js +17 -0
  22. package/lib/logging/Logger.d.ts +20 -19
  23. package/lib/logging/Logger.js +35 -34
  24. package/lib/logging/LoggerFactory.d.ts +11 -0
  25. package/lib/{interfaces/IGenerationService.js → logging/LoggerFactory.js} +3 -3
  26. package/lib/logging/VoidLogger.d.ts +7 -7
  27. package/lib/logging/VoidLogger.js +27 -27
  28. package/lib/logging/VoidLoggerFactory.d.ts +9 -0
  29. package/lib/logging/VoidLoggerFactory.js +17 -0
  30. package/lib/logging/WinstonLogger.d.ts +8 -7
  31. package/lib/logging/WinstonLogger.js +30 -38
  32. package/lib/logging/WinstonLoggerFactory.d.ts +10 -0
  33. package/lib/logging/WinstonLoggerFactory.js +24 -0
  34. package/lib/store/QuadStore.d.ts +165 -0
  35. package/lib/store/QuadStore.js +306 -0
  36. package/lib/utils/fetchFileOrUrl.d.ts +2 -2
  37. package/lib/utils/fetchFileOrUrl.js +22 -22
  38. package/lib/utils/namespaces.d.ts +24 -24
  39. package/lib/utils/namespaces.js +35 -35
  40. package/lib/utils/uniqueId.d.ts +1 -1
  41. package/lib/utils/uniqueId.js +13 -13
  42. package/package.json +11 -4
  43. package/lib/interfaces/IConversionService.d.ts +0 -10
  44. package/lib/interfaces/IGenerationService.d.ts +0 -8
  45. package/lib/utils/N3StoreFunctions.d.ts +0 -136
  46. package/lib/utils/N3StoreFunctions.js +0 -257
@@ -0,0 +1,306 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __metadata = (this && this.__metadata) || function (k, v) {
32
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.QuadStore = void 0;
39
+ const inversify_1 = require("inversify");
40
+ const N3 = __importStar(require("n3"));
41
+ const rdf_parse_1 = __importDefault(require("rdf-parse"));
42
+ const fetchFileOrUrl_1 = require("@oslo-core/utils/fetchFileOrUrl");
43
+ const namespaces_1 = require("@oslo-core/utils/namespaces");
44
+ let QuadStore = class QuadStore {
45
+ constructor() {
46
+ this.store = new N3.Store();
47
+ }
48
+ addQuads(quads) {
49
+ this.store.addQuads(quads);
50
+ }
51
+ addQuad(quad) {
52
+ this.store.addQuad(quad);
53
+ }
54
+ async addQuadsFromFile(file) {
55
+ const buffer = await (0, fetchFileOrUrl_1.fetchFileOrUrl)(file);
56
+ const textStream = require('streamify-string')(buffer.toString());
57
+ return new Promise((resolve, reject) => {
58
+ rdf_parse_1.default
59
+ .parse(textStream, { path: file })
60
+ .on('data', (quad) => this.store.addQuad(quad))
61
+ .on('error', (error) => reject(error))
62
+ .on('end', () => resolve());
63
+ });
64
+ }
65
+ findQuads(subject, predicate, object, graph = null) {
66
+ return this.store.getQuads(subject, predicate, object, graph);
67
+ }
68
+ findQuad(subject, predicate, object, graph = null) {
69
+ return this.findQuads(subject, predicate, object, graph).shift();
70
+ }
71
+ findSubjects(predicate, object, graph = null) {
72
+ return this.store.getSubjects(predicate, object, graph);
73
+ }
74
+ findSubject(predicate, object, graph = null) {
75
+ return this.findSubjects(predicate, object, graph).shift();
76
+ }
77
+ findObjects(subject, predicate, graph = null) {
78
+ return this.store.getObjects(subject, predicate, graph);
79
+ }
80
+ findObject(subject, predicate, graph = null) {
81
+ return this.findObjects(subject, predicate, graph).shift();
82
+ }
83
+ /**
84
+ * Finds the subject where predicate is 'rdf:type' and object 'oslo:Package'
85
+ * @returns a RDF.NamedNode or undefined
86
+ */
87
+ getPackageId() {
88
+ return (this.store.getSubjects(namespaces_1.ns.rdf('type'), namespaces_1.ns.oslo('Package'), null).shift());
89
+ }
90
+ /**
91
+ * Finds all subjects where predicate is 'rdf:type' and object 'owl:Class'
92
+ * @returns an array of RDF.NamedNodes
93
+ */
94
+ getClassIds(graph = null) {
95
+ return (this.store.getSubjects(namespaces_1.ns.rdf('type'), namespaces_1.ns.owl('Class'), graph));
96
+ }
97
+ /**
98
+ * Finds all subjects where predicate is 'rdf:type' and object 'owl:DatatypeProperty'
99
+ * @returns an array of RDF.NamedNodes
100
+ */
101
+ getDatatypePropertyIds(graph = null) {
102
+ return (this.store.getSubjects(namespaces_1.ns.rdf('type'), namespaces_1.ns.owl('DatatypeProperty'), graph));
103
+ }
104
+ /**
105
+ * Finds all subjects where predicate is 'rdf:type' and object 'owl:ObjectProperty'
106
+ * @returns an array of RDF.NamedNodes
107
+ */
108
+ getObjectPropertyIds(graph = null) {
109
+ return (this.store.getSubjects(namespaces_1.ns.rdf('type'), namespaces_1.ns.owl('ObjectProperty'), graph));
110
+ }
111
+ /**
112
+ * For a given subject, the quad store is queried to find the assigned URI
113
+ * @param subject The subject for which the assigned URI is to be retrieved
114
+ * @param store The quad store
115
+ * @returns An RDF.NamedNode or undefined if not found
116
+ */
117
+ getAssignedUri(subject, graph = null) {
118
+ return (this.store.getObjects(subject, namespaces_1.ns.oslo('assignedURI'), graph).shift());
119
+ }
120
+ /**
121
+ * Find all quads with a label predicate (vocLabel, apLabel and diagramLabel) for a given subject
122
+ * @param subject The RDF.Term to find the labels for
123
+ * @param store A N3 quad store
124
+ * @returns An array of RDF.Quads
125
+ */
126
+ getLabels(subject, graph = null) {
127
+ const vocLabel = this.store.getQuads(subject, namespaces_1.ns.oslo('vocLabel'), null, graph);
128
+ const apLabel = this.store.getQuads(subject, namespaces_1.ns.oslo('apLabel'), null, graph);
129
+ const diagramLabel = this.store.getQuads(subject, namespaces_1.ns.oslo('diagramLabel'), null, graph);
130
+ return vocLabel.concat(apLabel).concat(diagramLabel);
131
+ }
132
+ /**
133
+ * Finds the oslo:vocLabel whose language tag matches the given language
134
+ * @param subject The RDF.Term to find the oslo:vocLabel for
135
+ * @param store A N3 quad store
136
+ * @param language A language tag
137
+ * @returns An RDF.Literal or undefined if not found
138
+ */
139
+ getVocLabel(subject, language, graph = null) {
140
+ var _a;
141
+ return (_a = this.getLabels(subject, graph).find((x) => x.predicate.equals(namespaces_1.ns.oslo('vocLabel')) &&
142
+ x.object.language === (language || ''))) === null || _a === void 0 ? void 0 : _a.object;
143
+ }
144
+ /**
145
+ * Finds the oslo:apLabel whose language tag matches the given language
146
+ * @param subject The RDF.Term to find the oslo:apLabel for
147
+ * @param store A N3 quad store
148
+ * @param language A language tag
149
+ * @returns An RDF.Literal or undefined if not found
150
+ */
151
+ getApLabel(subject, language, graph = null) {
152
+ var _a;
153
+ return (_a = this.getLabels(subject, graph).find((x) => x.predicate.equals(namespaces_1.ns.oslo('apLabel')) &&
154
+ x.object.language === (language || ''))) === null || _a === void 0 ? void 0 : _a.object;
155
+ }
156
+ /**
157
+ * Finds the oslo:diagramLabel for a given subject
158
+ * @param subject The RDF.Term to find the oslo:diagramLabel for
159
+ * @param store A N3 quad store
160
+ * @param language A language tag
161
+ * @returns An RDF.Literal or undefined if not found
162
+ */
163
+ getDiagramLabel(subject, graph = null) {
164
+ var _a;
165
+ return (_a = this.getLabels(subject, graph).find((x) => x.predicate.equals(namespaces_1.ns.oslo('diagramLabel')))) === null || _a === void 0 ? void 0 : _a.object;
166
+ }
167
+ /**
168
+ * Find all definitions for a given subject
169
+ * @param subject The RDF.Term to find the definitions for
170
+ * @param store A N3 quad store
171
+ * @returns An array of RDF.Literals
172
+ */
173
+ getDefinitions(subject, graph = null) {
174
+ const vocDefinitions = this.store.getQuads(subject, namespaces_1.ns.oslo('vocDefinition'), null, graph);
175
+ const apDefinitions = this.store.getQuads(subject, namespaces_1.ns.oslo('apDefinition'), null, graph);
176
+ return vocDefinitions.concat(apDefinitions);
177
+ }
178
+ /**
179
+ * Finds the oslo:vocDefinition whose language tag matches the given language
180
+ * @param subject The RDF.Term to find the oslo:vocDefinition for
181
+ * @param store A N3 quad store
182
+ * @param language A language tag
183
+ * @returns An RDF.Literal or undefined if not found
184
+ */
185
+ getVocDefinition(subject, language, graph = null) {
186
+ var _a;
187
+ return (_a = this.getDefinitions(subject, graph).find((x) => x.predicate.equals(namespaces_1.ns.oslo('vocDefinition')) &&
188
+ x.object.language === (language || ''))) === null || _a === void 0 ? void 0 : _a.object;
189
+ }
190
+ /**
191
+ * Finds the oslo:apDefinition whose language tag matches the given language
192
+ * @param subject The RDF.Term to find the oslo:apDefinition for
193
+ * @param store A N3 quad store
194
+ * @param language A language tag
195
+ * @returns An RDF.Literal or undefined if not found
196
+ */
197
+ getApDefinition(subject, language, graph = null) {
198
+ var _a;
199
+ return (_a = this.getDefinitions(subject, graph).find((x) => x.predicate.equals(namespaces_1.ns.oslo('apDefinition')) &&
200
+ x.object.language === (language || ''))) === null || _a === void 0 ? void 0 : _a.object;
201
+ }
202
+ /**
203
+ * Finds the rdfs:range of a given RDF.Term
204
+ * @param subject The RDF.Term to find the range of
205
+ * @param store A N3 quad store
206
+ * @returns An RDF.Term or undefined if not found
207
+ */
208
+ getRange(subject, graph = null) {
209
+ return (this.store.getObjects(subject, namespaces_1.ns.rdfs('range'), graph).shift());
210
+ }
211
+ /**
212
+ * Finds the rdfs:domain of a given RDF.Term
213
+ * @param subject The RDF.Term to find the domain of
214
+ * @param store A N3 quad store
215
+ * @returns An RDF.Term or undefined if not found
216
+ */
217
+ getDomain(subject, graph = null) {
218
+ return (this.store.getObjects(subject, namespaces_1.ns.rdfs('domain'), graph).shift());
219
+ }
220
+ /**
221
+ * Finds all the usageNotes (voc and ap) of a given RDF.Term
222
+ * @param subject The RDF.Term to find the usage notes for
223
+ * @param store A N3 quad store
224
+ * @returns An array of RDF.Literals
225
+ */
226
+ getUsageNotes(subject, graph = null) {
227
+ const vocUsageNotes = this.store.getQuads(subject, namespaces_1.ns.oslo('vocUsageNote'), null, graph);
228
+ const apUsageNotes = this.store.getQuads(subject, namespaces_1.ns.oslo('apUsageNote'), null, graph);
229
+ return vocUsageNotes.concat(apUsageNotes);
230
+ }
231
+ /**
232
+ * Finds the oslo:vocUsageNote of which the language tag matches the given language
233
+ * @param subject The RDF.Term to find the vocabulary usage note for
234
+ * @param store A N3 quad store
235
+ * @param language A language tag
236
+ * @returns An RDF.Literal or undefined if not found
237
+ */
238
+ getVocUsageNote(subject, language, graph = null) {
239
+ var _a;
240
+ return (_a = this.getUsageNotes(subject, graph).find((x) => x.predicate.equals(namespaces_1.ns.oslo('vocUsageNote')) &&
241
+ x.object.language === (language || ''))) === null || _a === void 0 ? void 0 : _a.object;
242
+ }
243
+ /**
244
+ * Finds the oslo:apUsageNote of which the language tag matches the given language
245
+ * @param subject The RDF.Term to find the application profile usage note for
246
+ * @param store A N3 quad store
247
+ * @param language A language tag
248
+ * @returns An RDF.Literal or undefined if not found
249
+ */
250
+ getApUsageNote(subject, language, graph = null) {
251
+ var _a;
252
+ return (_a = this.getUsageNotes(subject, graph).find((x) => x.predicate.equals(namespaces_1.ns.oslo('apUsageNote')) &&
253
+ x.object.language === (language || ''))) === null || _a === void 0 ? void 0 : _a.object;
254
+ }
255
+ /**
256
+ * Finds the example:scope of a given subject
257
+ * @param subject The RDF.Term to find the scope for
258
+ * @returns An RDF.NamedNode or undefined if not found
259
+ */
260
+ getScope(subject, graph = null) {
261
+ return (this.store.getObjects(subject, namespaces_1.ns.oslo('scope'), graph).shift());
262
+ }
263
+ /**
264
+ * Finds the shacl:minCardinality for a given subject
265
+ * @param subject The RDF.Term to find the shacl:minCardinaly for
266
+ * @returns An RDF.Literal or undefined if not found
267
+ */
268
+ getMinCardinality(subject, graph = null) {
269
+ return (this.store.getObjects(subject, namespaces_1.ns.shacl('minCount'), graph).shift());
270
+ }
271
+ /**
272
+ * Finds the shacl:maxCardinality for a given subject
273
+ * @param subject The RDF.Term to find the shacl:maxCardinaly for
274
+ * @returns An RDF.Literal or undefined if not found
275
+ */
276
+ getMaxCardinality(subject, graph = null) {
277
+ return (this.store.getObjects(subject, namespaces_1.ns.shacl('maxCount'), graph).shift());
278
+ }
279
+ /**
280
+ * Finds all the rdfs:subClassOf of a given RDF.Term
281
+ * @param subject the RDF.Term to find the parents of
282
+ * @param store A N3 quad store
283
+ * @returns An array of RDF.Terms
284
+ */
285
+ getParentsOfClass(subject, graph = null) {
286
+ return (this.store.getObjects(subject, namespaces_1.ns.rdfs('subClassOf'), graph));
287
+ }
288
+ /**
289
+ * Finds the rdfs:subPropertyOf of a given RDF.Term
290
+ * @param subject The RDF.Term to find the parent of
291
+ * @param store A N3 quad store
292
+ * @returns An RDF.Term or undefined if not found
293
+ */
294
+ getParentOfProperty(subject, graph = null) {
295
+ return (this.store.getObjects(subject, namespaces_1.ns.rdfs('subPropertyOf'), graph).shift());
296
+ }
297
+ getCodelist(subject, graph = null) {
298
+ return (this.store.getObjects(subject, namespaces_1.ns.oslo('codelist'), graph).shift());
299
+ }
300
+ };
301
+ QuadStore = __decorate([
302
+ (0, inversify_1.injectable)(),
303
+ __metadata("design:paramtypes", [])
304
+ ], QuadStore);
305
+ exports.QuadStore = QuadStore;
306
+ //# sourceMappingURL=QuadStore.js.map
@@ -1,2 +1,2 @@
1
- /// <reference types="node" />
2
- export declare function fetchFileOrUrl(file: string): Promise<Buffer>;
1
+ /// <reference types="node" />
2
+ export declare function fetchFileOrUrl(file: string): Promise<Buffer>;
@@ -1,23 +1,23 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.fetchFileOrUrl = void 0;
7
- const fs_1 = require("fs");
8
- const promises_1 = require("fs/promises");
9
- const node_fetch_1 = __importDefault(require("node-fetch"));
10
- async function fetchFileOrUrl(file) {
11
- if (file.startsWith('http://') || file.startsWith('https://')) {
12
- return (await (0, node_fetch_1.default)(file)).buffer();
13
- }
14
- if (file.startsWith('file://')) {
15
- file = file.slice(7);
16
- }
17
- if (!(0, fs_1.existsSync)(file) || !(await (0, promises_1.stat)(file)).isFile()) {
18
- throw new Error(`Path does not refer to a valid file: ${file}`);
19
- }
20
- return (0, promises_1.readFile)(file);
21
- }
22
- exports.fetchFileOrUrl = fetchFileOrUrl;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fetchFileOrUrl = void 0;
7
+ const fs_1 = require("fs");
8
+ const promises_1 = require("fs/promises");
9
+ const node_fetch_1 = __importDefault(require("node-fetch"));
10
+ async function fetchFileOrUrl(file) {
11
+ if (file.startsWith('http://') || file.startsWith('https://')) {
12
+ return (await (0, node_fetch_1.default)(file)).buffer();
13
+ }
14
+ if (file.startsWith('file://')) {
15
+ file = file.slice(7);
16
+ }
17
+ if (!(0, fs_1.existsSync)(file) || !(await (0, promises_1.stat)(file)).isFile()) {
18
+ throw new Error(`Path does not refer to a valid file: ${file}`);
19
+ }
20
+ return (0, promises_1.readFile)(file);
21
+ }
22
+ exports.fetchFileOrUrl = fetchFileOrUrl;
23
23
  //# sourceMappingURL=fetchFileOrUrl.js.map
@@ -1,24 +1,24 @@
1
- declare enum Prefixes {
2
- example = "http://example.org/",
3
- adms = "http://www.w3.org/ns/adms#",
4
- dcat = "http://www.w3.org/ns/dcat#",
5
- dcterms = "http://purl.org/dc/terms/",
6
- foaf = "http://xmlns.com/foaf/0.1/",
7
- owl = "http://www.w3.org/2002/07/owl#",
8
- vlaanderen = "https://data.vlaanderen.be/ns/",
9
- void = "http://rdfs.org/ns/void#",
10
- rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
11
- rdfs = "http://www.w3.org/2000/01/rdf-schema#",
12
- qb = "http://purl.org/linked-data/cube#",
13
- skos = "http://www.w3.org/2004/02/skos/core#",
14
- xsd = "http://www.w3.org/2001/XMLSchema#",
15
- person = "http://www.w3.org/ns/person#",
16
- vann = "http://purl.org/vocab/vann/",
17
- shacl = "http://w3.org/ns/shacl#",
18
- prov = "http://www.w3.org/ns/prov#"
19
- }
20
- export declare type Namespace = {
21
- [T in keyof typeof Prefixes]: Function;
22
- };
23
- export declare const ns: Namespace;
24
- export {};
1
+ declare enum Prefixes {
2
+ adms = "http://www.w3.org/ns/adms#",
3
+ dcat = "http://www.w3.org/ns/dcat#",
4
+ dcterms = "http://purl.org/dc/terms/",
5
+ foaf = "http://xmlns.com/foaf/0.1/",
6
+ owl = "http://www.w3.org/2002/07/owl#",
7
+ vlaanderen = "https://data.vlaanderen.be/ns/",
8
+ void = "http://rdfs.org/ns/void#",
9
+ rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
10
+ rdfs = "http://www.w3.org/2000/01/rdf-schema#",
11
+ qb = "http://purl.org/linked-data/cube#",
12
+ skos = "http://www.w3.org/2004/02/skos/core#",
13
+ xsd = "http://www.w3.org/2001/XMLSchema#",
14
+ person = "http://www.w3.org/ns/person#",
15
+ vann = "http://purl.org/vocab/vann/",
16
+ shacl = "http://w3.org/ns/shacl#",
17
+ prov = "http://www.w3.org/ns/prov#",
18
+ oslo = "https://implementatie.data.vlaanderen.be/ns/oslo-toolchain#"
19
+ }
20
+ export type Namespace = {
21
+ [T in keyof typeof Prefixes]: Function;
22
+ };
23
+ export declare const ns: Namespace;
24
+ export {};
@@ -1,36 +1,36 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ns = void 0;
4
- const rdf_data_factory_1 = require("rdf-data-factory");
5
- const factory = new rdf_data_factory_1.DataFactory();
6
- // TODO: remove example.org from prefixes
7
- var Prefixes;
8
- (function (Prefixes) {
9
- Prefixes["example"] = "http://example.org/";
10
- Prefixes["adms"] = "http://www.w3.org/ns/adms#";
11
- Prefixes["dcat"] = "http://www.w3.org/ns/dcat#";
12
- Prefixes["dcterms"] = "http://purl.org/dc/terms/";
13
- Prefixes["foaf"] = "http://xmlns.com/foaf/0.1/";
14
- Prefixes["owl"] = "http://www.w3.org/2002/07/owl#";
15
- Prefixes["vlaanderen"] = "https://data.vlaanderen.be/ns/";
16
- Prefixes["void"] = "http://rdfs.org/ns/void#";
17
- Prefixes["rdf"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
18
- Prefixes["rdfs"] = "http://www.w3.org/2000/01/rdf-schema#";
19
- Prefixes["qb"] = "http://purl.org/linked-data/cube#";
20
- Prefixes["skos"] = "http://www.w3.org/2004/02/skos/core#";
21
- Prefixes["xsd"] = "http://www.w3.org/2001/XMLSchema#";
22
- Prefixes["person"] = "http://www.w3.org/ns/person#";
23
- Prefixes["vann"] = "http://purl.org/vocab/vann/";
24
- Prefixes["shacl"] = "http://w3.org/ns/shacl#";
25
- Prefixes["prov"] = "http://www.w3.org/ns/prov#";
26
- })(Prefixes || (Prefixes = {}));
27
- const vocab = () => {
28
- const namespaces = {};
29
- for (const prefix in Prefixes) {
30
- const expansion = Prefixes[prefix];
31
- namespaces[prefix] = (localName = '') => factory.namedNode(expansion + localName);
32
- }
33
- return namespaces;
34
- };
35
- exports.ns = vocab();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ns = void 0;
4
+ const rdf_data_factory_1 = require("rdf-data-factory");
5
+ const factory = new rdf_data_factory_1.DataFactory();
6
+ // TODO: remove example.org from prefixes
7
+ var Prefixes;
8
+ (function (Prefixes) {
9
+ Prefixes["adms"] = "http://www.w3.org/ns/adms#";
10
+ Prefixes["dcat"] = "http://www.w3.org/ns/dcat#";
11
+ Prefixes["dcterms"] = "http://purl.org/dc/terms/";
12
+ Prefixes["foaf"] = "http://xmlns.com/foaf/0.1/";
13
+ Prefixes["owl"] = "http://www.w3.org/2002/07/owl#";
14
+ Prefixes["vlaanderen"] = "https://data.vlaanderen.be/ns/";
15
+ Prefixes["void"] = "http://rdfs.org/ns/void#";
16
+ Prefixes["rdf"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
17
+ Prefixes["rdfs"] = "http://www.w3.org/2000/01/rdf-schema#";
18
+ Prefixes["qb"] = "http://purl.org/linked-data/cube#";
19
+ Prefixes["skos"] = "http://www.w3.org/2004/02/skos/core#";
20
+ Prefixes["xsd"] = "http://www.w3.org/2001/XMLSchema#";
21
+ Prefixes["person"] = "http://www.w3.org/ns/person#";
22
+ Prefixes["vann"] = "http://purl.org/vocab/vann/";
23
+ Prefixes["shacl"] = "http://w3.org/ns/shacl#";
24
+ Prefixes["prov"] = "http://www.w3.org/ns/prov#";
25
+ Prefixes["oslo"] = "https://implementatie.data.vlaanderen.be/ns/oslo-toolchain#";
26
+ })(Prefixes || (Prefixes = {}));
27
+ const vocab = () => {
28
+ const namespaces = {};
29
+ for (const prefix in Prefixes) {
30
+ const expansion = Prefixes[prefix];
31
+ namespaces[prefix] = (localName = '') => factory.namedNode(expansion + localName);
32
+ }
33
+ return namespaces;
34
+ };
35
+ exports.ns = vocab();
36
36
  //# sourceMappingURL=namespaces.js.map
@@ -1 +1 @@
1
- export declare function uniqueId(guid: string, label: string, id: number): string;
1
+ export declare function uniqueId(guid: string, label: string, id: number): string;
@@ -1,14 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uniqueId = void 0;
4
- const crypto_js_1 = require("crypto-js");
5
- function uniqueId(guid, label, id) {
6
- const object = {
7
- guid,
8
- label,
9
- id,
10
- };
11
- return (0, crypto_js_1.SHA256)(JSON.stringify(object)).toString();
12
- }
13
- exports.uniqueId = uniqueId;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uniqueId = void 0;
4
+ const crypto_js_1 = require("crypto-js");
5
+ function uniqueId(guid, label, id) {
6
+ const object = {
7
+ guid,
8
+ label,
9
+ id,
10
+ };
11
+ return (0, crypto_js_1.SHA256)(JSON.stringify(object)).toString();
12
+ }
13
+ exports.uniqueId = uniqueId;
14
14
  //# sourceMappingURL=uniqueId.js.map
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@oslo-flanders/core",
3
- "version": "0.0.3-alpha.0",
3
+ "version": "0.0.5-alpha.0",
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",
7
7
  "license": "MIT",
8
8
  "main": "index.js",
9
+ "_moduleAliases": {
10
+ "@oslo-core": "./lib"
11
+ },
9
12
  "directories": {
10
13
  "lib": "lib"
11
14
  },
@@ -50,20 +53,24 @@
50
53
  },
51
54
  "dependencies": {
52
55
  "crypto-js": "^4.1.1",
56
+ "inversify": "^6.0.1",
53
57
  "n3": "^1.16.2",
54
58
  "node-fetch": "^2.6.7",
55
59
  "rdf-data-factory": "^1.1.1",
56
60
  "rdf-parse": "^2.1.1",
57
61
  "reflect-metadata": "^0.1.13",
58
62
  "streamify-string": "^1.0.1",
59
- "winston": "^3.8.2"
63
+ "winston": "^3.8.2",
64
+ "winston-transport": "^4.5.0"
60
65
  },
61
66
  "devDependencies": {
62
67
  "@rdfjs/types": "^1.1.0",
63
68
  "@types/crypto-js": "^4.1.1",
69
+ "@types/n3": "^1.10.4",
64
70
  "@types/node-fetch": "^2.6.2",
65
71
  "@types/streamify-string": "^1.0.0",
66
- "@types/tmp": "^0.2.3"
72
+ "@types/tmp": "^0.2.3",
73
+ "module-alias": "^2.2.3"
67
74
  },
68
- "gitHead": "f749c71908781f533e0e35f0e3394ce43a8dd7c0"
75
+ "gitHead": "d6d439321b37ffa74063682fcd8a90d1b7ca12ed"
69
76
  }
@@ -1,10 +0,0 @@
1
- import type { Logger } from '../logging/Logger';
2
- import type { IConfiguration } from './IConfiguration';
3
- /**
4
- * Interface that must be implemented by classes that convert a UML diagram to an RDF file
5
- */
6
- export interface IConversionService {
7
- logger: Logger;
8
- configuration: IConfiguration;
9
- run: () => Promise<void>;
10
- }
@@ -1,8 +0,0 @@
1
- import type { IConfiguration } from './IConfiguration';
2
- /**
3
- * Interface that must be implemented by classes that use an RDF file as input and generates an artefact
4
- */
5
- export interface IGenerationService {
6
- configuration: IConfiguration;
7
- run: () => Promise<void>;
8
- }