Skip to content

Commit c006b96

Browse files
committed
Skohub: Add _registryConfigForBartocApiConfig (#29)
1 parent 1402765 commit c006b96

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/providers/skohub-provider.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,23 @@ export default class SkohubProvider extends BaseProvider {
4949
this._schemeCache = {}
5050
}
5151

52+
/**
53+
* Used by `registryForScheme` (see src/lib/CocodaSDK.js) to determine a provider config for a concept schceme.
54+
*
55+
* @param {Object} options
56+
* @param {Object} options.url API URL for BARTOC instance
57+
* @param {Object} options.scheme scheme for which the config is requested
58+
* @returns {Object} provider configuration
59+
*/
60+
static _registryConfigForBartocApiConfig({ url, scheme } = {}) {
61+
if (!url || !scheme) {
62+
return null
63+
}
64+
// Save scheme with "url" as main URI, add other identifier
65+
const newScheme = { uri: url, identifier: jskos.getAllUris(scheme).filter(uri => uri !== url) }
66+
return { schemes: [newScheme] }
67+
}
68+
5269
async _loadScheme({ scheme, ...config }) {
5370
const uris = jskos.getAllUris(scheme)
5471
for (let uri of uris) {

0 commit comments

Comments
 (0)