Ex : IDMS, CA-IDMS.
It is an implementation of the network model which originally includes record types and links and allow a 1:1, 1:n and N:M relationship types. This model only includes record types, set types and 1:N relationship types. The CODASYL model is considered to be legacy and has a lot of structural limitations. The two key building blocks are record types and set types.
As in the hierarchical model, the record type is a set of records describing a similar entity. It has 0, 1 or more records or record occurrences. It consists out of various data models. Ex: supplier can have various record types such as supplier name, supplier number,
The CODASYL model provides support for vectors and repeated groups.
A vector is a multivalued record type or an atomic data item for which a record can have multiple values. Ex : if a supplier can have multiple email addresses, it could be modeled using a vector.
A repeated group is a composite data item for which a record can have multiple values. Ex: if a supplier can have multiple addresses each with a zip code, street name, and city, then this can be modeled using a repeated group.
A set type models a 1:N relationship type between an owner record type and a member record type. A set type has a set occurrence for each record occurrence of the owner record type. A set occurrence has one owner record and 0,1 or more member records. The CODASYL interpretation of a set does not perfectly correspond to the notion of a set used in mathematics. In mathematics, a set is a collection with similar elements and without ordering. A CODASYL set has both an owner and a member record and it’s also possible to order the records.
Differences with the Hierarchical Model
- Support for vectors and repeated groups.
- Members can be disconnected from their owner since the minimal cardinality is equal to zero.
- Record type can be member record type in multiple set types. Allow the creation of network structures (simple networks).
- Multiple set types are possible between the same record types.
These models are usually represented using a network or diagram.
3 record types: Department, employee and project. The department has 0:N employees. Employee works with minimum zero, maximum 1 department. A department can work on 0:N projects. A project is assigned to minimum zero maximum one department.
Again, 1:1 relationship types have to be enforced/modeled in application programs. N:M relationship types needs to be modeled using a workaround.
A member-record can only belong to one occurrence of a specific set; hence it cannot just define a set type between the corresponding record types.
One option is to introduce a dummy record type which is included as a member record type in two set types having as owners the record types of the original N:M relationship type.This dummy record type can also contain the attributes of the relationship type.
N:N relationship type between employee and project. An employee can work to 0 to N projects and a project can be worked upon by 0 to N employees. We modeled this in CODASYL by using a dummy record type “works on” which also includes the attribute type of the relationship “hours worked” representing the number of hours an employee works on a project.
This relationship types has serious implications for data usage. Suppose we have a query that asks for all projects an employee is working on. To solve this query, we first need to select a set in a set type employee- works on. For each member, determine the owner in the set type project-works on. Go the other way around in case we need to find all employees working on a project. This is an example of procedural DML.
Furthermore, CODASYL provides no support for recursive set types or set types that only have one record type. A dummy record type needs to be introduced which is then defined as a member in two set types each having as owner record type the record type of the recursive relationship. This again implies extensive navigation when manipulating the data.As for the previous model, no relationship types with a degree >2 is supported.
Finally, the CODASYL model allows to logically ordering the member records. An example could be alphabetically or based on birth date. This can be useful for data manipulation.