Modeļu transformāciju valodu realizācija
Author
Šostaks, Agris
Co-author
Latvijas Universitāte. Datorikas fakultāte
Advisor
Kalniņš, Audris
Date
2010Metadata
Show full item recordAbstract
Pēdējos gados aizvien lielāku popularitāti gūst uz modeļiem balstītā pieeja programmatūras izstrādē (MDSD - Model Driven Software Development). Šīs pieejas pamatideja ir balstīt visus programmatūras izstrādes posmus uz specializētās modelēšanas valodās pierakstītiem modeļiem. MDSD pieejā programmatūras izstrāde notiek secīgos posmos, sākot ar mazāk detalizētiem modeļiem (augstāku abstrakcijas līmeni), ko izstrādes gaitā detalizē, iespējami vairāk izmantojot automātiskus modeļu pārveidojumus – modeļu transformācijas. Tieši automatizētie modeļu transformāciju soļi ļauj modeļus izmantot ne tikai kā dokumentāciju, bet arī kā tiešu programmatūras sastāvdaļu.
MDSD pirmsākumi ir meklējami starptautiskās standartizācijas organizācijas Object Managment Group (OMG) izdotajos dokumentos, kad 2000. gadā tika publicēts pirmais raksts par uz modeļiem balstīto arhitektūru (MDA – Model Driven Architecture). Drīz vien, jau 2002. gadā, OMG nonāk pie secinājuma, ka ir nepieciešama īpaša modeļu transformāciju valoda, ar kuras palīdzību būtu iespējams ērti aprakstīt nepieciešamos modeļu pārveidojumus. Tā kā viens no populārākajiem modelēšanas valodu definēšanas veidiem ir metamodelēšana, tad arī jauno transformāciju valodu tika nolemts veidot ar mērķi transformēt modeļus, kas ir definēti, izmantojot metamodeļus. Paši metamodeļi tiktu pierakstīti, izmantojot metamodelēšanas standartu MOF (Meta Object Facilities).
Kā sekas šīm OMG aktivitātēm radās ne tikai jauns modeļu transformāciju standarts MOF-QVT (MOF Queries/Views/Transformations), bet arī virkne jaunu modeļu transformāciju valodu ATL, GReAT, GrGen, Epsilon, kā arī LU MII izstrādātā modeļu transformāciju valoda MOLA. Jaunu pielietojumu apgabalu rada arī grafu transformāciju valodas, kuras līdz šim MDSD kontekstā netika lietotas, piemēram, PROGRES, AGG, VIATRA, vai arī tika lietotas šaurākā kontekstā, piemēram, Fujaba. Šāds transformāciju valodu daudzveidība ir saistīta ne tikai ar to, ka MOF-QVT standarts nav realizēts (šobrīd tas daļēji ir realizēts mediniQVT rīkā), bet arī ar transformāciju valodu plašajām pielietošanas iespējām dažādās programmatūras izstrādes jomās, kas valodām uzliek specifiskas prasības.
Tā kā modeļu transformācijas ir samērā jauns pētījumu apgabals, tad transformāciju valodas efektīva realizācija ir būtisks priekšnoteikums veiksmīgiem turpmākajiem pētījumiem šajā jomā. Vairumā modeļu transformāciju valodu tiek izmantots meklēšanas pēc šablona (pattern matching) mehānisms, kā efektīva realizācija ir netriviāls uzdevums, jo vispārīgā gadījumā tas reducējas uz apakšgrafu izomorfisma (subgraph isomorphism) problēmu, kas ir NP-pilna. Tieši efektīva meklēšanas pēc šablona realizācija ir centrālā promocijas darba pētījumu tēma.
Pētījumu mērķis ir izstrādāt efektīvu meklēšanas pēc šablona algoritmu modeļu transformāciju valodām un pārbaudīt tā efektivitāti praksē. Šis promocijas darbs piedāvā jaunu, viegli implementējamu meklēšanas pēc šablona algoritmu, kas šablonus pārveido par SQL vaicājumiem. Promocijas darbā ir piedāvāts arī jauns meklēšanas pēc šablona algoritms, kas ir efektīvs tieši tipiskiem MDSD uzdevumiem un izmanto lokālo plāno ģenerācijas metodi. Minētie algoritmi ir realizēti valodai MOLA. Darbā piedāvāts arī algoritms, kas papildināts ar metamodeļu anotāciju mehānismu ļauj izmantot izstrādātāja zināšanās par modelējamo problēmu apgabalu. Galvenie darbā aprakstītie rezultāti ir sekojoši:
- Izstrādāts vienkārši realizējams algoritms meklēšanai pēc šablona modeļu transformāciju valodām, izmantojot relāciju datubāzes un SQL valodu. Šī algoritma galvenā priekšrocība ir tas, ka to iespējams ātri realizēt, iegūstot darbojošos valodas prototipu īsā laikā. Tas iespējams, jo tiek izmantots relāciju datubāzu pārvaldības sistēmu vaicājumu optimizācijas mehānismi kas ir gadu gaitā pārbaudīta vērtība.
- Piedāvātais algoritms praksē ir realizēts valodai MOLA. Ir izveidots valodas MOLA interpretators, kas darbojas, izmantojot populārākās relāciju datubāzu pārvaldības In software engineering the Model Driven Software Development (MDSD) has gained continuously increasing popularity in recent years. The basic idea behind this approach is to drive all phases of software development by models described in specialized modelling languages. Software development using MDSD approach takes place in several consecutive steps, starting with development of less detailed models (higher level of abstraction). In the next steps details are specified using automatic model transformations. These automated model transformations allow using models not like documentation only, but also as direct components of software.
The first ideas of MDSD have emerged in the documents released by the international standardization organization Object Management Group (OMG) in year 2000, when for the first time a paper on Model Driven Architecture (MDA) has been published. Soon, in year 2002, OMG understood that a special model transformation language was required to specify model transformations in a convenient way. Since one of the most popular means for defining models is metamodelling, the new model transformation language was intended to transform models which are defined using metamodels. Meta Object Facilities (MOF) was the metamodelling language which had been proposed for defining metamodels.
As a consequence of OMG activities a new model transformation standard MOF Queries/Views/Transformations (MOF QVT) has been created and many new independent model transformation languages have been developed: ATL, GReAT, GrGen, Epsilon, and also MOLA language developed by IMCS, UL. A new area of application has been found also for graph transformation languages which were used in the context of MDSD, for example, PROGRES, AGG, VIATRA, or languages which were used in other areas, like, Fujaba. Explanation of such a large number of model transformation languages can be found in the lack of MOF QVT implementation (a partial implementation is available in mediniQVT). Another reason is a wide range of applications in different fields of software development.
Since research on model transformations is rather new, an efficient implementation of model transformation languages is an important requirement for further research in the area. Most of model transformation languages are using pattern matching mechanism. Implementation of pattern matching is a non-trivial task, because in general it can be reduced to sub-graph isomorphism problem which is NP-complete. An efficient implementation of pattern matching is the main research topic of the thesis.
The goal of the research is development of efficient pattern matching algorithms for model transformation languages. Effectiveness of algorithms has to be tested also practically. The research introduces a new easy implementable pattern matching algorithm which is based on relational databases and SQL queries. Another new pattern matching algorithm which uses local search plan generation approach is offered for MDSD-related tasks. Both algorithms have been implemented for model transformation language MOLA. A more advanced solution is also introduced for other domains. It is a local search plan strategy combined with the metamodel annotation mechanism, which allows using the developer’s knowledge of model constraints that otherwise could be obtained only by analysis of existing models. The main results of the thesis are:
- A new pattern matching algorithm has been developed for model transformation languages. The algorithm uses relational database and SQL queries. The main advantage of the algorithm is the simple mapping from pattern to single SQL query. The implementation of this mapping is easy thus enabling fast development of an efficient model transformation language prototype. In this case the hardest part, the actual pattern matching, is done by query optimization features of the relational database management system.
- The developed algorithm has been practically implemented for