Class: ShEx::Algebra::SemAct
- Defined in:
- lib/shex/algebra/semact.rb
Constant Summary collapse
- NAME =
:semact
Constants inherited from Operator
Instance Attribute Summary
Attributes inherited from Operator
Instance Method Summary collapse
-
#satisfies?(statements) ⇒ Boolean
The evaluation semActsSatisfied on a list of SemActs returns success or failure.
-
#semact? ⇒ Boolean
Does This operator is SemAct.
Methods inherited from Operator
#closed?, #each_descendant, #eql?, #first_ancestor, #initialize, #inspect, #not_matched, #not_satisfied, #operand, #parent, #parent=, #satisfiable?, #semantic_actions, #status, #structure_error, #to_sxp, #to_sxp_bin, #triple_expression?, #validate!
Constructor Details
This class inherits a constructor from ShEx::Algebra::Operator
Instance Method Details
#satisfies?(statements) ⇒ Boolean
The evaluation semActsSatisfied on a list of SemActs returns success or failure. The evaluation of an individual SemAct is implementation-dependent.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/shex/algebra/semact.rb', line 11 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 |
#semact? ⇒ Boolean
Does This operator is SemAct
36 |
# File 'lib/shex/algebra/semact.rb', line 36 def semact?; true; end |