|
|
Re: Getting model elements of other file for validation [message #895019 is a reply to message #895006] |
Wed, 11 July 2012 12:26 |
Hannes Müller Messages: 24 Registered: June 2012 |
Junior Member |
|
|
Hello,
Thx Ed for your answer - for the rest see below
Ed Merks wrote on Wed, 11 July 2012 07:39Hannes,
Comments below.
On 11/07/2012 1:22 PM, Hannes Müller wrote:
> Hello everyone,
>
> A short question: I have to model files (A and B for ease). In B I can
> reference to entities which I declared in A. So it seams that the
> model of A is known in B. But if I want to validate the model from B
> by checking for equal names in A I am not able to.
Can't you follow the references in B?
-> My validator starts with the root - so all elements should be reachable.
> In the validator methods I only get delivered the model elements of B
> by default.
Validators are generally applied to all the contents of each resource.
When you open A directly the validator will validate those, and, if you
have an Xtext nature in the project, the validator will run for each
resource in that project.
-> hm, this sounds like that I need: But if I debug than the followin happens:
A)In A are two measurements (here named ZigZag and Other)
measurements {
measurement ZigZag {
parameter BeginPos{
recalculates {
Customer & Finished ==> NOP;
}
}
state transitions {
Customer & Finished& FinishedAction ==> Customer & Finished;
}
}
end measurement;
measurement Other{
parameter BeginPos2{
recalculates {
Customer & Finished ==> NOP;
}
}
state transitions {
Customer & Finished& FinishedAction ==> Customer & Finished;
}
}
end measurement;
}
B) in B their is only one measurement
measurements {
measurement ZigZag {
parameter BeginPos2 {
recalculates {
Customer & Finished ==> 34;
}
}
state transitions {
Customer & Finished & FinishedAction ==> Customer & Finished;
}
}
end measurement;
}
If I make a change in A the validator starts and gets the root element of my model:
Here I get for A that I have one measurements element and two measurement elements. If I change B than I get one measurments element and one measurement element.
Also maybe interesting: The validation method will only be called one time (like I said before - the argument is the root element ...)
I also have other checks for other elements: The effect is the same for other elements! (two recalculates for A and one for B).
> That is why my question: How can I get the model elements of file A
> while the validator methods are called while changing something in
> model file B?
Would things in A really become invalid because of changes to B? It
sounds like all the problems should be in B when you change B, unless A
is referencing B...
-> B should be an extension to model A. A should represent the core functionalities and B C and D are individual models which use A and add their specific parts. An Example would be that a normal car has only the core functionalities like lights or wheels and the luxus edition has aircondition. That is the thought behind this.
>
> Thanks again for any answer
> Hannes
|
|
|
Re: Getting model elements of other file for validation [message #895031 is a reply to message #895019] |
Wed, 11 July 2012 13:04 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Hannes,
Comments below.
On 11/07/2012 2:26 PM, Hannes Müller wrote:
> Hello,
>
> Thx Ed for your answer - for the rest see below
> Ed Merks wrote on Wed, 11 July 2012 07:39
>> Hannes,
>>
>> Comments below.
>> On 11/07/2012 1:22 PM, Hannes Müller wrote:
>> > Hello everyone,
>> >
>> > A short question: I have to model files (A and B for ease). In B I
>> can > reference to entities which I declared in A. So it seams that
>> the > model of A is known in B. But if I want to validate the model
>> from B > by checking for equal names in A I am not able to. Can't you
>> follow the references in B?
>> -> My validator starts with the root - so all elements should be
>> reachable.
>> > In the validator methods I only get delivered the model elements of
>> B > by default. Validators are generally applied to all the contents
>> of each resource. When you open A directly the validator will
>> validate those, and, if you have an Xtext nature in the project, the
>> validator will run for each resource in that project.
>> -> hm, this sounds like that I need: But if I debug than the followin
>> happens:
>> A)In A are two measurements (here named ZigZag and Other)
>> measurements {
>> measurement ZigZag {
>> parameter BeginPos{
>> recalculates {
>> Customer & Finished ==> NOP;
>> }
>> }
>> state transitions { Customer & Finished&
>> FinishedAction ==> Customer & Finished;
>> }
>> }
>> end measurement;
>> measurement Other{
>> parameter BeginPos2{ recalculates {
>> Customer & Finished ==> NOP;
>> }
>> }
>> state transitions { Customer & Finished&
>> FinishedAction ==> Customer & Finished;
>> }
>> }
>> end measurement;
>> }
>>
>> B) in B their is only one measurement
>> measurements {
>> measurement ZigZag {
>> parameter BeginPos2 {
>> recalculates {
>> Customer & Finished ==> 34;
>> }
>> }
>> state transitions { Customer & Finished &
>> FinishedAction ==> Customer & Finished;
>> }
>> }
>> end measurement;
>> }
>> If I make a change in A the validator starts and gets the root
>> element of my model: Here I get for A that I have one measurements
>> element and two measurement elements. If I change B than I get one
>> measurments element and one measurement element.
>> Also maybe interesting: The validation method will only be called one
>> time (like I said before - the argument is the root element ...)
>> I also have other checks for other elements: The effect is the same
>> for other elements! (two recalculates for A and one for B).
>>
>> > That is why my question: How can I get the model elements of file A
>> > while the validator methods are called while changing something in
>> > model file B?
Are you saying B references A because B defines a measurement with the
same name as does A? Or is there actually a reference between the two
resources?
>> Would things in A really become invalid because of changes to B? It
>> sounds like all the problems should be in B when you change B, unless
>> A is referencing B...
>> -> B should be an extension to model A. A should represent the core
>> functionalities and B C and D are individual models which use A and
>> add their specific parts. An Example would be that a normal car has
>> only the core functionalities like lights or wheels and the luxus
>> edition has aircondition. That is the thought behind this.
There's no clear answer to any of your questions until you make it clear
how it is that B references A. I don't see anything in your example to
imply there's a reference between them.
>> >
>> > Thanks again for any answer
>> > Hannes
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03558 seconds