Class: ShEx::Algebra::Language
- Inherits:
-
Operator::Unary
- Object
- Operator
- Operator::Unary
- ShEx::Algebra::Language
- Defined in:
- lib/shex/algebra/language.rb
Constant Summary collapse
- NAME =
:language
Constants inherited from Operator::Unary
Constants inherited from Operator
Instance Attribute Summary
Attributes inherited from Operator
#id, #logger, #operands, #options, #schema
Instance Method Summary collapse
-
#match?(value, depth: 0) ⇒ Boolean
matches any literal having a language tag that matches value.
Methods inherited from Operator::Unary
Methods inherited from Operator
#base_uri, #closed?, #dup, #each_descendant, #eql?, #expression, #expressions, #find, #focus, #focus=, from_shexj, #initialize, #inspect, #iri, iri, #json_type, #matched, #matched=, #message, #message=, #not_matched, #not_satisfied, #operand, #parent, #parent=, #references, #satisfied, #satisfied=, #satisfy, #semact?, #semantic_actions, #serialize_value, #status, #structure_error, #to_h, #to_json, #to_sxp, #to_sxp_bin, #triple_expression?, #unmatched, #unmatched=, #unsatisfied, #unsatisfied=, #validate!, #value, value
Constructor Details
This class inherits a constructor from ShEx::Algebra::Operator::Unary
Instance Method Details
#match?(value, depth: 0) ⇒ Boolean
matches any literal having a language tag that matches value
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/shex/algebra/language.rb', line 8 def match?(value, depth: 0) status "", depth: depth if case expr = operands.first when RDF::Literal then value.language == expr.to_s.to_sym else false end status "matched #{value}", depth: depth true else status "not matched #{value}", depth: depth false end end |