LabelSearchSuggestionProvider

Label search suggestion provider.

This provider offers mapping recommendations based on label match via the /search endpoint of JSKOS APIs.

The provider requires that a list of initialized registries with search endpoints is provided via cdk (which refers to the CDK instance that's using this provider).

To use it in a registry, specify provider as "LabelSearchSuggestion":

{
 "uri": "http://coli-conc.gbv.de/registry/coli-conc-recommendations"
 "provider": "LabelSearchSuggestion"
}

You can provide a list of excluded schemes as JSKOS objects in excludedSchemes.

Experimental: You can also provide API URL overrides in the overrides field by giving a list of scheme objects each with a search field that contains the API URL. Note: This behavior is experimental and can change without a new major version.

Additionally, the following JSKOS properties can be provided: prefLabel, notation, definition

Constructor

new LabelSearchSuggestionProvider()

Extends

Members

(readonly) has :Object

A dictionary with functionality of the registry (e.g. registry.has.schemes).

Type:
  • Object
Inherited From

languages :Array.<string>

A list of RFC 3066 language tags in lowercase in order of priority.

Type:
  • Array.<string>

Methods

(async) deleteMappings(config) → {Array.<Object>}

DELETEs multiple mappings. Do not override in subclass!

Parameters:
NameTypeDescription
configObject
Properties
NameTypeDescription
mappingsArray

array of mapping objects

Returns:

array of results (true if successful); in case of failure, consult the _errors property on the array at the index of the failed request

Type: 
Array.<Object>

getCancelTokenSource() → {Object}

Returns a source for a axios cancel token.

Returns:

axios cancel token source

Type: 
Object

(async) getMappings(config) → {Array.<Object>}

Returns a list of mappings.

Parameters:
NameTypeDescription
configObject
Properties
NameTypeDescription
fromObject

JSKOS concept on from side

toObject

JSKOS concept on to side

modeObject

mappings mode

selectedObject

selected mappings in Cocoda

Returns:

array of JSKOS mapping objects

Type: 
Array.<Object>

(async) init() → {Promise}

Load data about registry via the status endpoint.

Inherited From
Returns:

Promise that resolves when initialization is complete.

Type: 
Promise

isAuthorizedFor(options) → {boolean}

Returns whether a user is authorized for a certain request.

Parameters:
NameTypeDescription
optionsObject
Properties
NameTypeAttributesDescription
typestring

type of item (e.g. mappings)

actionstring

action to be performed (read/create/update/delete)

userObject

user object

crossUserboolean<optional>

whether the request is a crossUser request (i.e. updading/deleting another user's item)

Returns:
Type: 
boolean

(async) postMappings(config) → {Array.<Object>}

POSTs multiple mappings. Do not override in subclass!

Parameters:
NameTypeDescription
configObject
Properties
NameTypeDescription
mappingsArray

array of mapping objects

Returns:

array of created mapping objects; in case of failure, consult the _errors property on the array at the index of the failed request

Type: 
Array.<Object>

setAuth(options)

Sets authentication credentials.

Parameters:
NameTypeDescription
optionsObject
Properties
NameTypeDescription
keystring

public key of login-server instance the user is authorized for

bearerTokenstring

token that is sent with each request

Inherited From

setRetryConfig(config)

Sets retry configuration.

Parameters:
NameTypeDescription
configObject
Properties
NameTypeAttributesDefaultDescription
methodsArray.<string><optional>
["get", "head", "options"]

HTTP methods to retry (lowercase)

statusCodesArray.<number><optional>
[401, 403]

status codes to retry

countnumber<optional>
3

maximum number of retries

delaynumber | function<optional>
300*count

a delay in ms or a function that takes the number of current retries and returns a delay in ms

supportsScheme(scheme) → {boolean}

Override supportsScheme to check whether a search URI is available for the scheme's registry.

Parameters:
NameTypeDescription
schemeObject

target scheme to check for support

Returns:
Type: 
boolean