On Mon, Jun 29, 2009 at 17:55, Fan Dong<[email protected]> wrote:
> The question was, more precisely, how do I feed a list of strings into such
> a service?
> I know how to pass a single value to xmlsplitter, but how to pass a list of
> string?

You just connect it up, and Taverna will do the iteration for you.


You would need some source for your list - for instance if you have
several string constants you can just drag them into the same port -
an intermediate merge will appear that makes the list.

If you have a workflow input port you can right click it and define
it's depth to 1 - that means it would expect a list. (When running you
can fill in each of the items, used as a nested workflow a list would
be passed in - but then you would of course still need to produce the
list from earlier)


If you receive the values from a previous service they should already
be in a list, but if they are not you would need to split the string
somehow - one of the local workers that can do this is
Split_string_into_string_list_by_regular_expression - you can feed it
with the regex "," (without quotes) - which would split it by comma -
combined with a string constant with "hello,there,I,am,the,list" as
the value you have made a list constant.

If you are making the list in a beanshell script you can set the
output depth to 1 and do something like:

 output = new ArrayList();
 output.add("Hello");
 output.add("there");


If you are getting the output from a web service you will have to make
sure that the web service returns the values as a list by the WSDL
definition, this depends on which tool you make your service in. You
might need to add an XML output splitter to the service to drill down
to that port that has that list, you could in the details of the
splitter or service then see something like:

response
Depth:1 {http://example.com}exampleResponse

depth 1 here means you will get a list of item of the
{http://example.com}exampleResponse type.  (Depth 0 is single values)


Lists can also occur due to implicit iteration - like if you connect
up a list to your service B that expects a single value, and it
returns a single value, for the workflow below it will look like if B
is returning a list - one return value per input. If you connect this
to a service C that again expects a single value, more implicit
iteration will occur.


There are some edge cases to look out for - like if you connect two
lists to two input ports expecting single values, you will have an
iteration over the first list, iterating over the second list -
returning a list of lists of return values. This is called a cross
product - and you can control this behaviour in Taverna 2.1 under
"List handling" - it's previously called "Iteration strategy".  You
can change the order (which is the outer loop) or change it to a Dot
product - then it will match one by one from each of the lists, kind
of

  for (a,b) in (A,B):
        service(a,b)


See 
http://www.mygrid.org.uk/usermanual1.7/scufl_language_wb_features.html#implicit_iteration
for equivalent documentation for Taverna 1.7.

-- 
Stian Soiland-Reyes, myGrid team
School of Computer Science
The University of Manchester

------------------------------------------------------------------------------
_______________________________________________
taverna-users mailing list
[email protected]
[email protected]
Web site: http://www.taverna.org.uk
Mailing lists: http://www.taverna.org.uk/taverna-mailing-lists/

Reply via email to