Skip to main content


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 07:20 Go to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior 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 23:17 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
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 11:51 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior 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 11: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 14:43 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
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 15:26 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior 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 18:44 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
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 10:48 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior 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 11:35 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
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/
Re: [ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1131185 is a reply to message #1127201] Thu, 10 October 2013 09:19 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

thanks very much for the hints. I was able to make considerable progress. However, I have a problem now. I want to take over the client and supplier properties from the source dependency to the target dependency.

I have tried the following:

E.g. for "client" properties:
tpd.client.add(spd.equivalent());
tpd.client.add(spd.supplier.name);


Both don't work the way I want.

Another thing that puzzles me at the moment is how to ensure that the elements that need to be added as properties are already existing. Do I need to perform the transformations in a certain order like you describe in the Chapter 5.5 "Execution Semantics" of the Epsilon book?

The relevant piece of code for the current problem is as follows (I also uploaded a current ZIP that contains all my stuff - see attachment):
rule PC2PCPattern_ProblemBearingDependency
	transform spd : Source!Dependency
  	to tpd : Target!Dependency{
  	guard : spd.hasStereotype("problem-bearing")
	("Transform domain-specific dependency with stereotype <<problem-bearing>> "
	+ "to cross-domain pattern model...").println();
	// Add tpd to the target model (this is necessary before the
	// stereotype can be applied)
	spd.eContainer().equivalent().packagedElements.add(tpd);
	
 
	
	// Apply the problem-bearing dependency stereotype to the target class
	var problemBearingStereotype = 
		Profile!Stereotype.all.selectOne(s | s.name = "problem-bearing");
	tpd.applyStereotype(problemBearingStereotype);  
	'Done.'.println();
	
	tpd.client.add(spd.equivalent());    // Neither this is not working...
	tpd.supplier.add(spd.supplier.name); // ...nor this ;-((
	

	}
operation Source!Dependency hasStereotype(name:String):Boolean {
	for (stereotype in self.getAppliedStereotypes()){
		if (stereotype.name = name) {
	    	return true;
	    }
	    else{
	    	return false;
	    }
	}
}


Thanks for your very much appreciated help and kind regards, Alexander
Re: [ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1131904 is a reply to message #1131185] Thu, 10 October 2013 21:57 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alexander,

Does the following work?

tpd.client ::= spd.client; // Equivalent to tpd.client = spd.client.equivalent();

Regarding ETL's execution semantics, all target objects for non-lazy rules are created before the body of the first rule is executed so rule ordering shouldn't be significant in this respect.

Cheers,
Dimitris
Re: [ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1135730 is a reply to message #1131904] Sun, 13 October 2013 11:03 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

thanks for this helpful proposal and your answer concerning the execution semantics. Indeed the statement worked fine.

Cheers, Alexander
Re: [ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1148751 is a reply to message #1127201] Mon, 21 October 2013 18:21 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

I have a similar issue again, and unfortunately have not been able to find the proper UML class/feature in the UML metamodel via the EPackage Registry. I now need to add a property to the target class according to the source model class. I tried e.g. the following:

(1) sourceproperty.eContainer().equivalent().attribute.add(targetproperty);
(2) sourceproperty.eContainer().equivalent().ownedElement.add(targetproperty);


I get a runtime exception "Internal error: java.lang.... UnsupportedOperationException..." with the approaches above.

When I try
targetproperty.eContainer().attribute ::= sourceproperty.eContainer().attribute; 


I get the error "Called feature attribute on undefined object".

Thanks in advance for your appreciated support and kind regards, Alexander
Re: [ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1148983 is a reply to message #1148751] Mon, 21 October 2013 21:47 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alexander,

I believe that "attribute" is a derived feature (and as such, immutable). Could you please try "ownedAttribute" instead and see what happens?

Cheers,
Dimitris
Re: [ETL] Error "Property 'stereotype' not found in object Class [...]" [message #1152014 is a reply to message #1148983] Wed, 23 October 2013 19:16 Go to previous message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

thanks a lot - it works fine!

Have a good time.

Cheers, Alex
Previous Topic:Type of input model in ETL project
Next Topic:Affixed Parent Side attribute
Goto Forum:
  


Current Time: Fri Apr 19 16:51:29 GMT 2024

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

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

Back to the top