Socket
Socket
Sign inDemoInstall

jskos-tools

Package Overview
Dependencies
9
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jskos-tools

Tools for working with the JSKOS data format.


Version published
Weekly downloads
13
decreased by-53.57%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

JSKOS Tools (jskos-tools)

Build Status standard-readme compliant

Tools for working with the JSKOS data format.

This repository contains tools for working with the JSKOS data format for knowledge organization systems.

Table of Contents

Install

npm i jskos-tools

Usage

const jskos = require("jskos-tools")

Validation

validate
let concept = {
  ...
}

jskos.validate.concept(concept) // returns true or false
// or jskos.validate.scheme(scheme)
// or jskos.validate.mapping(mapping)
// ...

Directory bin also contains a command line script for validation.

Mapping Identifiers

let mapping = {
  ...
}
mappingContentIdentifier

mappingContentIdentifier 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.

let contentIdentifier = jskos.mappingContentIdentifier(mapping)
mappingMembersIdentifier

mappingMembersIdentifier starts with urn:jskos:mapping:members: and only takes concepts into consideration. It uses the mappingMembers function to get relevant properties from the mapping.

let membersIdentifier = jskos.mappingMembersIdentifier(mapping)
addMappingIdentifiers

addMappingIdentifiers creates a new mapping with property "identifiers", containing mappingContentIdentifier and mappingMembersIdentifier.

let mappingWithIdentifiers = jskos.addMappingIdentifiers(mapping)

Tools

clean

Removes properties starting with _ or containing only uppercase letters from a JSKOS object.

jskos.clean(object)

Aliases: cleanJSKOS

copyDeep

Creates a deep copy of a JSKOS object, replacing possibly circular structures with open world [null] statements.

jskos.copyDeep(object)

Aliases: deepCopy

getAllUris

Returns all possible URIs for a JSKOS object. Takes into consideration both the uri and identifier properties, as well as different variants of those identifiers.

jskos.getAllUris(object)
compare

Compares two objects based on their URIs, using getAllUris.

jskos.compare(object1, object2)

Aliases: compareObjects, compareSchemes, compareConcepts

isConcept

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

jskos.isConcept(object)
isScheme

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

jskos.isScheme(object)
isContainedIn

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

jskos.isContainedIn(object, listOfObjects)

Aliases: isSchemeInList

sortConcepts

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

jskos.sortConcepts(concepts)
sortSchemes

Sorts a list of schemes by their German prefLabel, then URI. Returns a copy of the list.

jskos.sortSchemes(schemes)
minifyMapping

Removes unnecessary properties from mapping before export or saving. In particular, all properties except for to, from, toScheme, fromScheme, type, and creator on the mapping will be removed, and all properties except for uri and notation on concepts and schemes will be removed.

let newMapping = jskos.minifyMapping(mapping)

Build

git clone --recursive https://github.com/gbv/jskos-tools.git
cd jskos-tools/
npm install

Test

npm test

Maintainers

Contribute

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2018 Verbundzentrale des GBV (VZG)

FAQs

Last updated on 21 Aug 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc