SCUFL2 API

SCUFL2 API is part of Apache Taverna Language.

This is the API, model and format of SCUFL2, which is the workflow format of Apache Taverna.

SCUFL2 replaces the .t2flow format of Taverna 2. This API allows JVM applications to inspect, generate and modify Apache Taverna workflow definitions without depending on the Apache Taverna runtime.

The format Scufl2 Workflow Bundle is defined alongside this API. This format can be inspected, generated and modified independently of this API.

For more information, see the [SCUFL2 API][9] pages, the Javadoc and the SCUFL2 examples.

Usage

See the Apache Taverna Language README for details on building and using Apache Taverna Language using Maven. You will typically want to also use at least taverna-scufl2-wfbundle to support loading and saving of SCUFL2 workflows in the .wfbundle format.

All Scufl2 modules are also valid OSGi bundles, see the OSGi section below.

See the Taverna Language Javadoc for documentation of classes and methods of SCUFL2. The package org.apache.taverna.scufl2.api is a good starting point.

See the folder taverna-scufl2-examples for examples of usage. The best classes to start using would be org.apache.taverna.scufl2.api.io.WorkflowBundleIO and org.apache.taverna.scufl2.api.container.WorkflowBundle.

Example of converting .t2flow to .wfbundle:

import org.apache.taverna.scufl2.api.container.WorkflowBundle;
import org.apache.taverna.scufl2.api.io.ReaderException;
import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
import org.apache.taverna.scufl2.api.io.WriterException;

// ..

WorkflowBundleIO io = new WorkflowBundleIO();
File t2File = new File("workflow.t2flow");
File scufl2File = new File("workflow.wfbundle");
WorkflowBundle wfBundle = io.readBundle(t2File, "application/vnd.taverna.t2flow+xml");
io.writeBundle(wfBundle, scufl2File, "application/vnd.taverna.scufl2.workflow-bundle");

Supported file formats with WorkflowBundleIO and their required modules:

Media typeSupportJARDescription
application/vnd.taverna.t2flow+xmlreadtaverna-scufl2-t2flowTaverna 2 t2flow
application/vnd.taverna.scufl2.workflow-bundleread/writetaverna-scufl2-wfbundleTaverna 3 workflow bundle
application/vnd.taverna.scufl+xmlreadtaverna-scufl2-scuflTaverna 1 SCUFL (experimental)
text/vnd.taverna.scufl2.structureread/writetaverna-scufl2-apiTextual format for testing/debugging
text/vnd.wf4ever.wfdesc+turtlewritetaverna-scufl2-wfdescAbstract workflow structure in RDF Turtle according to the Wf4Ever wfdesc ontology
text/vnd.mgrast.awe.awf+jsonreadscufl2-awfWorkflow definition of the MG-RAST AWE workflow engine. (experimental)
application/vnd.shiwa.iwir+xmlread/writescufl2-iwirSHIWA's IWIR interoperabile workflow language (experimental)
application/jsonwritetaverna-scufl2-examplesAbstract workflow as JSON (experimental)

Note that the ability for Scufl2 API to read a workflow bundle (using the scufl2-wfbundle module) does not guarantee it is valid or structurally sound. You can use the validators to validate structure or correctness.

You can use the tavtool command line to perform workflow format conversions, inspection and validation.

OSGi services

To use SCUFL2 from OSGi with Spring, use the following OSGi Services. Example, from META-INF/spring/run-context.osgi.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/osgi"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:beans="http://www.springframework.org/schema/beans"
            xsi:schemaLocation="http://www.springframework.org/schema/beans
                                http://www.springframework.org/schema/beans/spring-beans.xsd
                                http://www.springframework.org/schema/osgi
                                http://www.springframework.org/schema/osgi/spring-osgi.xsd">

    <service ref="myService" interface="com.example.MyService"/>

    <reference id="workflowBundleIO" interface="org.apache.taverna.scufl2.api.io.WorkflowBundleIO" />

</beans:beans>

And in META-INF/spring/run-context.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="myService" class="com.example.impl.MyServiceImpl" >
            <property name="workflowBundleIO" ref="workflowBundleIO"/>
    </bean>

</beans>

This will provide a WorkflowBundleIO instance with its readers and writers loaded through OSGi, which when the bundles for taverna-scufl2-t2flow and taverna-scufl2-wfbundle are also loaded, would include support for the Taverna 2 t2flow format and the Taverna 3 wfbundle format.

Note that you do not need to use OSGi services to instantiate Scufl2Tools or URITools, but may do so if you wish.