@oslo-flanders/core 0.0.5-alpha.0 → 0.0.6-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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Digitaal Vlaanderen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/index.d.ts CHANGED
@@ -19,3 +19,4 @@ export * from '@oslo-core/logging/LogUtil';
19
19
  export * from '@oslo-core/logging/LoggerFactory';
20
20
  export * from '@oslo-core/logging/VoidLoggerFactory';
21
21
  export * from '@oslo-core/logging/WinstonLoggerFactory';
22
+ export * from '@oslo-core/utils/storeUtils';
package/index.js CHANGED
@@ -35,4 +35,5 @@ __exportStar(require("@oslo-core/logging/LogUtil"), exports);
35
35
  __exportStar(require("@oslo-core/logging/LoggerFactory"), exports);
36
36
  __exportStar(require("@oslo-core/logging/VoidLoggerFactory"), exports);
37
37
  __exportStar(require("@oslo-core/logging/WinstonLoggerFactory"), exports);
38
+ __exportStar(require("@oslo-core/utils/storeUtils"), exports);
38
39
  //# sourceMappingURL=index.js.map
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ns = void 0;
4
4
  const rdf_data_factory_1 = require("rdf-data-factory");
5
5
  const factory = new rdf_data_factory_1.DataFactory();
6
- // TODO: remove example.org from prefixes
7
6
  var Prefixes;
