ruby-rdf / shacl

Implementation of Shapes Constraint Language (SHACL) for RDF.rb
The Unlicense
8 stars 3 forks source link

Flatten closed_results before assignment #4

Closed andyundso closed 7 months ago

andyundso commented 7 months ago

I originally discovered the issue because of the following error messages in one of our tests:

undefined method `conform?' for [(ValidationResult
        (value "Undefiniert")
        (focus <http://example.com/base/rr_20221107093933331>)
        (path <https://www.ica.org/standards/RiC/ontology#type>)
        (shape shacl:RicoRecordResourceWithCategoryShape)
        (resultSeverity shacl:Violation)
        (component shacl:ClosedConstraintComponent)
        (message "closed node has extra property"))
       ]:Array

               next unless results.all?(&:conform?)
                                  ^^^^^
     # /Users/apf/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/shacl-0.4.0/lib/shacl/algebra/or.rb:34:in `all?'

I wondered where this array was coming from and did some deep-dives using the debugger. Since both builtin_results and op_results get flattend, I assume it should be the same for closed_results.

CLAassistant commented 7 months ago

CLA assistant check
All committers have signed the CLA.

gkellogg commented 7 months ago

Thanks, I'll need to dive back into this. Could you consider either adding a test for this, or putting an example that provokes the issue in a comment?

andyundso commented 7 months ago

I added a test. I developed it against your develop branch where I was able to reproduce the issue.

I admit I do not work in general with RDF, so could be that the example can be simplified in order to trigger the issue.

gkellogg commented 7 months ago

This is great, thanks so much for your contribution!