Sha256: 68a74ac339dd8b6e0902a4c347b4c63f50807c0c2f53860bd5f0ea64a21c9688
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
module SPARQL; module Algebra class Operator ## # The SPARQL logical `lcase` operator. # # @example # (lcase ?x) # # @see https://www.w3.org/TR/sparql11-query/#func-lcase # @see https://www.w3.org/TR/xpath-functions/#func-lcase class LCase < Operator::Unary include Evaluatable NAME = :lcase ## # 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 def apply(operand) 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 end # LCase end # Operator end; end # SPARQL::Algebra
Version data entries
5 entries across 5 versions & 1 rubygems