Home » Archived » 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  |
Eclipse User |
|
|
|
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] by Moderator
|
|
| | | |
Re: [How to] : Expressing constraints on type or class [message #1084268 is a reply to message #1083942] |
Sun, 11 August 2013 04:05   |
Eclipse User |
|
|
|
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 #1085000 is a reply to message #1084636] |
Mon, 12 August 2013 06:08   |
Eclipse User |
|
|
|
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
|
|
| |
Goto Forum:
Current Time: Tue May 13 08:06:17 EDT 2025
Powered by FUDForum. Page generated in 0.03588 seconds
|