Deutsch      Español      Français      日本語      한국어      Русский      中文

Translation support

You can click here to access the wiki and update the translation.

You can go back to the translated webpage.

To help you in the translation process, here is a comparison with the English version :

Casos de uso Sintaxis y características del diagrama

Sintaxis del diagrama de casos de uso PlantUML: Puede tener casos de uso, actores, extensiones, notas, estereotipos, flechas ... También es posible cambiar las fuentes y los colores.

Use case Diagram syntax and features

PlantUML use case diagram syntax: You can have use cases, actors, extensions, notes, stereotypes, arrows... Changing fonts and colors is also possible.

 

Diagrama de Casos de Uso

Veamos algunos ejemplos:

Puedes deshabilitar el sombreado usando el comando "skinparam shadowing false"

 

Use Case Diagram

Let's have few examples :

 

Casos de uso

Los casos de uso estan encerrados entre paréntesis (los paréntesis tienen un aspecto similar a un óvalo).

También puede usar la palabra usecase para crear un caso de uso. Ademas puede crear un alias, usando la palabra as. Este alias será usado mas adelante, cuando defina relaciones.

@startuml

(First usecase)
(Another usecase) as (UC2)  
usecase UC3
usecase (Last\nusecase) as UC4

@enduml

 

Usecases

Use cases are enclosed using between parentheses (because two parentheses looks like an oval).

You can also use the usecase keyword to define a usecase. And you can define an alias, using the as keyword. This alias will be used latter, when defining relations.

@startuml

(First usecase)
(Another usecase) as (UC2)  
usecase UC3
usecase (Last\nusecase) as UC4

@enduml

 

Actores

Los actores se encierran entre dos puntos.

También puedes usar la palabra reservada actor para definir un actor. Además puedes definir un alias, usando la palabra reservada as. Este alias será usado más adelante, cuando definamos relaciones.

Veremos más adelante que las declaraciones de los actores son opcionales.

@startuml

:First Actor:
:Another\nactor: as Men2  
actor Men3
actor :Last actor: as Men4

@enduml

 

Actors

Actor are enclosed using between two points.

You can also use the actor keyword to define an actor. And you can define an alias, using the as keyword. This alias will be used latter, when defining relations.

We will see later that the actor definitions are optional.

@startuml

:First Actor:
:Another\nactor: as Men2  
actor Men3
actor :Last actor: as Men4

@enduml

 

Descripción de Casos de uso

Si quiere realizar una descripción en varias líneas, puede usar citas (" ").

También puede usar los siguientes separadores: --..==__. Y puede introducir títulos dentro de los separadores.

@startuml

usecase UC1 as "You can use
several lines to define your usecase.
You can also use separators.
--
Several separators are possible.
==
And you can add titles:
..Conclusion..
This allows large description."

@enduml

 

Usecases description

If you want to have description on several lines, you can use quotes.

You can also use the following separators: --..==__. And you can put titles within the separators.

@startuml

usecase UC1 as "You can use
several lines to define your usecase.
You can also use separators.
--
Several separators are possible.
==
And you can add titles:
..Conclusion..
This allows large description."

@enduml

 

Ejemplo básico

Para relacionar actores y casos de uso, la flecha --> es usada.

Cuanto más guiones - en la flecha, más larga será la misma. Puedes añadir una etiqueta en la flecha, añadiendo el carácter : en la definición de la flecha.

En este ejemplo, puedes ver que User no ha sido definido, y es usado como un actor.

@startuml

User -> (Start)
User --> (Use the application) : A small label

:Main Admin: ---> (Use the application) : This is\nyet another\nlabel

@enduml

 

Basic example

To link actors and use cases, the arrow --> is used.

The more dashes - in the arrow, the longer the arrow. You can add a label on the arrow, by adding a : character in the arrow definition.

In this example, you see that User has not been defined before, and is used as an actor.

@startuml

