Hi Folks,
Some time ago Martin asked me to submit an example of the DSDL use-case
implemented using the DPML language - apologies but as ever it's taken a
while to get around to!
First some background.
Please allow me to introduce myself. I'm Peter Rodgers. I founded 1060
Research and am one of the architects of 1060 NetKernel[1]. NetKernel
is a virtual operating system based on a REST microkernel. This
technology originated from Hewlett-Packard's Dexter XML research
program, which I led until 2002 when we spun out to form 1060 Research.
The Dexter project started in 1999 to develop a general purpose
infrastructure for XML messaging systems. Over time it has broadened out
to become a general-purpose operating environment with a core tool set
for XML processes.
DPML (Declarative Process Markup Language)[2] is a very simple language
for composing NetKernel hosted services into processes - it is not
explicitly an XML pipelining language, rather it is one among many
language runtimes that can be used on NetKernel to build unix-like
applications.
NetKernel treats all software components as URI addressable services and
uses a RESTful abstraction to invoke them. Higher level language
runtimes (DPML, XRL, Java, Beanshell, Python, Groovy, Javascript) are
used to compose services into 'pipelines' - generally we use the term
'process' since 'pipeline' implies a linear synchronous flow whereas
'process' encompasses asynchronous forks, conditions and loops etc.
How is this related to XML pipelines and DSDL? NetKernel Standard
Edition provides a broad set of XML technologies[3] as simple URI
addressable services. Using the higher-level language runtimes the XML
technologies can be composed into heterogeneous XML systems - for a
detailed discussion of XML processes on NetKernel see[4]
Returning to DPML. DPML is a syntax for constructing URI requests for
services. The constructed requests are simply issued to the NetKernel
infrastructure which manages execution context, resource management, URI
address-spaces, asynchronous execution, exceptions etc.
DSDL Example as Linear DPML
---------------------------
Here we present a simple linear pipeline written entirely in DPML. We
have assumed that the DSDL technologies are implemented as URI
addressable services in some module accessible to this process. We have
reused the comments from Erik's earlier example in an attempt to
retain a common context.
To understand the DPML syntax you should know that a DPML instruction
<instr> has two reserved tags
<type> is used to identify the base URI for the required service
<target> is used to identify the resource which will receive the result
of the service.
All other tag names are simply arbitrary named arguments to be passed to
the implementing service on 'active URI'[5] request.
In DPML var: is used to identify transient variable resources managed by
the stateful DPML runtime engine. The special URI 'this:response' is the
resource which is finally returned as the result of a process.
On NetKernel the arguments to a service are sourced with URIs of the
form this:param:xxxxx - in this case we are assuming an argument
'input' has been passed from the process that is requesting the DSDL
pipeline - it is referenced with 'this:param:input'
If any request fails with an exception then process flow will switch to
the first <exception> block at the same level of cardinality as the
instruction which threw the exception. The exception is accessed with
the URI 'this:exception' and can be used as an XML resource in an error
handling process or thrown to a calling process etc. If no exception
block is provided the exception will percolate up to the calling parent
process.
Finally, in this use-case we are assuming that the 'nvdl' service has
been written to return a multipart resource. We then use multipart
fragmentation[6] to select the required named parts later in the
process. [Please see Part 3 where we offer some thoughts on pipelining
and multiple outputs].
<idoc>
<seq>
<comment>
**************
1. Use NVDL to split out the parts of the document that
are encoded using HTML, SVG and MathML from the bulk of
the document, whose tags are defined using a user-defined
set of markup tags.
Here we assume that the NVDL service will create a
multipart response containing the 'stripped-out'
resources 'html', 'svg', 'mathml' and 'other' - these
are later accessed by using multipart URI fragmentation.
**************
</comment>
<instr>
<type>nvdl</type>
<source>this:param:input</source>
<rules>nvdl-processing-rules.xml</rules>
<target>var:nvdl-streams</target>
</instr>
<comment>
**************
2. Validate the HTML elements and attributes using the
HTML 4.0 DTD (W3C XML DTD).
**************
</comment>
<instr>
<type>validate-DTD</type>
<source>var:nvdl-streams#part(html)</source>
<schema>DTD-schema.dtd</schema>
<target>var:html-validated</target>
</instr>
<comment>
**************
3. Use a set of Schematron rules stored in
check-metadata.xml to ensure that the metadata
of the HTML elements defined using Dublin Core semantics
conform to the information in the document about the
document's title and subtitle, author, encoding type,
etc.
**************
</comment>
<instr>
<type>validate-Schematron</type>
<source>var:html-validated</source>
<schema>check-metadata.xml</schema>
<target>var:html-schematronized</target>
</instr>
<comment>
**************
4. Validate the SVG components of the file using the
standard W3C schema provided in the SVG 1.2
specification.
**************
</comment>
<instr>
<type>validate-XSD</type>
<source>var:nvdl-streams#part(svg)</source>
<schema>svg-1.2.xsd</schema>
<target>var:svg-validated</target>
</instr>
<comment>
**************
5. Use the Schematron rules defined in SVG-subset.xml to
ensure that the SVG file only uses those features of SVG
that are valid for the particular SVG viewer available
to the system.
**************
</comment>
<instr>
<type>validate-Schematron</type>
<source>var:svg-validated</source>
<schema>SVG-subset.xml</schema>
<target>var:svg-schamatronized</target>
</instr>
<comment>
**************
6. Validate the MathML components using the latest
version of the MathML. schema (defined in RELAX-NG) to
ensure that all maths fragments are valid. The schema
will make use the datatype definitions in
check-maths.xml to validate the contents of specific
elements.
**************
</comment>
<instr>
<type>validate-RelaxNG</type>
<source>var:nvdl-streams#part(mathml)</source>
<schema>mathmld-1.0.rng</schema>
<target>var:mathml-validated</target>
</instr>
<comment>
**************
7. Use MathML-SVG.xslt to transform the MathML segments
to displayable SVG and replace each MathML fragment with
its SVG equivalent.
**************
</comment>
<instr>
<type>transform-XSLT</type>
<source>var:mathml-validated</source>
<transform>MathML-SVG.xslt</transform>
<target>var:mathml-as-svg</target>
</instr>
<comment>
**************
8. Use the DSRL definitions in convert-mynames.xml to
convert the tags in the local nameset to the form that
can be used to validate the remaining part of the
document using docbook.dtd.
**************
</comment>
<instr>
<type>dsrl</type>
<source>var:nvdl-streams#part(other)</source>
<rules>convert-mynames.xml</rules>
<target>var:docbook</target>
</instr>
<instr>
<type>validate-DTD</type>
<source>var:docbook</source>
<schema>docbook-validation.dtd</schema>
<target>var:docbook-validated</target>
</instr>
<comment>
**************
9. Use the CRDL rules defined in mycharacter-checks.xml
to validate that the correct character sets have been
used for text identified as being Greek and Cyrillic.
Note here we target to the same variable like x=f(x)
**************
</comment>
<instr>
<type>crdl</type>
<source>var:docbook-validated</source>
<crdl-rules>mycharacter-checks.xml</crdl-rules>
<target>var:docbook-validated</target>
</instr>
<comment>
**************
10. Convert the Docbook tags to HTML so that they can be
displayed in a web browser using the docbook-html.xslt
transformation rules.
**************
</comment>
<instr>
<type>transform-XSLT</type>
<source>var:docbook-validated</source>
<transform>docbook-html.xslt</transform>
<target>var:docbook-as-html</target>
</instr>
<comment>
**************
After completion of step 10 the HTML (both streams), and
SVG (both streams) should be recombined to produce a
single stream that can fed to a web browser.
**************
</comment>
<instr>
<type>transform-XSLT</type>
<source>var:docbook-as-html</source>
<transform>
stylesheet-to-aggregate-everything.xslt
</transform>
<html-param>var:html-schematronized</html-param>
<svg-param>var:svg-schematronized</svg-param>
<mathml-param>var:mathml-as-svg</mathml-param>
<target>this:response</target>
</instr>
<exception>
<comment>
**************
Here we are catching any exception in the
process - we are simply logging it and then
rethrowing it to the process which called us.
We could start the execution of an error
handling process here.
**************
</comment>
<instr>
<type>log</type>
<operand>this:exception</operand>
</instr>
<instr>
<type>throw</type>
<operand>this:exception</operand>
</instr>
</exception>
</seq>
</idoc>
References
----------
[1]http://www.1060research.com/netkernel/index.html
[3]http://www.1060research-server-1.co.uk/docs/2.0.2/book/declarative/doc_guide_xml_technologies.html
[4]http://www.1060research-server-1.co.uk/docs/2.0.2/book/declarative/doc_guide_xml_pipelines_main.html
[5] active URI is a new URI scheme we have created. It allows multiple
named URI arguments to placed on a URI each URI argument may also be a
active URI - it therefore allows a URI to describe a functional program.
We have submitted the active URI to the IETF for discussion.
http://ietf.mirror.netmonic.com/draft-butterfield-active-uri-01.txt
[6] NetKernel supports arbitrary URI fragmentation services including
XPointer etc. In this example the multipart fragmentation service is
used to provide access to resources within a multipart resource.
-- DSDL members discussion list To unsubscribe, please send a message with the command "unsubscribe" to dsdl-discuss-request@dsdl.org (mailto:dsdl-discuss-request@dsdl.org?Subject=unsubscribe)Received on Tue Mar 22 16:08:37 2005
This archive was generated by hypermail 2.1.8 : Tue Mar 22 2005 - 20:48:02 UTC