Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EMF-IncQuery » [Solved] [How to] : Expressing constraints on type or class
[Solved] [How to] : Expressing constraints on type or class [message #1083740] Sat, 10 August 2013 07:58 Go to next message
Didier Garcin is currently offline Didier Garcin
Messages: 30
Registered: April 2013
Member
Hi,

I'm trying to define my first query.

The query should say : "Select a PrimitiveType's instance that has the stereotype NumericType or DataAccessSubtype"

I've tried this :

pattern primitiveTypeIsConcrete(p : PrimitiveType) =
{ NumericType(p); } or { DataAccessSubtype(p); }


and

pattern primitiveTypeIsConcrete(p) =
{ PrimitiveType(p) ; NumericType(p); } or {  PrimitiveType(p) ; DataAccessSubtype(p); }


but in both cases, the compiler complains :

Ambiguous variable type defintions: [PrimitiveType, DataAccessSubtype], type cannot be selected. Please specify the one to be used as the parameter type by adding it to the parameter definition.


Note : the following query is accepted but does not answer to the specification.

pattern primitiveTypeIsConcrete(p) =
{ NumericType(p); } or {  DataAccessSubtype(p); } 


How may I express that ?

Thank a lot for your contribution.

[Updated on: Sun, 11 August 2013 17:28]

Report message to a moderator

Re: [How to] : Expressing constraints on type or class [message #1083760 is a reply to message #1083740] Sat, 10 August 2013 08:42 Go to previous messageGo to next message
Istvan Rath is currently offline Istvan Rath
Messages: 54
Registered: July 2009
Member
Hi,

Van you specify what type of models are you using? UML or some custom DSL? Can you attach a small sample instance model?

Regards,
Istvan
Re: [How to] : Expressing constraints on type or class [message #1083761 is a reply to message #1083740] Sat, 10 August 2013 08:42 Go to previous messageGo to next message
Istvan Rath is currently offline Istvan Rath
Messages: 54
Registered: July 2009
Member
Hi,

Can you specify what type of models are you using? UML or some custom DSL? Can you attach a small sample instance model?

Regards,
Istvan
Re: [How to] : Expressing constraints on type or class [message #1083942 is a reply to message #1083761] Sat, 10 August 2013 15:24 Go to previous messageGo to next message
Didier Garcin is currently offline Didier Garcin
Messages: 30
Registered: April 2013
Member
Oh yes, of course.

I'm using UML2 extended with an UML profile of my own.

To precise the context, I just want to complete my UML profile with a constraint ensuring that each UML::PrimitiveType instance of a model (applying my UML profile) shall apply the stereotype MyProfile::NumericType or the stereotype MyProfile::DataAccessSubtype.

Here is the UML profile's diagram :

https://docs.google.com/file/d/0B9ec3j4ntOP7WmZOazZYTGpRZ2c/edit


This is the UML simple model on which the UML profile is applied :

https://docs.google.com/file/d/0B9ec3j4ntOP7ZU5kY04tbnRNVm8/edit

[Updated on: Sat, 10 August 2013 16:30]

Report message to a moderator

Re: [How to] : Expressing constraints on type or class [message #1084268 is a reply to message #1083942] Sun, 11 August 2013 04:05 Go to previous messageGo to next message
Istvan Rath is currently offline Istvan Rath
Messages: 54
Registered: July 2009
Member
Hi Didier,

The short answer is that unfortunately, due to the (rather complicated) way stereotypes, profile applications and UML type-instance relationships are represented by Eclipse UML2, IncQuery cannot (yet) fully support queries involving these constructs.

The full support for UML2 is in the works, however (https://bugs.eclipse.org/bugs/show_bug.cgi?id=414824), with some prerequsite features having already been addressed (e.g. dynamic EMF https://bugs.eclipse.org/bugs/show_bug.cgi?id=398874) or scheduled (e.g. generic queries https://bugs.eclipse.org/bugs/show_bug.cgi?id=398772). We are very open to external contributors, so if you feel like helping us out with this, you are more than welcome to do so.

best regards,
Istvan
Re: [How to] : Expressing constraints on type or class [message #1084636 is a reply to message #1084268] Sun, 11 August 2013 18:22 Go to previous messageGo to next message
Didier Garcin is currently offline Didier Garcin
Messages: 30
Registered: April 2013
Member
Hi Istvan,

Don't mind. Your project is very promising.
I confess I'm charmed by the design : possible applications, nice syntax, incremental evaluation, easy to use and integrate.

And naturally, your project is useful for my profile.

I would like to know if there is a formal specification of the syntax, published.

I'm honored by your proposition. If I can contribute, I would be pleased to do so.
That could begin by contributing to the user manual.
Keep me informed.

Best regards,
Didier.
Re: [How to] : Expressing constraints on type or class [message #1085000 is a reply to message #1084636] Mon, 12 August 2013 06:08 Go to previous messageGo to next message
Istvan Rath is currently offline Istvan Rath
Messages: 54
Registered: July 2009
Member
Hi Didier,

I have attempted to give you a hint on how the patterns would look like in http://git.eclipse.org/c/incquery/org.eclipse.incquery.examples.git/commit/?id=1a6ca89ec526f606ffda9a31e5cd73e68837d10f

The problem is I'm not that familiar with UML2, so it would help a lot if you could provide an example .uml file containing your profile and your model (made with Eclipse UML2) - then I could make the code example even more accurate. (However, this is just an illustration of how the syntax would look like, as UML2 uses derived features to express certain relationships, and these derived features do not yet work correctly with IncQuery.)

Quote:
I would like to know if there is a formal specification of the syntax, published.


Everything is described on http://incquery.net/incquery/language, some of this has already been migrated to http://wiki.eclipse.org/EMFIncQuery/UserDocumentation/QueryLanguage

We don't have a "formal" specification yet (I'm not entirely sure what you mean by formal, though, as the grammar is defined by Xtext grammar definition rules, see http://git.eclipse.org/c/incquery/org.eclipse.incquery.git/tree/plugins/org.eclipse.incquery.patternlanguage/src/org/eclipse/incquery/patternlanguage/PatternLanguage.xtext and http://git.eclipse.org/c/incquery/org.eclipse.incquery.git/tree/plugins/org.eclipse.incquery.patternlanguage.emf/src/org/eclipse/incquery/patternlanguage/emf/EMFPatternLanguage.xtext).

Quote:

I'm honored by your proposition. If I can contribute, I would be pleased to do so.
That could begin by contributing to the user manual.
Keep me informed.


Thank you. The user manual is maintained at the Eclipse.org wiki here: http://wiki.eclipse.org/EMFIncQuery
If you feel like it, you are welcome to contribute here, you can start e.g. by migrating interesting parts of http://incquery.net/incquery/documentation

best regards
Istvan
Re: [How to] : Expressing constraints on type or class [message #1085403 is a reply to message #1085000] Mon, 12 August 2013 18:02 Go to previous message
Didier Garcin is currently offline Didier Garcin
Messages: 30
Registered: April 2013
Member
Thanks again, Istvan,

Fine !

I study all the materials.
And I'll see how to complete the wiki.

Have a nice day, Istvan !

Previous Topic:[Solved] [EMF-IncQuery Project Builder] : Errors running builder 'EMF-IncQuery Project Builder'
Next Topic:Simple expression syntax
Goto Forum:
  


Current Time: Fri Aug 01 18:39:26 EDT 2014

Powered by FUDForum. Page generated in 0.01698 seconds