Home-grown CASE tools with XML and XSLT

Similar documents
M359 Block5 - Lecture12 Eng/ Waleed Omar

Definition of Information Systems

XML Processing & Web Services. Husni Husni.trunojoyo.ac.id

Open XML Requirements Specifications, a Xylia based application

x ide xml Integrated Development Environment Specifications Document 1 Project Description 2 Specifi fications

Inf 202 Introduction to Data and Databases (Spring 2010)

Extending Blaise Capabilities in Complex Data Collections

COMP9321 Web Application Engineering

CTI Higher Certificate in Information Systems (Internet Development)

CS101 Introduction to Programming Languages and Compilers

Introducing Computer Programming

Biocomputing II Coursework guidance

Informatics 1: Data & Analysis

Hello INTRODUCTION TO XML. Neil Maycock. Pro-Bel Limited, UK ABSTRACT

Structured documents

CTI Short Learning Programme in Internet Development Specialist

Object-oriented Compiler Construction

Parser Design. Neil Mitchell. June 25, 2004

Uncertain Data Models

ADMINISTRATIVE MANAGEMENT COLLEGE

Symfony is based on the classic web design pattern called the MVC pattern

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Sorting lower bound and Linear-time sorting Date: 9/19/17

Beginning To Define ebxml Initial Draft

Object Query Standards by Andrew E. Wade, Ph.D.

One of the main selling points of a database engine is the ability to make declarative queries---like SQL---that specify what should be done while

Hands-On Perl Scripting and CGI Programming

Compilers Project Proposals

XML. Jonathan Geisler. April 18, 2008

NOTES ON OBJECT-ORIENTED MODELING AND DESIGN

Chapter 2 XML, XML Schema, XSLT, and XPath

Issues surrounding model consistency and QVT

Javascript Coding Interview Questions And Answers In C++ Pdfs >>>CLICK HERE<<<

.. Cal Poly CPE/CSC 366: Database Modeling, Design and Implementation Alexander Dekhtyar..


XML. Objectives. Duration. Audience. Pre-Requisites

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

Teiid Designer User Guide 7.5.0

Mitchell Bosecke, Greg Burlet, David Dietrich, Peter Lorimer, Robin Miller

Programming in Python

JDBC(TM) API Tutorial And Reference: Universal Data Access For The Java(TM) 2 Platform (2nd Edition) Download Free (EPUB, PDF)

Author: Jan-Eike Michels Source: U.S.A. Status: SQL:2003 TC and SQL:200x WD change proposal Date: March 8, 2004

APPLICATION OF A METASYSTEM IN UNIVERSITY INFORMATION SYSTEM DEVELOPMENT

This course is designed for anyone who needs to learn how to write programs in Python.

GUI Design for Android Applications


From Patterns to Frameworks to Programs

Data Presentation and Markup Languages

CHALLENGES IN ADAPTIVE WEB INFORMATION SYSTEMS: DO NOT FORGET THE LINK!

From Craft to Science: Rules for Software Design -- Part II

DRACULA. CSM Turner Connor Taylor, Trevor Worth June 18th, 2015

Our Team. Introduction. Language Features. COMSW4115 Proposal

Custom Fields With Virtuemart 2. Simple Custom Fields. Creating a Custom Field Type

Chapter 13 XML: Extensible Markup Language

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming

Automatic Generation of Graph Models for Model Checking

Functional Programming Language Haskell

Simulating Task Models Using Concrete User Interface Components

Test On Line: reusing SAS code in WEB applications Author: Carlo Ramella TXT e-solutions

CSI5387: Data Mining Project

WHY WE NEED AN XML STANDARD FOR REPRESENTING BUSINESS RULES. Introduction. Production rules. Christian de Sainte Marie ILOG

Programming the World Wide Web by Robert W. Sebesta

Summary of the course lectures

Python Scripting for Computational Science

SOME TYPES AND USES OF DATA MODELS

