<commit_before>USE cab2b
;



--  Drop Tables 
DROP TABLE IF EXISTS AbstractDomainObject
;

DROP TABLE IF EXISTS AdditionalMetaData
;

DROP TABLE IF EXISTS ArrayDesign
;

DROP TABLE IF EXISTS Experiment
;

DROP TABLE IF EXISTS ExperimentGroup
;

DROP TABLE IF EXISTS ExpGrpMapping
;

DROP TABLE IF EXISTS MicroarrayChip
;

DROP TABLE IF EXISTS MicroarrayExperiment
;

DROP TABLE IF EXISTS MicroExpChipMap
;


--  Create Tables 
CREATE TABLE AbstractDomainObject
(
	ADO_ID BIGINT auto_increment,
	ADO_ACTIVITY_STATUS VARCHAR(20),
	PRIMARY KEY (ADO_ID)	
) 
;
CREATE TABLE AdditionalMetaData
(
	AMD_ID BIGINT auto_increment,
	AMD_NAME VARCHAR(50),
	AMD_DESCRIPTION VARCHAR(200),
	AMD_CREATED_ON DATE,
	AMD_LAST_UPDATED_ON DATE,
	PRIMARY KEY (AMD_ID),
	KEY (AMD_ID)
) 
;
CREATE TABLE ArrayDesign
(
	ARD_ID BIGINT auto_increment,
	ARD_NAME VARCHAR(50),
	PRIMARY KEY (ARD_ID),
	KEY (ARD_ID)
) 
;
CREATE TABLE Experiment
(
	EXP_ID BIGINT auto_increment,
	PRIMARY KEY (EXP_ID),
	KEY (EXP_ID)
) 
;
CREATE TABLE ExperimentGroup
(
	EXG_ID BIGINT auto_increment,
	PARENT_EXG_ID BIGINT default NULL,
	PRIMARY KEY (EXG_ID),
	KEY (EXG_ID)
) 
;
CREATE TABLE ExpGrpMapping
(
	IDENTIFIER BIGINT auto_increment,
	EXP_ID BIGINT NOT NULL,
	EXG_ID BIGINT NOT NULL,
	PRIMARY KEY (IDENTIFIER),
	KEY (EXP_ID),
	KEY (EXG_ID)
) 
;
CREATE TABLE MicroarrayChip
(
	MIC_ID BIGINT auto_increment,
	MIC_DESCRIPTION VARCHAR(200),
	MIC_LABEL VARCHAR(50),	
	ARD_ID BIGINT NOT NULL,
	PRIMARY KEY (MIC_ID),
	KEY (MIC_ID),
	KEY (ARD_ID)
) 
;
CREATE TABLE MicroarrayExperiment
(
	MEX_ID BIGINT auto_increment,
	PRIMARY KEY (MEX_ID),
	KEY (MEX_ID)
) 
;
CREATE TABLE MicroExpChipMap
(
	IDENTIFIER BIGINT auto_increment,
	MEX_ID BIGINT NOT NULL,
	MIC_ID BIGINT NOT NULL,
	PRIMARY KEY (IDENTIFIER),
	KEY (MIC_ID),
	KEY (MEX_ID)
) 
;


# ----------- Table for saving data list annontation information ------------
CREATE TABLE DataList
(
	DL_ID BIGINT auto_increment,
	KEY (DL_ID)
)
;


# ----------- Table for saving the many-to-many mapping between experiment and datalist -------------
CREATE TABLE DLExpMap
(
	IDENTIFIER BIGINT auto_increment,
	EXP_ID BIGINT NOT NULL,
	DL_ID BIGINT NOT NULL,
	PRIMARY KEY (IDENTIFIER),
	KEY (EXP_ID),
	KEY (DL_ID)
)
;


--  Create Foreign Key Constraints 
ALTER TABLE AdditionalMetaData ADD CONSTRAINT FK_AdditionalMetaData_AbstractDomainObject 
	FOREIGN KEY (AMD_ID) REFERENCES AbstractDomainObject (ADO_ID)
;

ALTER TABLE Experiment ADD CONSTRAINT FK_Experiment_AdditionalMetaData 
	FOREIGN KEY (EXP_ID) REFERENCES AdditionalMetaData (AMD_ID)
;
<commit_msg>*** empty log message ***<commit_after>USE cab2b_test
;



--  Drop Tables 
DROP TABLE IF EXISTS AbstractDomainObject
;

