| 1 |
Gaphor XML format |
|---|
| 2 |
~~~~~~~~~~~~~~~~~~ |
|---|
| 3 |
|
|---|
| 4 |
This format is ment to be a shorter and more obvious version of Gaphor's |
|---|
| 5 |
file format. The current format makes it pretty hard to do some decent |
|---|
| 6 |
XSLT parsing. In the current file format one has to compare the @name |
|---|
| 7 |
attribute with the model element name one wishes. |
|---|
| 8 |
|
|---|
| 9 |
Since the data model is generated from a Gaphor (0.2) model it would be a |
|---|
| 10 |
piece of cake to generate a DTD too. |
|---|
| 11 |
|
|---|
| 12 |
These are the things that should be distinguished: |
|---|
| 13 |
- model elements |
|---|
| 14 |
- associations with other model elements (referenced by ID) |
|---|
| 15 |
. 0..1 relations |
|---|
| 16 |
. 0..* relations |
|---|
| 17 |
- attributes (always have a multiplicity of 0..1) |
|---|
| 18 |
- diagrams |
|---|
| 19 |
. one canvas |
|---|
| 20 |
. several canvas items |
|---|
| 21 |
- derived attributes and associations are not saved of course. |
|---|
| 22 |
|
|---|
| 23 |
Model elements should have their class name as tag name, e.g.: |
|---|
| 24 |
|
|---|
| 25 |
<Class id="DCE:xxx.xxx..."> |
|---|
| 26 |
... |
|---|
| 27 |
</Class> |
|---|
| 28 |
<Package id="DCE:xxx..."> |
|---|
| 29 |
... |
|---|
| 30 |
</Package> |
|---|
| 31 |
|
|---|
| 32 |
Associations are in two flavors: single and multiple. |
|---|
| 33 |
|
|---|
| 34 |
<Class id="DCE:xxx.xxx..."> |
|---|
| 35 |
<package> |
|---|
| 36 |
<ref refid="DCE:xxx.../> |
|---|
| 37 |
</package> |
|---|
| 38 |
</Class> |
|---|
| 39 |
<Package id="DCE:xxx..."> |
|---|
| 40 |
<ownedClassifier> |
|---|
| 41 |
<reflist> |
|---|
| 42 |
<ref refid="DCE:xxx.xxx..."/> |
|---|
| 43 |
... |
|---|
| 44 |
</reflist> |
|---|
| 45 |
</ownedClassifier> |
|---|
| 46 |
</Package> |
|---|
| 47 |
|
|---|
| 48 |
Associations contain primitive data, this can always be displayed as strings |
|---|
| 49 |
|
|---|
| 50 |
<Class id="DCE:xxx.xxx..."> |
|---|
| 51 |
<name> |
|---|
| 52 |
<![CDATA[My name]]> |
|---|
| 53 |
</name> |
|---|
| 54 |
<intvar>4</intvar> |
|---|
| 55 |
</Class> |
|---|
| 56 |
|
|---|
| 57 |
Canvas is the tag in which all canvas related stuff is placed. This is |
|---|
| 58 |
the same way it is done now: |
|---|
| 59 |
|
|---|
| 60 |
<Diagram id="..."> |
|---|
| 61 |
<canvas> |
|---|
| 62 |
<item type="AssociationItem"> |
|---|
| 63 |
<subject> |
|---|
| 64 |
<ref refid="DCE:..."/> |
|---|
| 65 |
</subject> |
|---|
| 66 |
<width><val>100.0</val></width> |
|---|
| 67 |
</item> |
|---|
| 68 |
</canvas> |
|---|
| 69 |
</Diagram> |
|---|
| 70 |
|
|---|
| 71 |
Most of the time you do not want to have anything to do with the canvas. |
|---|
| 72 |
The data stored there is specific to Gaphor. The model elements however, are |
|---|
| 73 |
interesting for other things such as code generators and conversion tools. |
|---|
| 74 |
Gaphor has export filters for SVG graphics, so diagrams can be exported in |
|---|
| 75 |
a independant way. |
|---|
| 76 |
|
|---|