Class: RDF::N3::Algebra::Str::Concatenation
- Inherits:
-
ListOperator
- Object
- SPARQL::Algebra::Operator::Binary
- ListOperator
- RDF::N3::Algebra::Str::Concatenation
- 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.
Constant Summary collapse
Instance Attribute Summary
Attributes included from Enumerable
Instance Method Summary collapse
-
#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.
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](ruby-rdf.github.io/sparql/SPARQL/Algebra/Expression#cast-class_method).
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 |