Module Database.ERD.Goodies

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

Author: Michael Hanus

Version: May 2017

Summary of exported operations:

erdName :: ERD -> String   
The name of an ERD.
entityName :: Entity -> String   
The name of an entity.
isEntityNamed :: String -> Entity -> Bool   
Is this an entity with a given name?
hasForeignKey :: String -> Entity -> Bool   
Has the entity an attribute with a foreign key for a given entity name?
foreignKeyAttributes :: String -> [Attribute] -> [Attribute]   
Returns the attributes that are a foreign key of a given entity name.
entityAttributes :: Entity -> [Attribute]   
The attributes of an entity
attributeName :: Attribute -> String   
The name of an attribute.
attributeDomain :: Attribute -> Domain   
The domain of an attribute.
hasDefault :: Domain -> Bool   
Has an attribute domain a default value?
isForeignKey :: Attribute -> Bool   
isNullAttribute :: Attribute -> Bool   
Has an attribute a null value?
cardMinimum :: Cardinality -> Int   
The minimum value of a cardinality.
cardMaximum :: Cardinality -> Int   
The maximum value of a cardinality (provided that it is not infinite).
showERD :: Int -> ERD -> String   
A simple pretty printer for ERDs.
combineIds :: [String] -> String   
Combines a non-empty list of identifiers into a single identifier.
storeERDFromProgram :: String -> IO String   
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   

The name of an ERD.

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

entityName :: Entity -> String   

The name of an entity.

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

isEntityNamed :: String -> Entity -> Bool   

Is this an entity with a given name?

hasForeignKey :: String -> Entity -> Bool   

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

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

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

entityAttributes :: Entity -> [Attribute]   

The attributes of an entity

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

attributeName :: Attribute -> String   

The name of an attribute.

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

attributeDomain :: Attribute -> Domain   

The domain of an attribute.

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

hasDefault :: Domain -> Bool   

Has an attribute domain a default value?

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

isForeignKey :: Attribute -> Bool   

isNullAttribute :: Attribute -> Bool   

Has an attribute a null value?

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

cardMinimum :: Cardinality -> Int   

The minimum value of a cardinality.

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

cardMaximum :: Cardinality -> Int   

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

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

showERD :: Int -> ERD -> String   

A simple pretty printer for ERDs.

combineIds :: [String] -> String   

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.

Further infos:
  • partially defined

storeERDFromProgram :: String -> IO String   

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.