Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

Both sides previous revision Poprzednia wersja
Nowa wersja
Poprzednia wersja
pl:miw:miw08_hekateatl [2008/09/30 15:43]
miw
pl:miw:miw08_hekateatl [2019/06/27 15:50] (aktualna)
Linia 34: Linia 34:
 ===== 080603 ===== ===== 080603 =====
   * trans?   * trans?
 +
 +
 +
 +
 +
  
  
Linia 39: Linia 44:
 ====== Projekt ====== ====== Projekt ======
  
-   * przyklad kodu KM3 (Source Metamodel) 
  
- <​code java> package ARD { 
  
- class Wlasnosc { 
  
- attribute name : String; 
  
- reference atrybuty[*] container : Atrybut opposite of wlasnocAtrybut;​+==== ATL ==== 
 +ATL (ATLAS Transformation Language) to język transformacji modeli wraz zestawem narzędzi opracowanych przez ATLAS Group (INRIA & LINA). ATL pozwala wyprodukować z zestawu modeli źródłowych,​ zestaw modeli docelowych. ​
  
- reference dependency container : Wlasnosc opposite of dependencyAtrybut;​+ATL jest hybrydą programowania deklaratywnego i imperatywnego. Preferowany styl programowania to styl deklaratywny który pozwala w łatwy sposób opisać powiazania pomiędzy modelem źródłowym a docelowym. Jednkże ATL przewiduje również konstrukcje imperatywne w celu opisania wyrażeń trudnych do opracowania w sposób deklaratywny. Program ATL składa się z zestawu reguł które definiują dopasowanie elementów modelu źrodłowego do modelu docelowego
  
- reference dependencyWlasnosc[*] ​Wlasnosc opposite of dependency;​ +Opracowane dla platformy Eclipse zintegorowane środowisko programistyczne (ATL IDE) oferuje szereg standardowych narzędzi programistycznych (podświetlanie składni, debuger itd.), które ułatwiają prace z ATL. Projkt ATL oferuje również bibliotege transformacji ATL gdzie można znaleźć ponad 100 opracowanych rozwiązań http://​www.eclipse.org/​m2m/​atl/​atlTransformations/​
- }+
  
- class Atrybut { 
  
- attribute name : String; 
  
- reference wlasnoscAtrybut[0-1] : Wlasnosc opposite of atrybuty; +==== The Model-Driven Architecture ==== 
- } +MDA to metoda projektowania systemów oprogramowania. Stanowi ona zbiór wytycznych dotyczących struktury specyfikacji,​ które są wyrażone jako modele. 
-}+Modele stanowią podstawowe elemetny MDA. W dziedzinie MDA model definiowany jest poprzez model modeli, tak zwany metamodel. Mówimy ze model zgodny z semantyka metamodelu odpowiada temu metamodelowi
  
-package Primitive Types { 
  
- datatype String; +{{:​pl:​miw:​mda.jpg|:​pl:​miw:​mda.jpg}}
-} +
-</​code>​ +
-  * kod XMI (Source Model) ​ (the lowest level)+
  
-<​code>​ 
-<Ard name="​thermostat">​ 
  
- <​property name="​month"/>​+==== Trasformacja ATL ====
  
- <​property name="​day"/>​+{{:​pl:​miw:​atl.jpg|:​pl:​miw:​atl.jpg}}
  
- <​property name="​hour"/>​ 
  
- <​property name="​today">​+Powyższy rysunek opisuje schemat transformacji ATL. Model Ma (plik wejściowy Ecore czyli XMI) odpowiadający metamodelowi MMa (plik Ecore) jest transformowany do modelu Mb (plik wyjściowy Ecore), który odpowiada metamodelowi MMb (Ecore). Transformacja definiowana jest przez model Mt (plik ATL) który odpowiada metamodelowi MMt (metamodel ATL). Metamodele MMt, MMa oraz MMb muszą odpowiadać metamdelowi MMM (MOF albo Ecore)
  
- <​dependency name="​day"/>​ 
  
- </​property>​ 
  
- <​property name="​operation">​ 
  
- <​dependency name="​today"/>​ 
  
