Gaphor XML formatΒΆ

This format is ment to be a shorter and more obvious version of Gaphor’s file format. The current format makes it pretty hard to do some decent XSLT parsing. In the current file format one has to compare the @name attribute with the model element name one wishes.

Since the data model is generated from a Gaphor (0.2) model it would be a piece of cake to generate a DTD too.

These are the things that should be distinguished: - model elements - associations with other model elements (referenced by ID):

  • 0..1 relations
  • 0..* relations
  • attributes (always have a multiplicity of 0..1)
  • diagrams
    • one canvas
    • several canvas items
  • derived attributes and associations are not saved of course.

Model elements should have their class name as tag name, e.g.:

<Class id="">
<Package id="DCE:xxx...">

Associations are in two flavors: single and multiple:

<Class id="">
    <ref refid="DCE:xxx.../>
<Package id="DCE:xxx...">
       <ref refid=""/>

Associations contain primitive data, this can always be displayed as strings:

<Class id="">
    <![CDATA[My name]]>

Canvas is the tag in which all canvas related stuff is placed. This is the same way it is done now:

<Diagram id="...">
    <item type="AssociationItem">
        <ref refid="DCE:..."/>

Most of the time you do not want to have anything to do with the canvas. The data stored there is specific to Gaphor. The model elements however, are interesting for other things such as code generators and conversion tools. Gaphor has export filters for SVG graphics, so diagrams can be exported in a independant way.