Sha256: f78838797e260bbfd061e9346a24708938ecd46deff7245a34a3e126730e18d1
Contents?: true
Size: 830 Bytes
Versions: 5
Compression:
Stored size: 830 Bytes
Contents
module SPARQL; module Algebra class Operator ## # The SPARQL `lang` operator. # # @see https://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
5 entries across 5 versions & 1 rubygems