eclipse-qvtd / org.eclipse.qvtd

Eclipse Public License 2.0
0 stars 0 forks source link

[qvts] Diagnose stupid mappings #386

Open eclipse-qvtd-bot opened 13 hours ago

eclipse-qvtd-bot commented 13 hours ago

| --- | --- | | Bugzilla Link | 547305 | | Status | NEW | | Importance | P3 normal | | Reported | May 15, 2019 05:17 EDT | | Modified | Jun 05, 2019 06:22 EDT | | See also | 547247 | | Reporter | Ed Willink |

Description

The mapInPattern_filter for ATL2QVTr turns out to be a stupid relation:

/**
 *  atl::InPattern filter <=> qvtr::RelationDomain when\
 */\
top relation mapInPattern_filter {\
    atlExpression : atloclMM::OclExpression;\
    qvtrExpression : pivotMM::OCLExpression;\
    enforce domain atl atlPattern : InPattern {\
        rule = atlRule : MatchedRule{},\
        filter = atlExpression\
    };\
    enforce domain qvtr qvtrDomain : RelationDomain {\
        rule = qvtrRelation : Relation {\
            when = w : Pattern{\
                predicate = p : Predicate{\
                    conditionExpression = qvtrExpression\
                }\
            }\
        }\
    };\
    when {\
        mapMatchedRule(atlRule, qvtrRelation);\
        mapInPattern(atlPattern, qvtrDomain);\
        mapOclExpression(atlExpression, qvtrExpression);\
    }\
}

The comment is the first clue; the qvtr side is a RelationDomain.rule.when not RelationDomain.when. Design bit rot.

The head analysis for the trace has no problem on the ATL side: any of {atlExpression atlPattern atlRule} can be the head.\ \ But on the QVTr side two heads groups are needed. {qvtrDomain}, {p qvtrExpression} since Pattern.predicate and Relation.~rule.is 1:N.

The sensible mapping is ATL::InPattern <=> QVTr::Predicate with hierarchical containment; nothing particularly unusual.

The mapInPattern(atlPattern, qvtrDomain) is just garbage, at best just ensuring duplicate domain to relation assignment.

Is it the case that multiple heads are bad smells that should be brought to the users attention? Perhaps only asymmetric multiple heads.

Could the gratuitous mapInPattern(atlPattern, qvtrDomain) be partitioned out so that even if the gratuitous code is executed, it does not incur quadratic costs?

eclipse-qvtd-bot commented 13 hours ago

By Ed Willink on May 29, 2019 06:50

The stupid mapInPattern_filter is replaced in 2019-06M3.

Still need to diagnose the stupidity for the user.

eclipse-qvtd-bot commented 13 hours ago

By Ed Willink on May 31, 2019 03:40

While migrating Ecore2Pivot to exploit extent the root Extent2Model mapping was accidentally declared as not-top. This makes the trace realized and the output a spurious 'head' leading to obscure problems. Need to be more helpful.

Also the Extent::elements had an erroneous non-unit opposite that inhibited sensible head detection. This is mitigated by early emission of the prevailing trace model if scheduling fails. But need to be more helpful.

eclipse-qvtd-bot commented 13 hours ago

By Ed Willink on Jun 05, 2019 05:46

A dead non-top Relation (with no invocations) is diagnosed as: "No incoming connections for trace". True, but hardly helpful.

eclipse-qvtd-bot commented 13 hours ago

By Ed Willink on Jun 05, 2019 06:22

Multiple roots can easily lead to non 1:1 relationships and consequently

java.lang.AssertionError: PREDICATED-PatternTypedNode(when_mapEPackage : middle!trace_Ecore2Pivot::trace_Ecore2Pivot::TmapEPackage) is not reachable within mapEDataType_as

The immediate problem is that a 1:N rather than a 1:1 would require multipe heads, but (differeent bug) the preferred trace head has dominated.