Sha256: 4e5e809b50fa666310525f3ca8317b0e2e367c58ad2dff9ec9983435c176e9d2

Contents?: true

Size: 840 Bytes

Versions: 17

Compression:

Stored size: 840 Bytes

Contents

require 'time'

module SPARQL; module Algebra
  class Operator
    ##
    # The SPARQL logical `now` operator.
    #
    # @example
    #     (prefix ((xsd: <http://www.w3.org/2001/XMLSchema#>))
    #       (ask (filter (= (datatype ?n) xsd:dateTime)
    #         (extend ((?n (now)))
    #           (bgp)))))
    #
    # @see http://www.w3.org/TR/sparql11-query/#func-now
    class Now < Operator::Nullary
      include Evaluatable

      NAME = :now

      ##
      # Returns an XSD dateTime value for the current query execution. All calls to this function in any one query execution must return the same value. The exact moment returned is not specified.
      #
      # @return [RDF::Literal::Double] random value
      def apply
        RDF::Literal(DateTime.now)
      end
    end # Now
  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/now.rb
sparql-1.1.9.1 lib/sparql/algebra/operator/now.rb
sparql-1.99.0 lib/sparql/algebra/operator/now.rb
sparql-1.1.9 lib/sparql/algebra/operator/now.rb
sparql-1.1.8 lib/sparql/algebra/operator/now.rb
sparql-1.1.7 lib/sparql/algebra/operator/now.rb
sparql-1.1.6 lib/sparql/algebra/operator/now.rb
sparql-1.1.5 lib/sparql/algebra/operator/now.rb
sparql-1.1.4 lib/sparql/algebra/operator/now.rb
sparql-1.1.3 lib/sparql/algebra/operator/now.rb
sparql-1.1.2.1 lib/sparql/algebra/operator/now.rb
sparql-1.1.2 lib/sparql/algebra/operator/now.rb
sparql-1.1.1 lib/sparql/algebra/operator/now.rb
sparql-1.1.0 lib/sparql/algebra/operator/now.rb
sparql-1.1.0p0 lib/sparql/algebra/operator/now.rb
sparql-1.0.8 lib/sparql/algebra/operator/now.rb
sparql-1.0.7 lib/sparql/algebra/operator/now.rb