Viewpoint uses EMF models to store both
Viewpoint Specification Models (the
*.odesign files) and representation data (the
*.aird files). If you need to extend the Viewpoint platform in Java, sooner or later you will have to deal with elements from these meta-models, so this document gives a very brief overview of which meta-models are used, where they are defined and how they are organized.
The structure of the
VSMs is defined by several meta-models. The
fr.obeo.dsl.viewpoint plug-in contains the
http://www.obeo.fr/dsl/viewpoint/description/1.1.0 Ecore package and its sub-packages, which defines both the general structure of a VSM and the
diagram descriptions (diagrams are defined in the core plug-in for historical reasons):
http://www.obeo.fr/dsl/viewpoint/description/1.1.0: defines the overall structure (
Group,
Viewpoint, the abstract
RepresentationDescription type used for all dialects) and the diagram-specific types like
DiagramDescription,
NodeMapping,
OptionalLayer, etc.
http://www.obeo.fr/dsl/viewpoint/description/style/1.1.0: defines both the abstract and generic
StyleDescription and all the styles for diagram elements, like
SquareDescription,
EdgeStyleDescription etc.
http://www.obeo.fr/dsl/viewpoint/description/tool/1.1.0: defines the generic
AbstractToolDescription and all the tools which can be applied to diagram elements, like
EdgeCreationDescription,
ContainerDropDescription, etc. This package also contains the definitions for all the
Model Operations like
If,
CreateInstance, etc.
http://www.obeo.fr/dsl/viewpoint/description/filter/1.1.0: defines the filters used in diagrams (
MappingFilter and
VariableFilter).
http://www.obeo.fr/dsl/viewpoint/description/validation/1.1.0: defines the validation rules which can be added to viewpoints and diagrams, include the quick-fixes definitions.
The other dialects define their own extensions to these packages, in their own plug-ins. They follow the same structure:
fr.obeo.dsl.viewpoint.diagram.sequence defines
http://www.obeo.fr/dsl/viewpoint/diagram/sequence/description/2.0.0 and
http://www.obeo.fr/dsl/viewpoint/diagram/sequence/description/tool/2.0.0 for sequence diagrams-specific mappings and tools.
fr.obeo.dsl.viewpoint.table defines
http://www.obeo.fr/dsl/viewpoint/table/description/1.1.0 for sequence table mappings and tools.
fr.obeo.dsl.viewpoint.tree defines
http://www.obeo.fr/dsl/viewpoint/tree/description/1.0.0 for sequence tree mappings and tools.
The meta-models described above correspond to the elements which are found inside the
*.odesign files. The
representation files (
*.aird) are also stored as models. A representation can be though of as a serialized version of a Viewpoint session. It includes references to the semantic models represented in the session, and the model for each actual representation (diagram, table or tree). These representation models are organized into groups corresponding to which viewpoint defines them, and the representation file also stores the set of currently enabled viewpoints in the session.
This means the representation file contains the representation and session data, references the semantic models, and also references the VSMs which define the representations it contains.
The meta-model for representation files is defined in the
http://www.obeo.fr/dsl/viewpoint/1.1.0 package, from the main
fr.obeo.dsl.viewpoint plug-in. As is the case for VSMs, this package defines both the overall structure of the representation files and, for historical reasons, the representation data used for diagrams. Sequence diagrams, tables and trees define their own meta-models to describe their representations' data:
http://www.obeo.fr/dsl/viewpoint/diagram/sequence/2.0.0 defined in
fr.obeo.dsl.viewpoint.diagram.sequence.
http://www.obeo.fr/dsl/viewpoint/table/1.1.0 defined in
fr.obeo.dsl.viewpoint.table.
http://www.obeo.fr/dsl/viewpoint/table/1.1.0 defined in
fr.obeo.dsl.viewpoint.table
http://www.obeo.fr/dsl/viewpoint/tree/1.0.0 defined in
fr.obeo.dsl.viewpoint.tree.
The concrete structure of an
aird file is the following: An
aird resource contains a single
DAnalysis. The analysis references the top-level elements of all the semantic resources in the session, via its
models reference, and may reference other «sub-aird» through its
referencedAnalysis reference. It also contains through
ownedViews a
DRepresentationContainer for every Viewpoint which was ever enabled in the session. The sub-set of
ownedViews in
selectedViews corresponds to the Viewpoints currently enabled in the session. Each
DRepresentationContainer references (through
viewpoint) the viewpoint definition it is an «instance» of, and contains actual representations (from that viewpoint) in
ownedRepresentations.
The structure of the representations themselves depend on each dialect, which defines its own meta-model as mentioned above. However, they all use the
fr.obeo.dsl.viewpoint.DSemanticDecorator interface for representation elements which stand for semantic elements. The
getTarget() method of
DSemanticDecorator can be used to obtain the actual semantic target element being represented. This means that both a node on a diagram (which is a
DNode) and a cell in a table (a
DCell), and any other representation element in Viewpoint, share the same API to retrieve the element in the user’s semantic model that it represents.