File Format (XML)ΒΆ

Since Gaphor generates the Python data model from a Gaphor model file, it would be possible to also generate a Document Type Definition (DTD) as well.

These are the things that should be distinguished:

  • Model elements

  • Associations with other model elements (referenced by ID):

    • Relations with multiplicity of zero to one (0..1)

    • Relations with multiplicity of zero or more (0..*)

  • Attributes, which always have a multiplicity of zero to one (0..1)

  • Diagrams

    • One canvas

    • Several canvas items

  • Derived attributes and associations are not saved

  • Model elements should have their class name as tag name:

<Class id="1234-5678-...">
<Package id="xxx...">
  • Support for the two types of Associations, single and multiple:

<Class id="">
    <ref refid="xxx..."/>
<Package id="xxx...">
      <ref refid=""/>
  • Associations contain primitive data, this can always be displayed as strings:

<Class id="">
  <name>My name</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="..."/>

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 is also able to export diagrams into a SVG image, so that they can be used outside of the tool.