"2nd Order" UML Parsing Analysis: use a «wrapper» Component as a container for the source text, and relate it to model elements using a Relationship

The full UML™ Parsing Analysis recipe can only be exploited when the relationship between source text and model elements can be traced. A relatable parsing container for snippets of source text is needed, from which one can draw a Relationship such as a Dependency, Association, or ComponentRealization, depending on the container and purpose.

To this end, a Classifier (such as a Component or Artifact) can be used, where the NamedElement.name is typically used to carry one sentence of source text
(usually combined with suitable styling of the element so that the name reads like regular text).

The Class is not well suited, because it is not a good graphical container for logical grouping, and if source text is to be related to Class elements it can be confusing to use a Class for the model and the source text.

The Artifact (being generally associated with external software artifacts) offers itself, however it is not able to sufficiently graphically and logically group a wide range of elements, and does not nest well.

Best by far is the UML Component, which can be happily misappropriated for this purpose in some UML tools.

I call UML Components used this way parsing «wrapper» Components, because they graphically "wrap" other model elements. When they are also only used to logically group other model elements (without "stealing" physical ownership of the graphically grouped elements), I call them logical «wrapper» Components:

IMPORTANT: UML Components misappropriated in this fashion for UML™ Parsing Analysis SHOULD be clearly stereotyped by a «wrapper» stereotype, or an extending sub-stereotype, such as «source» as an indicator of the source of the "parsed" text snippet that names the Component used as a relatable parsing container.

Thus, a «source» Component is a special kind of «wrapper» Component, one that provides a logical context for relating other UML model elements to the text that names the Component, and which also can provide a graphical grouping of those elements within the boundary of the Component.

In many UML tools, some types of elements that are graphically contained/placed inside a Component will be related to that Component automatically by a ComponentRealization, so that 1 analysis model element can be easily traced to zero or more parsing «source» Components.

This is the fundamental idea behind "2nd Order" UML™ Parsing Analysis. And it is very useful and powerful !

Notes
Visit also