# Extra UML MetaModeling Problems

There are all sorts of graphs used in Computer Science. Three are Pie Charts, Excel Line Charts, and Flow Charts.

## 1. Pie Charts

Below are two examples of pie charts. Both are object diagrams. The left is a 3D chart; the right is a 2D chart.

- What is the class diagram metamodel of Pie Charts that has the above charts as instances?
- What is a database schema that is derived from your class diagram?
- Populate a database with tuples that encodes the left pie chart.
- Populate another database with tuples that encodes the right pie chart.

## 2. Excel Line Charts

Below are two examples of Excel Line charts. Both are object diagrams.

- What is the class diagram metamodel of Excel Line Charts that has the above charts as instances?
- What is a database schema that is derived from your class diagram?
- How many tuples are in each table for the left-Line chart?
- How many tuples are in each table for the right-Line chart?

## 3. FlowCharts

Read the Wikipedia article on flowcharts. The
article defines 10 different flowchart icons; limit your answer to the
3 icon types (terminal, T/F decision, process). Two different
flowcharts
(from this article) are shown below. Both are object diagrams.

- What is the class diagram metamodel of FlowCharts that has the above charts as instances?
- What is a database schema that is derived from your class diagram?
- Populate a database with tuples that encodes the left flow chart.

## 4. A Grammar for Simple Arithmetic Expressions

(I think both parts of this problem are hard).
The following incomplete grammar can encode simple arithmetic
expressoins of non-negative integers, binary operations +, -, *, /, and
unary - and parethesis. You need to fill in the patterns for each
"?" below to complete the gramamr.

Expr :- ? | ? | ? ;

Term :- ? | ? | ? ;

Factor :- NonNegativeInteger | - Factor | "(" Expr ")" ;

where the parse of "-7 + 2*9" is:

where ?x is one of the Expr or Term patterns in the grammar above. Note that ?x need not equal ?y for different x,y.

Also, draw the parse tree for the following expression: (2 + 3) * ( 4 + 5 )