class RDF::N3::Algebra::Str::Matches
The subject is a string; the object is is a regular expression in the perl, python style. It is true iff the string matches the regexp.
Constants
- NAME
- URI
Public Instance Methods
apply(left, right)
click to toggle source
Tre if right, treated as a regular expression, matches left
@param [RDF::Literal] left
a simple literal
@param [RDF::Literal] right
a simple literal
@return [RDF::Literal::Boolean] ‘true` or `false` @see www.w3.org/TR/xpath-functions/#regex-syntax
# File lib/rdf/n3/algebra/str/matches.rb, line 33 def apply(left, right) RDF::Literal(Regexp.new(right.to_s).match?(left.to_s)) end
input_operand()
click to toggle source
Neither subect nor object are considered inputs, and must be resolved before evaluation.
# File lib/rdf/n3/algebra/str/matches.rb, line 20 def input_operand RDF::N3::List.new end
resolve(resource, position:)
click to toggle source
Resolves inputs as strings.
@param [RDF::Term] resource @param [:subject, :object] position @return [RDF::Literal] @see RDF::N3::ResourceOperator#evaluate
# File lib/rdf/n3/algebra/str/matches.rb, line 15 def resolve(resource, position:) resource if resource.literal? end