

SCHEMA example_schema;

TYPE label = STRING;
END_TYPE;

TYPE color = ENUMERATION OF (red, green, blue, yellow, orange, white, black, brown);
END_TYPE;

TYPE length_measure = REAL;
END_TYPE;

TYPE point = REAL;
END_TYPE;

ENTITY shape
SUPERTYPE OF (ONEOF (circle, triangle, rectangle));

    item_name : label;
    item_color : OPTIONAL color;
    number_of_sides : INTEGER;

END_ENTITY;

ENTITY circle
SUBTYPE OF (shape);

    radius : real;

END_ENTITY;

ENTITY triangle
SUBTYPE OF (shape);

    side1_length, side2_length, side3_length : length_measure;

END_ENTITY;

ENTITY rectangle
SUPERTYPE OF (square)
SUBTYPE OF (shape);

    height : length_measure;
    width : length_measure;

END_ENTITY;

ENTITY square
SUBTYPE OF (rectangle);

END_ENTITY;

ENTITY cartesian_point;

    x : point;
    y : point;
    z : OPTIONAL point;

END_ENTITY;

ENTITY line;

    end_point_one : cartesian_point;
    end_point_two : cartesian_point;

END_ENTITY;

ENTITY poly_line;

    points : LIST OF line;

END_ENTITY;

END_SCHEMA;
