Sha256: 5433fd20b86462ea98500ade24ed49d575c71c62ac816acca058325d66e4e2f9

Contents?: true

Size: 764 Bytes

Versions: 4

Compression:

Stored size: 764 Bytes

Contents

module RDF::N3::Algebra::List
  ##
  # Iff the subject is a list and the object is the first thing that list, then this is true. The object can be calculated as a function of the list.
  #
  # @example
  #     { ( 1 2 3 4 5 6 ) list:first 1 } => { :test1 a :SUCCESS }.
  #
  # The object can be calculated as a function of the list.
  class First < RDF::N3::Algebra::ListOperator
    NAME = :listFirst
    URI = RDF::N3::List.first

    ##
    # Resolves this operator using the given variable `bindings`.
    # If the last operand is a variable, it creates a solution for each element in the list.
    #
    # @param [RDF::N3::List] list
    # @return [RDF::Term]
    # @see RDF::N3::ListOperator#evaluate
    def resolve(list)
      list.first
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rdf-n3-3.3.0 lib/rdf/n3/algebra/list/first.rb
rdf-n3-3.2.1 lib/rdf/n3/algebra/list/first.rb
rdf-n3-3.2.0 lib/rdf/n3/algebra/list/first.rb
rdf-n3-3.1.2 lib/rdf/n3/algebra/list/first.rb