Sha256: 0e4abd5e8afd9036e775ede620263060e9534742e477e44ba2a19fc47a2e8bfb

Contents?: true

Size: 951 Bytes

Versions: 17

Compression:

Stored size: 951 Bytes

Contents

module SPARQL; module Algebra
  class Operator
    ##
    # The SPARQL logical `tz` operator.
    #
    # @example
    #     (prefix ((: <http://example.org/>))
    #       (project (?s ?x)
    #         (extend ((?x (tz ?date)))
    #           (bgp (triple ?s :date ?date)))))
    #
    # @see http://www.w3.org/TR/sparql11-query/#func-tz
    class TZ < Operator::Unary
      include Evaluatable

      NAME = :tz

      ##
      # 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
      def apply(operand)
        raise TypeError, "expected an RDF::Literal::DateTime, but got #{operand.inspect}" unless operand.is_a?(RDF::Literal::DateTime)
        operand.tz
      end
    end # TZ
  end # Operator
end; end # SPARQL::Algebra

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sparql-1.99.1 lib/sparql/algebra/operator/tz.rb
sparql-1.1.9.1 lib/sparql/algebra/operator/tz.rb
sparql-1.99.0 lib/sparql/algebra/operator/tz.rb
sparql-1.1.9 lib/sparql/algebra/operator/tz.rb
sparql-1.1.8 lib/sparql/algebra/operator/tz.rb
sparql-1.1.7 lib/sparql/algebra/operator/tz.rb
sparql-1.1.6 lib/sparql/algebra/operator/tz.rb
sparql-1.1.5 lib/sparql/algebra/operator/tz.rb
sparql-1.1.4 lib/sparql/algebra/operator/tz.rb
sparql-1.1.3 lib/sparql/algebra/operator/tz.rb
sparql-1.1.2.1 lib/sparql/algebra/operator/tz.rb
sparql-1.1.2 lib/sparql/algebra/operator/tz.rb
sparql-1.1.1 lib/sparql/algebra/operator/tz.rb
sparql-1.1.0 lib/sparql/algebra/operator/tz.rb
sparql-1.1.0p0 lib/sparql/algebra/operator/tz.rb
sparql-1.0.8 lib/sparql/algebra/operator/tz.rb
sparql-1.0.7 lib/sparql/algebra/operator/tz.rb