User -> (Start)
User --> (Use the application) : A small label

:Main Admin: ---> (Use the application) : This is\nyet another\nlabel

@enduml

 

Extensión

Si un actor/caso de uso extiende a otro, puedes usar el símbolo <|--.

@startuml
:Main Admin: as Admin
(Use the application) as (Use)

User <|-- Admin
(Start) <|-- (Use)

@enduml

 

Extension

If one actor/use case extends another one, you can use the symbol <|--.

@startuml
:Main Admin: as Admin
(Use the application) as (Use)

User <|-- Admin
(Start) <|-- (Use)

@enduml

 

Usando notas

Puedes usar las palabras claves: note left of , note right of , note top of , note bottom of, para añadir notas relacionadas a un objeto en particular.

También se puede añadir un nota solitaria con la palabra clave note, y después realacionarla con otro objeto usando el símbolo .. .

@startuml
:Main Admin: as Admin
(Use the application) as (Use)

User -> (Start)
User --> (Use)

Admin ---> (Use)

note right of Admin : This is an example.

note right of (Use)
  A note can also
  be on several lines
end note

note "This note is connected\nto several objects." as N2
(Start) .. N2
N2 .. (Use)
@enduml

 

Using notes

You can use the note left of , note right of , note top of , note bottom of keywords to define notes related to a single object.

A note can be also define alone with the note keywords, then linked to other objects using the .. symbol.

@startuml
:Main Admin: as Admin
(Use the application) as (Use)

User -> (Start)
User --> (Use)

Admin ---> (Use)

note right of Admin : This is an example.

note right of (Use)
  A note can also
  be on several lines
end note

note "This note is connected\nto several objects." as N2
(Start) .. N2
N2 .. (Use)
@enduml

 

Estereotipos

Puedes añadir estereotipos mientras defines actores y casos de uso, usando << y >>.

@startuml
User << Human >>
:Main Database: as MySql << Application >>
(Start) << One Shot >>
(Use the application) as (Use) << Main >>

User -> (Start)
User --> (Use)

MySql --> (Use)

@enduml

 

Stereotypes

You can add stereotypes while defining actors and use cases using << and >>.

@startuml
User << Human >>
:Main Database: as MySql << Application >>
(Start) << One Shot >>
(Use the application) as (Use) << Main >>

User -> (Start)
User --> (Use)

MySql --> (Use)

@enduml

 

Cambiar dirección a las flechas

Por defecto, conexiones entre clases tiene dos guiones -- y son verticalmente orientadas. Es posible usar una conexión horizontal, colocando un solo guión (o punto) de esta forma:

@startuml
:user: --> (Use case 1)
:user: -> (Use case 2)
@enduml

También puedes cambiar de dirección revirtiendo la conexión:

@startuml
(Use case 1) <.. :user:
(Use case 2) <- :user:
@enduml

También es posible cambiar la dirección de una flecha añadiendo las palabras clave left, right, up or down, dentro de la misma:

@startuml
:user: -left-> (dummyLeft) 
:user: -right-> (dummyRight) 
:user: -up-> (dummyUp)
:user: -down-> (dummyDown)
@enduml

Puedes acortar la flecha usando sólo el primer carácter de la dirección (por ejemplo, -d- en lugar de -down-) o los primeros dos caracteres (-do-).

Por favor tenga en cuenta que no debería abusar de esta funcionalidad : Graphviz usualmente devuelve buenos resultados sin realizar muchos ajustes.

 

Changing arrows direction

By default, links between classes have two dashes -- and are vertically oriented. It is possible to use horizontal link by putting a single dash (or dot) like this:

@startuml
:user: --> (Use case 1)
:user: -> (Use case 2)
@enduml

You can also change directions by reversing the link:

@startuml
(Use case 1) <.. :user:
(Use case 2) <- :user:
@enduml

It is also possible to change arrow direction by adding left, right, up or down keywords inside the arrow:

