Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "JET FAQ Can JET handle UML models as input?"
m (→Answer) |
(→Answer) |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 7: | Line 7: | ||
# Open plugin.xml on your JET transformation, switch the the Extensions tab, expand 'org.eclipse.jet.transform', click '(transform)', and set the modelLoader field to 'org.eclipse.jet.emf'. | # Open plugin.xml on your JET transformation, switch the the Extensions tab, expand 'org.eclipse.jet.transform', click '(transform)', and set the modelLoader field to 'org.eclipse.jet.emf'. | ||
− | # The UML2 meta model is very large, and I find | + | # JET cannot access stereotypes or steroetype properties. If you need, custom XPath functions could be created to access these. |
+ | # The UML2 meta model is very large, and I find most users are not intimately familiar with the navigation features. JET has a special XPath enhancement to make life a little easier. An XPath step such as $parent/foo is interpreted as "the contents of the EReference named 'foo' on the object identified by $parent". But, if there is no 'foo' feature, JET will then attempt to find a contained class of $parent (i.e. something in eContents()) whose eClass name is 'foo'. So, the following are equivalent: | ||
<code><pre> | <code><pre> | ||
/contents/nestedPackages/ownedTypes[@name = 'Person']/ownedAttributes[@name = 'address']/type/@name | /contents/nestedPackages/ownedTypes[@name = 'Person']/ownedAttributes[@name = 'address']/type/@name | ||
Line 13: | Line 14: | ||
/Model/Package/Class[@name = 'Person']/Property[@name = 'address']/type/@name | /Model/Package/Class[@name = 'Person']/Property[@name = 'address']/type/@name | ||
</pre></code> | </pre></code> | ||
− | + | Note: The UML uses singularized reference names, even for * multiplicities. So you'll have to use "nestedPackage", "ownedType" for the above example to work. | |
+ | |||
+ | = See Also = | ||
+ | * [[JET FAQ Should I write my JET code generator directly against UML2?]] | ||
+ | * [[JET FAQ What kind of input model can JET handle?]] | ||
+ | |||
+ | |||
+ | Back to the [[M2T-JET-FAQ]] | ||
+ | |||
+ | [[Category:Modeling]][[Category:M2T]] |
Latest revision as of 10:46, 14 March 2008
Question
Can JET load and traverse UML2 models?
Answer
UML2 Models (.uml, .uml2 or Rational Software Architect .emx files) are EMF-based models. So, yes, JET can read them. Here are some tips for doing it:
- Open plugin.xml on your JET transformation, switch the the Extensions tab, expand 'org.eclipse.jet.transform', click '(transform)', and set the modelLoader field to 'org.eclipse.jet.emf'.
- JET cannot access stereotypes or steroetype properties. If you need, custom XPath functions could be created to access these.
- The UML2 meta model is very large, and I find most users are not intimately familiar with the navigation features. JET has a special XPath enhancement to make life a little easier. An XPath step such as $parent/foo is interpreted as "the contents of the EReference named 'foo' on the object identified by $parent". But, if there is no 'foo' feature, JET will then attempt to find a contained class of $parent (i.e. something in eContents()) whose eClass name is 'foo'. So, the following are equivalent:
/contents/nestedPackages/ownedTypes[@name = 'Person']/ownedAttributes[@name = 'address']/type/@name
/Model/Package/Class[@name = 'Person']/Property[@name = 'address']/type/@name
Note: The UML uses singularized reference names, even for * multiplicities. So you'll have to use "nestedPackage", "ownedType" for the above example to work.
See Also
- JET FAQ Should I write my JET code generator directly against UML2?
- JET FAQ What kind of input model can JET handle?
Back to the M2T-JET-FAQ