Skip to content

Commit

Permalink
Flatten closed_results before assignment
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
andyundso committed Nov 20, 2023
1 parent fe84295 commit 8d98b8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/shacl/algebra/node_shape.rb
Expand Up @@ -44,7 +44,7 @@ def conforms(node, depth: 0, **options)
resultSeverity: options[:severity],
component: RDF::Vocab::SHACL.ClosedConstraintComponent,
**options)
end.compact
end.flatten.compact
elsif @options[:ignoredProperties]
raise SHACL::Error, "shape has ignoredProperties without being closed"
end
Expand Down

0 comments on commit 8d98b8e

Please sign in to comment.