8
7
  (function (Prefixes) {
9
8
  Prefixes["adms"] = "http://www.w3.org/ns/adms#";
@@ -0,0 +1,8 @@
1
+ import type * as RDF from '@rdfjs/types';
2
+ import type { QuadStore } from '@oslo-core/store/QuadStore';
3
+ export declare function getApplicationProfileLabel(subject: RDF.Term, store: QuadStore, language?: string | null): RDF.Literal | undefined;
4
+ export declare function getVocabularyLabel(subject: RDF.Term, store: QuadStore, language?: string | null): RDF.Literal | undefined;
5
+ export declare function getApplicationProfileDefinition(subject: RDF.Term, store: QuadStore, language?: string | null): RDF.Literal | undefined;
6
+ export declare function getVocabularyDefinition(subject: RDF.Term, store: QuadStore, language?: string | null): RDF.Literal | undefined;
7
+ export declare function getApplicationProfileUsageNote(subject: RDF.Term, store: QuadStore, language?: string | null): RDF.Literal | undefined;
8
+ export declare function getVocabularyUsageNote(subject: RDF.Term, store: QuadStore, language?: string | null): RDF.Literal | undefined;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getVocabularyUsageNote = exports.getApplicationProfileUsageNote = exports.getVocabularyDefinition = exports.getApplicationProfileDefinition = exports.getVocabularyLabel = exports.getApplicationProfileLabel = void 0;
4
+ const namespaces_1 = require("@oslo-core/utils/namespaces");
5
+ function getApplicationProfileLabel(subject, store, language = null) {
6
+ var _a, _b, _c;
7
+ const labels = store.getLabels(subject);
8
+ if (labels.some(x => x.predicate.equals(namespaces_1.ns.oslo('apLabel')))) {
9
+ return (_a = labels
10
+ .find(x => x.predicate.equals(namespaces_1.ns.oslo('apLabel')) &&
11
+ x.object.language === (language || ''))) === null || _a === void 0 ? void 0 : _a.object;
12
+ }
13
+ if (labels.some(x => x.predicate.equals(namespaces_1.ns.oslo('vocLabel')))) {
14
+ return (_b = labels.find(x => x.predicate.equals(namespaces_1.ns.oslo('vocLabel')) &&
15
+ x.object.language === (language || ''))) === null || _b === void 0 ? void 0 : _b.object;
16
+ }
17
+ return (_c = labels.find(x => x.predicate.equals(namespaces_1.ns.oslo('diagramLabel')))) === null || _c === void 0 ? void 0 : _c.object;
18
+ }
19
+ exports.getApplicationProfileLabel = getApplicationProfileLabel;
20
+ function getVocabularyLabel(subject, store, language = null) {
21
+ var _a, _b;
22
+ const labels = store.getLabels(subject);
23
+ if (labels.some(x => x.predicate.equals(namespaces_1.ns.oslo('vocLabel')))) {
24
+ return (_a = labels
25
+ .find(x => x.predicate.equals(namespaces_1.ns.oslo('vocLabel')) &&
26
+ x.object.language === (language || ''))) === null || _a === void 0 ? void 0 : _a.object;
27
+ }
28
+ return (_b = labels.find(x => x.predicate.equals(namespaces_1.ns.oslo('diagramLabel')))) === null || _b === void 0 ? void 0 : _b.object;
29
+ }
30
+ exports.getVocabularyLabel = getVocabularyLabel;
31
+ function getApplicationProfileDefinition(subject, store, language = null) {
32
+ var _a, _b;
33
+ const definitions = store.getDefinitions(subject);
34
+ if (definitions.some(x => x.predicate.equals(namespaces_1.ns.oslo('apDefinition')))) {
35
+ return (_a = definitions
36
+ .find(x => x.predicate.equals(namespaces_1.ns.oslo('apDefinition')) &&
37
+ x.object.language === (language || ''))) === null || _a === void 0 ? void 0 : _a.object;
38
+ }
39
+ if (definitions.some(x => x.predicate.equals(namespaces_1.ns.oslo('vocDefinition')))) {
40
+ return (_b = definitions
41
+ .find(x => x.predicate.equals(namespaces_1.ns.oslo('vocDefinition')) &&
42
+ x.object.language === (language || ''))) === null || _b === void 0 ? void 0 : _b.object;
43
+ }
44
+ return undefined;
45
+ }
46
+ exports.getApplicationProfileDefinition = getApplicationProfileDefinition;
47
+ function getVocabularyDefinition(subject, store, language = null) {
48
+ var _a;
49
+ const definitions = store.getDefinitions(subject);
50
+ if (definitions.some(x => x.predicate.equals(namespaces_1.ns.oslo('vocDefinition')))) {
51
+ return (_a = definitions
52
+ .find(x => x.predicate.equals(namespaces_1.ns.oslo('vocDefinition')) &&
53
+ x.object.language === (language || ''))) === null || _a === void 0 ? void 0 : _a.object;
54
+ }
55
+ return undefined;
56
+ }
57
+ exports.getVocabularyDefinition = getVocabularyDefinition;
58
+ function getApplicationProfileUsageNote(subject, store, language = null) {
59
+ var _a, _b;
60
+ const usageNotes = store.getUsageNotes(subject);
61
+ if (usageNotes.some(x => x.predicate.equals(namespaces_1.ns.oslo('apUsageNote')))) {
62
+ return (_a = usageNotes
63
+ .find(x => x.predicate.equals(namespaces_1.ns.oslo('apUsageNote')) &&
64
+ x.object.language === (language || ''))) === null || _a === void 0 ? void 0 : _a.object;
65
+ }
66
+ if (usageNotes.some(x => x.predicate.equals(namespaces_1.ns.oslo('vocUsageNote')))) {
67
+ return (_b = usageNotes
68
+ .find(x => x.predicate.equals(namespaces_1.ns.oslo('vocUsageNote')) &&
69
+ x.object.language === (language || ''))) === null || _b === void 0 ? void 0 : _b.object;
70
+ }
71
+ return undefined;
72
+ }
73
+ exports.getApplicationProfileUsageNote = getApplicationProfileUsageNote;
74
+ function getVocabularyUsageNote(subject, store, language = null) {
75
+ var _a;
76
+ const usageNotes = store.getUsageNotes(subject);
77
+ if (usageNotes.some(x => x.predicate.equals(namespaces_1.ns.oslo('vocUsageNote')))) {
78
+ return (_a = usageNotes
79
+ .find(x => x.predicate.equals(namespaces_1.ns.oslo('vocUsageNote')) &&
80
+ x.object.language === (language || ''))) === null || _a === void 0 ? void 0 : _a.object;
81
+ }
82
+ return undefined;
83
+ }
84
+ exports.getVocabularyUsageNote = getVocabularyUsageNote;
85
+ //# sourceMappingURL=storeUtils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslo-flanders/core",
3
- "version": "0.0.5-alpha.0",
3
+ "version": "0.0.6-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",
@@ -41,7 +41,10 @@
41
41
  "test/data/*",
42
42
  "lib/utils/namespaces.ts"
43
43
  ],
44
- "testEnvironment": "node"
44
+ "testEnvironment": "node",
45
+ "moduleNameMapper": {
46
+ "^@oslo-core/(.*)$": "<rootDir>/lib/$1"
47
+ }
45
48
  },
46
49
  "scripts": {
47
50
  "build": "npm run build:ts",
@@ -54,6 +57,7 @@
54
57
  "dependencies": {
55
58
  "crypto-js": "^4.1.1",
56
59
  "inversify": "^6.0.1",
60
+ "module-alias": "^2.2.3",
57
61
  "n3": "^1.16.2",
58
62
  "node-fetch": "^2.6.7",
59
63
  "rdf-data-factory": "^1.1.1",
@@ -69,8 +73,7 @@
69
73
  "@types/n3": "^1.10.4",
70
74
  "@types/node-fetch": "^2.6.2",
71
75
  "@types/streamify-string": "^1.0.0",
72
- "@types/tmp": "^0.2.3",
73
- "module-alias": "^2.2.3"
76
+ "@types/tmp": "^0.2.3"
74
77
  },
75
- "gitHead": "d6d439321b37ffa74063682fcd8a90d1b7ca12ed"
78
+ "gitHead": "e562cdd74bed9ae1d9a867a981b2b8a5c6492f1b"
76
79
  }