Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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.

--------------------------------------------------------------------------------

    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;
    }

--------------------------------------------------------------------------------

The queries need implementation.

You might postpone this for now by inlining them with the aid of the closure iteration.

    Regards

        Ed



Back to the top