[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [qvtd-dev] ClassToRDBMSSchedule.qvti review
|
Hi Ed,
Comments in-line,
Horacio Hoyos RodrÃguez
EngD Student
University of York
http://www.york.ac.uk/docs/disclaimer/email.htm
-----Original Message-----
From: qvtd-dev-bounces@xxxxxxxxxxx [mailto:qvtd-dev-bounces@xxxxxxxxxxx]
On Behalf Of Ed Willink
Sent: 22 April 2013 11:45
To: QVTD developers mailing list
Subject: [qvtd-dev] ClassToRDBMSSchedule.qvti review
Hi Horacio
Just taken a quick look at your latest ClassToRDBMSSchedule.qvti.
There are quite a few MappingCalls missing e.g. classToTableLM
--------------------------------------------------------------------------
-----
The call
map classToTableLM {
p := p;
c := p.elements;
p2s := p2s;
}
for
map classToTableLM in umlRdbms {
uml (p:Package, c:Class |
c.kind = 'persistent';
c.namespace = p;) { }
where (p2s:PackageToSchema | p2s.umlPackage=p;) {
seems good. It is probably better to pass p and or p2s rather than
recompute them. But that makes "c.namespace = p" and "p2s.umlPackage=p"
redundant so they can be eliminated.
--------------------------------------------------------------------------
-----
The call
map associationToForeignKeyLM {
p := p;
a <= p.elements->select(a |
a.oclIsTypeOf(simpleuml::Association));
p2s := p2s;
sc <= a->collect(source);
dc <= a->collect(destination);
sc2t <= p2s->collect(classesToTables);
dc2t <= p2s->collect(classesToTables);
}
for
map associationToForeignKeyLM in umlRdbms {
uml (p:Package, sc:Class, dc:Class, a:Association |
-- getAllForwards(sc)->includes(a);
a.source = sc;
-- getAllSupers(dc)->includes(a.destination);
a.destination = dc;
a.namespace = p;
sc.namespace = p;) { }
where (p2s:PackageToSchema, sc2t:ClassToTable, dc2t:ClassToTable |
sc2t.owner = p2s;
p2s.umlPackage = p;
sc2t.umlClass = sc;
dc2t.umlClass = dc; ) {
is awful; a 5-dimensional loop with syntax errors.
Much better to do:
map associationToForeignKeyLM {
p := p;
a <= p.elements->select(a |
a.oclIsTypeOf(simpleuml::Association));
p2s := p2s;
}
for
map associationToForeignKeyLM in umlRdbms {
uml (p:Package, sc:Class, dc:Class, a:Association |
-- getAllForwards(sc)->includes(a);
sc = a.source;
-- getAllSupers(dc)->includes(a.destination);
dc = a.destination;
sc.namespace = p;) { }
where (p2s:PackageToSchema, sc2t:ClassToTable, dc2t:ClassToTable |
sc2t = sc.ClassToTable;
dc2t = dc.ClassToTable; ) {
so that sc, dc, sc2t, dc2t are computed in the callee, rather than looped
in the caller.
[Horacio Hoyos Rodriguez]
This will mean analysing the mapping guard predicates to change their
direction and to make the binding change them to assignments. On a mapping
call perspective it means that not all variables need to be bind in the
mapping call (optional parameters?). My initial proposal is not optimal
but for the moment I think it is more straight forward to compute. Your
proposal is more optimal but requires more intelligence on the QVTc to
QVTi translation. I think we should start with a simple and not optimal
QVTc to QVTi translation which we can easily program into Epsilon (and
then QVT) and once that is working see how we can optimize it. The syntax
error can be fixed by allowing mapping call variables to be used in the
oclexpressions if they have been defined previously.
--------------------------------------------------------------------------
------
map associationToForeignKeyLM {
p := p;
a <= p.elements->select(a |
a.oclIsTypeOf(simpleuml::Association));
p2s := p2s;
}
is inconsistent with
map booleanToBooleanLM {
p := p;
prim := p.elements;
p2s := p2s;
}
which could be
map booleanToBooleanLM {
p := p;
prim := p.elements->select(a |
a.oclIsTypeOf(simpleuml::PrimitiveDataType));
p2s := p2s;
}
Clearly the underlying mapping call implementation should have a recipient
type filter so that it is sufficient to write
map associationToForeignKeyLM {
p := p;
a <= p.elements;
p2s := p2s;
}
[Horacio Hoyos Rodriguez]
I was thinking about this too. The GuardPatternVisitor will need
modification to test if the binded value of the variable is of the precise
type. Should the match be exact or will super types be accepted as valid
matches?
--------------------------------------------------------------------------
------
The queries need implementation.
[Horacio Hoyos Rodriguez]
How do I pass the queries to the environment? Do I need to visit them so
OCL knows to what type to associate the query?
On a side note on this, the getAllForwards query in the QVT specification
refers to the forward attribute of the Class class. I don't have this
reference in my SimpleUML metamodel, so will you agree this is the
opposite of the source reference in the Association class?
You might postpone this for now by inlining them with the aid of the
closure iteration.
Regards
Ed
_______________________________________________
qvtd-dev mailing list
qvtd-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/qvtd-dev