Eclipse Support for Using Eli and Teaching Programming Languages

2.2 Syntax Definition

Lecture content. Course goals. Course Introduction. TDDA69 Data and Program Structure Introduction

RAISE in Perspective

such a manner that we are able to understand, grasp and grapple with the problem at hand in a more organized fashion.

BCS THE CHARTERED INSTITUTE FOR IT. BCS Higher Education Qualifications BCS Level 6 Professional Graduate Diploma in IT EXAMINERS' REPORT

Lecture 6 Sequences II. Parallel and Sequential Data Structures and Algorithms, (Fall 2013) Lectured by Danny Sleator 12 September 2013

Web Technologies Present and Future of XML

Spell Checker for EiffelStudio

NETCONF Design and Implementation of a Prototype

Project Proposal. Currently Multicast Media Networks ( Multicast ) employs both Nick Yaitsky and Russell Myers as

CHAPTER. Oracle Database 11g Architecture Options

SUMMARY: MODEL DRIVEN SECURITY

CSCI B522 Lecture 11 Naming and Scope 8 Oct, 2009

XML Metadata Standards and Topic Maps

Converting Informix 4GL Applications to Informix Genero

Content Management for the Defense Intelligence Enterprise

XML for Java Developers G Session 2 - Sub-Topic 1 Beginning XML. Dr. Jean-Claude Franchitti

XML and Databases. Outline. Outline - Lectures. Outline - Assignments. from Lecture 3 : XPath. Sebastian Maneth NICTA and UNSW

IT6503 WEB PROGRAMMING. Unit-I

Quantum, a Data Storage Solutions Leader, Delivers Responsive HTML5-Based Documentation Centers Using MadCap Flare

EMERGING TECHNOLOGIES. XML Documents and Schemas for XML documents

SPARK-PL: Introduction

AADL Graphical Editor Design

POSSIBLE DATA OBJECTS FOR A LIBRARY RFID SYSTEM

Compilers and Code Optimization EDOARDO FUSELLA

This course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery.

Python Scripting for Computational Science

ReST 2000 Roy Fielding W3C

An Eclipse Plug-In for Generating Database Access Documentation in Java Code

Formal Verification Techniques for GPU Kernels Lecture 1

COMP9321 Web Application Engineering. Extensible Markup Language (XML)

Chapter 1 Getting Started

Jay Lofstead under the direction of Calton Pu

Lists. Michael P. Fourman. February 2, 2010

VTU Question Bank. UNIT 1 Introduction to WWW, XHTML

Transcription:

Home-grown CASE tools with XML and XSLT Rick van Rein Richard Brinkman University of Twente, the Netherlands {vanrein,brinkman}@cs.utwente.nl March 13, 2000 Abstract This paper demonstrates an approach to software generation where xml representations of models are transformed to implementations by xslt stylesheets. Although xslt was not primarily intended for this use, it serves quite well. There are only few problems in this approach, and we identify these based on our examples. Keywords: Software generation, case tools, xml, xslt. Introduction With the increasing popularity of the Internet, the html language has grown out of proportions, and the xml language is intended to structure its content better. Aside from its implications on the web, xml also receives considerate attention from software developers as a standard representation for data storage, which is mainly due to the intention of xml to model content rather than layout as is custom practice with html. To map this content to a layout, the xslt language was devised; this is a lanuage that recognises patterns in xml documents and transforms them according to a standard specification. In our work, we have used the xslt language for more than just transformation of content to layout, we increasingly generate software with it. Our experiences are reported in this paper. We start to discuss the advantages of the xml family of languages and tools in section 1, and continue to discuss its applicability to software generation in section 2. In section 3 we give several examples, and finally we present our conclusions. 1 Why XML is Useful for Modelling An xml document contains elements, each of which may have a number of attributes, each of which may encapsulate sub-elements. Since xml documents also have a single root element, the result is a tree of (what you could call) objects. This general format has a standardised representation, and the web consortium seems to have collected the critical mass to make it into a popular standard. This means that many tools are available for xml. 1

