Monday 19 May 2008

OOA Interchange Format

The OOA Interchange Format allows Shlaer-Mellor OOA models to be saved and exchanged between tools. Models are saved as XML based ".ooa" files conforming to the OOA Interchange Format. This allows models to be opened and manipulated using ordinary XML tools. The format is really a mapping from the current OOA of OOA to XML.

At present (Build 008), each BETA release of OOA Tool introduces some changes to the format which breaks previously saved models, primarily because each new build defines an expanded OOA of OOA. I have to manually fix the models that are distributed with each release. However, any users who have been downloading the tool and creating models must be getting annoyed when they break after each new BETA release. Unfortunately, there are too many unresolved issues for the format to be finalized yet beyond the fact that it is an XML format. However, what I have decided to do from Build 009 is to track all changes to the format so that users can fix their own models fairly easily. Once OOA Tool 1.0 Final is released I will support old versions of the format as new versions are released.

With this goal in mind, my first task was to ensure the DTD which formalizes the format is up-to-date and valid. I renamed the DTD as "OOAInterchangeFormat0.01.dtd" and updated it so that ".ooa" files can now be validated against the DTD. I then added some preferences to OOA Tool so that users can select whether to embed the DTD, reference the version on the website or reference the version installed with OOA Tool. I also added some options to add default values and/or add mathematically dependent attributes (which are not normally saved). The format will also now be versioned independently of the tool. Version 0.01 is the first tracked version supplied with Build 009.

After this, I have become a little sidetracked. The first thing that sidetracked me was the pretty print logic in OOA Tool which allows patterns, archetypes and actions to be pretty printed as colour-coded HTML files so that they can be viewed on the web. The logic relies on lexical rules in a ".pattern" file to identify tokens which are then colour-coded. First, I separated the logic out into a separate command-line application that will be released with Build 009. I then added the ability to pretty print XML and DTD files. This required an "ExtensibleMarkupLanguage.pattern". I went directly to the latest Extensible Markup Language (XML) 1.0 (Fourth Edition) specification and converted the syntax. This wasn't as easy as it looks because the XML specification does not separate lexical and syntax rules. In fact, to identify all the tokens defined in the specification my lexical rules have to perform some additional syntax parsing. I also identified and fixed a couple of bugs in my Pattern Language library. The first involved using integer literals as character patterns. The second involved referencing token rules from within other token rules. I am pretty happy with the end result:

Syntax and Lexical Rules for Extensible Markup Language

The next thing that has sidetracked me is the mapping from the OOA of OOA to XML. Why can't I automatically map the OOA of OOA to XML using an XML service domain? Obviously, I can't do it at present since OOA Tool is far from complete. However, I have tried to perform the required logic in a Java program. The first problem to solve is mapping object hierarchies to element hierarchies which isn't as easy as it sounds since OOA allows an object to have multiple supertypes and allows supertype objects to define multiple subtype-supertype relationships. The next problem is that we need to identify containment and reference relationships between XML elements. I have not solved all of these problems yet. However, the DTD generated so far has identified discrepancies with the current hand-coded DTD which are best fixed immediately, e.g. the current DTD only defines a single Attribute element, while the OOA of OOA defines multiple Attribute objects which should have their own elements.

Attempting to synchronize "OOAInterchangeFormat0.01.dtd" with an automatically generated version is the main thing holding up Build 009 now. I'm also trying to hold off from modelling the Extensible Markup Language service domain that I have added to the OOA Tool model. I can do that later when I am in a better position to implement it. This week's main goal is to finish messing with the format and release Build 009. That will allow me to return to the paper I am attempting to write on Recursive Design.

No comments: