---
title: 'UML2Dep: Formal UML Dependency Modeling'
url: https://www.emergentmind.com/topics/uml2dep
type: topic
---

# UML2Dep: Formal UML Dependency Modeling

UML2Dep is a rigorous framework leveraging Unified Modeling Language (UML) models as the substrate for deriving mathematically precise dependency representations, supporting both requirement analysis in Software Product Line (SPL) engineering and controllable code synthesis in industrial Service-Oriented Architectures (SOA). It formalizes structure and data flow by systematically transforming visual UML artifacts into explicit logic or dependency graphs, which can be verified or operationalized using automated reasoning tools or large language models (LLMs) [1310.0152][2508.03379].

## 1. Formalization of UML Feature Relationships

The original UML2Dep methodology targets SPL engineering by mapping standard UML feature-variation relationships onto propositional logic fragments. The supported relationship types include:

- **Mandatory**: $\mathrm{mand}(P,C):\; C \leftrightarrow P$
- **Optional**: $\mathrm{opt}(P,C):\; C \rightarrow P$
- **Or-group**: $\mathrm{orGroup}(P,\{C_i\}):\; [P \rightarrow \bigvee_i C_i] \wedge \bigwedge_i[C_i \rightarrow P]$
- **Xor-group**: $\mathrm{xorGroup}(P,\{C_i\}):\; [P \rightarrow \bigvee_i C_i]\wedge \bigwedge_i [C_i\rightarrow P]\wedge \bigwedge_{i<j} \neg(C_i\wedge C_j)$
- **Requires**: $\mathrm{requires}(A,B):\; A \rightarrow B$
- **Excludes**: $\mathrm{excludes}(A,B):\; \neg(A\wedge B)$

These logical forms serve as an interlingua for automated analysis—every feature model or dependency network expressible in UML diagrams is systematically encoded as a conjunction of Boolean constraints, denoted $\Phi$, suitable for direct input to SAT/SMT solvers or verified within model-finding frameworks such as Alloy [1310.0152].

## 2. Exact Logical Semantics and Metamodel

UML2Dep operates in pure propositional logic. A finite set of Boolean feature atoms $F = \{f_1,\ldots,f_n\}$ encodes model elements, with each system configuration $\sigma \subseteq F$ corresponding to a truth assignment. The formula syntax is:

- $\top$, $\bot$
- $f \in F$
- $\neg\text{Formula}$
- $\text{Formula} \wedge \text{Formula}$
- $\text{Formula} \vee \text{Formula}$
- $\text{Formula} \Rightarrow \text{Formula}$

Semantics follow classical Boolean logic, mapping each system variant selection to model validity, dead features, or configuration consistency [1310.0152].

Expanding to SOA code generation, UML2Dep introduces an extended UML sequence diagram $\mathrm{SD}_e = (L, M, F, \mathrm{DT}, \mathrm{API})$, incorporating lifelines, messages with typed API specs, control-flow fragments, and decision tables (DT) for business rules [2508.03379].

## 3. End-to-End Pipeline: From UML Model to Dependency Constraints

A four-step transformation pipeline provides systemic translation from UML diagrams to analyzable Dep (dependency) models:

1. **UML Model Preparation**: Annotate model elements—«variationPoint» for variation points, «variant» for features. Explicitly connect elements using compositional connectors and cross-tree «requires»/«excludes» links.
2. **Feature Graph Extraction**: Traverse model, collect direct children for each variation point, identify grouping modality, and record cross-tree dependencies.
3. **Rule Mapping**: Assign each parent-child or cross-tree group to its corresponding propositional template (as above).
4. **Dep Model Assembly**: Conjoin all fragments into global $\Phi$; optionally, encode into Alloy or SAT/SMT solver inputs [1310.0152].

For SOA, this pipeline is adapted to process enhanced sequence diagrams, performing static parse operations to extract execution dependencies and formalizing data dependencies at the messaging and decision-rule level [2508.03379].

## 4. Data Dependency Inference for Code Generation

In its recent instantiation, UML2Dep formalizes the Data Dependency Inference (DDI) problem as follows:

- **Input**: Extended sequence diagram $\mathrm{SD}_e = (L, M, F, \mathrm{DT}, \mathrm{API})$.
- **Output**: Directed graph $G_{\mathrm{DD}} = (V, E_{\mathrm{DD}}, D)$, where $V$ are nodes (messages/fragments/input/output), $D$ is the set of data entities, and $E_{\mathrm{DD}} \subseteq V \times D \times V$ encodes which node produces/consumes which data.

The formal matching problem must obey:

- **Reachability**: Data dependencies only between reachable nodes.
- **Producer/Consumer Roles**: Data is only produced/consumed by valid node types.
- **Completeness**: Every data item consumed is produced by exactly one predecessor.

The core inference uses symbolic prompts to steer LLMs in structured dependency extraction, leveraging mathematical constraint templates with explicit predecessor sets and output schema [2508.03379].

## 5. Preprocessing: Static Parsing and Context Pruning

UML2Dep preprocessing phases ensure tractable and accurate DDI problem statements:

- **Static Parsing**: Constructs an execution dependency graph (EDG) with hierarchical (containment) and sequential (ordered execution) edges.
- **Reachability-Based Context Pruning (RBCP)**: For each inference target node, only reachable predecessors are retained contextually, cutting spurious dependencies and reducing cognitive complexity for both LLM-driven and algorithmic analyses.

Algorithmically, this corresponds to a two-graph traversal collecting parents and sequential ancestors, omitting branches not relevant to the node's ancestry, as defined in the provided pseudocode [2508.03379].

## 6. Evaluation Metrics and Analysis

Task-level performance of UML2Dep on industrial SOA scenarios is evaluated via:

- **DDI Task Metrics**:
  - Precision: $TP/(TP+FP)$
  - Recall: $TP/(TP+FN)$
  - $F_1$ score: Harmonic mean of Precision and Recall

Empirical results from "WeChat Pay" use cases (224 dependencies: 157 API, 60 Condition, 7 Action) demonstrate:
- Average Recall: 89.97%
- Average Precision: 95.06%
- Average $F_1$: 92.33%

In code synthesis, DDI-driven prompts lead to improved test metrics over baseline:
- Compilation pass rate: +8.83 points (85.50% → 94.33%)
- Unit-test pass rate: +11.66 points (81.17% → 92.83%)
- Full test-suite pass rate: +5.00 points

In complex use cases, much larger impacts are documented—e.g., compilation pass rates in "QueryPMAccount" increased by 29 points, unit-test by 36 points [2508.03379].

## 7. Automated Verification and Practical Deployment

The Dep model, whether for SPL feature configuration or SOA data flows, directly supports automated verification. Regular queries include:

- Consistency checking (SAT/UNSAT)
- Dead/false-optional feature detection (by existence of $\sigma$ with or without certain features)
- Configuration or "product" enumeration (by constraining allowed feature choices)
- Detection of inconsistent or unreachable configurations

The methodology is solver-agnostic: The machine-checkable Boolean backbone of Dep supports Alloy, SAT4J, MiniSat, Z3, and CVC4 back ends. For data dependencies, the dependency graph underpins method signature synthesis, variable wiring, and testable code skeleton production. The graphical-to-logical pipeline remains visual and editable for domain experts, but is fully formalized for automated, trustworthy analysis and generative workflows [1310.0152][2508.03379].

Source: https://www.emergentmind.com/topics/uml2dep