Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [VALIDATION] How to customize Messages when loading OCL from file
[VALIDATION] How to customize Messages when loading OCL from file [message #424156] Fri, 17 October 2008 18:14 Go to next message
Torsten Link is currently offline Torsten LinkFriend
Messages: 51
Registered: July 2009
Member
Hi,

1.
I tried out the org.eclipse.validation.examples.ocl
and adapt this to my project. I like to have the OCL
Statements in a separate File.

But in the file I found no possibility to give
a name for the constraint and an own message
if the constraint failed.

Do I need to implement an own parser for the text file
or is there maybe an other solution with an
external XML File already in place.


2. When validating my model via the 'validate'
menue entry in the generated editor only the selected
element and its direkt children where validated.
The validation did not do an deep recursiv validation.
Is that right?



with kind regards


Torsten Link
Re: [VALIDATION] How to customize Messages when loading OCL from file [message #424162 is a reply to message #424156] Fri, 17 October 2008 18:43 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Torsten,

I'm sure Christian will have more to say, but I didn't get point 2.
Only the element and its direct children is a deep recursive
validation. You're hoping it would walk cross references as well as
containment references as part of the recursion? Likely Christian will
explain that you can control the traversal mechanism with the extended
validation framework yourself...


Torsten Link wrote:
> Hi,
>
> 1.
> I tried out the org.eclipse.validation.examples.ocl
> and adapt this to my project. I like to have the OCL
> Statements in a separate File.
>
> But in the file I found no possibility to give
> a name for the constraint and an own message
> if the constraint failed.
>
> Do I need to implement an own parser for the text file
> or is there maybe an other solution with an
> external XML File already in place.
>
>
> 2. When validating my model via the 'validate'
> menue entry in the generated editor only the selected
> element and its direkt children where validated.
> The validation did not do an deep recursiv validation.
> Is that right?
>
>
>
> with kind regards
>
>
> Torsten Link
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [VALIDATION] How to customize Messages when loading OCL from file [message #424168 is a reply to message #424162] Fri, 17 October 2008 20:29 Go to previous messageGo to next message
Torsten Link is currently offline Torsten LinkFriend
Messages: 51
Registered: July 2009
Member
Ed Merks wrote:

> Torsten,
>
> I'm sure Christian will have more to say, but I didn't get point 2.
> Only the element and its direct children is a deep recursive
> validation. You're hoping it would walk cross references as well as
> containment references as part of the recursion? Likely Christian will
> explain that you can control the traversal mechanism with the extended
> validation framework yourself...
Hi Ed,

I mean the recursion for containment elements
go only one level deep. I thought it should
visit the children and the children of the children and so
on. So that it visits the hole tree.



Thanks


Torsten Link



>
> Torsten Link wrote:
>> Hi,
>>
>> 1.
>> I tried out the org.eclipse.validation.examples.ocl
>> and adapt this to my project. I like to have the OCL
>> Statements in a separate File.
>>
>> But in the file I found no possibility to give
>> a name for the constraint and an own message
>> if the constraint failed.
>>
>> Do I need to implement an own parser for the text file
>> or is there maybe an other solution with an
>> external XML File already in place.
>>
>>
>> 2. When validating my model via the 'validate'
>> menue entry in the generated editor only the selected
>> element and its direkt children where validated.
>> The validation did not do an deep recursiv validation.
>> Is that right?
>>
>>
>>
>> with kind regards
>>
>>
>> Torsten Link
>>
Re: [VALIDATION] How to customize Messages when loading OCL from file [message #424169 is a reply to message #424156] Fri, 17 October 2008 21:34 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Torsten,

See some replies in-line, below.

HTH,

Christian

Torsten Link wrote:
> Hi,
>
> 1.
> I tried out the org.eclipse.validation.examples.ocl
> and adapt this to my project. I like to have the OCL
> Statements in a separate File.
>
> But in the file I found no possibility to give
> a name for the constraint and an own message
> if the constraint failed.

Right, this file just literally follows the OCL concrete syntax for
constraint context definitions (and the OCL constraint expressions,
themselves).


> Do I need to implement an own parser for the text file
> or is there maybe an other solution with an
> external XML File already in place.

There are all the solutions that you care to invent. :-)

You can extend the OCL language with a grammar and parser of your own,
much as the QVTo and UMLX projects have done. Or, you can do some kind
of hybrid approach, in which you parse a text file to extract the OCL
bits and the messages, and use the OCL parser on the OCL bits. Or, you
define an XML file (using EMF, of course) that externally associates
messages with the constraint names.

etc.


> 2. When validating my model via the 'validate'
> menue entry in the generated editor only the selected
> element and its direkt children where validated.
> The validation did not do an deep recursiv validation.
> Is that right?

How do you know that these elements weren't validated? Maybe they just
didn't have problems? If you're using the OCL example, note that
constraints are only applied to elements of a type that conforms to the
constraint's context classifier.

Maybe the tree shows non-contained objects as children? Validation is
recursive (by default) over the EObject containment, not the
presentation in the editor.

As Ed alluded to, you can implement the ITraversalStrategy API to
customize the walking of your objects to implement non-recursive
traversal. Put a breakpoint in the TraversalStrategyManager to see
which traversal implementation is used when you validate.


>
> with kind regards
>
>
> Torsten Link
Previous Topic:Validator
Next Topic:[CDO] resource navigator?
Goto Forum:
  


Current Time: Fri Apr 26 13:59:25 GMT 2024

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

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

Back to the top