jskos-tools. ConceptScheme

Constructor

new ConceptScheme(jskosopt)

Parameters:
NameTypeAttributesDescription
jskosobject<optional>

object that's copied as scheme (shallow copy)

Example
const { ConceptScheme } = require('jskos-tools')
let scheme = new ConceptScheme({
  namespace: "http://example.org/",
  notationPattern: "[0-9]+"
})

Methods

conceptFromNotation(notation, optionsopt)

Map local notation to concept, if notation is valid. Requires scheme to have uriPattern or namespace.

Parameters:
NameTypeAttributesDescription
notationstring
optionsobject<optional>

same as conceptFromUri options

conceptFromUri(uri, optionsopt)

Check whether URI belongs to the scheme, return concept on success. Requires scheme to have uriPattern or namespace.

Parameters:
NameTypeAttributesDescription
uristring
optionsobject<optional>

boolean flags inScheme and toConcept

isValidNotation(notation) → {array|null}

Check whether a string is a valid notation as defined by notationPattern.

Parameters:
NameTypeDescription
notationstring
Returns:
Type: 
array | null

notationFromUri(uri) → {string|undefined}

Check whether URI belongs to the scheme, return local notation on success. Requires scheme to have uriPattern or namespace.

Parameters:
NameTypeDescription
uristring
Returns:
Type: 
string | undefined

uriFromNotation(notation)

Map local notation to URI. Does not check whether notation is valid! Requires scheme to have uriPattern or namespace.

Parameters:
NameTypeDescription
notationstring
Example
scheme.uriFromNotation("123") // http://example.org/123