Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ETL] Error "Property 'stereotype' not found in object Class [...]"
[ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1125128] Fri, 04 October 2013 03:20 Go to next message
Alexander Fülleborn is currently offline Alexander Fülleborn
Messages: 32
Registered: April 2013
Member
Hello all,

in my ETL module, I want to restrict transformations to elements with a certain stereotype. Hence, I need to determine the stereotype of the elements. I do this using an own operation called "hasStereotype", see the following code.

operation Source!Class hasStereotype(name:String):Boolean {
return self.stereotype.exists(st:Class!Stereotype|st.name=name);
}

rule CopyProblemStatement
   transform sps : Source!Class
   to tps : Target!Class{
guard : sps.hasStereotype("Problemstatement")
}


Unfortunately, when I try to run this transformation, I receive an error, see the attached screenshot of the code and the error message.

I provide a detail description and minimum example concerning my project in a note and a zip file besides the screenshot of the code and the error message in the attachment to this message.

Any helpful hint is very much appreciated.

Kind regards, Alexander
Re: [ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1125831 is a reply to message #1125128] Fri, 04 October 2013 19:17 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 599
Registered: July 2009
Senior Member
Hi Alexander,

According the the EPackage Registry view, Class in UML doesn't have a "stereotype" property (at least in the version of UML that ships with Kepler). You probably need to use getAppliedStereotypes() instead.

Cheers,
Dimitris
Re: [ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1126310 is a reply to message #1125128] Sat, 05 October 2013 07:51 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander Fülleborn
Messages: 32
Registered: April 2013
Member
Hi Dimitris,

thanks a lot for your answer that indeed helped already to get on the right track. However, I now face the problem that the method "getAppliedStereotypes()" only finds the stereotype "class" instead of the additionally applied stereotype "problemstatement". Furthermore, I get some strange messages concerning the ambiguity of the element "Stereotype". In the following, I list my current ETL code:

rule CreateXDomainFromDomainSpecificProblemStatement
   transform sps : Source!Class
   to tps : Target!Class{
guard : sps.hasStereotype("problemstatement")
("Transform domain-specific problem statement '" + sps.getName() + "' to cross-domain problem statement...").println();
'Done.'.println();
}

operation Source!Class hasStereotype(name:String):Boolean {
  var rc:Boolean;
  rc = false;
  self.getName().println();
  var stereotypes:Sequence;
  stereotypes = self.getAppliedStereotypes();
  var stereotype:Stereotype;
  stereotype.println();
  name.println();
  for (stereotype in stereotypes){
    if (stereotype = name){
      rc = true;}
  }
  if (rc = true){
    return true;
  }
  if (rc = false){
    return false;
  }
}


I provide a zip file with the current project and in addition also an excerpt of the current epsilon log as a screenshot as an attachment to this message.

Another question: Where can I find the EPackage Registry view and the properties a Class has?

Thanks a lot for your very helpful support.

Alexander

[Updated on: Sat, 05 October 2013 07:55]

Report message to a moderator

Re: [ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1126421 is a reply to message #1126310] Sat, 05 October 2013 10:43 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 599
Registered: July 2009
Senior Member
Hi Alexander,

I've spotted two issues. First, your stereotyped is called "problem statement" instead of "problemstatement". As such your guard should look like this:

guard : sps.hasStereotype("problem statement")

Also, in "if (stereotype = name){" you're comparing a stereotype against a string. Your if statement should look like this instead:

if (stereotype.name = name){

Cheers,
Dimitris
Re: [ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1126450 is a reply to message #1126421] Sat, 05 October 2013 11:26 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander Fülleborn
Messages: 32
Registered: April 2013
Member
Hi Dimitris,

thanks a lot for your quick answer. Thanks also for the hints. However, the overall behaviour has not really changed after the corrections. Is it maybe possible that the stereotype "problem statement" is not known in the environment? Do I need to configure my ETL in the way that the profiles that need to recognized are identified?

Thanks and kind regards, Alexander
Re: [ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1126577 is a reply to message #1126450] Sat, 05 October 2013 14:44 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 599
Registered: July 2009
Senior Member
Hi Alexander,

I've made the suggested changes to your example and also added some code to apply the profile/stereotypes to the target model/classes. Please find a copy attached.

Cheers,
Dimitris
Re: [ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1127171 is a reply to message #1126577] Sun, 06 October 2013 06:48 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander Fülleborn
Messages: 32
Registered: April 2013
Member
Hi Dimitris,

thanks a lot - it works fine now - and I learned a lot from it Wink.

I did the same for the <<problembearing>> stereotype (depencency). I was able to filter such elements and add them to the target model. The problem I have now is how to get them connected to the other elements of the model. I played around with the equivalent() method but most probably miss some additional property that I need to use for this. I suppose that it must be something like:

sps.equivalent().<connectionToSourceElement>.add(tps);
sps.equivalent().<connectionToTargetElement>.add(tps);


Thanks a lot and kind regards, Alexander
Re: [ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1127201 is a reply to message #1127171] Sun, 06 October 2013 07:35 Go to previous message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 599
Registered: July 2009
Senior Member
Hi Alexander,

I'm glad this helped. I suspect you need to go through the UML metamodel to find an answer to your new question. You can go to Window -> Show view -> Other... to open the EPackage Registry view, click the refresh button on the view to populate it with the registered metamodels, and then explore the classes/features of the UML metamodel. Another trick that may help is to open your source UML model using Exeed (instead of the default UML editor) and then turn on display of structural info [1] to see what should go where.

Cheers,
Dimitris

[1] http://www.eclipse.org/epsilon/doc/articles/inspect-models-exeed/
Previous Topic:What causes this error?
Next Topic:Extended property
Goto Forum:
  


Current Time: Mon Oct 07 08:38:11 EDT 2013

Powered by FUDForum. Page generated in 0.07179 seconds