1

I have a UML model having OpaqueActions containing text conform to an XText Grammar/MetaModel. I am turning the UML model into text by means of an ACCELEO transformation. I'd like to invoke from the ACCELEO script a Java service which takes as input the text in the opaque actions within the model and provides as output the root element of the related model so that I can use it seamlessly from ACCELEO.

To this end I need to define a Java class with a method which: takes as parameter a String, invokes XTEXT, parses the text and, if it is correct, produces a related EMF model. Suppose the text is OCL (It isn't but I guess the procedure is the same), how would you do that?

Andrea Sindico
  • 7,358
  • 6
  • 47
  • 84

1 Answers1

0

You could try to load the OpaqueActions as the content of a resource in the resource set that holds the currently processed model. That will return the AST for that string.

Sebastian Zarnekow
  • 6,609
  • 20
  • 23