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
3
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rdf-validate-shacl - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

1

index.js

@@ -22,2 +22,3 @@ const clownface = require('clownface')

this.ns = prepareNamespaces(this.factory)
this.allowNamedNodeInList = options.allowNamedNodeInList === undefined ? false : options.allowNamedNodeInList
this.loadShapes(shapes)

@@ -24,0 +25,0 @@ this.validationEngine = new ValidationEngine(this, options)

2

package.json
{
"name": "rdf-validate-shacl",
"version": "0.4.1",
"version": "0.4.2",
"description": "RDF SHACL validator",

@@ -5,0 +5,0 @@ "main": "index.js",

# rdf-validate-shacl
Validate RDF data purely in JavaScript. An implementation of the [W3C SHACL](https://www.w3.org/TR/shacl/) specification on top of the [RDFJS](https://www.w3.org/TR/shacl/) stack.
Validate RDF data purely in JavaScript. An implementation of the [W3C SHACL](https://www.w3.org/TR/shacl/)
specification on top of the [RDFJS](https://www.w3.org/TR/shacl/) stack.

@@ -68,2 +69,4 @@ [![npm version](https://badge.fury.io/js/rdf-validate-shacl.svg)](https://badge.fury.io/js/rdf-validate-shacl)

stop. By default, it only stops after all the errors are found.
- `allowNamedNodeInList`: SHACL only allows blank nodes in property lists. To
allow named nodes to occur in property lists, set this value to `true`.

@@ -70,0 +73,0 @@ ## Running the tests

@@ -8,14 +8,16 @@ const NodeSet = require('./node-set')

* @param {Clownface} pathNode - Pointer to the start node of the path
* @param {object} ns - Namespaces
* @param {boolean} allowNamedNodeInList - Allow named node in lists. By default, only blank nodes are allowed
* @return Property path object
*/
function extractPropertyPath (pathNode, ns) {
if (pathNode.term.termType === 'NamedNode') {
function extractPropertyPath (pathNode, ns, allowNamedNodeInList) {
if (pathNode.term.termType === 'NamedNode' && !allowNamedNodeInList) {
return pathNode.term
}
if (pathNode.term.termType === 'BlankNode') {
if (pathNode.term.termType === 'BlankNode' || pathNode.term.termType === 'NamedNode') {
const first = pathNode.out(ns.rdf.first).term
if (first) {
const paths = [...pathNode.list()]
return paths.map(path => extractPropertyPath(path, ns))
return paths.map(path => extractPropertyPath(path, ns, allowNamedNodeInList))
}

@@ -26,3 +28,3 @@

const paths = [...alternativePath.list()]
return { or: paths.map(path => extractPropertyPath(path, ns)) }
return { or: paths.map(path => extractPropertyPath(path, ns, allowNamedNodeInList)) }
}

@@ -32,3 +34,3 @@

if (zeroOrMorePath.term) {
return { zeroOrMore: extractPropertyPath(zeroOrMorePath, ns) }
return { zeroOrMore: extractPropertyPath(zeroOrMorePath, ns, allowNamedNodeInList) }
}

@@ -38,3 +40,3 @@

if (oneOrMorePath.term) {
return { oneOrMore: extractPropertyPath(oneOrMorePath, ns) }
return { oneOrMore: extractPropertyPath(oneOrMorePath, ns, allowNamedNodeInList) }
}

@@ -44,3 +46,3 @@

if (zeroOrOnePath.term) {
return { zeroOrOne: extractPropertyPath(zeroOrOnePath, ns) }
return { zeroOrOne: extractPropertyPath(zeroOrOnePath, ns, allowNamedNodeInList) }
}

@@ -50,6 +52,7 @@

if (inversePath.term) {
return { inverse: extractPropertyPath(inversePath, ns) }
return { inverse: extractPropertyPath(inversePath, ns, allowNamedNodeInList) }
}
return pathNode.term
}
throw new Error(`Unsupported SHACL path: ${pathNode.term.value}`)

@@ -56,0 +59,0 @@ }

@@ -250,6 +250,6 @@ // Design:

get pathObject () {
const { $shapes, ns } = this.context
const { $shapes, ns, allowNamedNodeInList } = this.context
if (this._pathObject === undefined) {
this._pathObject = this.path ? extractPropertyPath($shapes.node(this.path), ns) : null
this._pathObject = this.path ? extractPropertyPath($shapes.node(this.path), ns, allowNamedNodeInList) : null
}

@@ -256,0 +256,0 @@

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