lib/ld/patch/algebra/reverse.rb
##
# Executes this upate on the given `writable` graph or repository.
#
# @param  [RDF::Queryable] queryable
#   the graph or repository to write
# @param  [Hash{Symbol => Object}] options
#   any additional options
# @option options [Array<RDF::Term>] starting terms
# @return [RDF::Query::Solutions] solutions with `:term` mapping
Executes this upate on the given `writable` graph or repository.
Executes this upate on the given ` writable ` graph or repository .
def execute(queryable, options = {})
      debug(options) {"Reverse"}
      op = operand(0)
      terms = Array(options.fetch(:terms))
      results = terms.map do |object|
        queryable.query({object: object, predicate: op}).map(&:subject)
      end.flatten
      RDF::Query::Solutions.new(results.map {|t| RDF::Query::Solution.new(path: t)})
    end
def execute ( queryable , options = { } ) debug ( options ) { "Reverse" } op = operand ( 0 ) terms = Array ( options . fetch ( :terms ) ) results = terms . map do | object | queryable . query ( { object : object , predicate : op } ) . map ( & :subject ) end . flatten RDF :: Query :: Solutions . new ( results . map { | t | RDF :: Query :: Solution . new ( path : t ) } ) end
Executes this upate on the given `writable` graph or repository.
Executes this upate on the given ` writable ` graph or repository .
solutions with `:term` mapping
solutions with ` : term ` mapping
RDF::Query::Solutions
queryable
<not_specific>
options
None
<not_specific>
options any additional options
options any additional options