- <​dependency name="​hour"/>​ 
  
- </​property>​ +==== Przykłady użycia ​====
- ... +
-</​Ard>​ +
-</​code>​ +
-  * opis ARD z TPH przy pomocy HML jako p. wyjścia dla XMI +
-<​code>​ +
-<hml name "​termostat">​ +
- <​attribute_set>​  +
- <att name "​thermostat"​ id "​att_0"/>​ +
- <att name "​time"​ id "​att_1"/>​ +
- <att name "​temperature"​ id "​att_2"/>​ +
- <att name "​date"​ id = "​att_3"/>​ +
- <att name = "​thermostat_settings"​ id = "​att_4"/>​ +
- <att name = "​operation"​ id = "​att_5"/>​ +
- <att name = "​season"​ id = "​att_6"/>​ +
- <att name = "​today"​ id = "​att_7"/>​ +
- <att name = "​hour"​ id = "​att_8"/>​ +
- <att name = "​month"​ id = "​att_9"/>​ +
- <att name = "​day"​ id = "​att_10"/>​  +
- </​attribute_set>​ +
-  +
- <​property_set>​ +
- <​property name = "​thermostat_pr"​ id="​prp_0">​ +
- <​attref ref = "​att_0"/>​ +
- </​property>​ +
- <​property name = "​time_temp_pr"​ id="​prp_1">​ +
- <​attref ref = "​att_1"/>​ +
- <​attref ref = "​att_2"/>​ +
- </​property>​ +
- <​property name = "​time_pr"​ id="​prp_2">​ +
- <​attref ref = "​att_1"/>​ +
- </​property>​ +
- <​property name = "​temperature"​ id="​prp_3">​ +
- <​attref ref = "​att_2"/>​ +
- </​property>​ +
- <​property name = "​date_hour_seasion_operation_pr"​ id="​prp_4">​ +
- <​attref ref = "​att_3"/>​ +
- <​attref ref = "​att_8"/>​ +
- <​attref ref = "​att_6"/>​ +
- <​attref ref = "​att_5"/>​ +
- </​property>​ +
- <​property name = "​date_hour_pr"​ id="​prp_5">​ +
- <​attref ref = "​att_3"/>​ +
- <​attref ref = "​att_8"/>​ +
- </​property>​ +
- <​property name = "​season_operation_pr"​ id="​prp_6">​ +
- <​attref ref = "​att_6"/>​ +
- <​attref ref = "​att_5"/>​ +
- </​property>​ +
- <​property name = "​day_month_today_pr"​ id="​prp_7">​ +
- <​attref ref = "​att_10"/>​ +
- <​attref ref = "​att_9"/>​ +
- <​attref ref = "​att_7"/>​ +
- </​property>​ +
- <​property name = "​day_today_pr"​ id="​prp_8">​ +
- <​attref ref = "​att_10"/>​ +
- <​attref ref = "​att_7"/>​ +
- </​property>​  +
- <​property name = "​thermostat_settings_pr"​ id="​prp_9">​ +
- <​attref ref = "​att_0"/>​ +
- </​property>​ +
- <​property name = "​operation_pr"​ id="​prp_10">​ +
- <​attref ref="​att_1"/>​ +
-         </​property>​ +
- <​property name = "​season_pr"​ id="​prp_11">​ +
- <​attref ref="​att_2"/>​ +
-         </​property>​ +
- <​property name = "​today_pr"​ id="​prp_12">​ +
-     <attref ref="​att_3"/>​ +
- </​property>​ +
- <​property name = "​hour_pr"​ id="​prp_13">​ +
-     <attref ref="​att_4"/>​ +
- </​property>​ +
- <​property name = "​month_pr"​ id = "​prp_14">​ +
- <​attref ref = "​att_5"/>​ +
- </​property>​ +
- <​property name = "​day_pr"​ id = "​prp_15">​ +
- <​attref ref = "​att_6"/>​ +
- </​property>​ +
- <​property name = "​date"​ id = "​prp_16">​ +
- <​attref ref = "​att_3"/>​ +
- </​property>​ +
- </​property_set>​ +
-  +
- <​tph>​ +
-            <trans src="​prp_0"​ dst="​prp_1"/>​ +
- <trans src="​prp_1"​ dst="​prp_2"/>​ +
- <trans src="​prp_1"​ dst="​prp_3"/>​ +
- <trans src="​prp_2"​ dst="​prp_4"/>​ +
- <trans src="​prp_3"​ dst="​prp_9"/>​ +
- <trans src="​prp_4"​ dst="​prp_5"/>​ +
- <trans src="​prp_4"​ dst="​prp_6"/>​ +
- <trans src="​prp_5"​ dst="​prp_13"/>​ +
- <trans src="​prp_5"​ dst="​prp_16"/>​ +
- <trans src="​prp_6"​ dst="​prp_10"/>​ +
- <trans src="​prp_6"​ dst="​prp_11"/>​ +
- <trans src="​prp_16"​ dst="​prp_7"/>​ +
- <trans src="​prp_7"​ dst="​prp_14"/>​ +
- <trans src="​prp_7"​ dst="​prp_8"/>​ +
- <trans src="​prp_8"​ dst="​prp_15"/>​ +
- <trans src="​prp_8"​ dst="​prp_12"/>​ +
- </​tph>​ +
-  +
- <​ard>​ +
-            <dep independent="​prp_15"​ dependent="​prp_12"/>​ +
- <dep independent="​prp_14"​ dependent="​prp_11"/>​ +
- <dep independent="​prp_13"​ dependent="​prp_10"/>​ +
- <dep independent="​prp_12"​ dependent="​prp_10"/>​ +
- <dep independent="​prp_10"​ dependent="​prp_9"/>​ +
- <dep independent="​prp_11"​ dependent="​prp_9"/>​ +
-        </​ard>​ +
-</​hml>​ +
-</​code>​+
  
