class SPARQL::Algebra::Operator::TZ

The SPARQL logical `tz` operator.

Returns the timezone part of `arg` as a simple literal. Returns the empty string if there is no timezone.

@example

(prefix ((: <http://example.org/>))
  (project (?s ?x)
    (extend ((?x (tz ?date)))
      (bgp (triple ?s :date ?date)))))

@see www.w3.org/TR/sparql11-query/#func-tz

Constants

NAME

Public Instance Methods

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

Returns the timezone part of arg as a simple literal. Returns the empty string if there is no timezone.

@param [RDF::Literal] operand

the operand

@return [RDF::Literal] @raise [TypeError] if the operand is not a simple literal

# File lib/sparql/algebra/operator/tz.rb, line 27
def apply(operand, **options)
  raise TypeError, "expected an RDF::Literal::DateTime, but got #{operand.inspect}" unless operand.is_a?(RDF::Literal::DateTime)
  operand.tz
end