One class of tool provides parsing and writing libraries for a variety of programming languages. These libraries can take care of many recurring compiler tasks, including lexical analysis and name space management, because the representations of these aspects is the same for all xml documents. The fact that much of the standard compiler issues resolved before you design your own xml data format means that a lot of overhead is taken out of the use of such a format; this saves considerable time in application development, and case tool development is not an exception to that rule. Another class of tools allows editing of xml documents, xslt specifications and even document syntaxes. These tools rely on the self-descriptive (and thus reflective) nature of xml. Every valid xml document refers to an explicit representation of its syntax. This information can be used in editors to ensure that only correctly formatted information is input, and even to automatically generate a graphical interface that presents the content such that it is browsable and editable. A particularly interesting development is xml schema, which captures this reflective information in xml, which means that all the advantages of xml can be applied at reflective levels too. This drastically increases the achievable complexity and fun of xml development. 2 Why XSLT is Useful for Software Generation An xslt stylesheet (which we shall call xslt transformers in this paper) recognises patterns in an xml document, and transforms these to another form. This recognition of patterns is quite instrumental in describing compilers. The possibility to specify queries that search the input replaces searching in self-made, compiler-internal storage structures. The input of an xslt transformer is a tree which is traversed as required to generate a tree-structured output. This implies that any tree structure can be generated from xslt. Among the tree structured file formats are not only html and xml, but also programs in most modern programming languages. This means that it is possible to generate programs with xslt transformers. One additional property of xml makes it particularly suitable for software generation through xslt transformations, namely the possibility to mix plain text (in our case, program text) with xml elements to be resolved by another xslt transformer. Because this involves the use of multiple xslt transformers applied in a sequence, it is possible to separate concerns according to software engineering principles; notably, to implement different design decisions in different xslt transformers. In our experiments with xslt as a software generation language we have worked with xslt transformers that make decisions like web enable through cgi-bin scripting or use sql for queries or exploit Motif. We believe that this grainsize is quite usable in practice. The dependency structure between xslt transformers seems to vary between software generation projects, although not between source documents. Furthermore, the dependency structure may mix in reflective constructs. This means that the transformations can get complicated and project-specific, but not beyond the reach of make. Since the result of this project-specific tweaking usually is a self-built sort of case tool, we think the effort of describing the dependencies that way is more than worthwhile. 2

Member.lifecycle Book.lifecycle Library.interface lifecycle2backend Library.backend backend2sql backend2c,... if2html Library.sql sql2cgi sql2jdbc,... Library.html calls Library.cgi-bin Figure 1: Translating Life Cycles to a web application. 3 Examples Software Generation Projects This paper is a report of practical experience from several projects. In this section, we describe some situations where we benefitted from our (ab)use of xslt for software generation. 3.1 Mapping Processes to SQL In my research, I specify life cycles, informally explained as communicating state diagrams. We use the case tool tcm to input diagrams, and transform its native storage format into a suitable xml description of life cycles. Figure 1 shows how these xml files are translated to a web application. Each of the x2y labels refers to a transforming step from format x to format y. The lifecycle format describes the processes in an application, in this case a Member and a Book in a library case study. The interface format describes externally visible events. The backend format integrates knowledge from the input life cycles, based on the interface description, and is the starting point for both software generation and our planned formal verification. The sql format contains the information from the backend, implemented in sql with such xml annotations that it may be embedded in many host languages, like Perl, Java and PHP3. Some transformation steps could be encoded in xslt, but not all (at least not without hacking around the intentions of xslt). A fragment of the library case study on such a life cycle description is the following, describing how a Book can go from Available to Out state when a 3

