Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Bug in default trace resolution?(In that case the default trace cannot be resolved. What is wrong?)
Bug in default trace resolution? [message #1855569] Thu, 20 October 2022 17:57 Go to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
Dear all,

Sometime one can spend lot of time on try to find a mistake that is too obvious to be visible... I'm sure some of you know what I mean ! :-)

It might be the case here, otherwise it could be a nasty bug hidden behind.
In the transformation attached I try to translate a library of types from one metamodel to another. The source library is split in two files and one element of the second file has a reference to an element in the first file. They are used by other applications and look well-formed.

The code provided does not run because of a class cast exception. This is something we classically get when the referenced element is not transformed, whatever the reason.

If the ligne of code that generate the error (#84) is deactivated, then the transformation runs and the output file is produced. The point is that the inspection of this output file shows that the referenced element that causes the exception has actually been transformed.

How can we explain that?
  • Attachment: Sv2ToUML.atl
    (Size: 4.97KB, Downloaded 50 times)


Yves
Re: Bug in default trace resolution? [message #1856339 is a reply to message #1855569] Sun, 04 December 2022 20:06 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

Could you provide an example zipped Eclipse project that exhibits this behaviour?

Cheers,
Dennis
Re: Bug in default trace resolution? [message #1856465 is a reply to message #1856339] Mon, 12 December 2022 09:14 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
Hi Dennis,

You'll need to have the SysMLv2 pre-release installed first. You can get it there:
https://github.com/Systems-Modeling/SysML-v2-Release/releases

Then you can use the ATL transformation with the launcher provided in the attached ZIP file
  • Attachment: Sv2ToUML.zip
    (Size: 2.10KB, Downloaded 42 times)


Yves
Re: Bug in default trace resolution? [message #1856653 is a reply to message #1856465] Wed, 21 December 2022 08:54 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
I have investigated further on this issue and my conclusion is that it comes from either a bug in the SysMLv2 pilot implementation or, at least, an incompatibility between that implementation and the way ATL reference the model elements internally.

Indeed, I discovered that I can succeed in getting the specialization relationships transformed if I implement my own "ad hoc" traceability mechanism.T his was set up easily by creating a global map that way:
helper def: elementMap: Map(String, OclAny) = Map{};

Then, the generic rule for the classifiers was modified in order to register any created UML::Classifier together with the xmi:id of its source element in the "do" section:
abstract rule FromClassifierCommon extends FromNamedElement {

	from src: SYSML2!Classifier
	
	to tgt: UML!Classifier (
		isAbstract <- src.isAbstract
	)
	
	do {
		thisModule.elementMap <- thisModule.elementMap->including(src.__xmiID__, tgt);
	}
}

Based on this, I modified the rule for the specialization in order to rely on this global map:
unique lazy rule FromSpecialization {
	
	from src: SYSML2!Specialization
	
	to tgt: UML!Generalization (
		__xmiID__ <- src.getStableID()
		,general <- thisModule.elementMap->get(src.general.__xmiID__)
		,specific <- thisModule.elementMap->get(src.specific.__xmiID__)
	)
}

With this new version, the UML::Generalization relationships are properly created.

Then, as an experiment, I modified the global map so that it uses direct object references rather than xmi:id strings as keys:
helper def: elementMap2: Map(OclAny, OclAny) = Map{};

I adjusted the rest of the code accordingly but I cannot make this version work because the map is unable to retrieve the key corresponding to the reference of the source element registered before.

I also witnessed that this issue with element reference is not limited to specialization relationships. It looks like it impact any element reference like, for instance, feature redefinitions.

My best guess at that point is that the references to the objects that the SysMLv2 pilot implementation provides are not stable. I don't think that there is any bug in the ATL engine here.


Yves
Re: Bug in default trace resolution? [message #1857228 is a reply to message #1856653] Wed, 25 January 2023 22:11 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

Can it be that SysMLv2 messes with the hashCode()/equals() implementation? See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=412999

Cheers,
Dennis
Re: Bug in default trace resolution? [message #1857233 is a reply to message #1857228] Thu, 26 January 2023 10:16 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
Hi Dennis,
Interesting... Thank you!
I'll check with the SST (i.e. SysMLv2 team) whether it could be related to the issue I observed.


Yves
Re: Bug in default trace resolution? [message #1858153 is a reply to message #1857233] Fri, 17 March 2023 13:58 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
I come back on this topic. I checked with the team that no hasCode()/equals() redefinition has been specified.
But I've just realized that the issue I describe above happen only when the referenced element is located in an external file (i.e. it's a 'href') and this - of course - despite that external file is provided as an input model.

So, does the temporary resolution mechanism actually work across all the input models or at least is there any specific thing to do for making it work?


Yves
Re: Bug in default trace resolution? [message #1858167 is a reply to message #1858153] Sat, 18 March 2023 22:19 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

Ah, that sounds like an EMF aliasing problem, where the same model is loaded twice via alternative routes. If the URI via which you load your external file is different from the URI that results from following the href reference, then EMF will consider the href'ed model as a different model than the preloaded model, and load it all over again inside a different EMF Resource. ATL will transform only the elements inside expressly loaded models, while the SYSML2!Specialization references a model element in the separate, href'ed model.

I haven't managed to run your example yet: the SysMLv2 pre-release I downloaded and imported seems to be very slow to build... no .kermlx models, just .kerml models...


Cheers,
Dennis
Re: Bug in default trace resolution? [message #1858483 is a reply to message #1858167] Tue, 04 April 2023 15:38 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
Interesting! I will investigate in this way and let you know.
Thanks !


Yves
Re: Bug in default trace resolution? [message #1858927 is a reply to message #1858483] Tue, 02 May 2023 08:38 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
I did another test, trying to simplify the transformation as much as possible. This time there is only one input file (so no risk of aliasing problem, I think) and the elements created by the transformation do not involve any external reference. The example is attached.

Actually the transformation only looks for one type of element and, for each occurrence of it, create two elements, one of them containing (and referring to)
the other.

As you can see in the Result.uml file, the results of that transformation still has a problem: the contained element (a UML::Constraint) is referenced as an ownedRule using a "href" and stored as a sibling element, while the reference to this element (postcondition) looks like a local reference.

This is really strange because I don't have this issue with other transformations. Might it comes from the launcher?... But I cannot find anything special in it.
  • Attachment: Sv2_Test.zip
    (Size: 22.47KB, Downloaded 16 times)


Yves
Re: Bug in default trace resolution? [message #1858930 is a reply to message #1858927] Tue, 02 May 2023 09:59 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
Ok, I found it!
In case of this example, my mistake is that I shall set the ownedRule property and not only the postcondition one. Once fixed, both the containment and the reference are properly managed.


Yves
Re: Bug in default trace resolution? [message #1859069 is a reply to message #1858930] Wed, 10 May 2023 08:26 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
Dennis,
I confirm that your diagnostic of an EMF aliasing problem is the right one.

Based on the Sv2UML.atl example I provided together with my initial post, I built a modified version of the ScalarValues.kermlx library where all the href referencing Base.kermlx were changed to the path specified in the launcher, instead of the relative path they have in their original version.

When the transformation in launched with this modified version of the library, the problem vanishes: the transformation behaves as expected and the generalization are properly computed.


Yves
Re: Bug in default trace resolution? [message #1859127 is a reply to message #1859069] Sat, 13 May 2023 06:07 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

Good to know, thanks for the update!

Cheers,
Dennis
Previous Topic:Setting a multi-valued tagged value
Next Topic:How to run ATL transformation programmatically
Goto Forum:
  


Current Time: Sat Nov 11 08:16:55 GMT 2023

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

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

Back to the top