Sha256: 76788706cf53043a0b6ac04148054a6f574bb7e9b031c962868f83ad30d52671
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
module ShEx::Algebra ## class SemAct < Operator NAME = :semact # # The evaluation semActsSatisfied on a list of SemActs returns success or failure. The evaluation of an individual SemAct is implementation-dependent. # @param [Array<RDF::Statement>] statements # @return [Boolean] `true` if satisfied, `false` if it does not apply # @raise [ShEx::NotSatisfied] if not satisfied def satisfies?(statements) # FIXME: should have a registry case operands.first.to_s when "http://shex.io/extensions/Test/" str = if md = /^ *(fail|print) *\( *(?:(\"(?:[^\\"]|\\")*\")|([spo])) *\) *$/.match(operands[1].to_s) md[2] || case md[3] when 's' then statements.first.subject when 'p' then statements.first.predicate when 'o' then statements.first.object else statements.first.to_sxp end.to_s else statements.empty? ? 'no statement' : statements.first.to_sxp end $stdout.puts str status str not_satisfied "fail" if md && md[1] == 'fail' true else status("unknown SemAct name #{operands.first}") {"expression: #{self.to_sxp}"} false end end # Does This operator is SemAct def semact?; true; end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shex-0.2.0 | lib/shex/algebra/semact.rb |
shex-0.1.0 | lib/shex/algebra/semact.rb |