Copyright © 2011-2014 Zuse Institute Berlin
Version: $Id$
Authors: Jan Fajerski (fajerski@zib.de).
API functions for the Map-Reduce system
The Map-Reduce system will snapshot the database and apply the the supplied job to that data. Since snapshots work on the overlay level only the hashed keys are available. Since hashed keys are not useful in this context, the MR system will only considers values of the following structure as inputs:{Key::string(), Value::term()} or {Tag::atom(), Key:string(), Value::term()}
Either all 2-tuples are considered to be input or, if
{tag, some_tag}
is found in the options list, all 3-tuples with some_tag
as the first element are.
Map = fun({_Key, Line}) -> Tokens = string:tokens(Line, " \n,.;:?!()\"'-_"), [{string:to_lower(X),1} || X <- Tokens] end, Reduce = fun(KVList) -> lists:map(fun({K, V}) -> {K, lists:sum(V)} end, KVList) end, api_mr:start_job({[{map, erlanon, Map}, {reduce, erlanon, Reduce}], []}).It considers all
{string(), string()}
as input and returns the word count of all
values.
start_job/1 | synchronous call to start a map reduce job. |
start_job(Job :: mr_state:job_description()) -> [any()]
synchronous call to start a map reduce job. it will return the results of the job.
Generated by EDoc, Feb 29 2016, 16:16:19.