Sha256: df78cbf0bb4a5f6df36b11459282b1f39efd8ea39971aad506103d1611ae079a

Contents?: true

Size: 996 Bytes

Versions: 1

Compression:

Stored size: 996 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/sparql11-query/#modOrderBy
    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, depth: options[:depth].to_i + 1, **options)
      end
    end # Asc
  end # Operator
end; end # SPARQL::Algebra

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sparql-3.1.0 lib/sparql/algebra/operator/asc.rb