Sha256: 2eefec2b5fef67557268b5826e1c5e3e7e1b86c4ef10491e66eaaf13ac6bafb8
Contents?: true
Size: 1.04 KB
Versions: 18
Compression:
Stored size: 1.04 KB
Contents
module SPARQL; module Algebra class Operator ## # The SPARQL logical `lcase` operator. # # @example # (lcase ?x) # # @see http://www.w3.org/TR/sparql11-query/#func-lcase # @see http://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
18 entries across 18 versions & 1 rubygems