@startuml
:user: -left-> (dummyLeft) 
:user: -right-> (dummyRight) 
:user: -up-> (dummyUp)
:user: -down-> (dummyDown)
@enduml

You can shorten the arrow by using only the first character of the direction (for example, -d- instead of -down-) or the two first characters (-do-).

Please note that you should not abuse this functionality : Graphviz gives usually good results without tweaking.

 

Dividiendo los diagramas

La palabra clave newpage divide su diagrama en varias páginas o imágenes.

@startuml
:actor1: --> (Usecase1)
newpage
:actor2: --> (Usecase2)
@enduml

 

Splitting diagrams

The newpage keywords to split your diagram into several pages or images.

@startuml
:actor1: --> (Usecase1)
newpage
:actor2: --> (Usecase2)
@enduml

 

Dirección: de izquierda a derecha

El comportamiento general cuando se construye un diagrama, es top to bottom.

@startuml
'default
top to bottom direction
user1 --> (Usecase 1)
user2 --> (Usecase 2)

@enduml
Puede cambiar a left to right usando el comando left to right direction. En ocaciones, el resultado es mejor con esta dirección.

@startuml

left to right direction
user1 --> (Usecase 1)
user2 --> (Usecase 2)

@enduml

 

Left to right direction

The general default behavior when building diagram is top to bottom.

@startuml
'default
top to bottom direction
user1 --> (Usecase 1)
user2 --> (Usecase 2)

@enduml
You may change to left to right using the left to right direction command. The result is often better with this direction.

@startuml

left to right direction
user1 --> (Usecase 1)
user2 --> (Usecase 2)

@enduml

 

Personalización (Skinparam)

Puedes usar el comando skinparam para cambiar los colores y las fuentes de los dibujos

Puedes usar este comando:

Puedes definir colores y fuentes específicas para los actores y casos de uso estereotipados.

@startuml
skinparam handwritten true

skinparam usecase {
	BackgroundColor DarkSeaGreen
	BorderColor DarkSlateGray

	BackgroundColor<< Main >> YellowGreen
	BorderColor<< Main >> YellowGreen
	
	ArrowColor Olive
	ActorBorderColor black
	ActorFontName Courier

	ActorBackgroundColor<< Human >> Gold
}

User << Human >>
:Main Database: as MySql << Application >>
(Start) << One Shot >>
(Use the application) as (Use) << Main >>

User -> (Start)
User --> (Use)

MySql --> (Use)

@enduml

 

Skinparam

You can use the skinparam command to change colors and fonts for the drawing.

You can use this command :

You can define specific color and fonts for stereotyped actors and usecases.

@startuml
skinparam handwritten true

skinparam usecase {
	BackgroundColor DarkSeaGreen
	BorderColor DarkSlateGray

	BackgroundColor<< Main >> YellowGreen
	BorderColor<< Main >> YellowGreen
	
	ArrowColor Olive
	ActorBorderColor black
	ActorFontName Courier

	ActorBackgroundColor<< Human >> Gold
}

User << Human >>
:Main Database: as MySql << Application >>
(Start) << One Shot >>
(Use the application) as (Use) << Main >>

User -> (Start)
User --> (Use)

MySql --> (Use)

@enduml

 

Un ejemplo completo

@startuml
left to right direction
skinparam packageStyle rectangle
actor customer
actor clerk
rectangle checkout {
  customer -- (checkout)
  (checkout) .> (payment) : include
  (help) .> (checkout) : extends
  (checkout) -- clerk
}
@enduml

 

Complete example

@startuml
left to right direction
skinparam packageStyle rectangle
actor customer
actor clerk
rectangle checkout {
  customer -- (checkout)
  (checkout) .> (payment) : include
  (help) .> (checkout) : extends
  (checkout) -- clerk
}
@enduml

This page is generated once per day from the wiki content.

Quantcast