You are here: Home V2 Software Software More ... Developer Notes Legacy Notes Data Model in XML

Data Model in XML

The new data model storage, using XML. Rasmus Fogh 2007. Basis for 2012 implementation.

Introduction:

This is a simple internal XML format, not an XMI standard. XMI will have to wait till we have a clear standard, a tool that can read the result, and someone who wants it. Meanwhile we can make an internal format so that the day-to-day model storage is at least not Python specific.

 

Proposal for new model:- XML, one file per class (or DataType, DataObjType, Exception, Constant)


- Directory structure like at present. Data to go (e.g.) cvsroot/model/ccp/xml. The current contents there (data XML schemas), go to (e.g.)  cvsroot/model/ccp/xmlSchema.

- A directory per package - package data in package.xml, class data (etc.) in ClassName.xml.

- Element tags equal to class names (MetaPackage, MetaClass, MetaDataType, MetaDataObjType,  MetaException, MetaConstant).

- MetaObjects will be contained within each other, but the container links are handled explicitly, rather than through the XML containment . Some elements (roles in interpackage links) will be inside an element that is not its container. The container links are tracked using the GUIDs.

- All single attributes except documentation and MetaConstant.value as XML attributes.

- Container as XML attribute (value is the container guid).

- Documentation as
<documentation>write documentation here</documentation>

- Attributes with hicard!=1 as e.g.
<keyNames>
<item>molType</item>
<item>ccpCode</item>
</keyNames>

<enumeration>
<item>protein</item>
<item>DNA</item>
.
.
.
</enumeration

- StringDicts (tagged values, code stubs, type codes, ...) as e.g.
<codeStubs>
<item tag='python'> put code here</item>
<item tag="java:file:myVariant:> put code here </item>
.
.
.
</codeStubs>

- Links handled as e.g.
<supertype>akfalsdjf</supertype>

- Multiple links handled as e.g.
<importedPackages>
<item>wqkwai bas</item>
<item>alekh09enga;sld</item>
</importedPackages>

- Use xInclude to read content objects. Skip if file not found.

Reading model data:


- You may enter leaf package names to be skipped or, alternatively, to be included. Missing files for leaf packages are skipped - the error messages come later if there is a link to a missing object.

- Add a global elements = {guid:element} dictionary and use it for string
conversion for links during reading


Flow will be:

- Files are read in one go, and all information extracted. Where possible, elements are created as the XML is read. If the container is not yet available the extracted data is stored for later processing.

The container and XML attributes are passed to the constructor. Documentation and StringDict attributes are passed in immediately. Lists, links, and valuetype attributes are stored in the objects _tempData dictionary.

After the first pass all missing elements are created. Finally the data from the _tempData are converted.