Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flatten closed_results before assignment #4

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

andyundso
Copy link
Contributor

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.

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
Copy link

CLAassistant commented Nov 20, 2023

CLA assistant check
All committers have signed the CLA.

@gkellogg
Copy link
Member

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
Copy link
Contributor Author

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
Copy link
Member

This is great, thanks so much for your contribution!

@gkellogg gkellogg merged commit 0f5bd08 into ruby-rdf:develop Nov 21, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants