Class: RDF::N3::Algebra::Str::Concatenation

Inherits:
ListOperator
  • Object
show all
Defined in:
lib/rdf/n3/algebra/str/concatenation.rb

Overview

The subject is a list of strings. The object is calculated as a concatenation of those strings.

Examples:

("a" "b") string:concatenation :s

Constant Summary collapse

NAME =
:strConcatenation
URI =
RDF::N3::Str.concatenation

Instance Attribute Summary

Attributes included from Enumerable

#existentials, #universals

Instance Method Summary collapse

Methods inherited from 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

The string:concatenation operator takes a list of terms cast to strings and either binds the result of concatenating them to the output variable, removes a solution that does equal the literal object.

List entries are stringified using SPARQL::Algebra::Expression.cast.

Parameters:

Returns:

See Also:

  • ListOperator#evaluate


19
20
21
22
23
24
25
# File 'lib/rdf/n3/algebra/str/concatenation.rb', line 19

def resolve(list)
  RDF::Literal(
    list.to_a.map do |o|
      SPARQL::Algebra::Expression.cast(RDF::XSD.string, o)
    end.join("")
  )
end