Members

(constant) compareFunctions

An object of compare functions (can be used by array.sort for example).

TODO: Add more functions.

(constant) isValidUri

Checks whether a string is a valid URI.

(constant) normalize

Applies recursive unicode normalization to data.

  • If data is an array, it will recursively normalize all elements of that array.
  • If data is an object, it will recursively normalize all property values of that object.
  • If data is a string, it will apply unicode normalization to that string.
  • If data is of any other type, it will be returned as is.

(constant) userOwnsMapping

Returns true if the user owns the mapping (i.e. is first creator), false if not.

Methods

annotationCreatorMatches(annotation, uris)

Matches an annotation's creator URI against a list of URIs (e.g. from a user).

Parameters:
NameTypeDescription
annotationobject

a JSKOS annotation

urisarray

array of user URIs

annotationCreatorName(annotation)

Returns the craetor name for an annotation.

Parameters:
NameTypeDescription
annotationobject

a JSKOS annotation

annotationCreatorUri(annotation)

Returns the creator URI for an annotation.

Parameters:
NameTypeDescription
annotationobject

a JSKOS annotation

definition(item, options)

Returns the definition of a JSKOS Item as an array. If there is no definition, an empty array will be returned.

Parameters:
NameTypeDescription
item*
optionsobject

options object:

  • language: preferred language

getLanguages()

Get the preference list either from store or from defaults (fallback)

languageMapContent(item, prop, options)

Returns the content of a language map for a JSKOS Item.

Parameters:
NameTypeDescription
item*

a JSKOS Item

propstring

property of interest in the item

optionsobject

options object:

  • language: preferred language

mappingRegistryIsStored(registry)

Returns whether a mapping registry has stored mappings (true = database) or not (false = recommendations).

Parameters:
NameTypeDescription
registryobject

JSKOS registry

notation(item, type)

Returns the primary notation for a JSKOS Item. If there is no notation, it will return an empty string. Scheme notations will be uppercased.

Parameters:
NameTypeDescription
itemobject

a JSKOS Item

typestring

type of item (optional)

prefLabel(item, options)

Returns the prefLabel of a JSKOS Item. If there is no label, it will return the URI. If there is no URI, it will return an empty string.

Parameters:
NameTypeDescription
item*
optionsobject

options object:

  • fallbackToUri: return URI if no prefLabel can be found (default: true)
  • language: preferred language

selectLanguage(languageMap)

Selects a language tag from a language map or null if no language was found.

Parameters:
NameTypeDescription
languageMapobject

map to select language tag from