-  ​KM3 (opis ARD TPH przy pomocy HML) +**DSLs coordination for Telephony** - praca przedstawia studium impelmentacji dwóch języków związanych z dziedziną telefonii: SPL(Session Processing Language) i CPL (Call Processing Language). Częścoiowo opierają się ona na tych samych słownikach. Jednakże same języki są bardzo różne i zostały zaprojektowane,​ aby być wykorzystywane przez różnych ludzi. Praca pokazuje w jak wykorzystać ATL w celu transformacji programu ​jednego języka do drugiego (http://www.eclipse.org/m2m/atl/usecases/DSLsTelephony/)
-<​code>​ +
-package HML { +
- abstract class Node { +
- reference parent[0-1] ​Element oppositeOf children; +
-+
- class Element { +
- reference children[*] ordered container : Node oppositeOf parent; +
-+
-//Ard +
- class Ard extends Node { +
-+
- class Dep extends Element { +
- attribute independent : String; +
- attribute dependent : String; +
-+
-//Tph +
- class Tph extends Node { +
-+
- class Trans extends Element { +
- attribute src : String; +
- attribute dst : String; +
-+
-//Property_set +
- class Property_set extends Node { //czy bez extends, bo reference ma byc do Property a nie Element +
- // (a moze moze zostac, bo Property dziedziczy z Element?)+
-+
- class Property extends Element { +
- attribute name : String; +
- attribute id : String; +
- reference parent[0-1] : Element oppositeOf children; +
-+
- class Attref extends Element { +
- attribute ref : String; +
-+
-//​Attribute_set +
- class Attribute_set extends Node { +
-+
- class Att extends Element { +
- attribute name : String; +
- attribute id : String; +
- }+
  
-}+==== Transformacja ARD w ARD ====
  
-package PrimitiveTypes { +Aby dokonać transformacji należy stworzyć metamodel ARD, odpowaidający mu model będący plikiem wejściowym do transformacji,​ oraz plik ATL opisujący transformację
- datatype Boolean; +
- datatype Integer; +
- datatype String; +
-+
-</​code>​+
  
-  * Metamodel ARD (w oparciu o HML)+  * Metamodel ARD (w oparciu o [[https://​ai.ia.agh.edu.pl/​wiki/​hekate:​hekate_markup_language|HML]]- schemat
 {{:​pl:​miw:​ard.png|:​pl:​miw:​ard.png}} {{:​pl:​miw:​ard.png|:​pl:​miw:​ard.png}}
-  * Metamodel ARD KM3+  * Metamodel ARD KM3 zbudowany na podsawie schematu
 <​code>​ <​code>​
 package Hml { package Hml {
Linia 319: Linia 148:
 </​code>​ </​code>​
  
-  * Metamodel ARD XMI+  * Metamodel ARD XMI - wygenerowany przez środowisko ATL
 <​code>​ <​code>​
 <?xml version="​1.0"​ encoding="​ISO-8859-1"?>​ <?xml version="​1.0"​ encoding="​ISO-8859-1"?>​
Linia 361: Linia 190:
 </​code>​ </​code>​
  
 +  * Plik wejściowy XMI do transformacji (Termostat) odpowiadający metamodelowi ARD
 +<​code>​
 +<?xml version="​1.0"​ encoding="​ISO-8859-1"?>​
 +<xmi:XMI xmi:​version="​2.0"​ xmlns:​xmi="​http://​www.omg.org/​XMI"​ xmlns="​Hml">​
 + <​Attribute_set> ​
 + <Att name = "​thermostat"​ id = "​att_0"/>​
 + <Att name = "​time"​ id = "​att_1"/>​
 + <Att name = "​temperature"​ id = "​att_2"/>​
 + <Att name = "​date"​ id = "​att_3"/>​
 + <Att name = "​thermostat_settings"​ id = "​att_4"/>​
 + <Att name = "​operation"​ id = "​att_5"/>​
 + <Att name = "​season"​ id = "​att_6"/>​
 + <Att name = "​today"​ id = "​att_7"/>​
 + <Att name = "​hour"​ id = "​att_8"/>​
 + <Att name = "​month"​ id = "​att_9"/>​
 + <Att name = "​day"​ id = "​att_10"/>​
 + </​Attribute_set>​
 +
 + <​Property_set>​
 + <​Property name = "​thermostat_pr"​ id="​prp_0">​
 + <​Attref ref = "​att_0"/>​
 + </​Property>​
 + <​Property name = "​time_temp_pr"​ id="​prp_1">​
 + <​Attref ref = "​att_1"/>​
 + <​Attref ref = "​att_2"/>​
 + </​Property>​
 + <​Property name = "​time_pr"​ id="​prp_2">​
 + <​Attref ref = "​att_1"/>​
 + </​Property>​
 + <​Property name = "​temperature"​ id="​prp_3">​
 + <​Attref ref = "​att_2"/>​
 + </​Property>​
 + <​Property name = "​date_hour_seasion_operation_pr"​ id="​prp_4">​
 + <​Attref ref = "​att_3"/>​
 + <​Attref ref = "​att_8"/>​
 + <​Attref ref = "​att_6"/>​
 + <​Attref ref = "​att_5"/>​
 + </​Property>​
 + <​Property name = "​date_hour_pr"​ id="​prp_5">​
 + <​Attref ref = "​att_3"/>​
 + <​Attref ref = "​att_8"/>​
 + </​Property>​
 + <​Property name = "​season_operation_pr"​ id="​prp_6">​
 + <​Attref ref = "​att_6"/>​
 + <​Attref ref = "​att_5"/>​
 + </​Property>​
 + <​Property name = "​day_month_today_pr"​ id="​prp_7">​
 + <​Attref ref = "​att_10"/>​
 + <​Attref ref = "​att_9"/>​
 + <​Attref ref = "​att_7"/>​
 + </​Property>​
 + <​Property name = "​day_today_pr"​ id="​prp_8">​
 + <​Attref ref = "​att_10"/>​
 + <​Attref ref = "​att_7"/>​
 + </​Property>​
 + <​Property name = "​thermostat_settings_pr"​ id="​prp_9">​
 + <​Attref ref = "​att_0"/>​
 + </​Property>​
 + <​Property name = "​operation_pr"​ id="​prp_10">​
 + <​Attref ref="​att_1"/>​
 +         </​Property>​
 + <​Property name = "​season_pr"​ id="​prp_11">​
 + <​Attref ref="​att_2"/>​
 +         </​Property>​
 + <​Property name = "​today_pr"​ id="​prp_12">​
 +     <Attref ref="​att_3"/>​
 + </​Property>​
 + <​Property name = "​hour_pr"​ id="​prp_13">​
 +     <Attref ref="​att_4"/>​
 + </​Property>​
 + <​Property name = "​month_pr"​ id = "​prp_14">​
 + <​Attref ref = "​att_5"/>​
 + </​Property>​
 + <​Property name = "​day_pr"​ id = "​prp_15">​
 + <​Attref ref = "​att_6"/>​
 + </​Property>​
 + <​Property name = "​date"​ id = "​prp_16">​
 + <​Attref ref = "​att_3"/>​
 + </​Property>​
 + </​Property_set>​
 +
 + <​Tph>​
 +    <Trans src="​prp_0"​ dst="​prp_1"/>​
 + <Trans src="​prp_1"​ dst="​prp_2"/>​
 + <Trans src="​prp_1"​ dst="​prp_3"/>​
 + <Trans src="​prp_2"​ dst="​prp_4"/>​
 + <Trans src="​prp_3"​ dst="​prp_9"/>​
 + <Trans src="​prp_4"​ dst="​prp_5"/>​
 + <Trans src="​prp_4"​ dst="​prp_6"/>​
 + <Trans src="​prp_5"​ dst="​prp_13"/>​
 + <Trans src="​prp_5"​ dst="​prp_16"/>​
 + <Trans src="​prp_6"​ dst="​prp_10"/>​
 + <Trans src="​prp_6"​ dst="​prp_11"/>​
 + <Trans src="​prp_16"​ dst="​prp_7"/>​
 + <Trans src="​prp_7"​ dst="​prp_14"/>​
 + <Trans src="​prp_7"​ dst="​prp_8"/>​
 + <Trans src="​prp_8"​ dst="​prp_15"/>​
 + <Trans src="​prp_8"​ dst="​prp_12"/>​
 + </​Tph>​
 +
 + <​Ard>​
 + <Dep independent="​prp_15"​ dependent="​prp_12"/>​
 + <Dep independent="​prp_14"​ dependent="​prp_11"/>​
 + <Dep independent="​prp_13"​ dependent="​prp_10"/>​
 + <Dep independent="​prp_12"​ dependent="​prp_10"/>​
 + <Dep independent="​prp_10"​ dependent="​prp_9"/>​
 + <Dep independent="​prp_11"​ dependent="​prp_9"/>​
 + </​Ard>​
 +</​xmi:​XMI>​
 +</​code>​
  
 +  * Model ATL - nie wprowadza żadnych zmian w pliku wyjściowym
 +<​code>​
 +module ARD2ARD; -- Module Template
 +create OUT : Hml from IN : Hml;
  
 +rule Element2Element { 
 + from 
 + s : Hml!Element 
 + to 
 + t : Hml!Element ( 
 + id <- s.id 
 +
 +
 +rule Dep2Dep { 
 + from 
 + s : Hml!Dep 
 + to 
 + t : Hml!Dep ( 
 + independent <- s.independent,​ 
 + dependent <- s.dependent 
 +
 +
 +rule Trans2Trans { 
 + from 
 + s : Hml!Trans 
 + to 
 + t : Hml!Trans ( 
 + src <- s.src, 
 + dst <- s.dst 
 +
 +
 +rule Att2Att { 
 + from 
 + s : Hml!Trans 
 + to 
 + t : Hml!Trans ( 
 + name <- s.name 
 +
 +
 +rule Attref2Attref { 
 + from 
 + s : Hml!Trans 
 + to 
 + t : Hml!Trans ( 
 + ref <- s.ref 
 +
 +
 +</​code>​
  
 ====== Sprawozdanie ====== ====== Sprawozdanie ======
pl/miw/miw08_hekateatl.1222782233.txt.gz · ostatnio zmienione: 2019/06/27 15:58 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0