class SPARQL::Algebra::Operator::LCase

The SPARQL logical `lcase` operator.

@example

(lcase ?x)

@see www.w3.org/TR/sparql11-query/#func-lcase @see www.w3.org/TR/xpath-functions/#func-lcase

Constants

NAME

Public Instance Methods

apply(operand, **options) click to toggle source

The LCASE function corresponds to the XPath fn:lower-case function. It returns a string literal whose lexical form is the lower case of the lexcial form of the argument.

@param [RDF::Literal] operand

the operand

@return [RDF::Literal] literal of same type @raise [TypeError] if the operand is not a literal value

# File lib/sparql/algebra/operator/lcase.rb, line 23
def apply(operand, **options)
  case operand
    when RDF::Literal then RDF::Literal(operand.to_s.downcase, datatype: operand.datatype, language: operand.language)
    else raise TypeError, "expected an RDF::Literal::Numeric, but got #{operand.inspect}"
  end
end