Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » MARTE errors on genmodel
MARTE errors on genmodel [message #1850859] Fri, 18 March 2022 17:04 Go to next message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
Hello everybody,

I've created an UML profile that depends on MARTE 1.2.2.
Then I've created the file .genmodel to generate the java classes of the profile.

When I open the file .genmodel, it returns the attached errors related to MARTE.

Do you know why it happens?

Moreover, if I try to generate the java classes, some of them needs MARTE files that do not exists, such as:
org.eclipse.papyrus.MARTE_Library.BasicNFP_Types.NFP_Integer;
org.eclipse.papyrus.MARTE_Library.BasicNFP_Types.NFP_Real;
org.eclipse.papyrus.MARTE_Library.BasicNFP_Types.NFP_String;

I'm using Eclipse 03-2021.

Thanks,
Alberto
Re: MARTE errors on genmodel [message #1850927 is a reply to message #1850859] Tue, 22 March 2022 14:34 Go to previous messageGo to next message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
Basically I have the same errors reported in the following posts:
- https://www.eclipse.org/forums/index.php?t=msg&th=207078&goto=662979&#msg_662979
- https://www.eclipse.org/forums/index.php?t=msg&th=1089362&goto=1774168&#msg_1774168

I can't apply the same solution because I'm using org.eclipse.uml2.uml 5.5.0.

Maybe is it needed only a patch for UMLUtil.java version 5.5.0.
Ansgar Radermacher, do you have any ideas?

Many thanks,
Alberto
Re: MARTE errors on genmodel [message #1850991 is a reply to message #1850927] Thu, 24 March 2022 07:41 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
I can confirm that the genmodel has errors. The genmodel needs to be re-generated. In the context of adapting the MARTE plugin to the version 1.2 of the spec (the plugin version number is not aligned with the spec), we are currently discussing internally whether we keep the patch in the UMLUtil package during the creation of the genmodel/ecore (i.e. mapping datatypes to strings) or revert tot eh standard mapping. We keep you updated concerning the progress on MARTE 1.2.

Ansgar
Re: MARTE errors on genmodel [message #1850994 is a reply to message #1850991] Thu, 24 March 2022 08:16 Go to previous messageGo to next message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
Many thanks Ansgar!

In the meanwhile, could you provide the patch for the plugin org.eclipse.uml2.uml version 5.5.0 in order to remove the errors mentioned here https://www.eclipse.org/forums/index.php?t=msg&th=1089362&goto=1774168&#msg_1774168?
Re: MARTE errors on genmodel [message #1851006 is a reply to message #1850994] Thu, 24 March 2022 12:44 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Sure, here it is. I haven't tested it in a while, so your mileage may vary:

diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java
index c78760f..7eb961f 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java
@@ -16,6 +16,7 @@
  *   E.D.Willink - 420338, 512439
  *   Christian W. Damus - 444588, 497359, 501740
  *   Camille Letavernier - 528925, 529564
+ * CEA: Patch that returns strings for MARTE datatypes
  *
  */
 package org.eclipse.uml2.uml.util;
@@ -4671,7 +4672,13 @@ public class UMLUtil
 
 				@Override
 				public Boolean caseDataType(DataType dataType) {
-					return Boolean.TRUE;
+					// CEA modification
+					if(mapDataTypeToString(dataType)) {
+						return Boolean.FALSE;
+					}
+					else {
+						return Boolean.TRUE;
+					}
 				}
 
 				@Override
@@ -4801,17 +4808,33 @@ public class UMLUtil
 					.getNearestPackage();
 
 				if (package_ != null) {
-					EClass eClass = EcoreFactory.eINSTANCE.createEClass();
-					elementToEModelElementMap.put(dataType, eClass);
 
-					EPackage ePackage = (EPackage) doSwitch(package_);
-					ePackage.getEClassifiers().add(eClass);
+					// CEA modification	
+					if(mapDataTypeToString(dataType)) {
+					   EDataType eDataType = EcoreFactory.eINSTANCE.createEDataType();
+					   elementToEModelElementMap.put(dataType, eDataType);
 
-					setName(eClass, dataType);
+					   EPackage ePackage = (EPackage)doSwitch(package_);
+					   ePackage.getEClassifiers().add(eDataType);
 
-					defaultCase(dataType);
+					   setName(eDataType, dataType);
+					   eDataType.setInstanceClassName("java.lang.String"); //$NON-NLS-1$
 
-					return eClass;
+					   return eDataType;
+				   }
+				   else {
+					   EClass eClass = EcoreFactory.eINSTANCE.createEClass();
+					   elementToEModelElementMap.put(dataType, eClass);
+
+						EPackage ePackage = (EPackage) doSwitch(package_);
+						ePackage.getEClassifiers().add(eClass);
+
+						setName(eClass, dataType);
+
+						defaultCase(dataType);
+
+						return eClass;
+					}
 				}
 			}
 			return super.caseDataType(dataType);
@@ -5214,7 +5237,13 @@ public class UMLUtil
 
 					setName(eDataType, primitiveType);
 
-					eDataType.setInstanceClassName(eDataType.getName());
+					// CEA modification
+					if(mapDataTypeToString(primitiveType)) {
+						eDataType.setInstanceClassName("java.lang.String"); //$NON-NLS-1$
+					}
+					else {
+						eDataType.setInstanceClassName(eDataType.getName());
+					}
 
 					defaultCase(primitiveType);
 
@@ -13478,7 +13507,7 @@ public class UMLUtil
 		if (resourceSet != null) {
 			Map<String, Object> contentTypeToFactoryMap = resourceSet
 				.getResourceFactoryRegistry().getContentTypeToFactoryMap();
-
+ 
 			contentTypeToFactoryMap.put(
 				UML402UMLResource.UML_4_0_0_CONTENT_TYPE_IDENTIFIER,
 				UML402UMLResource.Factory.INSTANCE);
@@ -13746,4 +13775,15 @@ public class UMLUtil
 		return allSubsetFeatures;
 	}
 
+	/**
+	 * CEA: Map certain data types to string. This is useful for instance for MARTE types
+	 * 
+	 * @param dataType
+	 * @return true, if data-type should be mapped to a string
+	 */
+	private static boolean mapDataTypeToString(DataType dataType) {
+		// currently: map all data types to string
+		return true;
+	}
+
 }

Re: MARTE errors on genmodel [message #1851024 is a reply to message #1851006] Thu, 24 March 2022 20:42 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

a) Wouldn't it be easier and standard to leave the DataTypes as is and just provide all the XXXFactoryImpl convert/create YYY String methods with String-like functionality? IIRC they default to String-like anyway.

eDataType.setInstanceClassName("java.lang.String");

can be achieved using the ecore::EDataType Stereotype

b) The patch doesn't seem sound in that it could affect existing uses adversely, so it might face opposition from committers.

If the mapping is sometimes appropriate, surely it would need to be controlled by fine-grained genmodel options so that a Boolean, oops DataType not PrimitiveType, is not corrupted? OCL support for SysML at least has to be fairly generous to avoid the prolific variants of Boolean etc being treated as distinct types.

Regards

Ed Willink
Re: MARTE errors on genmodel [message #1851033 is a reply to message #1851024] Fri, 25 March 2022 08:11 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hi Ed,

thanks for the feedback. We don't intend to submit the patch, it was a workaround used many years ago to enforce the string serialization of datatypes in the MARTE profile (notably those that can be expressed in MARTE's value specification language VSL). It's more likely than not, that we will use the default ecore mapping in an upcoming version of MARTE.

Best

Ansgar
Re: MARTE errors on genmodel [message #1851113 is a reply to message #1851033] Mon, 28 March 2022 10:01 Go to previous messageGo to next message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
I'm using the patch, but I still have the attached errors.
Did I miss something in the procedure?

Thanks,
Alberto

Re: MARTE errors on genmodel [message #1851125 is a reply to message #1851113] Mon, 28 March 2022 12:14 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Did you do a reload of the .genmodel file? (in a 2nd Eclipse instance, assuring that the patch is taken into account)
Re: MARTE errors on genmodel [message #1851132 is a reply to message #1851125] Mon, 28 March 2022 13:51 Go to previous messageGo to next message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
I reloaded the model.

In the 2nd Eclipse instance, if I search the type "UMLUtil", Eclipse links to the patched class (see the attached screenshots).
  • Attachment: screen1.PNG
    (Size: 13.39KB, Downloaded 106 times)
  • Attachment: screen2.PNG
    (Size: 12.61KB, Downloaded 105 times)
Re: MARTE errors on genmodel [message #1851481 is a reply to message #1851132] Wed, 06 April 2022 12:20 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
I cannot reproduce the issue on my machine. Did you use the MARTE version 1.2.3.qualifier from the MARTE git repo? Did you use the UML model importer during the reload? (available in the UML2 extender SDK) ?
Re: MARTE errors on genmodel [message #1851487 is a reply to message #1851481] Wed, 06 April 2022 13:25 Go to previous messageGo to next message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
Quote:
Did you use the UML model importer during the reload? (available in the UML2 extender SDK) ?


Where I can verify this?
I use UML model (see the attached image).
  • Attachment: importer.PNG
    (Size: 16.26KB, Downloaded 139 times)

[Updated on: Wed, 06 April 2022 13:25]

Report message to a moderator

Re: MARTE errors on genmodel [message #1851490 is a reply to message #1851487] Wed, 06 April 2022 13:46 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Yes, that's the right import variant.
Re: MARTE errors on genmodel [message #1851611 is a reply to message #1851490] Mon, 11 April 2022 07:37 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
I've created Bug 579646 - The MARTE generator model has errors. The current patch is not yet merge - to be reviewed/tested. This bug only covers a fix for the validation issues - we want to use the standard UML to ecore mapping later (requiring a migration of existing models).
Re: MARTE errors on genmodel [message #1851786 is a reply to message #1851611] Fri, 15 April 2022 13:40 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
The fix for bug 579646 has been merged into master. We've also updated the Java compatibility of the plugins to Java-11 and updated the target-platform as well as the CI build jobs to 2022-03. You can get a nightly build (update-site) from the MARTE CI job. Please note that the RCPs are currently not working correctly.

[Updated on: Fri, 15 April 2022 13:50]

Report message to a moderator

Re: MARTE errors on genmodel [message #1851831 is a reply to message #1851786] Tue, 19 April 2022 08:47 Go to previous messageGo to next message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
Thanks Ansgar.

Do you plan to include also the patch in the nightly build?
Re: MARTE errors on genmodel [message #1851890 is a reply to message #1851831] Thu, 21 April 2022 09:23 Go to previous messageGo to next message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
I'm having a strange issue that I think is related with the latest version of MARTE.

When I create for example a UML Constraint, in the console appears the following exception:


com.google.inject.ProvisionException: Guice provision errors:

1) Error injecting constructor, org.eclipse.emf.common.util.WrappedException: org.eclipse.xtext.resource.ClasspathUriResolutionException: org.eclipse.xtext.resource.FileNotFoundOnClasspathException: Couldn't find resource on classpath. URI was 'classpath:/org/eclipse/papyrus/marte/textedit/constraintwithvsl/xtext/ConstraintWithVSLl.xmi'
  at org.eclipse.xtext.common.services.TerminalsGrammarAccess.<init>(Unknown Source)
  at org.eclipse.xtext.common.services.TerminalsGrammarAccess.class(Unknown Source)
  while locating org.eclipse.xtext.common.services.TerminalsGrammarAccess
    for parameter 1 at org.eclipse.papyrus.marte.vsl.services.VSLGrammarAccess.<init>(Unknown Source)
  at org.eclipse.papyrus.marte.vsl.services.VSLGrammarAccess.class(Unknown Source)
  while locating org.eclipse.papyrus.marte.vsl.services.VSLGrammarAccess
    for parameter 1 at org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.services.ConstraintWithVSLlGrammarAccess.<init>(Unknown Source)
  at org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.services.ConstraintWithVSLlGrammarAccess.class(Unknown Source)
  while locating org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.services.ConstraintWithVSLlGrammarAccess
  while locating org.eclipse.xtext.IGrammarAccess
    for parameter 0 at org.eclipse.xtext.ui.editor.templates.XtextTemplateContextTypeRegistry.<init>(Unknown Source)
  at org.eclipse.xtext.ui.editor.templates.XtextTemplateContextTypeRegistry.class(Unknown Source)
  while locating org.eclipse.xtext.ui.editor.templates.XtextTemplateContextTypeRegistry
  while locating org.eclipse.jface.text.templates.ContextTypeRegistry
    for parameter 0 at org.eclipse.xtext.ui.editor.templates.XtextTemplateStore.<init>(Unknown Source)
  at org.eclipse.xtext.ui.editor.templates.XtextTemplateStore.class(Unknown Source)
  while locating org.eclipse.xtext.ui.editor.templates.XtextTemplateStore
  while locating org.eclipse.jface.text.templates.persistence.TemplateStore


@Ansgar Do you know what is the cause?

It seems that the file org/eclipse/papyrus/marte/textedit/constraintwithvsl/xtext/ConstraintWithVSLl.xmi is missing.
Re: MARTE errors on genmodel [message #1851899 is a reply to message #1851831] Thu, 21 April 2022 11:15 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Dear Alberto.

this is not planned as it would be problematic to ship a modified version of a plugin that is used by many other components. It will not be necessary as well in the future (for people that plan to extend MARTE), since we will migrate to the standard UML mappings.
Re: MARTE errors on genmodel [message #1851904 is a reply to message #1851899] Thu, 21 April 2022 12:16 Go to previous messageGo to next message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
OK. Thanks for the answer!

What about the FileNotFoundOnClasspathException?
Re: MARTE errors on genmodel [message #1851913 is a reply to message #1851904] Thu, 21 April 2022 15:09 Go to previous message
Alberto Debiasi is currently offline Alberto DebiasiFriend
Messages: 84
Registered: March 2018
Member
This error was already reported:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=435511

It seems caused by the default setting of Embedded Editor for vsl coming from marte plugins.
Previous Topic:Creating a new stereotype with a custom cpp codegen behaviour
Next Topic:Minimal Interaction size
Goto Forum:
  


Current Time: Sat Apr 20 07:16:49 GMT 2024

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

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

Back to the top