ceXML - an XML vocabulary for building and civil engineering: Master thesis | ||
---|---|---|
Prev | Chapter 7. Prototype implementation | Next |
This section describes various generic utilities used. These utilities are used by most of the other programs to complete much-used tasks.
cexmlhelper.py (see the section called cexmlhelper.py in Appendix D) is a small python program that provides basic functions that can be called from the other python scripts. It serves the purpose of keeping the amount of code in the other files down.
Sets the classpath needed to execute the Java programs. Uses the specific classpath info on my linux machine, hence the name.
This function processes in_file with XSL/T stylesheet xslt_file (using the optional parameters to set variables in the stylesheet).
These print out for instance the header needed when communicating an XML or HTML file back to the user by means of a web server. Also a function to remove temporary files is available.
A step that is often necessary is to remove all languages except one from a file. The language part is all situated within the name tags. These tags have an attribute language. So, all name tags with an attribute language different from the language to be retained should be removed.
An additional pitfall to be avoided is to strip away the name tags with a language of "si", because they are used within units using the S.I. system for measurements (like m and kg).
This task is performed by an XSLT stylesheet, named language-.xslt (see the section called language-.xslt in Appendix E). It reads through the entire file, removing all name tags except those specified in the language which is to be preserved and the units which are specified in S.I.
propagate.xslt (see the section called propagate.xslt in Appendix E) is used to propagate the characteristics of parents to all children. As said before, builtobjects are stored in a tree-like structure using specialisation. For reasons of efficiency, the file containing the central tree-like structure does not repeat the characteristics of a builtobject endlessly in all it's children. For presentation and other purposes, it is however necessary to have those characteristics copied from the parent to it's children, also: propagated. This stylesheet does the job.
Again for reasons of efficiency (read: file-size) and because the same is done by the LexiCon (upon which model the ceXML message model is based), not the full information on the quantifications and functions is included every time they are part of a builtobject's characteristics. Instead, only a reference is made in the form of <quantification><name language="en">span</name></quantification>. This should eventually be changed into the full quantification, like:
<quantification> <name language="en">span</name> <name language="nl">overspanning</name> <amount/> <unit> <name language="si">m</name> </unit> </quantification> |
In this quantification, of course the unit tag also should be expanded. This rejoining of place-holders with their original intended full information is done by the rejoin.xslt stylesheet (see the section called rejoin.xslt in Appendix E).
The LexiCon system can largely be implemented in XML. Simple XSL/T stylesheets can achieve a lot of the needed functionality.