Sha256: 648e30dbdc74e9fcd61d355f571dae9f004a79c0b8ed3d598ca0cbc371a8ac5d
Contents?: true
Size: 829 Bytes
Versions: 11
Compression:
Stored size: 829 Bytes
Contents
module SPARQL; module Algebra class Operator ## # The SPARQL `lang` operator. # # @see http://www.w3.org/TR/sparql11-query/#func-lang class Lang < Operator::Unary include Evaluatable NAME = :lang ## # Returns the language tag of the operand, if it has one. # # If the operand has no language tag, returns `""`. # # @param [RDF::Literal] literal # a literal # @return [RDF::Literal] a simple literal # @raise [TypeError] if the operand is not a literal def apply(literal) case literal when RDF::Literal then RDF::Literal(literal.language.to_s) else raise TypeError, "expected an RDF::Literal, but got #{literal.inspect}" end end end # Lang end # Operator end; end # SPARQL::Algebra
Version data entries
11 entries across 11 versions & 1 rubygems