npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

barnard59-validate-shacl

v0.3.8

Published

A barnard59 step that validates RDF using the Shapes Constraint Language (SHACL).

Downloads

122

Readme

barnard59-validate-shacl

A barnard59 step that validates RDF using the Shapes Constraint Language (SHACL).

Install

npm install barnard59-validate-shacl --save

Exported steps

validate

Validates a chunk of RDF against a set of conditions specified in a SHACL graph.

The argument is a RDF stream containing the SHACL shapes.

prefix : <https://pipeline.described.at/>
prefix code: <https://code.described.at/>

<#shaclValidate> a :Step ;
  code:implementedBy
    [
      a code:EcmaScriptModule ;
      code:link <node:barnard59-validate-shacl/validate.js#shacl>
    ] ;
  code:arguments ( <#CubeShapes> ) ;
.

Note that this operation does not take care of partitioning the data, using this operation requires to prepare the data accordingly.

To pass additional options, initialize the step with named arguments instead. All except shape are optional.

prefix : <https://pipeline.described.at/>
prefix code: <https://code.described.at/>

<#shaclValidate> a :Step ;
  code:implementedBy
    [
      a code:EcmaScriptModule ;
      code:link <node:barnard59-validate-shacl/validate.js#shacl>
    ] ;
  code:arguments
    [ code:name "shape" ; code:value <#CubeShapes> ] ,
    # validation will stop when the given number is reached (default 1)
    # set to 0 to report all errors    
    [ code:name "maxErrors" ; code:value 100 ] ,
    # callback function which allows pipeline authors to perform
    # additional actions and/or decide to continue the pipeline 
    # when SHACL violations are encountered (see below)
    [ 
      code:name "onViolation" ; 
      code:value [ a code:EcmaScriptModule ; code:link <file:...> ] ;
    ] ;
.

onViolation

The function below could be used to continue the pipeline when SHACL violations are found but none of them are sh:Violation.

import { sh } from '@tpluscode/rdf-ns-builders'

/**
* @param context {Object} Pipeline context
* @param data {DatasetCore} Data graph which failed validation
* @param report {ValidationReport}
*/
export function continueOnWarnings({ context, data, report }) {
    const hasViolations = report.results.some(({ severity }) => severity.equals(sh.Violation))

    return !hasViolations
}