From 8d98b8ecf981f2b9a79327aa281612bfe5cf1837 Mon Sep 17 00:00:00 2001 From: Andy Pfister Date: Mon, 20 Nov 2023 15:25:56 +0100 Subject: [PATCH] Flatten closed_results before assignment I originally discovered the issue because of the following error messages in one of our tests: ``` undefined method `conform?' for [(ValidationResult (value "Undefiniert") (focus ) (path ) (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`. --- lib/shacl/algebra/node_shape.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/shacl/algebra/node_shape.rb b/lib/shacl/algebra/node_shape.rb index a144993..89c5d5f 100644 --- a/lib/shacl/algebra/node_shape.rb +++ b/lib/shacl/algebra/node_shape.rb @@ -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