Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » QVTO- creating RDBMS view from UML PIM
QVTO- creating RDBMS view from UML PIM [message #478760] Thu, 06 August 2009 18:12 Go to next message
Omran  is currently offline Omran Friend
Messages: 21
Registered: July 2009
Junior Member
Dear All,
I want to create a view in RDBMS PSM; I looked to class2table mapping and
tried to do some thing similare but i found the following

1-rdm metmodel view has the following
attributes(name,columns,ddl,referencedTablesAndViews)but the pim.simpluml
source model has only the following properties for its
classes(abstract,name,stereotype);
"How can we make pim.simppleuml has new properties such as ddl to map to
rdb target metamodel??"
"what are the chnages that we have to do in rdb metamodel and simpuml
metamodel if needed???"

2-I made a simple try to create a view by addin a class "myview" with
stereotype "view" then updating Simpleuml_To_Rdb.qvto using the code
below; but the view has not been created(WITH NO errORS);

mapping UML::Class::viewClass2viewtable() : RDB::view::View
when { self.isview() }
{
name := self.name;
columns := self.map class2vcolumns(self) ->sortedBy(name);
ddl := "aaaaa";
referencedTablesAndViews := null;

}


mapping UML::Class::class2vcolumns(targetClass: UML::Class) :
OrderedSet(RDB::view::ViewColumn) {
init {
result := self.map dataType2columns(targetClass)->
union(self.map generalizations2columns(targetClass))->asOrderedSet()
}
}


query UML::ModelElement::isview() : Boolean {
return self.stereotype->includes('view')
}


Any help is highly appreciated

regards,
Omran
Re: QVTO- creating RDBMS view from UML PIM [message #479492 is a reply to message #478760] Tue, 11 August 2009 10:25 Go to previous message
Sergey Boyko is currently offline Sergey BoykoFriend
Messages: 171
Registered: July 2009
Senior Member
Hi Omran ,

See some replies in-line, below.

Regards,
Sergey

Omran wrote:
> Dear All,
> I want to create a view in RDBMS PSM; I looked to class2table mapping
> and tried to do some thing similare but i found the following
>
> 1-rdm metmodel view has the following
> attributes(name,columns,ddl,referencedTablesAndViews)but the
> pim.simpluml source model has only the following properties for its
> classes(abstract,name,stereotype);

You listed only EAttribute-based properties. There are also
EReference-based properties (attributes, generalizations, taggedValue)
in SimpleUML classes.

> "How can we make pim.simppleuml has new properties such as ddl to map
> to rdb target metamodel??"

You can copy SimpleUML.ecore and rdb.ecore into workspace. When copied
these models can be referenced from Simpleuml_To_Rdb.qvto script as
descripbed in
http://www.eclipse.org/newsportal/article.php?id=4592&gr oup=eclipse.modeling.m2m#4592

After that you can change these workspace metamodels using for example
Ecore editor. All modifications made to them (after model saving) will
be immediately available in QVTo script.

> "what are the chnages that we have to do in rdb metamodel and simpuml
> metamodel if needed???"
>
> 2-I made a simple try to create a view by addin a class "myview" with
> stereotype "view" then updating Simpleuml_To_Rdb.qvto using the code
> below; but the view has not been created(WITH NO errORS);
>
> mapping UML::Class::viewClass2viewtable() : RDB::view::View
> when { self.isview() }
> {
> name := self.name;
> columns := self.map class2vcolumns(self) ->sortedBy(name);
> ddl := "aaaaa";
> referencedTablesAndViews := null;
>
> }
>
>
> mapping UML::Class::class2vcolumns(targetClass: UML::Class) :
> OrderedSet(RDB::view::ViewColumn) {
> init {
> result := self.map dataType2columns(targetClass)->
> union(self.map
> generalizations2columns(targetClass))->asOrderedSet()
> }
> }
>
>
> query UML::ModelElement::isview() : Boolean {
> return self.stereotype->includes('view')
> }

There's some inconsistent type checking in QVTo. Main problem is that
mapping dataType2columns() returns collection of type RDB::TableColumn
while mapping class2viewColumns() declares result to be collection of
type RDB::view::ViewColumn.
I'll file that bug.

However in any case you can't reuse existing mappings (since they are
results in collections of type RDB::TableColumn) and provide your own
mappings for type RDB::view::ViewColumn.
It may look like follows:

mapping UML::Class::class2vcolumns(targetClass: UML::Class) :
OrderedSet(RDB::view::ViewColumn) {
init {
result := self.map generalizations2viewColumns(targetClass)->
union(self.attributes->collect(i|object
RDB::view::ReferencedViewColumn{name := i.name})->asSet())->asOrderedSet()
}
}

mapping UML::Class::generalizations2viewColumns(targetClass :
UML::Class) : OrderedSet(RDB::view::ViewColumn) {
init {
result := self.generalizations.general->map
class2vcolumns(targetClass)->flatten()->asOrderedSet();
}
}


>
>
> Any help is highly appreciated
>
> regards,
> Omran
Previous Topic:[QVTO] Where to find the log output?
Next Topic:Calling Java Code from QVTO 1.0.1
Goto Forum:
  


Current Time: Thu Jan 16 13:27:55 GMT 2025

Powered by FUDForum. Page generated in 0.03467 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top