Class: RDF::N3::Algebra::Log::OutputString
- Inherits:
-
ResourceOperator
- Object
- SPARQL::Algebra::Operator::Binary
- ResourceOperator
- RDF::N3::Algebra::Log::OutputString
- Defined in:
- lib/rdf/n3/algebra/log/output_string.rb
Overview
The subject is a key and the object is a string, where the strings are to be output in the order of the keys.
Constant Summary collapse
- NAME =
:logOutputString- URI =
RDF::N3::Log.outputString
Instance Attribute Summary
Attributes included from Enumerable
Instance Method Summary collapse
-
#apply(term1, term2) ⇒ RDF::Literal::Boolean
Returns
term2, but addsterm2as an output keyed onterm1. -
#input_operand ⇒ Object
Both subject and object are inputs.
-
#resolve(resource, position:) ⇒ RDF::Term
Resolves inputs as strings.
Methods inherited from ResourceOperator
#as_literal, #execute, #valid?
Methods included from Builtin
#each, #evaluate, #hash, #rank, #to_uri
Instance Method Details
#apply(term1, term2) ⇒ RDF::Literal::Boolean
Returns term2, but adds term2 as an output keyed on term1.
30 31 32 33 |
# File 'lib/rdf/n3/algebra/log/output_string.rb', line 30 def apply(term1, term2) ([:strings][term1.to_s] ||= []) << term2.to_s term2 end |
#input_operand ⇒ Object
Both subject and object are inputs.
36 37 38 |
# File 'lib/rdf/n3/algebra/log/output_string.rb', line 36 def input_operand RDF::N3::List.new(values: operands) end |
#resolve(resource, position:) ⇒ RDF::Term
Resolves inputs as strings.
15 16 17 |
# 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 |