Class: SHACL::Algebra::Or
- Defined in:
- lib/shacl/algebra/or.rb
Constant Summary collapse
- NAME =
:or
Constants inherited from Operator
SHACL::Algebra::Operator::ALL_KEYS
Instance Attribute Summary
Attributes inherited from Operator
Instance Method Summary collapse
-
#conforms(node, path: nil, depth: 0, **options) ⇒ Array<SHACL::ValidationResult>
Specifies the condition that each value node conforms to at least one of the provided shapes.
Methods inherited from Operator
apply_op, #comment, #deactivated?, from_expanded_value, from_json, #id, iri, #iri, #label, #not_satisfied, parse_path, #satisfy, to_rdf, #to_sxp_bin, #type
Instance Method Details
#conforms(node, path: nil, depth: 0, **options) ⇒ Array<SHACL::ValidationResult>
Specifies the condition that each value node conforms to at least one of the provided shapes. This is comparable to disjunction and the logical “or” operator.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/shacl/algebra/or.rb', line 27 def conforms(node, path: nil, depth: 0, **) log_debug(NAME, depth: depth) {SXP::Generator.string({node: node}.to_sxp_bin)} operands.each do |op| results = op.conforms(node, depth: depth + 1, **) next unless results.all?(&:conform?) return satisfy(focus: node, path: path, value: node, message: "node conforms to some shape", component: RDF::Vocab::SHACL.OrConstraintComponent, depth: depth, **) end return not_satisfied(focus: node, path: path, value: node, message: "node does not conform to any shape", resultSeverity: .fetch(:severity), component: RDF::Vocab::SHACL.OrConstraintComponent, depth: depth, **) end |