Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Xtext validation using Complete OCL
Xtext validation using Complete OCL [message #1230265] Sat, 11 January 2014 13:48 Go to next message
Vlad Gheorghe is currently offline Vlad GheorgheFriend
Messages: 127
Registered: May 2011
Senior Member
Hello,

I have followed the OCL help documentation OCL Integration/Complete OCL for Xtext Validation to setup the Complete OCL validation in my xtext DSL implementation.

Xtext does invoke the registerd CompleteOCLEObjectValidator, but in the method
EObjectValidator#validatePivot validationAdapter==null, and thus validation is not performed.

Is it necessary to configure the ValidationAdapter too ?
Where should this be done ?

( In XText there is one ResourceSet instance per editor - so I assume that the editor should do it. Is this right ?)

Is there any documentation on this ? (I couldnt find any..)

Best regards
Vlad Gheorghe
Re: Xtext validation using Complete OCL [message #1230278 is a reply to message #1230265] Sat, 11 January 2014 14:35 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

When I came to prepare my Eclipse Eutope 2013 presentation, I recall
being embarrassed that a couple of use cases didn't work, so I fixed them.

If you're using less than Luna M3 you may be hitting one of these
problems. The Luna OCL milestones are installable on Kepler, which will
probably install the corresponding Xtext too.

Regards

Ed Willink



On 11/01/2014 13:48, Vlad Gheorghe wrote:
> Hello,
>
> I have followed the OCL help documentation OCL Integration/Complete
> OCL for Xtext Validation to setup the Complete OCL validation in my
> xtext DSL implementation.
>
> Xtext does invoke the registerd CompleteOCLEObjectValidator, but in
> the method
> EObjectValidator#validatePivot validationAdapter==null, and thus
> validation is not performed.
>
> Is it necessary to configure the ValidationAdapter too ?
> Where should this be done ?
>
> ( In XText there is one ResourceSet instance per editor - so I assume
> that the editor should do it. Is this right ?)
>
> Is there any documentation on this ? (I couldnt find any..)
>
> Best regards
> Vlad Gheorghe
Re: Xtext validation using Complete OCL [message #1230290 is a reply to message #1230278] Sat, 11 January 2014 15:28 Go to previous messageGo to next message
Vlad Gheorghe is currently offline Vlad GheorgheFriend
Messages: 127
Registered: May 2011
Senior Member
Hi Ed,

Thanks for the reply.

I found really useful to have the constraints in a separate file.
I have used before EMFV constraints defined in xml files, but it was rather cumbersome.

The current application uses xtext, so I gather EMFV is out of discussion.
Our application must soon be in production - so I also have to consider the stability of the used components.

What would you recommend to use for OCL validation of model instances of ecore-based metamodels, in production-use applications ?

Best regards
Vlad Gheorghe




Re: Xtext validation using Complete OCL [message #1230301 is a reply to message #1230290] Sat, 11 January 2014 15:56 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

There has been steady evolution making OCL in Ecore steadily more
useable. As you note OCL inCDATA is not really tenable.

The OCL concrete syntax is very stable. It's the tooling that hopefully
gets better and better. So if you develop OCL futuire evolution should
only require peripheral tweaks.

I am a major supporter of OCL so I would certainly recommend it for
someone like you who won't get thrown by a minor hiccough.

Production-use? Well if you mention safety critical... Not today, but
there are few other approaches that can actually be better.

Realistically you have to see whether it's herlpful for you.

The classic Ecore-based OCL is very stable but has corner bugs that are
too hard to fix.

The new modelled pivot OCL used with Xtext is potentially much cleaner,
but if you look at some of the recent bug fixes, it's clearly not yet
perfect.

I would use OCLinEcore as first choice, or Complete OCL where you need
to separate structural and validation concerns.

[I'm still hoping to have a Validity View for detailed control of
constraints with the ability to fire off a debugger to investigate
failures for Luna.]

Regards

Ed Willink


On 11/01/2014 15:28, Vlad Gheorghe wrote:
> Hi Ed,
>
> Thanks for the reply.
>
> I found really useful to have the constraints in a separate file.
> I have used before EMFV constraints defined in xml files, but it was
> rather cumbersome.
>
> The current application uses xtext, so I gather EMFV is out of
> discussion.
> Our application must soon be in production - so I also have to
> consider the stability of the used components.
>
> What would you recommend to use for OCL validation of model instances
> of ecore-based metamodels, in production-use applications ?
>
> Best regards
> Vlad Gheorghe
>
>
>
>
>
Re: Xtext validation using Complete OCL [message #1230956 is a reply to message #1230301] Mon, 13 January 2014 13:00 Go to previous messageGo to next message
Vlad Gheorghe is currently offline Vlad GheorgheFriend
Messages: 127
Registered: May 2011
Senior Member
Hi Ed,

Thanks for the recommendations.

I have installed the examples 4.2M3 and I have made some progress in loading the complete ocl.
I think I'll give up the convenience of completeOCL and switch to oclinecore, hoping that it will work.

The current error that I get is:

528837 [Worker-5] ERROR main.utilities.StandaloneProjectMap - Conflicting access to 'platform:/resource/[...]/model/ptest.ecore' or 'platform:/plugin/[...]/model/ptest.ecore' already accessed as 'http://thalesgroup.com/dts/l905/ptest/model/config/1.0'

I think that this happens because ptest.ecore stores a ptest package and a ptestc package, nested under ptest.

The ocl file uses
import 'ptest.ecore/#'

trying to say that we import the root package, not the nested one.

Do you have such a test case ?
Is this another bug ?

Regards
Vlad Gheorghe

Re: Xtext validation using Complete OCL [message #1230969 is a reply to message #1230956] Mon, 13 January 2014 13:35 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

As far as I am aware Eclipse OCL is the only tooling that gives you some
assistance with metamodel schizophrenia; loading two different models
with the same nsURI. By default the loader redirects later accesses to
the the first.

This is almost certainly user stupidity.

Regards

Ed Willink


On 13/01/2014 13:00, Vlad Gheorghe wrote:
> Hi Ed,
>
> Thanks for the recommendations.
>
> I have installed the examples 4.2M3 and I have made some progress in
> loading the complete ocl.
> I think I'll give up the convenience of completeOCL and switch to
> oclinecore, hoping that it will work.
>
> The current error that I get is:
>
> 528837 [Worker-5] ERROR main.utilities.StandaloneProjectMap -
> Conflicting access to 'platform:/resource/[...]/model/ptest.ecore' or
> 'platform:/plugin/[...]/model/ptest.ecore' already accessed as
> 'http://thalesgroup.com/dts/l905/ptest/model/config/1.0'
>
> I think that this happens because ptest.ecore stores a ptest package
> and a ptestc package, nested under ptest.
>
> The ocl file uses
> import 'ptest.ecore/#'
>
> trying to say that we import the root package, not the nested one.
>
> Do you have such a test case ?
> Is this another bug ?
>
> Regards
> Vlad Gheorghe
>
>
Re: Xtext validation using Complete OCL [message #1231047 is a reply to message #1230969] Mon, 13 January 2014 17:39 Go to previous messageGo to next message
Vlad Gheorghe is currently offline Vlad GheorgheFriend
Messages: 127
Registered: May 2011
Senior Member
Hello Ed,

I am aware that having meta-models in the dev workspace and in the dev platform produces a lot of headaches (we also use acceleo which at best, just throws some exceptions if not satisfied..)

However, I think there might be an issue in the OCL runtime too.
In my case, a single ecore file (ptest.ecore) stores TWO packages, having distinct URIs, one nested below the other.

Do you think this case should be supported ?

Regards
Vlad Gheorghe





Re: Xtext validation using Complete OCL [message #1231109 is a reply to message #1231047] Mon, 13 January 2014 21:17 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Should be supported for multiple packages. (Bug 404660 should only
affect CG.)

Regards

Ed Willink

On 13/01/2014 17:39, Vlad Gheorghe wrote:
> Hello Ed,
>
> I am aware that having meta-models in the dev workspace and in the dev
> platform produces a lot of headaches (we also use acceleo which at
> best, just throws some exceptions if not satisfied..)
>
> However, I think there might be an issue in the OCL runtime too.
> In my case, a single ecore file (ptest.ecore) stores TWO packages,
> having distinct URIs, one nested below the other.
>
> Do you think this case should be supported ?
>
> Regards
> Vlad Gheorghe
>
>
>
>
>
>
Re: Xtext validation using Complete OCL [message #1231515 is a reply to message #1231109] Tue, 14 January 2014 21:31 Go to previous messageGo to next message
Vlad Gheorghe is currently offline Vlad GheorgheFriend
Messages: 127
Registered: May 2011
Senior Member
Hello Ed,

It would be very nice of you to also recommend some written material that might hopefully fix the 'user stupidity' that you have noticed.
This is a technical forum, after all..

Regards
Vlad


Re: Xtext validation using Complete OCL [message #1231643 is a reply to message #1231515] Wed, 15 January 2014 05:56 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi<br>
<br>
I started writing an nsURI blog/paper but time ... money ...
enthisiasm ...<br>
<br>
You got really quite a good error message<br>
<br>
528837 [Worker-5] ERROR main.utilities.StandaloneProjectMap  -
Conflicting access to 'platform:<i class="moz-txt-slash"><span
class="moz-txt-tag">/</span>resource<span class="moz-txt-tag">/</span></i>[...]/model/ptest.ecore' 
or 'platform:<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>plugin<span
class="moz-txt-tag">/</span></i>[...]/model/ptest.ecore'
already accessed as '<a class="moz-txt-link-freetext"
href="http://thalesgroup.com/dts/l905/ptest/model/config/1.0">http://thalesgroup.com/dts/l905/ptest/model/config/1.0</a>'
<br>
<br>
a) a location<br>
b) a target<br>
c) two conflicting sources<br>
<br>
I suggest you use a debugger or text search to understand why you
are using two different URIs<br>
<br>
platform:<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>plugin<span
class="moz-txt-tag">/</span></i>[...]/model/ptest.ecore<br>
<a class="moz-txt-link-freetext"
href="http://thalesgroup.com/dts/l905/ptest/model/config/1.0">http://thalesgroup.com/dts/l905/ptest/model/config/1.0</a><br>
<br>
as references to the one model.<br>
<br>
    Regards<br>
<br>
        Ed Willink<br>
<br>
On 14/01/2014 21:31, Vlad Gheorghe wrote:<br>
</div>
<blockquote cite="mid:lb4abt$368$1@xxxxxxxxe.org" type="cite">Hello
Ed,
<br>
<br>
It would be very nice of you to also recommend some written
material that might hopefully fix the 'user stupidity' that you
have noticed.
<br>
This is a technical forum, after all..
<br>
<br>
Regards
<br>
Vlad
<br>
<br>
<br>
<br>
</blockquote>
<br>
</body>
</html>
Re: Xtext validation using Complete OCL [message #1235886 is a reply to message #1231643] Sat, 25 January 2014 15:48 Go to previous messageGo to next message
Vlad Gheorghe is currently offline Vlad GheorgheFriend
Messages: 127
Registered: May 2011
Senior Member
Hello Ed,

After some more tries, I've decided to go with OCLinEcore and the mature LPG implementation in this project - this works for the moment.

However, I would like to clarify what was wrong with the setup that prevented CompleteOCL from being initialized.

I think it is related to some inconsistencies in the references between the various models and meta-models involved. (the schizophrenia that you mention in other posts).
Could you share the paper/blog on this topic, even if it's incomplete ?
Or - maybe that would be easier - can you recommend an example of project that has
- an ecore model referencing another ecore model - available in the target platform (e.g. UML.ecore)
- generates code from the ecore (genmodel)
- an xtext grammar for it - which uses both myDSL and UML models

The general questions are
- what kind of URI to use for references in each case ?
- and where to have the referenced metamodels in the development ?

I guess a 'canonic' example would respond to all the cases.

Best regards
Vlad Gheorghe









Re: Xtext validation using Complete OCL [message #1236164 is a reply to message #1235886] Sun, 26 January 2014 12:00 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You can find some of my thoughts in
https://bugs.eclipse.org/bugs/show_bug.cgi?id=360926#c7 and the
referenced StandaloneProjectMap/ProjectMap Java Docs.

The fundamental problem is that each of

http://www.eclipse.org/emf/2002/Ecore

platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore

platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore

is a distinct document URI and so may loaded separately even though they
all shore the same namespace URI.

So you may have 3 different EClass instances and anything that work on
type equality or type inheritance gets confused and gives you helpful
messages such as EClass is not equal to EClass which is correct but
really confusing.

You must either use only one of the document URIs transitively
throughout your whole application or use StandaloneProjectMap to
redirect the diverse accesses to the first referenced.

Regards

Ed Willink


On 25/01/2014 15:48, Vlad Gheorghe wrote:
> Hello Ed,
>
> After some more tries, I've decided to go with OCLinEcore and the
> mature LPG implementation in this project - this works for the moment.
>
> However, I would like to clarify what was wrong with the setup that
> prevented CompleteOCL from being initialized.
>
> I think it is related to some inconsistencies in the references
> between the various models and meta-models involved. (the
> schizophrenia that you mention in other posts).
> Could you share the paper/blog on this topic, even if it's incomplete ?
> Or - maybe that would be easier - can you recommend an example of
> project that has - an ecore model referencing another ecore model -
> available in the target platform (e.g. UML.ecore)
> - generates code from the ecore (genmodel)
> - an xtext grammar for it - which uses both myDSL and UML models
>
> The general questions are - what kind of URI to use for references
> in each case ? - and where to have the referenced metamodels in the
> development ?
>
> I guess a 'canonic' example would respond to all the cases.
>
> Best regards
> Vlad Gheorghe
>
>
>
>
>
>
>
>
>
>
Previous Topic:change in the use of environmentView from juno to kepler
Next Topic:Defining a Data Type with operations visible in OCL
Goto Forum:
  


Current Time: Thu Apr 25 04:55:56 GMT 2024

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

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

Back to the top