cocoda-sdk 3.4.0 → 3.4.2
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.
|
@@ -391,11 +391,15 @@ class ConceptApiProvider extends BaseProvider {
|
|
|
391
391
|
if (schemeUri) {
|
|
392
392
|
_.set(config, "params.uri", schemeUri);
|
|
393
393
|
}
|
|
394
|
-
|
|
394
|
+
let types = await this.axios({
|
|
395
395
|
...config,
|
|
396
396
|
method: "get",
|
|
397
397
|
url: this._api.types
|
|
398
398
|
});
|
|
399
|
+
if (schemeUri) {
|
|
400
|
+
types = types.filter((type) => !type.inScheme || jskos.isContainedIn(scheme, type.inScheme));
|
|
401
|
+
}
|
|
402
|
+
return types;
|
|
399
403
|
}
|
|
400
404
|
}
|
|
401
405
|
ConceptApiProvider.providerName = "ConceptApi";
|
|
@@ -3,6 +3,7 @@ import * as errors from "../errors/index.js";
|
|
|
3
3
|
import * as utils from "../utils/index.js";
|
|
4
4
|
import jskos from "jskos-tools";
|
|
5
5
|
import axios from "axios";
|
|
6
|
+
const api = "https://lobid.org/gnd/";
|
|
6
7
|
const gndJson = {
|
|
7
8
|
uri: "http://bartoc.org/en/node/430",
|
|
8
9
|
concepts: [
|
|
@@ -109,6 +110,15 @@ function toJSKOS(data) {
|
|
|
109
110
|
});
|
|
110
111
|
concept.broader = concept.broader.map((broader) => ({ uri: broader.id }));
|
|
111
112
|
concept.identifier = [concept.uri.replace("https://", "http://")];
|
|
113
|
+
if (data.sameAs && data.sameAs.length) {
|
|
114
|
+
concept.mappings = data.sameAs.map((target) => ({
|
|
115
|
+
from: { memberSet: [{ uri: concept.uri }] },
|
|
116
|
+
fromScheme: { uri: gndJson.uri },
|
|
117
|
+
to: { memberSet: [{ uri: target.id }] },
|
|
118
|
+
toScheme: { uri: target.collection.id },
|
|
119
|
+
type: ["http://www.w3.org/2004/02/skos/core#exactMatch"]
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
112
122
|
return concept;
|
|
113
123
|
}
|
|
114
124
|
function fixURI(uri) {
|
|
@@ -130,6 +140,11 @@ class LobidApiProvider extends BaseProvider {
|
|
|
130
140
|
this.has[c] = false;
|
|
131
141
|
});
|
|
132
142
|
}
|
|
143
|
+
_setup() {
|
|
144
|
+
if (!this._api.api) {
|
|
145
|
+
this._api.api = api;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
133
148
|
/**
|
|
134
149
|
* Used by `registryForScheme` (see src/lib/CocodaSDK.js) to determine a provider config for a concept schceme.
|
|
135
150
|
*
|
|
@@ -142,7 +157,7 @@ class LobidApiProvider extends BaseProvider {
|
|
|
142
157
|
return null;
|
|
143
158
|
}
|
|
144
159
|
return {
|
|
145
|
-
api
|
|
160
|
+
api,
|
|
146
161
|
schemes: [gndJson]
|
|
147
162
|
};
|
|
148
163
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cocoda-sdk",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"description": "SDK for Cocoda",
|
|
5
5
|
"main": "dist/cjs/index.cjs",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -53,21 +53,21 @@
|
|
|
53
53
|
"homepage": "https://github.com/gbv/cocoda-sdk#readme",
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"axios-mock-adapter": "^1.21.2",
|
|
56
|
-
"clean-jsdoc-theme": "^4.2.
|
|
57
|
-
"esbuild": "~0.17.
|
|
56
|
+
"clean-jsdoc-theme": "^4.2.6",
|
|
57
|
+
"esbuild": "~0.17.8",
|
|
58
58
|
"esbuild-plugin-ifdef": "^1.0.1",
|
|
59
|
-
"eslint": "^8.
|
|
59
|
+
"eslint": "^8.34.0",
|
|
60
60
|
"eslint-config-gbv": "^1.0.4",
|
|
61
61
|
"glob": "^8.1.0",
|
|
62
62
|
"jsdoc": "^4.0.0",
|
|
63
63
|
"license-checker": "^25.0.1",
|
|
64
|
-
"lint-staged": "^13.1.
|
|
64
|
+
"lint-staged": "^13.1.2",
|
|
65
65
|
"mocha": "^10.2.0",
|
|
66
66
|
"mocha-eslint": "^7.0.0",
|
|
67
67
|
"pre-commit": "^1.2.2"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"axios": "^1.3.
|
|
70
|
+
"axios": "^1.3.3",
|
|
71
71
|
"flexsearch": "~0.6.32",
|
|
72
72
|
"jskos-tools": "^1.0.30",
|
|
73
73
|
"localforage": "^1.10.0",
|