Sha256: 51a54fb5f0f93eb394144c1cf1892258192641843dc65c6d2f33eff97509c067

Contents?: true

Size: 901 Bytes

Versions: 2

Compression:

Stored size: 901 Bytes

Contents

module RDF::N3::Algebra::Str
  ##
  # The subject is a list of strings. The object is calculated as a concatenation of those strings.
  #
  # @example
  #     ("a" "b") string:concatenation :s
  class Concatenation < RDF::N3::Algebra::ListOperator
    NAME = :strConcatenation
    URI = RDF::N3::Str.concatenation

    ##
    # 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}.
    #
    # @param [RDF::N3::List] list
    # @return [RDF::Term]
    # @see RDF::N3::ListOperator#evaluate
    def resolve(list)
      RDF::Literal(
        list.to_a.map do |o|
          SPARQL::Algebra::Expression.cast(RDF::XSD.string, o)
        end.join("")
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rdf-n3-3.2.0 lib/rdf/n3/algebra/str/concatenation.rb
rdf-n3-3.1.2 lib/rdf/n3/algebra/str/concatenation.rb