zazuko / rdf-validate-shacl

Validate RDF data purely in JavaScript. An implementation of the W3C SHACL specification on top of the RDFJS stack.
MIT License
95 stars 12 forks source link

perf: reuse sh:in nodeSet #130

Closed giacomociti closed 2 months ago

giacomociti commented 2 months ago

This change boosts validation of sh:in constraints with long lists of allowed values.

The existing implementation recreates the set of allowed nodes again and again, for each value to be validated. With the proposed change, the node set is created only once.

To appreciate the performance gain, you may try a shapes graph like this, having a constraint with a huge list of municipalities. Try to validate a few observations

(remember to add the target declaration in the shapes graph):


<https://energy.ld.admin.ch/elcom/electricityprice/shape> <http://www.w3.org/ns/shacl#targetClass> <https://cube.link/Observation>  . ```
changeset-bot[bot] commented 2 months ago

🦋 Changeset detected

Latest commit: 1329680589c6467cbc0d4d06b0123d2ed7965b65

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------------------ | ----- | | rdf-validate-shacl | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR