module ShEx::Algebra ## class OneOf < Operator include TripleExpression NAME = :oneOf ## # `expr` is a OneOf and there is some shape expression `se2` in shapeExprs such that a `matches(T, se2, m)`... # # @param [Array] statements # @return [Array e status "not matched: #{e.message}" op = op.dup op.unmatched = statements - results unsatisfied << op false end end break unless matched_something num_iters += 1 status "matched #{results.length} statements after #{num_iters} iterations" end # Max violations handled in Shape if num_iters < minimum raise ShEx::NotMatched, "Minimum Cardinality Violation: #{results.length} < #{minimum}" end # Last, evaluate semantic acts semantic_actions.all? do |op| op.satisfies?(results) end unless results.empty? satisfy matched: results, satisfied: satisfied, unsatisfied: unsatisfied rescue ShEx::NotMatched, ShEx::NotSatisfied => e not_matched e.message, matched: results, unmatched: (statements - results), satisfied: satisfied, unsatisfied: unsatisfied end end end