Class: RDF::N3::Algebra::List::Length

Inherits:
RDF::N3::Algebra::ListOperator show all
Defined in:
lib/rdf/n3/algebra/list/length.rb

Overview

Iff the subject is a list and the object is the last thing that list, then this is true. The object can be calculated as a function of the list.

The object can be calculated as a function of the list.

Examples:

{ ( 1 2 3 4 5 6 ) list:length 6 } => { :test1 a :SUCCESS }.

Constant Summary collapse

NAME =
:listLength
URI =
RDF::N3::List.length

Instance Attribute Summary

Attributes included from Enumerable

#existentials, #universals

Instance Method Summary collapse

Methods inherited from RDF::N3::Algebra::ListOperator

#as_literal, #execute, #input_operand, #validate

Methods included from Builtin

#each, #evaluate, #hash, #input_operand, #rank, #to_uri

Instance Method Details

#resolve(list) ⇒ RDF::Term

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.

Parameters:

Returns:

See Also:

  • ListOperator#evaluate


20
21
22
# File 'lib/rdf/n3/algebra/list/length.rb', line 20

def resolve(list)
  RDF::Literal(list.length)
end