QVT 1.0 NO IDEA Avatar
  1. OMG Issue

QVT — Relations language

  • Key: QVT-6
  • Legacy Issue Number: 10784
  • Status: closed  
  • Source: TCS ( Sreedhar Reddy)
  • Summary:

    Relations language: It appears redundant to have three different collection template
    expressions, viz. enumeration, comprehension and member selection. They can be unified into
    one expression. Suppose we have an extended member selection expression such as
    the following:
    <collectionTemplate> ::= [<identifier>] ':' <CollectionTypeIdentifierCS>
    '(' <TypeCS> ')'
    ['

    {' <memberSelection> '}

    ']

    <memberSelection> ::= (<identifier> | <objectTemplate> | '_')+
    '++'
    (<identifier> | '_')

    Enumeration can be specified as a collection of members to be matched:
    e.g. cs:Set(Class)

    { c1, c2, c3 ++ _ }


    Comprehension can be specified as a condition that each member of the collection
    must satisfy:
    e.g. cs:Set(Class)

    { cs->forAll(c| <condition>) }

  • Reported: QVT 1.0b1 — Thu, 22 Feb 2007 05:00 GMT
  • Disposition: Resolved — QVT 1.0
  • Disposition Summary:

    Suggestion accepted and reflected in the meta model and concrete syntax as follows:

    Meta model:
    Make the following changes to class CollectionTemplateExp in Figure 7.6 - QVT Template Package:
    · Rename the associations 'part' and 'match' to 'member' and 'rest'.
    · Make the 'member' association ordered and set its cardinality to '1..*'; set the cardinality of 'rest' to '1'.

    Modify the text explanation of CollectionTemplateExp in section 7.11.2.3 as follows:

    7.11.2.3 CollectionTemplateExp
    A collection template expression specifies a pattern that matches a collection of elements.
    It specifies a set of member expressions that match individual elements, and a collection-typed variable that matches the rest of the collection. The type of collection that a template matches is given by the referred collection type. If the referred collection type is a sequence then the matching member elements must be present at the head of the sequence in the order specified by the member expressions.

    Superclasses
    TemplateExp

    Associations
    referredCollectionType : CollectionType [1]
    The type of the collection that is being specified. It can be any of the EMOF
    collection types such as Set, Sequence, OrderedSet, etc.

    member : OclExpression [1..*]
    The expressions that the elements of the collection must have matches for. A
    special variable _ may be used to indicate that any arbitrary element may be
    matched and ignored.

    rest : OclExpression [1]
    The variable that the rest of the collection (i.e. excluding elements matched by
    member expressions) must match. A special variable _ may be used to indicate that
    any arbitrary collection may be matched and ignored.

    Concrete syntax:
    <collectionTemplate> ::= [<identifier>] ':' <CollectionTypeIdentifierCS>
    '(' <TypeCS> ')'
    ['

    {' <memberSelection> '}

    ']

    <memberSelection> ::= (<identifier> | <objectTemplate> | '_')+
    '++'
    (<identifier> | '_')

    The updated grammar is given in Appendix A of this report. This replaces the grammar given in section 7.13.

  • Updated: Fri, 6 Mar 2015 20:53 GMT