Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [smila-user] SMILA vs Human Computing


From: smila-user-bounces@xxxxxxxxxxx [mailto:smila-user-bounces@xxxxxxxxxxx] On Behalf Of Ilio Catallo
Sent: Monday, February 27, 2012 5:35 PM
To: Smila project user mailing list
Subject: Re: [smila-user] SMILA vs Human Computing

Hi Juergen,

> our workflows.json is completely equivalent to yours (the only difference is that the startAction is 
> associated to the bulkbuilder worker).   

Yes, of course. I left this out intentionally (;

> Our proof-of-concept retrieveLogoInstancesPipelet.process()
> implementation is the following:

[... snip ...]

> The questions are: 
> . We tried to link the output of the bulkbuilder to the input of the pipeline. This input is supposed to 
> contain the  name of the logos that you want to retrieve. Using the above instruction, can we assure to 
> find into the variable logoName the expected input value coming from the input records? 

If the attribute "logoName" of the records you push to the bulkbuilder contains a single string value 
(like { ..., "logoName": "SMILA", ... }): yes, you will get this value with the code above.
If you have multiple values in there (like { ..., "logoName": ["Eclipse", "SMILA"]} ), you should do

  AnySeq logoNames = blackboard.getMetadata(id).getSeq("logoName");

and then you can iterate over logoNames to get the single values in there.

> How is it possible to save the variable record in the object store associated to the output bucket?

It's usually not necessary to access the ObjectStore yourself. For each record ID returned by the pipeline
(i.e. by the final pipelet in the pipeline, usually), the PipelineProcessor writes these records from
the blackboard to the output bulk and you are done. So basically, your pipelet must return the IDs of the
records you want to write to the output bulk, and you must add your newly created records to the blackboard.
I would propose something like this:

List<String> logoRecordIds = new ArrayList<String>();
for (String id:recordIds) {
  ...
  String logoId = createSomeUniqueID(logoName);
  Record logoRecord = blackboard.getRecord(logoId, Get.NEW);
  logoRecord.getMetadata().put("URL", "URL_1");
  logoRecordIds.add(logoId);
}
return logoRecordIds.toArray();

And you should be done. However, if for each input record just one logo record is created, it's probably 
easier to just modify the metadata of the input records and return the original record IDs.

Cheers,
Jürgen.


Back to the top