Closed giacomociti closed 2 months ago
Latest commit: f732f93478c88fe3f42afae31835a85fb22ea1ff
The changes in this PR will be included in the next version bump.
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
added a commit to also address #131 because the information in the rdfs:comment
and in sh:resultMessage
is complementary
@giacomociti FYI this PR may have a regression which occurs for some cubes while not for others - can you reproduce?
repro:
npx barnard59 cube fetch-metadata --endpoint https://ld.admin.ch/query --cube https://environment.ld.admin.ch/foen/ubd0066/12 | npx barnard59 cube check-metadata --profile ./validation/profile-visualize.ttl
msg:
TypeError: Cannot read properties of undefined (reading 'size')
at inListSize (file:///tmp/test/node_modules/rdf-validate-shacl/src/dataset-utils.js:43:33)
at extractSourceShapeStructure (file:///tmp/test/node_modules/rdf-validate-shacl/src/dataset-utils.js:48:41)
at extractSourceShapeStructure.next (<anonymous>)
at ValidationEngine.copySourceShapeStructure (file:///tmp/test/node_modules/rdf-validate-shacl/src/validation-engine.js:271:16)
at ValidationEngine.createResult (file:///tmp/test/node_modules/rdf-validate-shacl/src/validation-engine.js:244:10)
at ValidationEngine.createResultFromObject (file:///tmp/test/node_modules/rdf-validate-shacl/src/validation-engine.js:181:25)
at file:///tmp/test/node_modules/rdf-validate-shacl/src/validation-engine.js:131:37
at Array.map (<anonymous>)
at ValidationEngine.validateValueNodeAgainstConstraint (file:///tmp/test/node_modules/rdf-validate-shacl/src/validation-engine.js:131:8)
at ValidationEngine.validateNodeAgainstConstraint (file:///tmp/test/node_modules/rdf-validate-shacl/src/validation-engine.js:119:19)
nb: some more repro cases
npx barnard59 cube fetch-metadata --endpoint https://ld.admin.ch/query --cube https://environment.ld.admin.ch/foen/EFV_cofog_international/2 | npx barnard59 cube check-metadata --profile ./validation/profile-visualize.ttl
npx barnard59 cube fetch-metadata --endpoint https://ld.admin.ch/query --cube https://environment.ld.admin.ch/foen/nfi/nfi_C-1029/cube/2023-3 | npx barnard59 cube check-metadata --profile ./validation/profile-visualize.ttl
npx barnard59 cube fetch-metadata --endpoint https://int.ld.admin.ch/query --cube https://agriculture.ld.admin.ch/foag/cube/Eggs/Consumption_Price_Month | npx barnard59 cube check-metadata --profile ./validation/profile-visualize.ttl
npx barnard59 cube fetch-metadata --endpoint https://int.ld.admin.ch/query --cube https://health.ld.admin.ch/fsvo/gefahrFRESIL/7 | npx barnard59 cube check-metadata --profile ./validation/profile-visualize.ttl
...
Nice catch @Rdataflow : the list of values allowed by sh:in
is collected lazily; in your case, it was needed in the report shape but not initialized yet because not needed during validation.
I managed to fix the issue, also introducing a non-regression test. But I'm not super-happy with the design: the list initialization is now within the Constraint
class, but it is a feature specific for the sh:in
constraint. Maybe @tpluscode can suggest an improvement
@giacomociti thanks for your fix - confirm it works here :+1:
Maybe @tpluscode can suggest an improvement
Not without diving deeper. I suggest we create a ticket to improve in the future and roll with what we have now
should address #109 . Result messages include the first (three) elements of lists