Tutorial for UML to XML
The Unified Modeling Language, or UML, allows programmers to create diagrams to represent data. Though more often used with databases, UML is a storage-agnostic means of representing data. This means you can use UML to represent Extensible Markup Language data or any other type of repeating data. UML diagrams contain boxes that represent "entities," which group conceptually related data including people, businesses, teams or products. Lines in a UML diagram connect the entity boxes to illustrate the relationship between data.
Instructions
-
Define UML Entities
-
1
Draw a box for each of the entities that you must store as XML. Consider carefully the type of data you must store and logically group each type of data. For example, if you're creating a database for a Web store, draw a box labeled "Customers," a box for "Products" and a box for "Orders." Write the name of the entity across the top of the box and draw a horizontal line beneath it. Examine the first-order parent nodes in the XML file to ensure that you haven't failed to include any relevant entity. You can create an entity from nearly any XML parent node.
-
2
Write the different names of the different kinds of data you intend to store within each entity, called "attributes." For example, write "price," "product number," "category" and "weight" within the "Products" model. Examine children nodes in the XML file to ensure that you've included all relevant attributes in your UML diagram.
-
-
3
Examine the XML file for relationships and draw a line between parent nodes and their children on the UML diagram to represent relationships between entities.
Define UML Cardinality
-
4
Draw circles at the point where the connecting lines touch the entity boxes. Examine the XML file you're modeling to correctly represent cardinality. Parent nodes have a one-to-many or a one-to-one relationship with child nodes. For example, a car dealership has a one-to-many relationship with its vehicles, because it is a single dealership containing many vehicles. A person and a Social Security number have a one-to-one relationship because there can only be one Social Security number for each person.
-
5
Draw a hollow circle where the line touches the box that represents the multiple entity.
-
6
Draw a shaded circle at the point where the line touches the box if the entity has a one-to-one relationship with another entity.
-
1
References
- Photo Credit Jason Reed/Photodisc/Getty Images