Perform documents are used by clients to instruct OGSA-DAI services to perform activities. These activities may include data resource queries and updates, data transformations or data delivery operations. A simple perform document might specify a single database query activity, while a more complicated example could connect several activities to form a pipeline. In this way, the results of a database query could be filtered, transformed and then delivered by FTP. OGSA-DAI is able to stream data from one end of a pipeline to the other.
Perform documents are expressed using XML. The root element of a perform document is a perform element, under which can be a collection of zero or more activity elements. An activity element is an element corresponding to an activity for the OGSA-DAI service to perform. Activities can be connected to form pipelines by ensuring that the named output stream of one activity element is referenced by the input stream of another. Any output streams that are left unconnected are known as the end-points of a perform document. Data that is written into these end-points will be delivered back to the client within a response document.
If a perform document contains any end-points then an OGSA-DAI service will process it synchronously. This means that result data will be returned in the response document to the client when the activity processing is complete. If however a perform document contains no end-points then there will be no result data to embed within the response document. In this case the OGSA-DAI service is able to return the response document to the client immediately (the response document will contain only the current execution state of the request) and then begin processing the perform document asynchronously. The perform document will continue processing to completion within the OGSA-DAI service.
Perform documents also allow the expression of simple control-flow logic. This provides the client with more precise control over the order in which an OGSA-DAI service will process the activities. By default any unconnected activities or distinct activity pipelines contained in a perform document are processed concurrently. OGSA-DAI control-flow supports this behaviour but also allows unconnected activities and distinct activity pipelines to be processed in sequence. Two different control flow elements, which can be nested within one another, are defined to achieve this:
It is important to note that an individual activity is not always the smallest component of a control-flow. When activities are connected into pipelines, the entire pipeline will form a single component of control-flow. This is because OGSA-DAI processes pipelines by streaming data from one end to the other, so all the connected activities are processing synchronously. Note also that although control-flow elements can be nested within one another, an activity pipeline cannot span multiple control-flow elements.
In most interactions with OGSA-DAI services these control-flow elements are not required, however, for some advanced scenarios it is necessary to ensure strict ordering of activity execution. For example, consider creating a temporary table, populating it with data, querying that data, and then dropping the temporary table. This could be achieved with a single perform document by using a sequence element to order these four activities.
The following perform document specifies an SQL query on a relational database. There is one end-point so this perform document will be processed synchronously and the query results will be delivered within a response document:
<?xml version="1.0" encoding="UTF-8"?>
<perform
xmlns="http://ogsadai.org.uk/namespaces/2005/03/types">
<documentation>
Perform a simple SELECT statement.
</documentation>
<sqlQueryStatement name="myQuery">
<expression>
select * from littleblackbook where id=10
</expression>
<webRowSetStream name="myQueryOutput"/>
</sqlQueryStatement>
</perform>
The query results will be inserted in a result element of the response document. The element will be named myQueryOutput to correspond to the end-point (or unconnected output stream). The result data will be expressed in WebRowSet XML and embedded within a CDATA child node.
The following perform document specifies an SQL update and then two SQL queries on a relational database. A sequence element is used to ensure that the queries are not performed until the update is complete. A flow element is used to allow both queries to process simultaneously.
<?xml version="1.0" encoding="UTF-8"?>
<perform
xmlns="http://ogsadai.org.uk/namespaces/2005/03/types">
<documentation>
Perform an UPDATE followed by a SELECT statement.
</documentation>
<sequence name="mySequence">
<sqlUpdateStatement name="myUpdate">
<expression>
update littleblackbook set address='13 Cod Road' where id=10
</expression>
<resultStream name="statementOutput"/>
</sqlUpdateStatement>
<flow name="myFlow">
<sqlQueryStatement name="myQuery1">
<expression>
select * from LittleBlackBook where id = 10
</expression>
<webRowSetStream name="myQuery1Output"/>
</sqlQueryStatement>
<sqlQueryStatement name="myQuery2">
<expression>
select * from BigRedBook where id < 100
</expression>
<webRowSetStream name="myQuery2Output"/>
</sqlQueryStatement>
</flow>
</sequence>
</perform>
The query results will be inserted into two result elements of the response document named myQuery1Output and myQuery2Output.
An asynchronous data delivery between two OGSA-DAI data services requires two perform document interactions. In this example, the first perform document is sent to the source data service, and the second to the sink. The data is then pulled between the data services using OGSA-DAI DataTransport (DT) functionality. All OGSA-DAI data services implement DataTransport operations for reading and writing data asynchronously. A number of activities are provided to complement these operations so that data can be pushed and pulled between services easily.
The perform document below specifies an SQL query connected to a special outputStream activity. This activity enables another data service to get (pull) the result data via DataTransport operations. Because there is no unconnected output (end-point) in this perform document, an OGSA-DAI data service would process it asynchronously. In other words, the response document would return to the client immediately, but the data service would continue processing until all of the result data had been read by the sink data service.
<?xml version="1.0" encoding="UTF-8"?>
<perform
xmlns="http://ogsadai.org.uk/namespaces/2005/03/types">
<sqlQueryStatement name="myQuery">
<expression>
select * from littleblackbook where id<100
</expression>
<webRowSetStream name="myQueryOutput"/>
</sqlQueryStatement>
<outputStream name="myOutputStream">
<fromLocal from="myQueryOutput"/>
</outputStream>
</perform>
The perform document below specifies a deliverFromGDT activity to read the result data from the source data service. The handle to the source data service and the value of the streamId attribute identify the result data. The implementation of this activity uses the DataTransport GetBlock operation to perform the data transfer. When the data arrives at the sink data service it becomes available through the output stream named myDeliveryOutput. This output stream could then be connected to another activity or simply delivered in the response document.
<?xml version="1.0" encoding="UTF-8"?>
<perform
xmlns="http://ogsadai.org.uk/namespaces/2005/03/types">
<deliverFromGDT name="myDelivery">
<fromGDT streamId="myOutputStream" mode="block">
http://handle/to/SourceDataService
</fromGDT>
<toLocal name="myDeliveryOutput"/>
</deliverFromGDT>
</perform>
More example perform documents are located in: OGSA-DAI/examples/GDSPerform.
A Perform document consists of a root element {http://ogsadai.org.uk/namespaces/2005/03/types}perform. This element can contain:
{http://ogsadai.org.uk/namespaces/2005/03}activityType
{http://ogsadai.org.uk/namespaces/2005/03}performDocumentSchema
OGSA-DAI/schema/ogsadai/types/general_types.xsd
| Back: Activities | Up: Interacting with Data Resources | Next: Response Documents |
| © International Business Machines Corporation, 2004. | © The University of Edinburgh, 2004. |