Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Keeping an exact reference to source model element
Keeping an exact reference to source model element [message #990214] Tue, 11 December 2012 13:07 Go to next message
Leonid Ripeynih is currently offline Leonid Ripeynih
Messages: 99
Registered: February 2012
Member
Hi! I have a simple rule:

rule Formular2GFElement {
  from
    c : UML!Class(
      c.isFormular
    )
  to 
    gf : GF!FGUmlLinked (
      name <- c.name,
      umlElement <- c,
      child <- c.attribute -> 
        collect(a | thisModule.FProperty2GFElement(a))		
    )
}


umlElement is of type UML!NamedElement. However, with traceability links it's resolced to 'gf' itself ('/'). How could i resolve it to 'c'?

Many thanks in advance!

[Updated on: Tue, 11 December 2012 13:08]

Report message to a moderator

Re: Keeping an exact reference to source model element [message #990223 is a reply to message #990214] Tue, 11 December 2012 13:34 Go to previous messageGo to next message
Andreas Brieg is currently offline Andreas Brieg
Messages: 48
Registered: November 2012
Member
If you use refining model, you could try this:
rule Formular2GFElement {
  from
    c : UML!Class(
      c.isFormular
    )
  to 
    out: UML!Class(
        ),
    gf : GF!FGUmlLinked (
      name <- c.name,
      umlElement <- c,
      child <- c.attribute -> 
        collect(a | thisModule.FProperty2GFElement(a))		
    )
}

The first element of the to clause is refined to the first element in the from clause. So you need to break the identity between c and gf, which is wrongly established. By specifying a dummy element in the to clause, gf won't be the same as c.
Re: Keeping an exact reference to source model element [message #990413 is a reply to message #990214] Wed, 12 December 2012 10:56 Go to previous messageGo to next message
Leonid Ripeynih is currently offline Leonid Ripeynih
Messages: 99
Registered: February 2012
Member
Thank you for you answer.

I'm not using refining model, just generating a complete new (kind of decorator) model for the source model.
Re: Keeping an exact reference to source model element [message #990556 is a reply to message #990214] Thu, 13 December 2012 06:50 Go to previous message
Leonid Ripeynih is currently offline Leonid Ripeynih
Messages: 99
Registered: February 2012
Member
After a few hours of frustration I've discrovered that imperative assigments will not follow traceability links and found this solution:

rule Formular2GFElement {
  from
    c : UML!Class(
      c.isFormular
    )	
  to 
    gf : GF!FGUmlLinked (
      name <- c.name,
      child <- c.attribute -> collect(a |
        thisModule.FProperty2GFElement(a))	
    )
  do {
    gf.umlElement <- c;
  }
}
Re: Keeping an exact reference to source model element [message #990720 is a reply to message #990214] Wed, 12 December 2012 21:14 Go to previous message
Dennis Wagelaar is currently offline Dennis Wagelaar
Messages: 164
Registered: September 2012
Senior Member

Like this:

umlElement <:= c

(assignment instead of binding)

Dennis

Op 11-12-12 14:07, Dark Diver schreef:
> Hi! I have a simple rule:
>
> rule Formular2GFElement {
> from
> c : UML!Class(
> c.isFormular
> )
> to gf : GF!FGUmlLinked (
> name <- c.name,
> umlElement <- c
> child <- c.attribute -> collect(a |
> thisModule.FProperty2GFElement(a))
> )
> }
>
>
> umlElement is of type UML!NamedElement. However, with traceability links it's
> resolced to 'gf' itself ('/'). How could i resolve it to 'c'?
> Many thanks in advance!


Cheers,
Dennis
Previous Topic:Applying Stereotypes
Next Topic:[MMT] EMFInjector to inject objects
Goto Forum:
  


Current Time: Sun Sep 21 10:17:26 GMT 2014

Powered by FUDForum. Page generated in 0.02350 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software