Presentation is loading. Please wait.

Presentation is loading. Please wait.

Associate Professor Dept. of Computer and Information Sciences NTNU

Similar presentations


Presentation on theme: "Associate Professor Dept. of Computer and Information Sciences NTNU"— Presentation transcript:

1 Associate Professor Dept. of Computer and Information Sciences NTNU
@ IFIP, Copenhagen Hallvard Trætteberg Associate Professor Dept. of Computer and Information Sciences NTNU

2 Installation process Install the Eclipse installer for your platform from and launch it Install Eclipse using the Sirius4Ifip setup file Switch to advanced mode using menu in upper right corner. Add the Sirius4Ifip setup file by clicking the green + icon in upper right corner browse to Sirius4Ifip.setup file and close dialog with OK Select newly added Sirius4Ifip product setup, press Next until you can finally can press Finish Launch newly installed Eclipse with pre-configured sirius4ifip workspace newly installed Eclipse should start automatically browse to and select sirius4ifip workspace folder Eclipse eventually opens with 2 x 4 projects (family and ifipui example projects)

3 Sirius – modeling workbench framework
Typical situation Various models used by various stakeholders Need for tools for viewing and editing models from different perspectives Diagrams are generally preferred, but other representations may also be useful Solution 1 – develop custom editors by hand difficult and time-consuming Solution 2 – use Sirius! declarative description of diagram syntax for your models supports typical diagram elements like nodes, edges and containers supports creation and other editing tools

4 Sirius – step by step Create your domain model Create a model instance
create your Ecore model in your favorite tool, e.g. the Ecore diagram editor based on Sirius! generate code for your model Create a model instance EMF lets you quickly create example models for any Ecore model use relevant scenarios as basis for example models Install model plugins in Eclipse export into the same Eclipse installation, or fire up a second Eclipse instance (easiest) Create initial artifacts a so-called Viewpoint Specification, i.e. the diagram syntax description a so-called Representation for your example model, i.e. a diagram Refine Viewpoint Specification and iterate while you add specification elements, the diagram continuously updates

5 Eclipse projects overview
Launch second Eclipse with Run as... > Eclipse app Develop model Eclipse with Ecore Sirius Import ...examples ...diagram Workspace with ...model – Ecore model project ...model.edit – generated ...examples – model instances ...diagram – diagram spec. project Develop diagram editor Eclipse with Ecore Sirius ...model ...model.edit Two examples - Family - UI Workspace with (imported) ...examples – model instances ...diagram – diagram spec. project

6 Family example Domain Person Family Man and Woman name
parents and children mother and father Family members Man and Woman Person subclasses (!)

7 Family example (in second Eclipse)
two editors – same data Standard tree editor Diagram editor

8 diagram specification
Family example diagram specification rules for generating nodes and edges Standard tree editor Diagram editor

9 Structure of a diagram specification
Layers – container for rules and features rules for mapping domain concepts to diagram elements diagram – the top-level object corresponding to whole diagram nodes – nodes in a graph containers – nodes that can contain other nodes edges – lines between nodes (or edges!) tools for creating and editing diagram elements create nodes, containers or edges (between nodes or edges) reparent nodes or reconnect edges edit labels Common for (most) mappings Id and Label: for referencing mappings, e.g. reuse/import Domain class: domain concept that is mapped Precondition Expression: pre-condition for triggering rule Semantic candidate expression: which elements should be considered Style with Label & Icon: the actual visual element

10 Node mapping - WomanNode
Maps Woman (basicfamily.Woman) concept to node Candidates are the members (feature:members) of the container (here: top-level Family diagram object)

11 Edge mapping - motherEdge
Maps mother reference (basicfamily.Person.mother) to edge (i.e. edge does not correspond to an object) Source of edge can be either ManNode or WomanNode (node mappings) Target of edge must be WomanNode Compute the target from the source using mother reference (feature:mother)

12 Creation tool – createMan
Defines context variables based on tool gesture containerView – the diagram or container node container – containerView’s semantic element Tree-structured script Change Context: sets context object for contained operations Create Instance: creates instance of domain concept and sets or adds to reference (of context object) Set: set (default) feature value

13 Using queries Sirius’ flexibility is due to its use of queries
compute candidates, e.g. based on several features filter out elements, e.g. based on type or feature values diagram structure can be very different from underlying structure Supports several kinds of queries (languages) feature: get value of feature of current context object, e.g. container var: get value of context variable, e.g. container, source (node), ... aql: OCL-dialect with powerful functions for selection, mapping, filtering, ... supports features and variables, but is (of course) more verbose and slower aql example (default name of new Man instance): 'man'+container.members->filter(basicfamily::Man)->size()

14 Try queries in Acceleo > Interpreter view
select context object = self enter and evaluate query

15 Explore the Family example
Questions about the diagram description WomanNode node mapping What happens if the Woman type is replaced by Person? Why? Could you fix the issue without change the type back? How? motherEdge edge mapping What happens if you remove one of the mappings (WomanNode or ManNode) from the Source Mapping? Explain! How can you reformulate the Target Finder Expression using an aql query? Change the instance edit the underlying diagram data in the tree-based editor save and see what happens Change the diagram definition add a label to the mother (or father) edge, to indicate whether the source is ‘daughter of’ or ‘son of’ the target

16 IFIP UI example Hierarchy of views Port Binding
View, ViewParent and Composite View Port flow into and out of view dataContext and userInput typed Binding connects ports may derive value from feature

17 Initial state Diagram description Model instance
two layers Default layer node mapping creation tool Domain layer Model instance hierarchy of six View instances four Binding instances Diagram for model instance empty, why?

18 Target (or something similar)

19 Supporting hierarchical diagrams
Three kinds of nodes simple nodes – no contents (besides label) bordered nodes – simple nodes attached to border of other nodes container nodes – contains other nodes free-form layout – children can be moved around list (horisontal and vertical) – constrained layout and look & feel Node mappings may have child mappings (simple) nodes may have bordered nodes container nodes may contain all kinds of nodes child nodes are created with container object as context Reusing mappings mappings may be reused as child mappings (Import tab in prop. view) saves time, but most importantly... supports unlimited hierarchies by recursive reuse

20 Overview of steps – Default layer
Simple View node mapping find out what is missing add it, so diagram contains six views Data Context and User Input (bordered) node mapping add mappings, so Simple View nodes have node(s) on border Composite View container mapping add mapping, so (a single) Composite View node appears add child mappings, so Composite View node contains other nodes, either Simple View nodes or Composite View nodes update Simple View node mapping, to avoid nodes for CompositeView instances Bindings edge mapping add mapping, so Binding edges appear Node creation tool for Composite View container nodes Edge creation tool for Binding edges

21 Overview of steps – Domain layer
EClass node mapping add it, so domain classes (EClass instances) appear Feature (border) node mapping add it, so attributes and references appear on EClass node border Edge mappings Port Type edge mapping – edge from Port node to EClass node Binding Feature edge mapping – edge from Binding edge (!) to feature node Edge creation tools Port Type edge creation tool – edge from Port node to EClass node Binding Feature edge tool – edge from Binding edge (!) to feature node

22 Sirius - Framework and tool set for creating diagram editor
complete modelling workbenches Check out

23 EMFBlocks DSL framework for EMF and Eclipse ala Sirius, but for block-based syntax

24 Programming with EMFBlocks and Xtext
Combine EMFBlocks and Xtext, to ease kids’ transition from block-based to textual programming vs.

25 Combining sketching and programming


Download ppt "Associate Professor Dept. of Computer and Information Sciences NTNU"

Similar presentations


Ads by Google