class RDF::N3::Algebra::Log::OutputString

The subject is a key and the object is a string, where the strings are to be output in the order of the keys.

Constants

NAME
URI

Public Instance Methods

apply(term1, term2) click to toggle source

Returns ‘term2`, but adds `term2` as an output keyed on `term1`.

@param [RDF::Term] term1

an RDF term

@param [RDF::Term] term2

an RDF term

@return [RDF::Literal::Boolean] ‘true` or `false` @raise [TypeError] if either operand is not an RDF term or operands are not comperable

@see RDF::Term#==

# File lib/rdf/n3/algebra/log/output_string.rb, line 30
def apply(term1, term2)
  (@options[:strings][term1.to_s] ||= []) << term2.to_s
  term2
end
input_operand() click to toggle source

Both subject and object are inputs.

# File lib/rdf/n3/algebra/log/output_string.rb, line 36
def input_operand
  RDF::N3::List.new(values: operands)
end
resolve(resource, position:) click to toggle source

Resolves inputs as strings.

@param [RDF::Term] resource @param [:subject, :object] position @return [RDF::Term] @see RDF::N3::ResourceOperator#evaluate

# File lib/rdf/n3/algebra/log/output_string.rb, line 15
def resolve(resource, position:)
  SPARQL::Algebra::Expression.cast(RDF::XSD.string, resource) if resource.term?
end