Module Database.ERD

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: May 2017

Summary of exported operations:

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.

Exported datatypes:


ERD

Data type to represent entity/relationship diagrams.

Constructors:


ERDName

Type synonym: ERDName = String


Entity

Constructors:


EName

Type synonym: EName = String


Attribute

Constructors:


AName

Type synonym: AName = String


Key

Constructors:

  • NoKey :: Key
  • PKey :: Key
  • Unique :: Key

Null

Type synonym: Null = Bool


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

Relationship

Constructors:

  • Relationship :: RName -> [REnd] -> Relationship

RName

Type synonym: RName = String


REnd

Constructors:


Role

Type synonym: Role = String


Cardinality

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

MaxValue

The upper bound of a cardinality which is either a finite number or infinite.

Constructors:

  • Max :: Int -> MaxValue
  • Infinite :: MaxValue

Exported operations:

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.