Constructor
new ConceptScheme(jskosopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
jskos | object | <optional> | object that's copied as scheme (shallow copy) |
- Source
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:
Name | Type | Attributes | Description |
---|---|---|---|
notation | string | ||
options | object | <optional> | same as conceptFromUri options |
- Source
conceptFromUri(uri, optionsopt)
Check whether URI belongs to the scheme, return concept on success. Requires scheme to have uriPattern
or namespace
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
uri | string | ||
options | object | <optional> | boolean flags |
- Source
isValidNotation(notation) → {array|null}
Check whether a string is a valid notation as defined by notationPattern
.
Parameters:
Name | Type | Description |
---|---|---|
notation | string |
- Source
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:
Name | Type | Description |
---|---|---|
uri | string |
- Source
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:
Name | Type | Description |
---|---|---|
notation | string |
- Source
Example
scheme.uriFromNotation("123") // http://example.org/123