New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rdf-validate-shacl

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rdf-validate-shacl

RDF SHACL validator

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3K
increased by3.62%
Maintainers
1
Weekly downloads
 
Created
Source

rdf-validate-shacl

RDF/JS SHACL validator

Build Status

Usage

Create a new SHACL validator and load data and shapes to trigger the validation.

The validation function returns a ValidationReport object that can be used to inspect conformance and results.

const validator = new SHACLValidator(shapesDataset)
const report = await validator.validate(dataDataset)

// Check conformance: `true` or `false`
console.log(report.conforms)

for (const result of report.results) {
  // See https://www.w3.org/TR/shacl/#results-validation-result for details
  // about each method
  console.log(result.message)
  console.log(result.path)
  console.log(result.focusNode)
  console.log(result.severity)
  console.log(result.sourceConstraintComponent)
  console.log(result.sourceShape)
}

Validator options

The SHACLValidator constructor accepts an optional options object as second parameter. The available options are:

  • factory: RDF/JS data factory (must have a .dataset() method)
  • maxErrors: max number of errors after which the validation process should stop. By default, it only stops after all the errors are found.

Running the tests

$ npm test

Regenerating vocabularies

The SHACL vocabulary is imported from @zazuko/rdf-vocabularies and pre-parsed in src/vocabularies/shacl.js.

After updating the @zazuko/rdf-vocabularies dependency, run npm run generate-vocabularies to regenerate the pre-parsed vocabulary.

About

rdf-validate-shacl was originally a fork of shacl-js meant to make it compatible with RDF/JS libraries. Since then, we dropped support for the SHACL-JS extension and adapted the API to suit our needs.

Keywords

FAQs

Package last updated on 01 Apr 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc