Where do PIM and PSM sit in the M0–M3 MOF stack, and what does a QVT-based PIM-to-PSM transformation actually operate on?
answer
- PIM and PSM both live at M1
- QVT maps between metamodels, not just data
- reflective traversal, not hardcoded parsing
- regen overwrites hand edits without protected regions
- transformation rules are first-class deliverables
basics
~20 sPIM and PSM are both just models sitting at the same level in the stack, built using rules like UML's. A transformation tool reads the PIM according to those rules and writes out a PSM according to a possibly different set of platform rules, using a defined mapping between the two.
solid answer
~40 sBoth the PIM and the PSM live at M1 — they are concrete models, not metamodels — but they typically conform to different M2 metamodels: the PIM conforms to plain UML or a restricted business-oriented profile, while the PSM conforms to a platform-specific metamodel or a heavier profile carrying platform stereotypes, such as a relational profile. A QVT transformation is defined as a mapping between two M2 metamodels — it declares rules like 'a PIM Class maps to a PSM Class stereotyped Entity with an added Property for the primary key' — and the transformation engine executes those rules by walking the PIM's M1 model reflectively via the MOF/EMF reflection API and constructing the corresponding PSM M1 model, not by manipulating M2 or M3 at all.
go deeper
Can say that a translator turns the PIM into the PSM, without needing to name QVT specifically.
Can name that both PIM and PSM sit at M1 and identify that a transformation tool such as QVT maps between their metamodels.
Can explain concretely how a QVT-style rule maps PIM elements to PSM elements and describe the regeneration/hand-edit conflict as a real operational risk.
Can compare QVT Relations versus Operational trade-offs, explain why many real projects used simpler template generators instead, and reason about governance of the transformation rules as first-class deliverables.
## What QVT is QVT (Query/View/Transformation) is OMG's standard transformation language, comprising three sub-languages, while community tools like ATL fill a similar role in practice outside the OMG standard itself. | Sub-language | What it is | |---|---| | QVT Relations | declarative | | QVT Operational | imperative | | QVT Core | a low-level target | ## What a transformation actually operates on A transformation definition is written once against the two metamodels it bridges, for example UML and a relational-platform profile of UML, and declares mapping rules such as: - for every PIM `Class` not marked abstract, create a PSM `Class` stereotyped `Table`; - copy each PIM `Attribute` to a PSM `Column`; - and if the PIM `Class` has an `Association` to another PIM `Class`, create a PSM foreign-key `Column` instead. The transformation engine executes these rules by reflectively traversing the source M1 model — introspecting it generically via the M2 metamodel's structure, without hardcoded PIM-specific parsing code — and constructing target M1 elements accordingly. Because both PIM and PSM conform to metamodels that are themselves MOF-based, the same generic transformation engine can, in principle, run any PIM-to-PSM mapping a project defines, not just one hardcoded pipeline. ## Why standardize the language at all Standardizing on a transformation language rather than hand-writing bespoke generator scripts exists to make mapping rules declarative, inspectable, and partially verifiable independent of any single vendor's tool — an explicit acknowledgment that PIM-to-PSM transformation is not a single fixed algorithm but a family of project- and platform-specific mappings that still deserve a common notation. It also enables **traceability tooling**: because the transformation is declarative rules rather than opaque code, tools can, in theory, trace a given PSM element back to the PIM element it was derived from, supporting impact analysis when the PIM changes. ## The trade-offs The trade-offs cut both ways. - **Declarative QVT Relations transformations are easier to reason about and verify** but struggle to express transformations with complex conditional or iterative logic, pushing real projects toward QVT Operational or general-purpose-language generators, such as Xtend templates in openArchitectureWare/Xtext-based toolchains, that trade declarative clarity for expressive power. - **There's also a tooling-maturity cost:** QVT implementations historically lagged the specification and were inconsistent across vendors, so many real MDA projects used simpler template-based generation, such as Velocity or Xpand templates over a PIM, instead of full QVT, sacrificing formal transformation traceability for pragmatic delivery speed. ## Failure modes 1. **Treating the rules as a one-off script.** A common failure mode is treating the transformation rules as a one-off script rather than a maintained artifact: when the PIM's metamodel or the target platform's conventions evolve, the transformation rules need updating too, and if that discipline lapses, the generated PSM silently starts producing subtly wrong platform code — for example, a transformation still using an old primary-key-naming convention after the team standardized on a new one — that isn't caught until a downstream integration or a production defect surfaces it. 2. **Conformance drift.** Because PIM and PSM are both just M1 models with no runtime type-checking against their M2 metamodels beyond what the modeling tool enforces at edit time, hand-tweaking a generated PSM file directly, common under delivery pressure, can quietly produce an M1 model that no longer strictly conforms to its declared metamodel's semantic intent — the file is still valid XML/XMI, but constraints the metamodel or an attached OCL rule set was supposed to guarantee are now silently violated, and only a re-run of the validator, if anyone remembers to run it, would catch it. ## Where the full sequence really ran Enterprise projects in the 2000s that adopted MDA seriously — for instance telecom OSS/BSS systems following TeleManagement Forum's SID/MDA-influenced guidance, and some defense/avionics model-based development pipelines — used exactly this PIM (UML business model) to QVT or template transformation to PSM (platform profile) to code sequence, with the transformation rules themselves versioned in source control as first-class deliverables alongside the PIM and generated code, precisely so that 'why does the generated code look like this' always had a traceable answer in an explicit rule rather than a developer's memory.
- What's the difference between QVT Relations and QVT Operational?QVT Relations is declarative — you state correspondence rules between source and target metamodel elements and let the engine figure out execution order, which is easier to verify but weaker at complex conditional logic. QVT Operational is imperative — you write step-by-step transformation procedures, trading declarative clarity for expressive power.
- If a PSM is hand-edited after generation and never reconciled with the PIM, in what sense does it stop conforming to anything?It can remain structurally valid against its M2 metamodel, still legal UML or profile syntax, while silently violating semantic constraints the PIM-to-PSM transformation was supposed to guarantee, such as a foreign-key column matching the PIM's association cardinality. Nothing in the toolchain re-checks that automatically unless someone reruns validation or diffs against a fresh regeneration.
- Why might a project use simple template-based generation instead of full QVT?Historically, QVT implementations lagged the OMG specification and were inconsistent across vendors, so projects often chose lighter template engines that directly render a model's data into source code, sacrificing formal, verifiable transformation rules and traceability for faster, more predictable delivery.
A translator who doesn't memorize your specific letter but knows the grammar rules of both languages well enough to translate any letter written in the source language.
saying these in an interview costs you the question
- Places the PSM at a different MOF layer, such as M0, than the PIM
- Believes a QVT transformation modifies the M2 metamodel rather than mapping M1 models via rules between two metamodels
- Thinks conformance checking automatically catches semantic drift from hand-edited generated code
- Cannot describe any concrete failure mode of PIM-to-PSM transformation in a real project