Sha256: e5e88f570085e69771d56dc610f0ae87d486f0033835abead3aa7120e66fcd0e

Contents?: true

Size: 1.02 KB

Versions: 11

Compression:

Stored size: 1.02 KB

Contents

require 'time'

module SPARQL; module Algebra
  class Operator
    ##
    # The SPARQL logical `now` operator.
    #
    # 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.
    #
    # @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

11 entries across 11 versions & 1 rubygems

Version Path
sparql-3.1.0 lib/sparql/algebra/operator/now.rb
sparql-3.0.2 lib/sparql/algebra/operator/now.rb
sparql-3.0.1 lib/sparql/algebra/operator/now.rb
sparql-3.0.0 lib/sparql/algebra/operator/now.rb
sparql-2.2.2 lib/sparql/algebra/operator/now.rb
sparql-2.2.1 lib/sparql/algebra/operator/now.rb
sparql-2.2.0 lib/sparql/algebra/operator/now.rb
sparql-2.1.0 lib/sparql/algebra/operator/now.rb
sparql-2.0.0 lib/sparql/algebra/operator/now.rb
sparql-2.0.0.beta2 lib/sparql/algebra/operator/now.rb
sparql-2.0.0.beta1 lib/sparql/algebra/operator/now.rb