Sha256: 6247a69d22eb279dc7030d17bd92d0d2c39c3bb3490e9403bfa5cc3f37a99f1f

Contents?: true

Size: 1012 Bytes

Versions: 2

Compression:

Stored size: 1012 Bytes

Contents

module SPARQL; module Algebra
  class Operator
    ##
    # The SPARQL ascending sort operator.
    #
    # @example
    #   (prefix ((foaf: <http://xmlns.com/foaf/0.1/>))
    #     (project (?name)
    #       (order ((asc ?name))
    #         (bgp (triple ?x foaf:name ?name)))))
    #
    # @see http://www.w3.org/TR/rdf-sparql-query/#func-isLiteral
    class Asc < Operator::Unary
      include Evaluatable

      NAME = :asc

      ##
      # Returns the evaluation of its operand. Default comparison is in
      # ascending order. Ordering is applied in {Order}.
      #
      # @param  [RDF::Query::Solution] bindings
      #   a query solution containing zero or more variable bindings
      # @param [Hash{Symbol => Object}] options ({})
      #   options passed from query
      # @return [RDF::Term]
      def evaluate(bindings, options = {})
        operand(0).evaluate(bindings, options.merge(:depth => options[:depth].to_i + 1))
      end
    end # Asc
  end # Operator
end; end # SPARQL::Algebra

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sparql-1.1.5 lib/sparql/algebra/operator/asc.rb
sparql-1.1.4 lib/sparql/algebra/operator/asc.rb