A Callimachus pipeline performs a sequence of operations on specified XML documents, such as transforming them into RDF in order to load data from a remote source. Callimachus supports XProc pipeline documents and uses the Calabash XProc implementation. 

To create a pipeline, select Pipeline using the create menu from the folder you wish to store the pipeline in. You will be presented with the following initial code:

<?xml version="1.0" encoding="UTF-8" ?>
<p:pipeline version="1.0"
        xmlns:p="http://www.w3.org/ns/xproc"
        xmlns:c="http://www.w3.org/ns/xproc-step"
        xmlns:l="http://xproc.org/library">

<p:identity />

</p:pipeline>

Invoking pipelines

Pipelines are invoked by HTTP GET and POST requests, using the URL as the request URL with results in the query component.

Result URL example

http://example.com/my-pipeline.xpl?results

Additional key / value pairs are used in the query component are passed as options into the pipeline.

HTTP GET request

Sending an HTTP GET request to the result URL will trigger an instantiation of the pipeline, without providing an input document for the source port. The pipeline would have to take care of that by either

  • Embedding the input document into the pipeline, or
  • Requesting it using the p:http-request step

Example: Invoking a pipeline using HTTP GET

<?xml version="1.0" encoding="UTF-8" ?>
<p:pipeline 
    xmlns:t="http://xproc.org/ns/testsuite" 
    xmlns:p="http://www.w3.org/ns/xproc"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0" 
    name="pipeline">
    <p:load href="http://example.com/document.xml" />
    <p:xslt>
        <p:input port="stylesheet">
            <p:inline>
                <xsl:stylesheet version="1.0">
                    <xsl:output method="xml" indent="yes" />
                    <xsl:template match="/">
                        <Info elementNo="{count(/Elements/Element)}"/>
                    </xsl:template>
                </xsl:stylesheet>            
            </p:inline>      
        </p:input>
    </p:xslt>  
</p:pipeline>

Assuming an HTTP GET request to http://example.com/document.xml returns: 

<?xml version="1.0" encoding="UTF-8" ?>
<Elements>
  <Element />
  <Element />
</Elements>

then, an HTTP GET request to the pipeline will result in:

<?xml version="1.0" encoding="UTF-8" ?>
<Info elementNo="2"/>

Note: The URL used by the p:load step can identify a Callimachus web resource (an XML document), facilitating the use of Callimachus web resources as XProc pipelines and inputs to such pipelines.

HTTP POST request

Sending an HTTP POST request to the result URL will trigger an instantiation of the pipeline, passing the request body as an input document for the source port.

Pipeline Parameters

Any parameters appended to the result URL, as additional query components, will be passed as options name/(string) value pairs.

So a POST request to:

http://example.com/my-pipeline.xpl?result&foo=bar 

to the following pipeline:

<?xml version="1.0" encoding="UTF-8" ?>
<p:pipeline 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:p="http://www.w3.org/ns/xproc"
        version="1.0" 
        name="pipeline">
    <p:option name="foo" required="true" />
    <p:xslt>
        <p:with-param name="foo" select="$foo" />
        <p:input port="stylesheet">
            <p:inline>
                <xsl:stylesheet version="1.0">
                    <xsl:output method="xml" indent="yes" />
                    <xsl:param name="foo"/>
                    <xsl:template match="/">
                        <Element foo="{$foo}"/>
                    </xsl:template>
                </xsl:stylesheet>            
            </p:inline>      
        </p:input>
    </p:xslt>    
</p:pipeline>

will result in:

<Element foo="bar"/>