This module contains some useful operations on the data types representing entity/relationship diagrams
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. Used in ERD transformation and code generation to create names for combined objects, e.g., relationships and foreign keys.
readERDFromProgram
:: String -> IO ERD
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
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.