Skip to content

Commit

Permalink
Skohub: Add _registryConfigForBartocApiConfig (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandesu committed Jun 22, 2022
1 parent 1402765 commit c006b96
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/providers/skohub-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ export default class SkohubProvider extends BaseProvider {
this._schemeCache = {}
}

/**
* Used by `registryForScheme` (see src/lib/CocodaSDK.js) to determine a provider config for a concept schceme.
*
* @param {Object} options
* @param {Object} options.url API URL for BARTOC instance
* @param {Object} options.scheme scheme for which the config is requested
* @returns {Object} provider configuration
*/
static _registryConfigForBartocApiConfig({ url, scheme } = {}) {
if (!url || !scheme) {
return null
}
// Save scheme with "url" as main URI, add other identifier
const newScheme = { uri: url, identifier: jskos.getAllUris(scheme).filter(uri => uri !== url) }
return { schemes: [newScheme] }
}

async _loadScheme({ scheme, ...config }) {
const uris = jskos.getAllUris(scheme)
for (let uri of uris) {
Expand Down

0 comments on commit c006b96

Please sign in to comment.