DROP TABLE IF EXISTS AdditionalMetaData
;

DROP TABLE IF EXISTS ArrayDesign
;

DROP TABLE IF EXISTS Experiment
;

DROP TABLE IF EXISTS ExperimentGroup
;

DROP TABLE IF EXISTS ExpGrpMapping
;

DROP TABLE IF EXISTS MicroarrayChip
;

DROP TABLE IF EXISTS MicroarrayExperiment
;

DROP TABLE IF EXISTS MicroExpChipMap
;


--  Create Tables 
CREATE TABLE AbstractDomainObject
(
	ADO_ID BIGINT auto_increment,
	ADO_ACTIVITY_STATUS VARCHAR(20),
	PRIMARY KEY (ADO_ID)	
) 
;
CREATE TABLE AdditionalMetaData
(
	AMD_ID BIGINT auto_increment,
	AMD_NAME VARCHAR(50),
	AMD_DESCRIPTION VARCHAR(200),
	AMD_CREATED_ON DATE,
	AMD_LAST_UPDATED_ON DATE,
	PRIMARY KEY (AMD_ID),
	KEY (AMD_ID)
) 
;
CREATE TABLE ArrayDesign
(
	ARD_ID BIGINT auto_increment,
	ARD_NAME VARCHAR(50),
	PRIMARY KEY (ARD_ID),
	KEY (ARD_ID)
) 
;
CREATE TABLE Experiment
(
	EXP_ID BIGINT auto_increment,
	PRIMARY KEY (EXP_ID),
	KEY (EXP_ID)
) 
;
CREATE TABLE ExperimentGroup
(
	EXG_ID BIGINT auto_increment,
	PARENT_EXG_ID BIGINT default NULL,
	PRIMARY KEY (EXG_ID),
	KEY (EXG_ID)
) 
;
CREATE TABLE ExpGrpMapping
(
	IDENTIFIER BIGINT auto_increment,
	EXP_ID BIGINT NOT NULL,
	EXG_ID BIGINT NOT NULL,
	PRIMARY KEY (IDENTIFIER),
	KEY (EXP_ID),
	KEY (EXG_ID)
) 
;
CREATE TABLE MicroarrayChip
(
	MIC_ID BIGINT auto_increment,
	MIC_DESCRIPTION VARCHAR(200),
	MIC_LABEL VARCHAR(50),	
	ARD_ID BIGINT NOT NULL,
	PRIMARY KEY (MIC_ID),
	KEY (MIC_ID),
	KEY (ARD_ID)
) 
;
CREATE TABLE MicroarrayExperiment
(
	MEX_ID BIGINT auto_increment,
	PRIMARY KEY (MEX_ID),
	KEY (MEX_ID)
) 
;
CREATE TABLE MicroExpChipMap
(
	IDENTIFIER BIGINT auto_increment,
	MEX_ID BIGINT NOT NULL,
	MIC_ID BIGINT NOT NULL,
	PRIMARY KEY (IDENTIFIER),
	KEY (MIC_ID),
	KEY (MEX_ID)
) 
;


# ----------- Table for saving data list annontation information ------------
CREATE TABLE DataList
(
	DL_ID BIGINT auto_increment,
	ENT_ID BIGINT DEFAULT NULL,
	KEY (DL_ID)
) 
;


# ----------- Table for saving the many-to-many mapping between experiment and datalist -------------
CREATE TABLE DLExpMap
(
	IDENTIFIER BIGINT auto_increment,
	EXP_ID BIGINT NOT NULL,
	DL_ID BIGINT NOT NULL,
	PRIMARY KEY (IDENTIFIER),
	KEY (EXP_ID),
	KEY (DL_ID)
) 
;


--  Create Foreign Key Constraints 
ALTER TABLE AdditionalMetaData ADD CONSTRAINT FK_AdditionalMetaData_AbstractDomainObject 
	FOREIGN KEY (AMD_ID) REFERENCES AbstractDomainObject (ADO_ID)
;

ALTER TABLE Experiment ADD CONSTRAINT FK_Experiment_AdditionalMetaData 
	FOREIGN KEY (EXP_ID) REFERENCES AdditionalMetaData (AMD_ID)
;

{'fraction_non_alphanumeric': 0.08404503105590062, 'fraction_numerical': 0.005822981366459627, 'mean_word_length': 4.42421052631579, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3076851', 'n_tokens_mistral': 2082, 'n_tokens_neox': 1902, 'n_words': 544}