Module Database.ERD.Goodies

This module contains some useful operations on the data types representing entity/relationship diagrams

Author: Michael Hanus

Version: December 2021

Summary of exported operations:

erdName :: ERD -> String  Deterministic 
The name of an ERD.
entityName :: Entity -> String  Deterministic 
The name of an entity.
isEntityNamed :: String -> Entity -> Bool  Deterministic 
Is this an entity with a given name?
hasForeignKey :: String -> Entity -> Bool  Deterministic 
Has the entity an attribute with a foreign key for a given entity name?
foreignKeyAttributes :: String -> [Attribute] -> [Attribute]  Deterministic 
Returns the attributes that are a foreign key of a given entity name.
entityAttributes :: Entity -> [Attribute]  Deterministic 
The attributes of an entity
attributeName :: Attribute -> String  Deterministic 
The name of an attribute.
attributeDomain :: Attribute -> Domain  Deterministic 
The domain of an attribute.
hasDefault :: Domain -> Bool  Deterministic 
Has an attribute domain a default value?
isForeignKey :: Attribute -> Bool  Deterministic 
isNullAttribute :: Attribute -> Bool  Deterministic 
Has an attribute a null value?
cardMinimum :: Cardinality -> Int  Deterministic 
The minimum value of a cardinality.
cardMaximum :: Cardinality -> Int  Deterministic 
The maximum value of a cardinality (provided that it is not infinite).
showERD :: Int -> ERD -> String  Deterministic 
A simple pretty printer for ERDs.
combineIds :: [String] -> String  Deterministic 
Combines a non-empty list of identifiers into a single identifier.
readERDFromProgram :: String -> IO ERD  Non-deterministic 
Reads the ERD defined in a Curry program (as a top-level operation of type Database.ERD.ERD).
storeERDFromProgram :: String -> IO String  Non-deterministic 
Writes the ERD defined in a Curry program (as a top-level operation of type Database.ERD.ERD) in a term file and return the name of the term file.

Exported operations:

erdName :: ERD -> String  Deterministic 

The name of an ERD.

Further infos:
  • solution complete, i.e., able to compute all solutions

entityName :: Entity -> String  Deterministic 

The name of an entity.

Further infos:
  • solution complete, i.e., able to compute all solutions

isEntityNamed :: String -> Entity -> Bool  Deterministic 

Is this an entity with a given name?

hasForeignKey :: String -> Entity -> Bool  Deterministic 

Has the entity an attribute with a foreign key for a given entity name?

foreignKeyAttributes :: String -> [Attribute] -> [Attribute]  Deterministic 

Returns the attributes that are a foreign key of a given entity name.

entityAttributes :: Entity -> [Attribute]  Deterministic 

The attributes of an entity

Further infos:
  • solution complete, i.e., able to compute all solutions

attributeName :: Attribute -> String  Deterministic 

The name of an attribute.

Further infos:
  • solution complete, i.e., able to compute all solutions

attributeDomain :: Attribute -> Domain  Deterministic 

The domain of an attribute.

Further infos:
  • solution complete, i.e., able to compute all solutions

hasDefault :: Domain -> Bool  Deterministic 

Has an attribute domain a default value?

isForeignKey :: Attribute -> Bool  Deterministic 

isNullAttribute :: Attribute -> Bool  Deterministic 

Has an attribute a null value?

Further infos:
  • solution complete, i.e., able to compute all solutions

cardMinimum :: Cardinality -> Int  Deterministic 

The minimum value of a cardinality.

Further infos:
  • solution complete, i.e., able to compute all solutions

cardMaximum :: Cardinality -> Int  Deterministic 

The maximum value of a cardinality (provided that it is not infinite).

showERD :: Int -> ERD -> String  Deterministic 

A simple pretty printer for ERDs.

combineIds :: [String] -> String  Deterministic 

Combines a non-empty list of identifiers into a single identifier. Used in ERD transformation and code generation to create names for combined objects, e.g., relationships and foreign keys.

readERDFromProgram :: String -> IO ERD  Non-deterministic 

Reads the ERD defined in a Curry program (as a top-level operation of type Database.ERD.ERD). This is done by compiling the Curry program with an auxiliary operation and processing the output of the program.

storeERDFromProgram :: String -> IO String  Non-deterministic 

Writes the ERD defined in a Curry program (as a top-level operation of type Database.ERD.ERD) in a term file and return the name of the term file.