This module contains the definition of data types to represent entity/relationship diagrams and an I/O operation to read them from a term file.
Author: Michael Hanus, Marion Mueller
Version: December 2021
readERDTermFile
:: String -> IO ERD
Read an ERD specification from a file containing a single ERD term. |
writeERDTermFile
:: ERD -> IO String
Writes an ERD term into a file with name ERDMODELNAME.erdterm
and returns the absolute path name of the generated term file.
|
writeFileWithERDTerm
:: String -> ERD -> IO ()
Writes an ERD term into a file with name provided as first argument. |
Data type to represent entity/relationship diagrams. The components are the name of the ER model, the list of entities, and the list of relationships.
Constructors:
ERD
:: ERDName -> [Entity] -> [Relationship] -> ERD
The name of an ER model (a string).
Type synonym: ERDName = String
Data type to represent the entities of an ER model. Each entity consists of a name and a list of attributes.
Constructors:
The name of an entity (a string).
Type synonym: EName = String
Data type to represent attributes of entities of an ER model. Each attribute consists of
Constructors:
The name of an attribute (a string).
Type synonym: AName = String
Data type to represent key properties of attributes (no key, primary key, or unique).
Constructors:
NoKey
:: Key
PKey
:: Key
Unique
:: Key
Type of the flag of an attribute indicating whether the attribute
can contain null values (if the flag has value True
).
Type synonym: Null = Bool
Data type the domain of an attribute. If the attribute has a default value, it can be specified as an argument in the domain.
Constructors:
IntDom
:: (Maybe Int) -> Domain
FloatDom
:: (Maybe Float) -> Domain
CharDom
:: (Maybe Char) -> Domain
StringDom
:: (Maybe String) -> Domain
BoolDom
:: (Maybe Bool) -> Domain
DateDom
:: (Maybe CalendarTime) -> Domain
UserDefined
:: String -> (Maybe String) -> Domain
KeyDom
:: String -> Domain
Data type to represent the relationships of an ER model. Each relationship consists of a name and a list of end points (usually with two elements).
Constructors:
The name of a relationship (a string).
Type synonym: RName = String
An end point of a relationship which consists of the name of an entity, the name of the role, and a cardinality constraint.
Constructors:
REnd
:: EName -> Role -> Cardinality -> REnd
The name of a role (a string).
Type synonym: Role = String
Cardinality of a relationship w.r.t. some entity. The cardinality is either a fixed number (e.g., (Exactly 1) representing the cardinality (1,1)) or an interval (e.g., (Between 1 (Max 4)) representing the cardinality (1,4), or (Between 0 Infinite) representing the cardinality (0,n)).
Constructors:
Exactly
:: Int -> Cardinality
Between
:: Int -> MaxValue -> Cardinality
The upper bound of a cardinality which is either a finite number or infinite.
Constructors:
Max
:: Int -> MaxValue
Infinite
:: MaxValue
Read an ERD specification from a file containing a single ERD term. |
Writes an ERD term into a file with name |
Writes an ERD term into a file with name provided as first argument. |