Welcome to the repository for the Museum Project. This project consists of two major assignments:
- Assignment 4: Data Modeling of the Museum 📊
- Assignment 5: Conceptual Changes and Process Implementation on the Database Layer 🔄
In this assignment, we focused on the data modeling of the museum. This includes creating the structure for all necessary entities and their relationships. The data modeling captures all the essential aspects of a museum, such as exhibits, artifacts, zones, and more.
This assignment involves making some conceptual changes and mainly focuses on implementing various processes on the database layer. These processes ensure the smooth operation and management of the museum's data.
- museum.sql: Contains the Data Definition Language (DDL) statements for setting up the database schema.
- scenarios.sql: Contains the implemented processes, defined as stored procedures and functions.
When planning an exhibition, a new record is created in the Exposition
table. Date validations are performed if provided. A new ExpositionState
is created. New records are added to the ExhibitedInformation
table with assigned zone and exposition IDs. The database allows creating an exposition without pre-known dates. During planning, all scenarios are validated using the check_exposition_overlap()
function. The exposition status is set to PLANNED
.
When inserting a new specimen, all mandatory and optional attributes of the Exemplar
entity are initialized. A record is created in the ExemplarOwnership
table with the assigned ID of our institution (assuming the museum record is statically created during database initialization) and the specimen. If the specimen is owned by multiple institutions, the corresponding number of records is created. If the specimen has a category, a category record is created or an existing category is used. A relationship between the category and the specimen is established in the ExemplarCategory
table. A record in the ExemplarState
table is created with locationStatus
set to IN_STORAGE
and assigned the specimen ID.
Moving a specimen to another zone involves the following steps:
- Ensure exhibitions exist; if not, create them using the steps for planning an exhibition.
- Check if the zone, specimen, and exhibition exist. If the specimen is in storage or vault, the previous status is closed, and a new record in the
ExemplarState
table withlocationStatus
set toWITHIN_MUSEUM
is created. When the specimen reaches its place in the zone, the previous status is closed, and a new statusEXHIBITED
is created. If theExhibitedInformation
record does not yet contain the specimen, the specimen ID is assigned; otherwise, a new record is created. If the specimen is already exhibited, the status is set toWITHIN_MUSEUM
, and in theExhibitedInformation
list, the transfer date is set, a newExhibitedInformation
record with the new zone is created, and the status is set toEXHIBITED
.
When receiving a specimen from another institution, simulated data with the entire historical process of transferring the specimen to another institution and back to our institution are created. The last status of the specimen is IN_TRANSIT
. The receiving process involves checking if the specimen exists, closing the previous state, creating a new record with locationStatus
set to IN_STORAGE
, and assigning the specimen ID.
This process requires information about the specimen, initializing attributes when creating the Exemplar
entity record. The input is validated based on the unique email of the institution; if the institution does not exist, it is created. The following steps are the same as receiving and creating a specimen. The change occurs when creating a record in the ExemplarState
table, where a record with locationStatus
set to BORROWED
is created and the specimen ID is assigned.
For detailed technical documentation, please check the documentation files in the repository. Diagrams illustrating the data model are available in the png
format within the repository.
This project is authored by RikoAppDev.
This project is licensed under the MIT License.
Happy coding! 🚀