Alf, the Action Language for Foundation UML

Alf (the Action Language for Foundation UML) is a textual language for coding detailed, executable behavior within an overall UML model. Alf is a standard of the Object Management Group (OMG), which is also the organization that maintains the UML specification. Alf is one of a suite of OMG specifications related to defining precise execution semantics for UML, building on the original Foundational UML (fUML) specification.

The Alf Plugin for MagicDraw allows you to use the Alf language within MagicDraw. The Alf Plugin provides both a syntax-aware editor for entering and updating Alf code, and a compiler for translating Alf code into fUML activity models. When used with Cameo Simulation Toolkit, behavioral specifications written using Alf code are fully executable in the context of class, activity and state machine models.

The Alf Plugin supports the Alf language at the “Full Conformance” level, i.e. it provides a complete action language for representing behavior within a UML model created in the usual way in MagicDraw.

Key Features:

  • Supports the Alf 1.1 action language at the “Full Conformance” level.
  • Provides a syntax aware editor for Alf bodies of activities, opaque behavior, opaque expressions and opaque actions.
  • Compiles to executable UML activity models.

Why an action language?

In order for a model to be fully executable, it has to specify all the detailed behavior to be executed during a simulation run. It is possible to do this using activity diagrams, but creating explicit activity models at this level of detail is tedious and error prone.

Alternatively, Cameo Simulation Toolkit provides a rich capability for using scripting languages (such as Javascript) within executable UML models. While such languages benefit from being already well-known, they do not, however, naturally integrate with the UML model in which they are embedded. For example, a navigation from an object across an association can require several API calls.

Alf, on the other hand, was designed as a Java-like scripting language that is fully integrated with the enclosing UML model. Using Alf gives you all the functionality of specifying behavior using activity diagrams, only far more easily.

For example, suppose you are modeling an Assembly that contains a set of Components, and you want to compute the total weight of the Assembly as the sum of the weight of the Components. You could draw an Activity diagram with eight or more different actions on it to do this. Or you could code it in JavaScript using the non-standard MagicDraw Action Language Helper (ALH) API as

totalWeight = 0.0;

for (var i = 0; i < components.length; i++) {
    totalWeight += ALH.getValue(components[i], "weight");

}

Or you could write the single standard Alf expression:

this.totalWeight = this.components.weight->reduce '+' ?? 0.0;

and the Alf Editor will even provide static type checking, consistent with your class model.
Alf is the scripting language designed to be used with UML.

Join the conversation in the CATIA MBSE Cyber System User Community!

OSLC Tutorial: Business Use Case flow with DNG

Hi,I am using CSM 2022x Refresh 2 with Teamwork Cloud and Collaborator plugins.I am trying the OSLC integration capability with DNG by following one of your available tutorial https://docs.nomagic.com/CDH/latest/business-use-case-flow-with-dng-304012914.html but somehow, I am not ending with a similar result.By the end of the flow, I should be able to view the CSM element (which I published as an

CATIA MBSE CYBER SYSTEMS

Where is AI really creating value? Join us for the CATIA R2027x Live Keynote

According to PwC’s 29th Global CEO Survey, only 1 in 8 CEOs say AI delivers both higher revenues and lower costs. Billions invested. Countless pilots. So where is AI creating value?It starts with a real business challenge, and virtual twins give industrial AI the context to solve it.On Thursday, November 19, 2026, join us for the CATIA R2027x Live Keynote, in person in Vélizy-Villacoublay or onlin

CATIA MBSE CYBER SYSTEMS

CATIA Magic (Cameo) plugin for live RTI Connext DDS: publish and subscribe from a SysML simulation

A SysML model can describe a DDS interface. This plugin for CATIA Magic lets it take part in one: a simulation can publish and subscribe to real RTI Connext DDS traffic, so a service that exists only as a model can exchange data with services that already exist as code.The video (linked below) shows the setup and a live demo.What it's forChecking interfaces before implementation. A supplier's code

CATIA MBSE CYBER SYSTEMS

Student Research: connecting Cameo Systems Modeler to NASA GMAT, and access options

Hello everyone,I am a student working on a research project to build a digital thread between Cameo Systems Modeler and NASA's GMAT (General Mission Analysis Tool). I am modelling a CubeSat in Cameo, and I want its parameters (orbit elements, mass, constraints) to drive GMAT orbit analysis, with the results coming back to the model.I am using the Cameo 2021 demo version because I cannot afford a l

CATIA MBSE CYBER SYSTEMS

NOTE: Existing users of No Magic products can access to the user portal at https://magicdraw.com/main.php, as well as Cameo Collaborator for Teamwork Cloud samples at https://ccexamples.nomagic.com.

Learn What CATIA Can Do for You

Speak with a CATIA expert to learn how our solutions enable seamless collaboration and sustainable innovation at organizations of every size.

Get Started

Courses and classes are available for students, academia, professionals and companies. Find the right CATIA training for you. 

Get Help

Find information on software & hardware certification, software downloads, user documentation, support contact and services offering