XQuery/Dataflow diagrams

This description of the data flow in the Timetable application (another page scraping application) is loosely based on XPL

  Input id            input week number input role create url i1            i2             i3             get html s1            x1             external s2            Syllabus Plus convert to xhtml s2            extract xml s3            transform to vcal s4            transform to htm s4  

With a map from types to shapes:

    

Conversion to dot format for onward conversion to a GIF image

declare option exist:serialize "method=text"; declare variable $nl := "&#10;"; declare variable $url := request:get-parameter("url","/db/Wiki/DataFlow/timetablexpl.xml"); declare variable $processTypes := /ProcessTypes; let $pipe := doc($url)

return  (  "digraph {",   for $process in $pipe//process    let $type :=         if (exists($process/type))        then $process/type        else if (empty($process/input))        then "input"        else "process"    let $shape :=  string($processTypes/type[@name=$type]/@shape)     return       ( concat ($process/@id, ' [shape=',$shape,',label="',$process/title, '"];',$nl), for $input in $process/input return concat($input, '->', $process/@id,";",$nl) ),  "} ",$nl )

Dot file Diagram