Estereotipos¶
En UML, los estereotipos son una forma de extender la aplicación del lenguaje UML a nuevos dominios. Por ejemplo: SysML comenzó como un perfil para UML.
Gaphor también admite estereotipos. Son la forma de adaptar sus modelos a sus necesidades específicas.
Los modelos UML, SysML, RAAML y otros utilizados en Gaphor - el código se genera a partir de archivos de modelo Gaphor - hacen uso de estereotipos para proporcionar información específica utilizada al generar el código del modelo de datos.
Para crear un estereotipo, asegúrese de que el Perfil UML está activo y abra la sección Perfil de la caja de herramientas. Primero añada una Metaclase a su diagrama. Después añada un Estereotipo, y conecte ambos con una Extensión. El estereotipo "metaclass" solo se mostrará una vez que la Extensión esté conectada tanto a la clase como al estereotipo.
Nota
Los nombres de clase en la metaclase deben ser un nombre de clase del modelo UML, como Class, Interface, Property, Association. O incluso «Elemento» si desea utilizar el estereotipo en todos los elementos.
Su declaración de estereotipo puede parecer algo así:
El estereotipo Asynchronous tiene una propiedad priority. A esta propiedad se le puede asignar un valor una vez que el estereotipo se aplica a una Propiedad, como un extremo de asociación.
Cuando se puede aplicar un estereotipo a un elemento del modelo, aparecerá una sección Estereotipo en el editor.

Creating a profile¶
In SysML extending the profile using stereotypes is often required to tailor the model to your needs. For example, creating Customer vs System requirements.
To add a profile to your model:¶
Create a package called
profilethis can be done by right clicking in the left hand column.Switch modelling language to the UML profile (top of left hand menu drop down)
Within the package create a profile diagram (prf)
Add a profile element to the diagram
Add a meta-class element to the diagram, within the profile.
Add a stereotype element to the diagram, within the profile.
Connect meta-class and stereotype with an Extension relation. The head should be attached to the class. As soon as the Extension is connected, the class will get a stereotype metaclass assigned.
With the meta-class and stereotype placed on the diagram, either:
Double-click the meta-class and name it after the base element you want to create your stereotype from.
Select the base element from the drop down menu in the Property Editor on the right hand side. In this case only UML elements can be used as base elements.
Styling Stereotypes¶
You can apply styling to stereotypes. For example here the base element requirement has a stereotype system requirement
/*Add style to Requirement element*/
requirement{
background-color: #C5E7E7;
text-color: #2A2A2A;
}
/*Update Requirement styling for the System stereotype*/
requirement[appliedStereotype.classifier.name=system]{
background-color: #D5F7E7;
text-color: #2A2A2A;
}
Style Sheets has more detail on how CSS works in Gaphor