checkout event occurs with that book s identity as the first parameter. lifecycle name= Book startstate= START endstate= END transit from= Available to= Out event name= checkout param name= this type= Book use= out / param name= m type= Member use= in / /event /transit /lifecycle The lifecycle2backend transformer combines a few of those life cycles, and holds them against an interface, which is an xml document describing externally visible events. We regret that xslt is constrained to a single input file, even though we could hack our way around it; this is why lifecycle2backend is not implemented in xslt. Our preference would have been to construct a binary operator on life cycle descriptions, used to unite two life cycles to one life cycle. Such an approach would greatly benefit from the ability to perform algebraic analysis on the transformer, in this case to prove commutativity and associativity. Such checks help to ensure the correctness of the transformers. We believe such checks can be performed using structure induction based on the input/output file structure, which is well defined since they are xml files. The backend format can be transformed to, say, sql code. This is a decision which deserves its own transformer because it defines a decision which has alternatives; such alternatives can be specified in other transformers on the backend format. Since sql is a language which may be embedded in practically everything, it is fruitful to defer the decision of the programming language to the next xslt transformer. The sql code representing the checkout (book,member) concrete event occurrence (where book and member symbolically represent the actual parameters) is generated by backend2sql, and it consists of two parts. The first part is a precondition to implement blocking behaviour, essentially expressing that a Book that is checked out cannot be checked out again: precondition maximum= 0 message= select count(*) from Book where state= Out and this= actual param= book / /precondition Note how useful the mixture of plain text and xml elements is here: Instead of an embedding-dependent notation? for a parameter, we used an xml element to represent our intention more accurately. Also note how the implementation of a precondition element may differ between host languages, and how that is hidden from this representation by use of an xml element. These techniques realise the separation of concerns between transformers, by selectively marking things as work to be done in a following transformer step. 4

The second part of this transaction is the actual update for this transition: transit lifecycle= Book message= update Book set m= actual param= member /, state= Out where this= actual param= book / and state= Available /transit Combined with the precondition, and possibly other effects of checking out a book in other life cycles, a transaction may be formed some sql embedding interface such as jdbc or dbi. This can now be done with a next transformation step: Another transformer for another design decision. The last stages typically require tailoring with options, such as the host, username and database name for database access. Since xslt does not incorporate options in its translation process, we decided to use another transformer language for this last stage. More information on life cycles can be found on the web, http://www.cs.utwente. nl/ vanrein/research.lc.html. 3.2 User Interface Generation Modern computing has given us means of portability across platforms, of which Java and xml are just two examples. User interfaces are not similarly easy to port to different platforms, because a user interface mostly depends heavily on the functionality of a particular widget library. For instance, Windows offers native support for showing tree structures, which lacks in Tcl/Tk. We therefore did a project to describe user interfaces in a general xml format. We use xslt transformers for the translation of this generic user interface format to specific program code in a particular programming language. This makes it possible to describe a user interface once and translate it to any development environment for which an xslt transformer exists. Such environments currently include Java/Swing, Tcl/Tk, Appbuilder/Motif and Delphi. msgdialog.gui gui2codeframe msgdialog.codeframe gui2codeframe2pas codeframe2pas msgdialog.pas Figure 2: Generating an xslt transformer to allow editable codeframes. Figure 2 shows how the general user interface xml files are translated to the development environment. A message dialog, described in the msgdialog.gui file, is the starting point of the xslt traject. 5

