JSKOS Tools.

Classes

ConceptScheme

Members

(static, constant) exports.addContext

Add @context URI to a JSKOS resource or to an array of JSKOS resources.

(static, constant) exports.clean

Recursively cleans JSKOS object by removing properties starting with _ or containing only uppercase letters. Warning: Works directly on the object without creating a copy!

(static, constant) exports.compare

Compares two objects based on their URIs, using getAllUris.

(static, constant) exports.conceptsOfMapping

Returns a list of concepts for a mapping.

(static, constant) exports.copyDeep

Creates a deep copy of a JSKOS object, replacing possibly circular structures with open world [null] statements. All properties starting with an underscore (_) will be ignored.

(static, constant) exports.defaultMappingType

(static, constant) exports.flattenMapping

(static, constant) exports.getAllUris

Returns all possible URIs for a JSKOS object. Takes into consideration both the uri and identifier properties.

(static, constant) exports.isConcept

Checks whether JSKOS object is a concept based on type property.

(static, constant) exports.isContainedIn

Checks whether an object is contained in a list of objects using compare.

(static, constant) exports.isScheme

Checks whether JSKOS object is a concept scheme based on type property.

(static, constant) exports.mappingCSV

Returns an object of preconfigured conversion functions to convert mappings into CSV.

(static, constant) exports.mappingTypeByType

(static, constant) exports.mappingTypeByUri

(static, constant) exports.matchObjectTypes

Checks if two objects have a matching object type. Returns false only if types for both objects could be guessed and they did not match.

(static, constant) exports.merge

Merges two JSKOS objects. Object properties will be merged deeply. Array properties will be combined (and URIs will be used for comparison if it's an array of objects).

The options property allows for different options:

  • mergeUris (boolean, default false) - appends b's URI to the result's identifier property if necessary, removes a's URI from the result's identifier property if necessary (useful for merging ConceptSchemes)
  • detectMismatch (array of strings, default []) - throws an error if the value at a certain path does not match between the two objects (allows for deep properties, e.g. prefLabel.de)
  • skipPaths (array of strings, default []) - provide paths to completely skip when merging

(static, constant) exports.mergeUris

Merge URIs of two objects a and b into a by adding/removing URIs from identifier property.

(static, constant) exports.minifyMapping

(static, constant) exports.objectTypes

JSKOS Concept Types indexed by primary name.

(static, constant) exports.sortConcepts

Sorts a list of concepts by their notation, then URI.

(static, constant) exports.sortSchemes

Sorts a list of schemes by their prefLabel (German or English), then notation, then URI.

Methods

(static) csvSerializer()

Returns a function to serialize an array as CSV row as configured. See CSV Dialect (https://frictionlessdata.io/specs/csv-dialect/).

(static) exports.addMappingIdentifiers()

(static) exports.compareMappingMembers()

(static) exports.compareMappings()

(static) exports.compareMappingsDeep()

Compare two mappings based on their properties. Concept sets and schemes are compared by URI.

(static) exports.guessObjectType(jskos|name|uri, shortname)

Guess the JSKOS Concept Type name from an object or name.

Parameters:
NameTypeDescription
jskos|name|uriobject | string

object or string to guess from

shortnameboolean

return short name if enabled (false by default)

(static) exports.mappingContentIdentifier()

Returns a mapping content identifier. The identifier starts with urn:jskos:mapping:content: and takes concepts and type into consideration. It uses the mappingContent function to get relevant properties from the mapping.

(static) exports.mappingMembersIdentifier()