Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Xcore Validation
Xcore Validation [message #891758] Mon, 25 June 2012 19:54 Go to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
http://wiki.eclipse.org/EMF/Validation/Recipes claims that "Xcore supports direct maintenance of Java validation code within Ecore models" but I haven't been able to find any documentation of that feature. Does it really exist? Smile
Re: Xcore Validation [message #891806 is a reply to message #891758] Tue, 26 June 2012 05:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Miles,

There isn't yet direct support for expressing constraints in Xbase,
other than invariant operations, (or as annotations).

On 25/06/2012 9:54 PM, Miles Parker wrote:
> http://wiki.eclipse.org/EMF/Validation/Recipes claims that "Xcore
> supports direct maintenance of Java validation code within Ecore
> models" but I haven't been able to find any documentation of that
> feature. Does it really exist? :)


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Xcore Validation [message #891944 is a reply to message #891806] Tue, 26 June 2012 16:06 Go to previous messageGo to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
Ed,

Can you say a bit more about invariant operations? Do you mean just like with the current validation framework? It seems like that might still be more maintainable, as at least the logic and annotations would be in one place. Do you happen to have an example of that?

On the other hand, speaking of annotations, that's the one area of Xcore that I'm finding disappointing. (Otherwise, it is clearly more productive and I think a better sale to non-modelistas.) We get these lovely compact text models and then they get junked up with all of the java style "@" verbosity for genmodel constructs, etc.. Plus you lose the separation of concerns. Have you thought about other ways to support some kind of "advisement" of the core model design that allows the annotations to be maintained separately?

cheers,

Miles
Re: Xcore Validation [message #892010 is a reply to message #891944] Tue, 26 June 2012 19:52 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Miles,

Comments below.
On 26/06/2012 6:06 PM, Miles Parker wrote:
> Ed,
>
> Can you say a bit more about invariant operations? Do you mean just
> like with the current validation framework?
Yes; it's just an EOperation with a special signature, so you can define
an XOperation that will convert to the right thing and have an Xbase body...
> It seems like that might still be more maintainable, as at least the
> logic and annotations would be in one place. Do you happen to have an
> example of that?
No, but the validation overview shows one...
>
> On the other hand, speaking of annotations, that's the one area of
> Xcore that I'm finding disappointing. (Otherwise, it is clearly more
> productive and I think a better sale to non-modelistas.) We get these
> lovely compact text models and then they get junked up with all of the
> java style "@" verbosity for genmodel constructs, etc.. Plus you lose
> the separation of concerns. Have you thought about other ways to
> support some kind of "advisement" of the core model design that allows
> the annotations to be maintained separately?
Well, there's really no reason an external GenModel can't refer to the
EPackage that's in an Xcore resource. There's just no nice wizard to
set it up that way.
>
> cheers,
>
> Miles


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Xcore Validation [message #892850 is a reply to message #892010] Sat, 30 June 2012 13:15 Go to previous messageGo to next message
João Paulo Almeida is currently offline João Paulo AlmeidaFriend
Messages: 1
Registered: June 2012
Junior Member
Ed,

What would be the signature of an invariant operation in XCore?

Would it be transformed into a public boolean validate(DiagnosticChain diagnostic, Map<Object, Object> context)?

thanks,
João Paulo
Re: Xcore Validation [message #892855 is a reply to message #892850] Sat, 30 June 2012 14:43 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
João,<br>
<br>
Comments below.<br>
<br>
<div class="moz-cite-prefix">On 30/06/2012 3:15 PM, João Paulo
Almeida wrote:<br>
</div>
<blockquote cite="mid:jsmu5u$qc4$1@xxxxxxxxe.org" type="cite">Ed,
<br>
<br>
What would be the signature of an invariant operation in XCore?
<br>
</blockquote>
<blockquote><small>import org.eclipse.emf.ecore.EDiagnosticChain<br>
import org.eclipse.emf.ecore.EMap<br>
<br>
class Foo<br>
{<br>
    op boolean bar(EDiagnosticChain diagnostics, EMap&lt;Object,
Object&gt; context)<br>
    {<br>
        return true<br>
    }<br>
}<br>
</small></blockquote>
<blockquote cite="mid:jsmu5u$qc4$1@xxxxxxxxe.org" type="cite">
<br>
Would it be transformed into a public boolean
validate(DiagnosticChain diagnostic, Map&lt;Object, Object&gt;
context)?
<br>
</blockquote>
It will be called from the generated validator:<br>
<blockquote><small>  public boolean validateFoo_bar(Foo foo,
DiagnosticChain diagnostics, Map&lt;Object, Object&gt; context)<br>
  {<br>
    return foo.bar(diagnostics, context);<br>
  }<br>
</small></blockquote>
<blockquote cite="mid:jsmu5u$qc4$1@xxxxxxxxe.org" type="cite">
<br>
thanks,
<br>
João Paulo
<br>
</blockquote>
<br>
<br>
</body>
</html>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Xcore Validation [message #893641 is a reply to message #892010] Thu, 05 July 2012 04:22 Go to previous messageGo to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
Ed Merks wrote on Tue, 26 June 2012 15:52
Miles,

Comments below.
On 26/06/2012 6:06 PM, Miles Parker wrote:
> It seems like that might still be more maintainable, as at least the
> logic and annotations would be in one place. Do you happen to have an
> example of that?
No, but the validation overview shows one...


Do you mean in POEcore? I guess all the plumbing would be the same. Hoping for some kind of syntactic magic there. Smile

BTW, the code you pasted got all html'ized on the forum post. Could you paste it in again in human readable form?
Re: Xcore Validation [message #893647 is a reply to message #893641] Thu, 05 July 2012 06:28 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Miles,

Posting it will probably just do it again:

import org.eclipse.emf.ecore.EDiagnosticChain
import org.eclipse.emf.ecore.EMap

class Foo
{
op boolean bar(EDiagnosticChain diagnostics, EMap<Object, Object>
context)
{
return true
}
}


On 05/07/2012 6:22 AM, Miles Parker wrote:
> Ed Merks wrote on Tue, 26 June 2012 15:52
>> Miles,
>>
>> Comments below.
>> On 26/06/2012 6:06 PM, Miles Parker wrote:
>> > It seems like that might still be more maintainable, as at least
>> the > logic and annotations would be in one place. Do you happen to
>> have an > example of that?
>> No, but the validation overview shows one...
>
>
> Do you mean in POEcore? I guess all the plumbing would be the same.
> Hoping for some kind of syntactic magic there. :)
>
> BTW, the code you pasted got all html'ized on the forum post. Could
> you paste it in again in human readable form?


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Xcore how to define the value of an EnumLiterals
Next Topic:EMF decorators
Goto Forum:
  


Current Time: Sat Apr 20 00:53:16 GMT 2024

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

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

Back to the top