Summary
This recipe shows how to convert a flow (expressed in RDF) into an equivalent ZigZag script automatically.
A simple flow example
To introduce some of the ZigZag concepts we will use the following flow
![]() |
| Example flow that concatenate strings and converts the result into upper case |
|---|
This flow is available on any Meandre engine as part of the /public/services/demo_repository.rdf. If we run the flow from the Meandre Workbench with no modifications, we obtain the following output
![]() |
| Flow output produced by the example flow |
|---|
This flow contains six instances of five different components
| Instance name | Component name | Language | Description |
|---|---|---|---|
| Push String 0 | Push String | Java | Push hello world |
| Push String 1 | Push String | Java | Push hello world |
| Concatenate String 0 | Concatenate String | Java | Concatenates two strings |
| To Uppercase 0 | To Uppercase | Python | Converts and string to upper case |
| Pass Through 0 | Pass Through | List | Just passes the input to the output |
| Print Object 0 | Print Object | Java | Prints an object to the console |
This flow is expressed by the following RDF descriptor
@prefix meandre: <http://www.meandre.org/ontology/> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . <meandre://test.org/flow/test-hello-world-with-python-and-lisp/connector/4> rdf:type meandre:data_connector_configuration ; meandre:connector_instance_data_port_source <meandre://test.org/component/pass-through/output/string> ; meandre:connector_instance_data_port_target <meandre://test.org/component/print-object/input/object> ; meandre:connector_instance_source <meandre://test.org/flow/test-hello-world-with-python-and-lisp/instance/pass-through/4> ; meandre:connector_instance_target <meandre://test.org/flow/test-hello-world-with-python-and-lisp/instance/print-object/5> . <meandre://test.org/flow/test-hello-world-with-python-and-lisp/instance/push-string/0/property/wb_top_pix_pos> rdf:type meandre:property ; meandre:key "wb_top_pix_pos"^^xsd:string ; meandre:value "133"^^xsd:string . <meandre://test.org/flow/test-hello-world-with-python-and-lisp/connector/set> rdf:type meandre:connector_set ; meandre:data_connector <meandre://test.org/flow/test-hello-world-with-python-and-lisp/connector/4> , <meandre://test.org/flow/test-hello-world-with-python-and-lisp/connector/2> , <meandre://test.org/flow/test-hello-world-with-python-and-lisp/connector/3> , <meandre://test.org/flow/test-hello-world-with-python-and-lisp/connector/1> , <meandre://test.org/flow/test-hello-world-with-python-and-lisp/connector/0> . ...
RDF, despite all its benefits, it is not human friendly. Writing an RDF descriptor would be tedious and error prone. Thus, Meandre provides the ability to express flows in a human-friendly readable using the ZigZag scripting language. This scripting language is intended to manipulate flows without using the Workbench and to create self contained flows that can be run on standalone mode outside the Meandre server.
Converting a flow in to a ZigZag script
Meandre provides a simple tool to generate ZigZag scripts out of RDF descriptors. We can get the ZigZag script describing the flow by using the rdf2zz facility. For instance, we can generate the ZigZag script running the following command
$ java -jar rdf2zz-1.4.4.jar -i http://demo.seasr.org:1714/public/services/demo_repository.ttl -f meandre://test.org/flow/test-hello-world-with-python-and-lisp/ -o upper.zz
where http://demo.seasr.org:1714/public/services/demo_repository.ttl
is the location containing the flow RDF description, and meandre://test.org/flow/test-hello-world-with-python-and-lisp/ the flow URI we want to convert to a ZigZag script. The script contained on upper.zz is listed below.
# # Generated by RDF2ZZConverter on Wed Apr 29 10:41:16 CDT 2009 # # @name Hello World With Java, Python, and Lisp Components!!! # @description A simple hello world test # @creator Xavier Llorà # @date Tue Sep 11 21:06:03 CDT 2007 # @rights University of Illinois/NCSA open source license # @tags hello_world, demo # @uri meandre://test.org/flow/test-hello-world-with-python-and-lisp/ # # # Specify component imports # import <http://demo.seasr.org:1714/public/services/demo_repository.ttl> # # Create the component aliases # alias <meandre://test.org/component/concatenate-strings> as CONCATENATE_STRINGS alias <meandre://test.org/component/to-uppercase> as TO_UPPERCASE alias <meandre://test.org/component/pass-through> as PASS_THROUGH alias <meandre://test.org/component/push-string> as PUSH_STRING alias <meandre://test.org/component/print-object> as PRINT_OBJECT # # Create the component instances # to_uppercasde_0 = TO_UPPERCASE() push_string_0 = PUSH_STRING() print_object_0 = PRINT_OBJECT() concatenate_string_0 = CONCATENATE_STRINGS() pass_through_0 = PASS_THROUGH() push_string_1 = PUSH_STRING() # # Set component properties # # # Create the flow by connecting the components # @to_uppercasde_0_outputs = to_uppercasde_0() @pass_through_0_outputs = pass_through_0() @concatenate_string_0_outputs = concatenate_string_0() @push_string_0_outputs = push_string_0() @push_string_1_outputs = push_string_1() to_uppercasde_0(string: concatenate_string_0_outputs.concatenated_string) pass_through_0(string: to_uppercasde_0_outputs.string) concatenate_string_0( string_two: push_string_0_outputs.string; string_one: push_string_1_outputs.string ) print_object_0(object: pass_through_0_outputs.string)


Add Comment