Skip to content

JS iterable error when using SHACL model #73

@LaurensRietveld

Description

@LaurensRietveld

Depending on the structure of your SHACL shape and its list definitions, you may get obscure errors such as this:

Message:
   listNode.list is not a function or its return value is not iterable

Stacktrace:
   at rdfListToArray                 rdf-validate-shacl/src/dataset-utils.js:91            return [...listNode.list()].map(({ term }) => term)                             
   at validateClosed                 rdf-validate-shacl/src/validators.js:43               allowed.addAll(rdfListToArray(context.$shapes.node(ignoredPropertiesNode)))     
   at execute                        rdf-validate-shacl/src/validation-function.js:11      return this.func.apply(globalObject, [this.context, focusNode, valueNode, const…
   at validateNodeAgainstConstraint  rdf-validate-shacl/src/validation-engine.js:217       const obj = validationFunction.execute(focusNode, valueNode, constraint)        
   at validateNodeAgainstShape       rdf-validate-shacl/src/validation-engine.js:177       if (this.validateNodeAgainstConstraint(focusNode, valueNodes, constraint, dataG…
   at validateAll                    rdf-validate-shacl/src/validation-engine.js:154       if (this.validateNodeAgainstShape(focusNode, shape, dataGraph)) {               
   at validate                       rdf-validate-shacl/index.js:36                        this.validationEngine.validateAll(this.$data)                         

This seems to be caused by the clownface list() implementation returning null instead of an iterable (see here

I would have expected no error, or a more informative error instead.

Let me know if you need an MWE, and I'll see whether I can add the M to my WE

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions