Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » VIATRA » Use qualified Classifier name
Use qualified Classifier name [message #1753785] Fri, 10 February 2017 08:25 Go to next message
Eric Lépicier is currently offline Eric LépicierFriend
Messages: 25
Registered: October 2013
Junior Member
Hi,

In my .eiq file, I need two import two Ecore packages which contains classifiers having the same name.
In the patterns, I can use only the classifier imported from the first import clause.

I can't find the syntax to be more precise about the classifier, is there a kind of qualified name built with the Ecore package ? Or with the Java generated package ?

An example could be in using the classifiers Constraint, which are present inside Ecore OCL, IQPL and Capella :
import "http://www.eclipse.org/ocl/1.1.0/Ecore"
import "http://www.eclipse.org/incquery/patternlanguage/PatternLanguage"
import "http://www.polarsys.org/capella/core/core/0.8.0"

Cheers,
Eric
Re: Use qualified Classifier name [message #1753793 is a reply to message #1753785] Fri, 10 February 2017 09:36 Go to previous messageGo to next message
Abel Hegedus is currently offline Abel HegedusFriend
Messages: 197
Registered: September 2015
Senior Member
Hi Eric,

depending on your version, you can use the "as" keyword to alias packages. See for example here and used here

import "http://www.eclipse.org/uml2/5.0.0/UML" as uml

pattern typeDefinitionInPackage(umlPackage: Package, type : uml::Type) {
[...]
}
Re: Use qualified Classifier name [message #1753797 is a reply to message #1753793] Fri, 10 February 2017 10:00 Go to previous messageGo to next message
Eric Lépicier is currently offline Eric LépicierFriend
Messages: 25
Registered: October 2013
Junior Member
Thanks Abel,

I read about that, but forgot it as it is not so often needed.

By the way, we're still using IncQuery 0.7 ...
The "as" syntax doesn't seem to be available in this old version ?
Is there another solution ?
Re: Use qualified Classifier name [message #1753798 is a reply to message #1753793] Fri, 10 February 2017 10:01 Go to previous messageGo to next message
Eric Lépicier is currently offline Eric LépicierFriend
Messages: 25
Registered: October 2013
Junior Member
Thanks Abel,

I read about that, but forgot it as it is not so often needed.

By the way, we're still using IncQuery 0.7 ...
The "as" syntax doesn't seem to be available in this old version ?
Is there another solution ?
Re: Use qualified Classifier name [message #1753799 is a reply to message #1753793] Fri, 10 February 2017 10:01 Go to previous messageGo to next message
Eric Lépicier is currently offline Eric LépicierFriend
Messages: 25
Registered: October 2013
Junior Member
Thanks Abel,

I read about that, but forgot it as it is not so often needed.

By the way, we're still using IncQuery 0.7 ...
The "as" syntax doesn't seem to be available in this old version ?
Is there another solution ?
Re: Use qualified Classifier name [message #1753800 is a reply to message #1753793] Fri, 10 February 2017 10:02 Go to previous messageGo to next message
Eric Lépicier is currently offline Eric LépicierFriend
Messages: 25
Registered: October 2013
Junior Member
Thanks Abel,

I read about that, but forgot it as it is not so often needed.

By the way, we're still using IncQuery 0.7 ...
The "as" syntax doesn't seem to be available in this old version ?
Is there another solution ?
Re: Use qualified Classifier name [message #1753801 is a reply to message #1753800] Fri, 10 February 2017 10:05 Go to previous messageGo to next message
Eric Lépicier is currently offline Eric LépicierFriend
Messages: 25
Registered: October 2013
Junior Member
Sorry for duplicates, the thing went crazy ... Please delete as I can't do it myself.
Re: Use qualified Classifier name [message #1753802 is a reply to message #1753800] Fri, 10 February 2017 10:06 Go to previous messageGo to next message
Eric Lépicier is currently offline Eric LépicierFriend
Messages: 25
Registered: October 2013
Junior Member
Sorry for duplicates, the thing went crazy ... Please delete as I can't do it myself.
Re: Use qualified Classifier name [message #1753803 is a reply to message #1753798] Fri, 10 February 2017 10:12 Go to previous messageGo to next message
Abel Hegedus is currently offline Abel HegedusFriend
Messages: 197
Registered: September 2015
Senior Member
I can't remember whether cross-resource find pattern was available in EMF-IncQuery 0.7.0, but if it was, you might be able to workaround the problem by creating three additional EIQ files where each imports only one of the metamodels and create helper patterns for wrapping the individual types, e.g.:

ocl-helper.eiq:
import "http://www.eclipse.org/ocl/1.1.0/Ecore"

pattern oclConstraint(c) {
  Constraint(c);
}


iqpl-helper.eiq:
import "http://www.eclipse.org/incquery/patternlanguage/PatternLanguage"

pattern iqplConstraint(c) {
  Constraint(c);
}


Then you can simply use the helper patterns to enforce the correct type, e.g.

pattern myP() {
  find oclConstraint(c);
  [...]
}


I don't know exactly in which scenarios would the name clash create problems, so this might not work.
Re: Use qualified Classifier name [message #1753942 is a reply to message #1753803] Mon, 13 February 2017 08:40 Go to previous message
Eric Lépicier is currently offline Eric LépicierFriend
Messages: 25
Registered: October 2013
Junior Member
Thanks Abel for this workaround.

Cheers,
--Eric
Previous Topic:vaitra queries visualised using Sirius
Next Topic:Importing Ecore metamodel into Modelspace with VIATRA2 R3.1
Goto Forum:
  


Current Time: Fri Dec 13 00:39:27 GMT 2024

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

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

Back to the top