QVT 1.3 RTF Avatar
  1. OMG Issue

QVT13 — QVTo: when and where as assertions

  • Key: QVT13-24
  • Legacy Issue Number: 18363
  • Status: closed  
  • Source: gmail.com ( Fáo Levy Siqueira)
  • Summary:

    In operational QVT, it is not clear what happens when the "when" or "where" clause of an inherited mapping does not hold.

    Suggestion:
    Considering inheritance is a type (or, maybe, a synonym) of generalization, it would be expected that the semantics of inheritance mimics the semantics of generalization in MOF. The UML, which defines generalization used by CMOF and EMOF, states: "... features specified for instances of the general classifier are implicitly specified for instances of the specific classifier. Any constraint applying to instances of the general classifier also applies to instances of the specific classifier." (UML Infrastructure 2.4.1, p.51). If the "when" and "where" clauses are considered as features of a mapping, the clauses of the inherited mapping should be implicitly specified. Similarly, if they are considered as constraints applying to a mapping, the clauses defined in the inherited mapping should apply to the inheriting mapping. Therefore, a possible solution in both situations is to consider that the "when" and "where" clauses must hold in the inheriting mapping.

    Commentary:
    An interesting discussion is if something similar to the Liskov substitution principle should be applied in this situation.

  • Reported: QVT 1.1 — Fri, 4 Jan 2013 05:00 GMT
  • Disposition: Resolved — QVT 1.3
  • Disposition Summary:

    Undefined semantics for unsatisfied "when" and "where" in inherited mapping

    In operational QVT, it is not clear what happens when the "when" or "where" clause of an inherited mapping does not hold.

    Suggestion:
    Considering inheritance is a type (or, maybe, a synonym) of generalization, it would be expected that the semantics of inheritance mimics the semantics of generalization in MOF. The UML, which defines generalization used by CMOF and EMOF, states: "... features specified for instances of the general classifier are implicitly specified for instances of the specific classifier. Any constraint applying to instances of the general classifier also applies to instances of the specific classifier." (UML Infrastructure 2.4.1, p.51). If the "when" and "where" clauses are considered as features of a mapping, the clauses of the inherited mapping should be implicitly specified. Similarly, if they are considered as constraints applying to a mapping, the clauses defined in the inherited mapping should apply to the inheriting mapping. Therefore, a possible solution in both situations is to consider that the "when" and "where" clauses must hold in the inheriting mapping.

    Commentary:
    An interesting discussion is if something similar to the Liskov substitution principle should be applied in this situation.

    Discussion

    The suggestions regarding constraint inheritance and LSP are appropriate for a declarative language; they are not appropriate for a pragmatic imperative language such as QVTo. Each mapping can be independently specified.

    It can be made clearer that pre and post conditions are assertions that fail accordingly.

    Comparison of QVTr/QVTo when and where highlights the fallacy that a QVTo mapping is a refinement of QVTr relation. In QVTo, failure of a where post-condition is a catastrophic assertion failure, whereas a QVTr where clause is a corrollary to be attempted afterwards and ignored if it fails/fails to match. The claim in 8.1.4 that the QVTo when and where clauses are owned by QVTr is untrue; QVTo owns its own when and where clauses and works very well without any QVTr objects.

  • Updated: Tue, 29 Mar 2016 15:09 GMT