XQuery/Dataflow diagrams
< XQuery
This description of the data flow in the Timetable application (another page scraping application) is loosely based on XPL
<?xml version="1.0" encoding="UTF-8"?> <Pipeline id="timetable"> <process id="i1"> <title>Input id</title> </process> <process id="i2"> <title>input week number</title> </process> <process id="i3"> <title>input role</title> </process> <process id="s1"> <title>create url</title> <input>i1</input> <input>i2</input> <input>i3</input> </process> <process id="s2"> <title>get html</title> <input>s1</input> <input>x1</input> </process> <process id="x1"> <type>external</type> <input>s2</input> <title>Syllabus Plus</title> </process> <process id="s3"> <title>convert to xhtml</title> <input>s2</input> </process> <process id="s4"> <title>extract xml</title> <input>s3</input> </process> <process id="s5"> <title>transform to vcal</title> <input>s4</input> </process> <process id="s6"> <title>transform to htm</title> <input>s4</input> </process> </Pipeline>
With a map from types to shapes:
<ProcessTypes> <type name="input" shape="invtriangle"/> <type name="process" shape="box"/> <type name="external" shape="house"/> </ProcessTypes>
Conversion to dot format for onward conversion to a GIF image
declare option exist:serialize "method=text"; declare variable $nl := " "; 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 )