How SmART works (Technical Documentation)
SmART's Backbone
The SmART Loop
Servlet-Stylesheet Communication
Graphic Output
Third-Party Tools
SmART's Backbone
The backbone of SmART is a Java servlet called "SmartSsa". The servlet accepts
HTTP requests from a web
browser and sends back a response each time it is called. This
response consists of a (new) HTML page to be displayed by the browser unless
the user has clicked the "Save" or the "Export" button.
The servlet will send XML output (the SSA's internal representation) in the former case
and some other output (JPG, PNG, TIFF, SVG, PDF) in the latter.
In both cases the browser will ask the user where to save the servlet's response.
The SmART Loop
When sending HTML output the servlet has (in most cases) constructed a new
SSA according to the user's input (e.g., connecting two propositions). Each SSA
is internally represented as an XML structure. This structure is transformed to HTML
by means of an XSLT stylesheet ("ssa2html.xsl"). The stylesheet displays propositions,
relations, and the buttons which the user is supposed to click. But there is also
a hidden text field containing the original XML structure representing the SSA.
The field content is sent to the servlet when the "Connect" or "Disconnect" button is
clicked and a new SSA structure is composed from the propositions to be (dis-)connected,
the chosen relation, and the old structure. Likewise, the new structure is represented
as XML and transformed to HTML.
Servlet-Stylesheet Communication
In general, the HTML output depends on the action the user has chosen. Opening a file
requires a different output than disconnecting propositions. Thus, the servlet has
to communicate with the XSLT stylesheet, providing the right information so that
the adequate output can be generated. This is achieved by means of a
Finite Automaton
model. The automaton's state (e.g., "openRequest", "open", "ssa")
is represented in the stylesheet's HTML output by means of a hidden text field.
When a button is clicked a JavaScript function writes the new state into the field which
is evaluated by the servlet. Now the appropriate action (e.g., constructing
a new SSA structure holding an additional relation) is performed and the
new state is passed as a parameter to the stylesheet which will in turn
evaluate the state and generate the approprioate HTML output.
Graphic Output
Export into several graphic formats is performed via
SVG (Scalable Vector Graphics). This is done by means of a second
XSLT stylesheet, called "ssa2svg.xsl". A SVG stream can easily
be converted to JPG, PNG, and TIFF using Apache Batik and to PDF using Apache FOP (Formatting Objects Processor).
Third-Party Tools
The SmART project would not be possible without extensive use of many non-commercial
tools which are distributed with the SmART package:
- XML manipulation in Java is done using the
JDOM library.
- The Apache Batik
library is used to convert SVG to JPG, PNG, and TIFF.
- PDF generation from a SVG stream is performed using
Apache FOP
(Formatting Objects Processor).
- The "Open File" functionality has been implemented by means of O'Reilly's
com.oreilly.servlet
package. The source code, object code, and documentation in the com.oreilly.servlet
package is copyright and owned by Jason Hunter.
- Cardo is a
Unicode font by David Perry. It has been converted to a SVG font file by means of
Apache Batik and the font file
has been included in the SmART package with kind permission of the author.
- The Unicode Classical Greek Inputter is distributed in the SmART
package with kind permission of its author, James Naughton.
- The nice tooltips showing the semantics of the buttons when the mouse pointer
is hovering over them have been created with Erik Bosrup's
overLIB.
|