Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Integrate and validate OCL grammer in XText
Integrate and validate OCL grammer in XText [message #1385044] Tue, 03 June 2014 22:00 Go to next message
Aksa A is currently offline Aksa AFriend
Messages: 12
Registered: May 2014
Junior Member
I want to integrate OCL grammer with my DSL grammer in XText for the requirement to write and validate grammer for non functional properties. An informal
syntax like below for a grammer to be specified for non functional properties

in context <URIContextModel>
declare measurement
<Type> <Name> (<parameterList>) {
spec <OCLExpression> ;
}

One such example that is created from this is below.

declare measurement real response_time
(ServiceOperation op) {
spec op.invocations->last.end -
op.invocations->last.start ;
}

Now the text

op.invocations->last.end -
op.invocations->last.start ;

is an OCLExpression but it is based on a parameter op, which is a method parameter to be called for this non functional property and it is not OCL. How can I write grammer for the above example so that I can validate my above examples through it?


declare measurement real response_time
(ServiceOperation op) {
spec op.invocations->last.end -
op.invocations->last.start ;
}


How can I integrate OCL grammer to my DSL grammer in xtext? Some examples would be really appreciated.

Thanks in advance for your help.
Re: Integrate and validate OCL grammer in XText [message #1385099 is a reply to message #1385044] Wed, 04 June 2014 10:15 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6734
Registered: July 2009
Senior Member
Hi

Please use the OCL newsgroup for OCL discussions.

The OCL and QVTd projects provide a variety of examples that extend the
EssentialOCL.xtext grammar, however doing so is not nearly as easy as
extending Xbase where ultimately everything is Java rather than an
OMG-defined AST. There are no tutorials for this yet since the APIs are
far from stable.

Probably the easiest OCL approach would be to use Complete OCL so that
you can use an independent document with existing tooling to complement
your DSL.

If you really want an integrated approach look at the OCLinEcore.xtext
grammar that embeds OCL in a structural language for Ecore.

Regards

Ed Willink




On 04/06/2014 00:06, Aksa A wrote:
> I want to integrate OCL grammer with my DSL grammer in XText for the
> requirement to write and validate grammer for non functional
> properties. An informal syntax like below for a grammer to be
> specified for non functional properties
>
> in context <URIContextModel>
> declare measurement
> <Type> <Name> (<parameterList>) {
> spec <OCLExpression> ;
> }
>
> One such example that is created from this is below.
>
> declare measurement real response_time
> (ServiceOperation op) {
> spec op.invocations->last.end -
> op.invocations->last.start ;
> }
>
> Now the text
>
> op.invocations->last.end -
> op.invocations->last.start ;
>
> is an OCLExpression but it is based on a parameter op, which is a
> method parameter to be called for this non functional property and it
> is not OCL. How can I write grammer for the above example so that I
> can validate my above examples through it?
>
>
> declare measurement real response_time
> (ServiceOperation op) {
> spec op.invocations->last.end -
> op.invocations->last.start ;
> }
>
>
> How can I integrate OCL grammer to my DSL grammer in xtext? Some
> examples would be really appreciated.
>
> Thanks in advance for your help.
Re: Integrate and validate OCL grammer in XText [message #1385193 is a reply to message #1385099] Wed, 04 June 2014 21:17 Go to previous messageGo to next message
Aksa A is currently offline Aksa AFriend
Messages: 12
Registered: May 2014
Junior Member
First of all many thanks for your reply. I could not understand few things and I will appreciate if you can elaborate them further. Like

1- I can't find OCLinExore.xtext file and therefore can not look at any example to get inspiration from. Can you please send me a reference or link
where i can have a look at it?

2- Additionally do you think it is possible that OCL can use something defined outside OCL like ServiceOperation in my example? That would mean we are using
OCL expressions on an entity that is not OCL. I would appreciate if you can give some example to explain this if you think it is possible.

3- Complete OCL project does not link to OCL libraries? Again can you please share the link for Complete OCL you are talking about?

I am precisely looking for some example where I can have OCL Expressions part of grammer specified in XText so that I can write grammer for my scenarios.

Many Thanks really
Re: Integrate and validate OCL grammer in XText [message #1385259 is a reply to message #1385193] Thu, 05 June 2014 08:51 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6734
Registered: July 2009
Senior Member
HI

Get Eclipse OCL from GIT and search for *.xtext.

OCLinEcore.xtext

Regards

Ed Willink

On 04/06/2014 22:17, Aksa A wrote:
> First of all many thanks for your reply. I could not understand few
> things and I will appreciate if you can elaborate them further. Like
>
> 1- I can't find OCLinExore.xtext file and therefore can not look at
> any example to get inspiration from. Can you please send me a
> reference or link where i can have a look at it?
> 2- Additionally do you think it is possible that OCL can use something
> defined outside OCL like ServiceOperation in my example? That would
> mean we are using OCL expressions on an entity that is not OCL. I
> would appreciate if you can give some example to explain this if you
> think it is possible.
>
> 3- Complete OCL project does not link to OCL libraries? Again can you
> please share the link for Complete OCL you are talking about?
>
> I am precisely looking for some example where I can have OCL
> Expressions part of grammer specified in XText so that I can write
> grammer for my scenarios.
>
> Many Thanks really
>
Re: Integrate and validate OCL grammer in XText [message #1386581 is a reply to message #1385259] Wed, 18 June 2014 11:39 Go to previous messageGo to next message
Aksa A is currently offline Aksa AFriend
Messages: 12
Registered: May 2014
Junior Member
Hi,


When I try to run the Xtext artifcats of the project ocliecore.xtext I get this error:


>Caused by: org.eclipse.emf.mwe.core.ConfigurationException: Couldn't find an interface org.eclipse.ocl.examples.xtext.base.baseCST.BaseCSTPackage
at org.eclipse.emf.mwe.utils.StandaloneSetup.addRegisterGeneratedEPackage(StandaloneSetup.java:414)






Thanks, any help would be greatly appreciated.


Note: I also had the same error when I run my own project.
Re: Integrate and validate OCL grammer in XText [message #1386583 is a reply to message #1386581] Wed, 18 June 2014 11:44 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6734
Registered: July 2009
Senior Member
Hi

Since your own project fails, and you provide no details, I suggest you
start with one of the Xtext examples projects and see how your project
differs.

Regards

Ed Willink


On 18/06/2014 12:39, Aksa A wrote:
> Hi,
>
>
> When I try to run the Xtext artifcats of the project ocliecore.xtext I
> get this error:
>
>
>> Caused by: org.eclipse.emf.mwe.core.ConfigurationException: Couldn't
>> find an interface
>> org.eclipse.ocl.examples.xtext.base.baseCST.BaseCSTPackage
> at
> org.eclipse.emf.mwe.utils.StandaloneSetup.addRegisterGeneratedEPackage(StandaloneSetup.java:414)
>
>
>
>
>
>
> Thanks, any help would be greatly appreciated.
>
>
> Note: I also had the same error when I run my own project.
Previous Topic:Clean problem for DSLs in Xtext
Next Topic:Reference does not work
Goto Forum:
  


Current Time: Tue Jun 02 15:41:10 GMT 2020

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

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

Back to the top