@oslo-flanders/core 1.0.1 → 1.0.4

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/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export * from './lib/enums/Scope';
12
12
  export * from './lib/enums/PropertyTypes';
13
13
  export * from './lib/enums/specificationType';
14
14
  export * from './lib/enums/DataTypes';
15
+ export * from './lib/enums/OutputFormat';
15
16
  export * from './lib/logging/LogLevel';
16
17
  export * from './lib/logging/Logger';
17
18
  export * from './lib/logging/VoidLogger';
package/index.js CHANGED
@@ -28,6 +28,7 @@ __exportStar(require("./lib/enums/Scope"), exports);
28
28
  __exportStar(require("./lib/enums/PropertyTypes"), exports);
29
29
  __exportStar(require("./lib/enums/specificationType"), exports);
30
30
  __exportStar(require("./lib/enums/DataTypes"), exports);
31
+ __exportStar(require("./lib/enums/OutputFormat"), exports);
31
32
  __exportStar(require("./lib/logging/LogLevel"), exports);
32
33
  __exportStar(require("./lib/logging/Logger"), exports);
33
34
  __exportStar(require("./lib/logging/VoidLogger"), exports);
@@ -0,0 +1,4 @@
1
+ export declare enum InputFormat {
2
+ AccessDB = "accessdb",
3
+ Sqlite = "sqlite"
4
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InputFormat = void 0;
4
+ var InputFormat;
5
+ (function (InputFormat) {
6
+ InputFormat["AccessDB"] = "accessdb";
7
+ InputFormat["Sqlite"] = "sqlite";
8
+ })(InputFormat = exports.InputFormat || (exports.InputFormat = {}));
9
+ //# sourceMappingURL=InputFormat.js.map
@@ -0,0 +1,9 @@
1
+ export declare enum OutputFormat {
2
+ JsonLd = "application/ld+json",
3
+ Json = "application/json",
4
+ trig = "application/trig",
5
+ turtle = "text/turtle",
6
+ nquads = "application/n-quads",
7
+ ntriples = "application/n-triples",
8
+ unsupported = "unsupported/format"
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OutputFormat = void 0;
4
+ var OutputFormat;
5
+ (function (OutputFormat) {
6
+ OutputFormat["JsonLd"] = "application/ld+json";
7
+ OutputFormat["Json"] = "application/json";
8
+ OutputFormat["trig"] = "application/trig";
9
+ OutputFormat["turtle"] = "text/turtle";
10
+ OutputFormat["nquads"] = "application/n-quads";
11
+ OutputFormat["ntriples"] = "application/n-triples";
12
+ OutputFormat["unsupported"] = "unsupported/format";
13
+ })(OutputFormat = exports.OutputFormat || (exports.OutputFormat = {}));
14
+ //# sourceMappingURL=OutputFormat.js.map
@@ -175,18 +175,32 @@ export declare class QuadStore {
175
175
  */
176
176
  getStatus(subject: RDF.Term, graph?: RDF.Term | null): RDF.NamedNode | undefined;
177
177
  /**
178
- * Finds all the other tags.
178
+ * Finds all the extension tags.
179
179
  * This could be any tag that is not a label, definition, usage note, scope, minCardinality, maxCardinality, parent, range, domain, status or codelist
180
- * @param subject The RDF.Term to find the other tags for
180
+ * @param subject The RDF.Term to find the extension tags for
181
181
  * @param store A N3 quad store
182
182
  * @returns An array of RDF.Literals
183
183
  */
184
- getOtherTags(subject: RDF.Term, graph?: RDF.NamedNode | null): RDF.Quad[];
184
+ getExtensionTags(subject: RDF.Term, graph?: RDF.NamedNode | null): RDF.Quad[];
185
185
  /**
186
- * Use the other tags method from earlier and sanitize the results so the ns('any') is removed
187
- * @param subject The RDF.Term to find the other tags for
186
+ * Finds the oslo:key of a given RDF.Term
187
+ * @param subject The RDF.Term to find the oslo:key of
188
188
  * @param store A N3 quad store
189
- * @returns An array of RDF.Literals
189
+ * @returns An RDF.Term or undefined if not found
190
+ */
191
+ getExtension(subject: RDF.Term, graph?: RDF.Term | null): RDF.NamedNode | undefined;
192
+ /**
193
+ * Finds the oslo:key of a given RDF.Term
194
+ * @param subject The RDF.Term to find the oslo:key of
195
+ * @param store A N3 quad store
196
+ * @returns An RDF.Term or undefined if not found
197
+ */
198
+ getOsloExtensionKey(subject: RDF.Term, graph?: RDF.Term | null): RDF.NamedNode | undefined;
199
+ /**
200
+ * Finds the oslo:value of a given RDF.Term
201
+ * @param subject The RDF.Term to find the oslo:key of
202
+ * @param store A N3 quad store
203
+ * @returns An RDF.Term or undefined if not found
190
204
  */
191
- getSanitizedOtherTags(subject: RDF.Term, graph?: RDF.NamedNode | null): RDF.Quad[];
205
+ getOsloExtensionValue(subject: RDF.Term, graph?: RDF.Term | null): RDF.NamedNode | undefined;
192
206
  }
@@ -314,30 +314,49 @@ let QuadStore = class QuadStore {
314
314
  return (this.store.getObjects(subject, namespaces_1.ns.adms('status'), graph).shift());
315
315
  }
316
316
  /**
317
- * Finds all the other tags.
317
+ * Finds all the extension tags.
318
318
  * This could be any tag that is not a label, definition, usage note, scope, minCardinality, maxCardinality, parent, range, domain, status or codelist
319
- * @param subject The RDF.Term to find the other tags for
319
+ * @param subject The RDF.Term to find the extension tags for
320
320
  * @param store A N3 quad store
321
321
  * @returns An array of RDF.Literals
322
322
  */
323
- getOtherTags(subject, graph = null) {
324
- const allQuads = this.store.getQuads(subject, null, null, graph);
325
- // Filter quads where the predicate includes 'any' partially
326
- const anyQuads = allQuads.filter((quad) => quad.predicate.value.includes(namespaces_1.ns.oslo('any').value));
327
- return anyQuads;
323
+ getExtensionTags(subject, graph = null) {
324
+ const quads = this.store
325
+ .getQuads(subject, null, null, graph)
326
+ .filter((quad) => quad.predicate.value.includes(namespaces_1.ns.oslo('extensions').value));
327
+ return quads.map((quad) => {
328
+ const sanitizedPredicate = N3.DataFactory.namedNode(quad.predicate.value.replace(`${namespaces_1.ns.oslo('extensions').value}:`, ''));
329
+ return N3.DataFactory.quad(quad.subject, sanitizedPredicate, quad.object, quad.graph);
330
+ });
328
331
  }
329
332
  /**
330
- * Use the other tags method from earlier and sanitize the results so the ns('any') is removed
331
- * @param subject The RDF.Term to find the other tags for
333
+ * Finds the oslo:key of a given RDF.Term
334
+ * @param subject The RDF.Term to find the oslo:key of
332
335
  * @param store A N3 quad store
333
- * @returns An array of RDF.Literals
336
+ * @returns An RDF.Term or undefined if not found
334
337
  */
335
- getSanitizedOtherTags(subject, graph = null) {
336
- const quads = this.getOtherTags(subject, graph);
337
- return quads.map((quad) => {
338
- const sanitizedPredicate = N3.DataFactory.namedNode(quad.predicate.value.replace(`${namespaces_1.ns.oslo('any').value}:`, ''));
339
- return N3.DataFactory.quad(quad.subject, sanitizedPredicate, quad.object, quad.graph);
340
- });
338
+ getExtension(subject, graph = null) {
339
+ console.log(this.store.getObjects(subject, namespaces_1.ns.oslo('key'), graph).shift());
340
+ console.log(this.store.getObjects(subject, null, graph));
341
+ return (this.store.getObjects(subject, namespaces_1.ns.oslo('oslo:key'), graph).shift());
342
+ }
343
+ /**
344
+ * Finds the oslo:key of a given RDF.Term
345
+ * @param subject The RDF.Term to find the oslo:key of
346
+ * @param store A N3 quad store
347
+ * @returns An RDF.Term or undefined if not found
348
+ */
349
+ getOsloExtensionKey(subject, graph = null) {
350
+ return (this.store.getObjects(subject, namespaces_1.ns.oslo('key'), graph).shift());
351
+ }
352
+ /**
353
+ * Finds the oslo:value of a given RDF.Term
354
+ * @param subject The RDF.Term to find the oslo:key of
355
+ * @param store A N3 quad store
356
+ * @returns An RDF.Term or undefined if not found
357
+ */
358
+ getOsloExtensionValue(subject, graph = null) {
359
+ return (this.store.getObjects(subject, namespaces_1.ns.oslo('value'), graph).shift());
341
360
  }
342
361
  };
343
362
  QuadStore = __decorate([
@@ -1,3 +1,2 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  export declare function fetchFileOrUrl(file: string): Promise<Buffer>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslo-flanders/core",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
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",