Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » OCL evaluation error in Xtext editor(OCL validation returns error message in Xtext editor)
OCL evaluation error in Xtext editor [message #670016] Thu, 12 May 2011 12:31 Go to next message
Darie Moldovan is currently offline Darie MoldovanFriend
Messages: 67
Registered: November 2010
Location: Darmstadt, Germany
Member
Hello everyone,

I'm trying to define a very simple OCL expression in the Ecore, that checks if an element in my (Xtext) editor satisfies certain requirements - here I just want to make sure, that the name of each element is at least 4 characters long.

In the Ecore (at the right spot), I have the following:
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
      <details key="LongNameNecessary" value="asError((name).size() > 3)"/>
      <details key="LongNameNecessary$message" value="'Name should have more than 3 characters.'"/>
</eAnnotations>


The problem:

When I run the editor and write an element with a name that does not satisfy this condition, it is marked (as expected), but upon hovering on the element, I see the following message:

An exception occurred while delegating evaluation of the 'LongNameNecessary' constraint on 'MyML.impl.ElemImpl@12bad06{platform:/resource/TestOCLXtext2/src/test.abc#//@elements.0}': OCL validation result of 'LongNameNecessary' is null


But: not always! Confused Sometimes I see this error, after I change and save the file a couple of times, the right text appears when hovering over the element name...

I also read this thread and set the Operation Reflection to true in genmodel (and regenerated the model code), as Ed Wilink describes in the first reply to that thread.

Until now I couldn't find any solution to this problem. What I'm curious about is why the predefined message is not always shown. As I said, the validation seems to work properly, because the error marker is shown only when I define an element with a name shorter than 4 characters. If I change the name into a longer one, the marker dissappears. But the message I defined is shown only sometimes - instead I see the error above. Could this be a bug?

Any help is appreciated. Thank you in advance.

Darie

PS: I tried this in Eclipse Indigo Build id: 20110505-1223 with Xtext 2.0.0.v201105030849 and OCL 3.1.0.v20110502 (everything up to date)
Re: OCL evaluation error in Xtext editor [message #670112 is a reply to message #670016] Thu, 12 May 2011 16:56 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Darie

[Please use the OCL forum for OCL messages.]

You are clearly using very recent milestone releases of Xtext and OCL
with mixed success.

Both Xtext and OCL have had a variety of bug fixes at M6 and M7 and RC1
(imminent)
that might affect what you observe. You don't identify which versions
you're using so
it's difficult to look for a repro. I'll try and test this on RC1. If
you can send your exact
files, it improves my chances of reproducing the problem.

Regards

Ed Willink

On 12/05/2011 13:31, Darie wrote:
> Hello everyone,
>
> I'm trying to define a very simple OCL expression in the
> Ecore, that checks if an element in my (Xtext) editor
> satisfies certain requirements - here I just want to make
> sure, that the name of each element is at least 4
> characters long.
>
> In the Ecore (at the right spot), I have the following:
> <eAnnotations
> source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
> <details key="LongNameNecessary"
> value="asError((name).size() > 3)"/>
> <details key="LongNameNecessary$message" value="'Name
> should have more than 3 characters.'"/>
> </eAnnotations>
>
> The problem:
>
> When I run the editor and write an element with a name that
> does not satisfy this condition, it is marked (as
> expected), but upon hovering on the element, I see the
> following message:
>
> An exception occurred while delegating evaluation of the
> 'LongNameNecessary' constraint on
> 'MyML.impl.ElemImpl@12bad06 {platform:/resource/TestOCLXtext2/src/test.abc#//@elements.0 }':
>
> OCL validation result of 'LongNameNecessary' is null
>
> But: not always! :? Sometimes I see this error, after I
> change and save the file a couple of times, the right text
> appears when hovering over the element name...
>
> I also read
> http://www.eclipse.org/forums/index.php/mv/msg/173157/551060 /
> thread and set the Operation Reflection to true in genmodel
> (and regenerated the model code), as Ed Wilink describes in
> the first reply to that thread.
>
> Until now I couldn't find any solution to this problem. What
> I'm curious about is why the predefined message is not
> always shown. As I said, the validation seems to work
> properly, because the error marker is shown only when I
> define an element with a name shorter than 4 characters. If
> I change the name into a longer one, the marker dissappears.
> But the message I defined is shown only sometimes - instead
> I see the error above. Could this be a bug?
>
> Any help is appreciated. Thank you in advance.
>
> Darie
>
> PS: I tried this in Eclipse Indigo Build id: 20110505-1223
> with Xtext 2.0.0.v201105030849 and OCL 3.1.0.v20110502
> (everything up to date)
Re: OCL evaluation error in Xtext editor [message #671264 is a reply to message #670112] Tue, 17 May 2011 10:17 Go to previous messageGo to next message
Darie Moldovan is currently offline Darie MoldovanFriend
Messages: 67
Registered: November 2010
Location: Darmstadt, Germany
Member
Hello Ed,

sorry for the delayed response. In your reply, you wrote

Edward Willink
You don't identify which versions you're using so it's difficult to look for a repro.


You meant which versions of Xtext/OCL/Eclipse? If yes, I wrote them in my initial message, but here they are again:

-> Eclipse Indigo Build id: 20110505-1223
-> Xtext 2.0.0.v201105030849
-> OCL 3.1.0.v20110502
(everything up to date - maybe this is exactly the problem...)

Unfortunately I cannot give you the original source code, because it's part of a research project with non-public source code. But I created a new dummy Xtext project under the same platform, with a minimalist Xtext and Ecore model, just to be able to reproduce the error. I attached the model files to this post.

Because the new features of Xtext2 had some compatibility problems with Eclipse Helios, I wanted to test it on Indigo.

Thank you for your help. Please let me know if you need other information.

Regards,

Darie
  • Attachment: MyDSL.ecore
    (Size: 3.25KB, Downloaded 205 times)
  • Attachment: MyDsl.xtext
    (Size: 0.57KB, Downloaded 131 times)
Re: OCL evaluation error in Xtext editor [message #672374 is a reply to message #671264] Fri, 20 May 2011 20:50 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Darie

See response on OCL forum.

Regards

Ed Willink

On 17/05/2011 11:17, Darie wrote:
> Hello Ed,
>
> sorry for the delayed response. In your reply, you wrote
>
> Edward Willink
>> You don't identify which versions you're using so it's
>> difficult to look for a repro.
>
>
> You meant which versions of Xtext/OCL/Eclipse? If yes, I
> wrote them in my initial message, but here they are again:
>
> -> Eclipse Indigo Build id: 20110505-1223
> -> Xtext 2.0.0.v201105030849
> -> OCL 3.1.0.v20110502 (everything up to date - maybe this is exactly the
> problem...)
>
> Unfortunately I cannot give you the original source code,
> because it's part of a research project with non-public
> source code. But I created a new dummy Xtext project under
> the same platform, with a minimalist Xtext and Ecore model,
> just to be able to reproduce the error. I attached the model
> files to this post.
>
> Because the new features of Xtext2 had some compatibility
> problems with Eclipse Helios, I wanted to test it on
> Indigo.
>
> Thank you for your help. Please let me know if you need
> other information.
>
> Regards,
>
> Darie
> begin 644 MyDSL.ecore
> M/#]X;6P@=F5R<VEO;CTB,2XP(B!E;F-O9&EN9STB551&+3@B/SX-"CQE8V]R
> M93I%4&%C:V%G92!X;6DZ=F5R<VEO;CTB,BXP(@T*("`@('AM;&YS.GAM:3TB
> M:'1T<#HO+W=W=RYO;6<N;W)G+UA-22(@>&UL;G,Z>'-I/2)H='1P.B\O=W=W
> M+G<S+F]R9R\R,#`Q+UA-3%-C:&5M82UI;G-T86YC92(-"B`@("!X;6QN<SIE
> M8V]R93TB:'1T<#HO+W=W=RYE8VQI<'-E+F]R9R]E;68O,C`P,B]%8V]R92(@
> M;F%M93TB37E$4TPB#0H@("`@;G-54DD](FAT='`Z+R]W=W<N97AA;7!L92YC
> M;VTO;V-L+V-O<F4O37E$4TPB(&YS4')E9FEX/2)->4133"(^#0H@(#QE06YN
> M;W1A=&EO;G,@<V]U<F-E/2)H='1P.B\O=W=W+F5C;&EP<V4N;W)G+V5M9B\R
> M,#`R+T5C;W)E(CX-"B`@("`\9&5T86EL<R!K97D](FEN=F]C871I;VY$96QE
> M9V%T97,B('9A;'5E/2)H='1P.B\O=W=W+F5C;&EP<V4N;W)G+V5M9B\R,#`R
> M+T5C;W)E+T]#3"]0:79O="(O/@T*("`@(#QD971A:6QS(&ME>3TB<V5T=&EN
> M9T1E;&5G871E<R(@=F%L=64](FAT='`Z+R]W=W<N96-L:7!S92YO<F<O96UF
> M+S(P,#(O16-O<F4O3T-,+U!I=F]T(B\^#0H@("`@/&1E=&%I;',@:V5Y/2)V
> M86QI9&%T:6]N1&5L96=A=&5S(B!V86QU93TB:'1T<#HO+W=W=RYE8VQI<'-E
> M+F]R9R]E;68O,C`P,B]%8V]R92]/0TPO4&EV;W0B+SX-"B`@/"]E06YN;W1A
> M=&EO;G,^#0H@(#QE0VQA<W-I9FEE<G,@>'-I.G1Y<&4](F5C;W)E.D5#;&%S
> M<R(@;F%M93TB36]D96PB/@T*("`@(#QE4W1R=6-T=7)A;$9E871U<F5S('AS
> M:3IT>7!E/2)E8V]R93I%071T<FEB=71E(B!N86UE/2)N86UE(B!E5'EP93TB
> M96-O<F4Z141A=&%4>7!E(&AT='`Z+R]W=W<N96-L:7!S92YO<F<O96UF+S(P
> M,#(O16-O<F4C+R]%4W1R:6YG(B\^#0H@("`@/&53=')U8W1U<F%L1F5A='5R
> M97,@>'-I.G1Y<&4](F5C;W)E.D5!='1R:6)U=&4B(&YA;64](FQA;F=U86=E
> M(B!E5'EP93TB96-O<F4Z141A=&%4>7!E(&AT='`Z+R]W=W<N96-L:7!S92YO
> M<F<O96UF+S(P,#(O16-O<F4C+R]%4W1R:6YG(B\^#0H@("`@/&53=')U8W1U
> M<F%L1F5A='5R97,@>'-I.G1Y<&4](F5C;W)E.D5!='1R:6)U=&4B(&YA;64]
> M(G9E<G-I;VXB(&54>7!E/2)E8V]R93I%1&%T851Y<&4@:'1T<#HO+W=W=RYE
> M8VQI<'-E+F]R9R]E;68O,C`P,B]%8V]R92,O+T53=')I;F<B+SX-"B`@("`\
> M95-T<G5C='5R86Q&96%T=7)E<R!X<VDZ='EP93TB96-O<F4Z15)E9F5R96YC
> M92(@;F%M93TB96QE;65N=',B('5P<&5R0F]U;F0](BTQ(@T*("`@("`@("!E
> M5'EP93TB(R\O06)S=')A8W1%;&5M96YT(B!C;VYT86EN;65N=#TB=')U92(O
> M/@T*("`\+V5#;&%S<VEF:65R<SX-"B`@/&5#;&%S<VEF:65R<R!X<VDZ='EP
> M93TB96-O<F4Z14-L87-S(B!N86UE/2)!8G-T<F%C=$5L96UE;G0B+SX-"B`@
> M/&5#;&%S<VEF:65R<R!X<VDZ='EP93TB96-O<F4Z14-L87-S(B!N86UE/2)%
> M;G1I='DB(&53=7!E<E1Y<&5S/2(C+R]!8G-T<F%C=$5L96UE;G0B/@T*("`@
> M(#QE06YN;W1A=&EO;G,@<V]U<F-E/2)H='1P.B\O=W=W+F5C;&EP<V4N;W)G
> M+V5M9B\R,#`R+T5C;W)E(CX-"B`@("`@(#QD971A:6QS(&ME>3TB8V]N<W1R
> M86EN=',B('9A;'5E/2),;VYG3F%M94YE8V5S<V%R>2(O/@T*("`@(#PO94%N
> M;F]T871I;VYS/@T*("`@(#QE06YN;W1A=&EO;G,@<V]U<F-E/2)H='1P.B\O
> M=W=W+F5C;&EP<V4N;W)G+V5M9B\R,#`R+T5C;W)E+T]#3"]0:79O="(^#0H@
> M("`@("`\9&5T86EL<R!K97D](DQO;F=.86UE3F5C97-S87)Y(B!V86QU93TB
> M87-%<G)O<B@H;F%M92DN<VEZ92@I(#X@,RDB+SX-"B`@("`@(#QD971A:6QS
> M(&ME>3TB3&]N9TYA;65.96-E<W-A<GDD;65S<V%G92(@=F%L=64](B=4:&4@
> M;&5N9W1H(&]F('1H92!E;&5M96YT(&YA;64@;75S="!B92!G<F5A=&5R('1H
> M86X@,RXG(B\^#0H@("`@/"]E06YN;W1A=&EO;G,^#0H@("`@/&5/<&5R871I
> M;VYS(&YA;64](F%S17)R;W(B(&]R9&5R960](F9A;'-E(B!E5'EP93TB96-O
> M<F4Z141A=&%4>7!E(&AT='`Z+R]W=W<N96-L:7!S92YO<F<O96UF+S(P,#(O
> M16-O<F4C+R]%0F]O;&5A;B(^#0H@("`@("`\94%N;F]T871I;VYS('-O=7)C
> M93TB:'1T<#HO+W=W=RYE8VQI<'-E+F]R9R]E;68O,C`P,B]%8V]R92]/0TPO
> M4&EV;W0B/@T*("`@("`@("`\9&5T86EL<R!K97D](F)O9'DB('9A;'5E/2)I
> M9B!V97)D:6-T('1H96X@=')U92!E;'-E(&YU;&P@96YD:68B+SX-"B`@("`@
> M(#PO94%N;F]T871I;VYS/@T*("`@("`@/&5087)A;65T97)S(&YA;64](G9E
> M<F1I8W0B(&]R9&5R960](F9A;'-E(B!E5'EP93TB96-O<F4Z141A=&%4>7!E
> M(&AT='`Z+R]W=W<N96-L:7!S92YO<F<O96UF+S(P,#(O16-O<F4C+R]%0F]O
> M;&5A;B(O/@T*("`@(#PO94]P97)A=&EO;G,^#0H@("`@/&53=')U8W1U<F%L
> M1F5A='5R97,@>'-I.G1Y<&4](F5C;W)E.D5!='1R:6)U=&4B(&YA;64](FYA
> M;64B(&54>7!E/2)E8V]R93I%1&%T851Y<&4@:'1T<#HO+W=W=RYE8VQI<'-E
> M+F]R9R]E;68O,C`P,B]%8V]R92,O+T53=')I;F<B+SX-"B`@/"]E0VQA<W-I
> M9FEE<G,^#0H@(#QE0VQA<W-I9FEE<G,@>'-I.G1Y<&4](F5C;W)E.D5%;G5M
> M(B!N86UE/2)%;&5M051Y<&4B/@T*("`@(#QE3&ET97)A;',@;F%M93TB03$B
> M+SX-"B`@("`\94QI=&5R86QS(&YA;64](D$R(B!V86QU93TB,2(O/@T*("`@
> M(#QE3&ET97)A;',@;F%M93TB03,B('9A;'5E/2(R(B\^#0H@(#PO94-L87-S
> M:69I97)S/@T*("`\94-L87-S:69I97)S('AS:3IT>7!E/2)E8V]R93I%0VQA
> M<W,B(&YA;64](D5L96U!(B!E4W5P97)4>7!E<STB(R\O16YT:71Y(CX-"B`@
> M("`\95-T<G5C='5R86Q&96%T=7)E<R!X<VDZ='EP93TB96-O<F4Z14%T=')I
> M8G5T92(@;F%M93TB=&ET;&4B(&54>7!E/2)E8V]R93I%1&%T851Y<&4@:'1T
> M<#HO+W=W=RYE8VQI<'-E+F]R9R]E;68O,C`P,B]%8V]R92,O+T53=')I;F<B
> M+SX-"B`@("`\95-T<G5C='5R86Q&96%T=7)E<R!X<VDZ='EP93TB96-O<F4Z
> M14%T=')I8G5T92(@;F%M93TB='EP92(@951Y<&4](B,O+T5L96U!5'EP92(O
> M/@T*("`@(#QE4W1R=6-T=7)A;$9E871U<F5S('AS:3IT>7!E/2)E8V]R93I%
> M071T<FEB=71E(B!N86UE/2)D97-C<FEP=&EO;B(@951Y<&4](F5C;W)E.D5$
> M871A5'EP92!H='1P.B\O=W=W+F5C;&EP<V4N;W)G+V5M9B\R,#`R+T5C;W)E
> M(R\O15-T<FEN9R(O/@T*("`@(#QE4W1R=6-T=7)A;$9E871U<F5S('AS:3IT
> M>7!E/2)E8V]R93I%4F5F97)E;F-E(B!N86UE/2)S=7!P;W)T<R(@=6YI<75E
> M/2)F86QS92(-"B`@("`@("`@=7!P97)";W5N9#TB+3$B(&54>7!E/2(C+R]%
> M;&5M02(O/@T*("`\+V5#;&%S<VEF:65R<SX-"CPO96-O<F4Z15!A8VMA9V4^
> "#0H`
> `
> end
> begin 644 MyDsl.xtext
> M9W)A;6UA<B!O<F<N>'1E>'0N97AA;7!L92YM>61S;"Y->41S;"!W:71H(&]R
> M9RYE8VQI<'-E+GAT97AT+F-O;6UO;BY497)M:6YA;',*"FEM<&]R="`B<&QA
> M=&9O<FTZ+W)E<V]U<F-E+V]R9RYX=&5X="YE>&%M<&QE+FUY9'-L+F-O<F4O
> M;6]D96PO37E$4TPN96-O<F4B(`H*:6UP;W)T(")H='1P.B\O=W=W+F5C;&EP
> M<V4N;W)G+V5M9B\R,#`R+T5C;W)E(B!A<R!E8V]R90H*36]D96PZ"@DH)VUO
> M9&5L)R!N86UE/4E$*3\@"@DH)VQA;F=U86=E)R!L86YG=6%G93U)1"`H=F5R
> M<VEO;CU35%))3D<I/RD_"@DH96QE;65N=',K/4%B<W1R86-T16QE;65N="DJ
> M.PH*06)S=')A8W1%;&5M96YT.@H)16YT:71Y.PH*16YT:71Y.B`*"45L96U!
> M.PH*96YU;2!%;&5M051Y<&4Z"@E!,2!\($$R('P@03,["@D*16QE;4$Z"@DG
> M16QE;4$G(&YA;64]240@)R@G"@DH)W1I=&QE)R!T:71L93U35%))3D<I/PH)
> M*"=T>7!E)R!T>7!E/45L96U!5'EP92D_"@DH)V1E<V-R:7!T:6]N)R!D97-C
> M<FEP=&EO;CU35%))3D<I/R`*"2@G<W5P<&]R='-%;&5M02<@<W5P<&]R=',K
> J/5M%;&5M05T@*"<L)R!S=7!P;W)T<RL]6T5L96U!72DJ("D_"@DG*2<[
> `
> end
>
Previous Topic:"name" attribute and global visibility
Next Topic:Scope of XText
Goto Forum:
  


Current Time: Thu Mar 28 14:11:33 GMT 2024

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

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

Back to the top