Such a file looks like: window id= msgdialog text= window title button id= okbutton text= Show message onclick= true / /window This is a window with a button named okbutton, which responds when it is clicked on by invoking a bit of code. Each xml file describing the user interface of msgdialog will be transformed to a codeframe. A codeframe is a framework in which the developer types his language-specific program code. A codeframe xslt transformer creates an empty code tag for each event in the window description. A codeframe looks like: codeframe code id= okbutton event= onclick begin ShowMessage ( Hello, world! ); end; /code /codeframe Here, the onclick behaviour of the previously seen button okbutton is described in a codeframe entry; the three lines of Pascal are a specific implementation of an event response for Delphi. Note that the separation of code fragments is advantageous for future extensions, including the embedding of code fragments of one language (like sql) into another; this can be done with an xslt transformer that operates on codeframes. The generated codeframe is originally empty, but on regeneration of the codeframe, already previously entered program code is retained to make it possible to keep the user interface and program code integrated while the application evolves. It is the developers task to fill in the contents of the code tags, but combining them remains the responsibility of this xml based mini case tool. The second step in our parse traject is to generate the program code for the selected development environment. Because it is currently not possible to jointly parse two xml-files like the window description and the codeframe with a single xslt transformer, we have chosen to split this step into two sub-steps. First, we transform the window description with an xslt transformer into another xslt transformer. This xslt transformer contains all the language-specific code necessary for displaying the user interface. At places where the code tags from the codeframe are to be inserted, an xslt command like xsl:value-of select= codeframe/code[@id= okbutton and @event= onclick ] / is inserted. This selects the Pascal code snippet given above. The second and last step evaluates this generated xslt transformer to insert the codeframe in the rest of the program code. The result can be compiled with a traditional compiler. More information and code of this interface generation project can be found on http://www.cs.utwente.nl/ vanrein/plug. 6

3.3 Database Schema Generation A last practical example shows the use of xml schema, which are xml representations of xml document structure. The reflective information contained in an xml schema makes it possible to generate reflective code, such as the sql statements to create a set of database tables that can contain the xml data instantiated from the xml schema. We used this technique on a project, the Linux hardware Support Database. This database includes a mirrorring scheme where (database schema independent) representations of the database content are transferred in an xml document over secure ssh network connections. For this mirroring process, we also generated (from the xml schema) a program that reads xml documents from the secure input stream and puts its contents in the database which has the database schema that was also generated. The benefit of this approach is, once again, the separation of concerns. The mirrorring process passess around a standardised format, and several database schemas can read/write that format. This is all fairly standard. What the above scheme adds, is the automatic generation of all access to the database schema; another database schema can be selected by changing to another set of xslt transformers. This makes it possible to employ different schema optimisation techniques on different databases, but still support the communication for mirrorring. An interesting problem that comes up in this situation is that xml documents are represented as trees of objects, whereas (relational) database schemas contain a more general network of tuples. Furthermore, order is not implied by database tables, whereas xml implicitly always assumes order to be information. This is due to the single focus on parsing xml files based on schema definitions, and insufficient attention to writing them. It should be noted that ibm has launched a similar project named xle. In this project, they worked from a dtd rather than an xml schema, and not surprisingly, they need annotations to address the differences between a relataional database schema and xml representation. 7

Conclusions We experienced xml as a fruitful data representation, and well worth the effort of mapping a native format to. The xslt language has been similarly fruitful in transforming conceptual descriptions to an implementation. It seems to be a good idea to construct the transformation as a number of sequential steps, where each xslt stylesheet represents a design decision; this provides a placeholder for alternative decisions. We stretched xslt a bit beyond the current treatment that it receives from the web consortium, which led to a number of problems: 1. An xslt transformer takes only one input, and generates only one output file. This means that transformations like the life cycle compiler cannot be (directly) implemented in xslt. 2. It is not possible to make small modifications of the behaviour of an xslt transformer by supplying options and arguments to it. 3. We would be quite pleased to see tools to verify an xslt transformer by treating it as an operator, and use structural induction to verify algebraic properties such as transitivity, idempotence, monotonicity, associativity and commutativity. 4. The xml schema language specifies sufficient information for parsing an xml document; however, subtle matters like whether or not the data is ordered is lacking, which makes writing out xml documents based on their schema non-deterministic. Since we believe that our use of xslt extends the line of thinking of the web consortium, we hope and expect that these matters can be resolved in future versions of the xslt specification. Acknowledgements. We wish to thank the students Sander Evers, Kristiaan Breuker and Jeroen van Nieuwenhuizen for their work on the graphical interface generator, and Roelof van Zwol and Maurice van Keulen for helping to tame them. 8