text: -- Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
  -- Copyright [2016-2021] EMBL-European Bioinformatics Institute
  --
  -- Licensed under the Apache License, Version 2.0 (the "License");
  -- you may not use this file except in compliance with the License.
  -- You may obtain a copy of the License at
  --
  --      http://www.apache.org/licenses/LICENSE-2.0
  --
  -- Unless required by applicable law or agreed to in writing, software
  -- distributed under the License is distributed on an "AS IS" BASIS,
  -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  -- See the License for the specific language governing permissions and
  -- limitations under the License.
  
  create table %MART_NAME%.TEMP_CLOSURE ENGINE=MyISAM as select a.parent_term_id as parent_term_id_301,a.distance as distance_301,a.subparent_term_id as subparent_term_id_301,a.child_term_id as child_term_id_301,a.closure_id as closure_id_301_key from %ONTOLOGY_DB%.closure as a;
  create index I_0 on %MART_NAME%.TEMP_CLOSURE(child_term_id_301);
  create table %MART_NAME%.TEMP_ONTOLOGY ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305,b.name as name_305,b.definition as definition_305,b.accession as accession_305,b.subsets as subsets_305 from %MART_NAME%.TEMP_CLOSURE as a inner join %ONTOLOGY_DB%.term as b on a.child_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP_CLOSURE;
  create index I_1 on %MART_NAME%.TEMP_ONTOLOGY(ontology_id_305);
  create table %MART_NAME%.TEMP2 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='bfo';
  create index I_2 on %MART_NAME%.TEMP2(parent_term_id_301);
  create table %MART_NAME%.TEMP3 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP2 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP2;
  create index I_3 on %MART_NAME%.TEMP3(ontology_id_305_r1);
  create table %MART_NAME%.TEMP4 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP3 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='bfo';
  drop table %MART_NAME%.TEMP3;
  create index I_4 on %MART_NAME%.TEMP4(subparent_term_id_301);
  create table %MART_NAME%.TEMP5 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP4 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP4;
  create index I_5 on %MART_NAME%.TEMP5(ontology_id_305_r2);
  create table %MART_NAME%.TEMP6 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP5 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='bfo';
  drop table %MART_NAME%.TEMP5;
  create table %MART_NAME%.TEMP7 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP6;
  drop table %MART_NAME%.TEMP6;
  create index I_6 on %MART_NAME%.TEMP7(accession_305);
  create index I_7 on %MART_NAME%.TEMP7(accession_305_r1);
  rename table %MART_NAME%.TEMP7 to %MART_NAME%.closure_BFO__closure__main;
  create index I_8 on %MART_NAME%.closure_BFO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP10 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='bto';
  create index I_11 on %MART_NAME%.TEMP10(parent_term_id_301);
  create table %MART_NAME%.TEMP11 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP10 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP10;
  create index I_12 on %MART_NAME%.TEMP11(ontology_id_305_r1);
  create table %MART_NAME%.TEMP12 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP11 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='bto';
  drop table %MART_NAME%.TEMP11;
  create index I_13 on %MART_NAME%.TEMP12(subparent_term_id_301);
  create table %MART_NAME%.TEMP13 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP12 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP12;
  create index I_14 on %MART_NAME%.TEMP13(ontology_id_305_r2);
  create table %MART_NAME%.TEMP14 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP13 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='bto';
  drop table %MART_NAME%.TEMP13;
  create table %MART_NAME%.TEMP15 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP14;
  drop table %MART_NAME%.TEMP14;
  create index I_15 on %MART_NAME%.TEMP15(accession_305);
  create index I_16 on %MART_NAME%.TEMP15(accession_305_r1);
  rename table %MART_NAME%.TEMP15 to %MART_NAME%.closure_BTO__closure__main;
  create index I_17 on %MART_NAME%.closure_BTO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP18 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='chebi';
  create index I_20 on %MART_NAME%.TEMP18(parent_term_id_301);
  create table %MART_NAME%.TEMP19 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP18 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP18;
  create index I_21 on %MART_NAME%.TEMP19(ontology_id_305_r1);
  create table %MART_NAME%.TEMP20 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP19 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='chebi';
  drop table %MART_NAME%.TEMP19;
  create index I_22 on %MART_NAME%.TEMP20(subparent_term_id_301);
  create table %MART_NAME%.TEMP21 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP20 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP20;
  create index I_23 on %MART_NAME%.TEMP21(ontology_id_305_r2);
  create table %MART_NAME%.TEMP22 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP21 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='chebi';
  drop table %MART_NAME%.TEMP21;
  create table %MART_NAME%.TEMP23 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP22;
  drop table %MART_NAME%.TEMP22;
  create index I_24 on %MART_NAME%.TEMP23(accession_305);
  create index I_25 on %MART_NAME%.TEMP23(accession_305_r1);
  rename table %MART_NAME%.TEMP23 to %MART_NAME%.closure_CHEBI__closure__main;
  create index I_26 on %MART_NAME%.closure_CHEBI__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP26 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='cl';
  create index I_29 on %MART_NAME%.TEMP26(parent_term_id_301);
  create table %MART_NAME%.TEMP27 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP26 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP26;
  create index I_30 on %MART_NAME%.TEMP27(ontology_id_305_r1);
  create table %MART_NAME%.TEMP28 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP27 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='cl';
  drop table %MART_NAME%.TEMP27;
  create index I_31 on %MART_NAME%.TEMP28(subparent_term_id_301);
  create table %MART_NAME%.TEMP29 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP28 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP28;
  create index I_32 on %MART_NAME%.TEMP29(ontology_id_305_r2);
  create table %MART_NAME%.TEMP30 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP29 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='cl';
  drop table %MART_NAME%.TEMP29;
  create table %MART_NAME%.TEMP31 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP30;
  drop table %MART_NAME%.TEMP30;
  create index I_33 on %MART_NAME%.TEMP31(accession_305);
  create index I_34 on %MART_NAME%.TEMP31(accession_305_r1);
  rename table %MART_NAME%.TEMP31 to %MART_NAME%.closure_CL__closure__main;
  create index I_35 on %MART_NAME%.closure_CL__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP34 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='eco';
  create index I_38 on %MART_NAME%.TEMP34(parent_term_id_301);
  create table %MART_NAME%.TEMP35 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP34 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP34;
  create index I_39 on %MART_NAME%.TEMP35(ontology_id_305_r1);
  create table %MART_NAME%.TEMP36 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP35 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='eco';
  drop table %MART_NAME%.TEMP35;
  create index I_40 on %MART_NAME%.TEMP36(subparent_term_id_301);
  create table %MART_NAME%.TEMP37 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP36 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP36;
  create index I_41 on %MART_NAME%.TEMP37(ontology_id_305_r2);
  create table %MART_NAME%.TEMP38 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP37 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='eco';
  drop table %MART_NAME%.TEMP37;
  create table %MART_NAME%.TEMP39 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP38;
  drop table %MART_NAME%.TEMP38;
  create index I_42 on %MART_NAME%.TEMP39(accession_305);
  create index I_43 on %MART_NAME%.TEMP39(accession_305_r1);
  rename table %MART_NAME%.TEMP39 to %MART_NAME%.closure_ECO__closure__main;
  create index I_44 on %MART_NAME%.closure_ECO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP42 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='efo';
  create index I_47 on %MART_NAME%.TEMP42(parent_term_id_301);
  create table %MART_NAME%.TEMP43 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP42 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP42;
  create index I_48 on %MART_NAME%.TEMP43(ontology_id_305_r1);
  create table %MART_NAME%.TEMP44 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP43 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='efo';
  drop table %MART_NAME%.TEMP43;
  create index I_49 on %MART_NAME%.TEMP44(subparent_term_id_301);
  create table %MART_NAME%.TEMP45 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP44 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP44;
  create index I_50 on %MART_NAME%.TEMP45(ontology_id_305_r2);
  create table %MART_NAME%.TEMP46 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP45 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='efo';
  drop table %MART_NAME%.TEMP45;
  create table %MART_NAME%.TEMP47 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP46;
  drop table %MART_NAME%.TEMP46;
  create index I_51 on %MART_NAME%.TEMP47(accession_305);
  create index I_52 on %MART_NAME%.TEMP47(accession_305_r1);
  rename table %MART_NAME%.TEMP47 to %MART_NAME%.closure_EFO__closure__main;
  create index I_53 on %MART_NAME%.closure_EFO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP50 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='eo';
  create index I_56 on %MART_NAME%.TEMP50(parent_term_id_301);
  create table %MART_NAME%.TEMP51 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP50 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP50;
  create index I_57 on %MART_NAME%.TEMP51(ontology_id_305_r1);
  create table %MART_NAME%.TEMP52 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP51 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='eo';
  drop table %MART_NAME%.TEMP51;
  create index I_58 on %MART_NAME%.TEMP52(subparent_term_id_301);
  create table %MART_NAME%.TEMP53 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP52 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP52;
  create index I_59 on %MART_NAME%.TEMP53(ontology_id_305_r2);
  create table %MART_NAME%.TEMP54 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP53 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='eo';
  drop table %MART_NAME%.TEMP53;
  create table %MART_NAME%.TEMP55 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP54;
  drop table %MART_NAME%.TEMP54;
  create index I_60 on %MART_NAME%.TEMP55(accession_305);
  create index I_61 on %MART_NAME%.TEMP55(accession_305_r1);
  rename table %MART_NAME%.TEMP55 to %MART_NAME%.closure_EO__closure__main;
  create index I_62 on %MART_NAME%.closure_EO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP58 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='fypo';
  create index I_65 on %MART_NAME%.TEMP58(parent_term_id_301);
  create table %MART_NAME%.TEMP59 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP58 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP58;
  create index I_66 on %MART_NAME%.TEMP59(ontology_id_305_r1);
  create table %MART_NAME%.TEMP60 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP59 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='fypo';
  drop table %MART_NAME%.TEMP59;
  create index I_67 on %MART_NAME%.TEMP60(subparent_term_id_301);
  create table %MART_NAME%.TEMP61 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP60 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP60;
  create index I_68 on %MART_NAME%.TEMP61(ontology_id_305_r2);
  create table %MART_NAME%.TEMP62 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP61 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='fypo';
  drop table %MART_NAME%.TEMP61;
  create table %MART_NAME%.TEMP63 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP62;
  drop table %MART_NAME%.TEMP62;
  create index I_69 on %MART_NAME%.TEMP63(accession_305);
  create index I_70 on %MART_NAME%.TEMP63(accession_305_r1);
  rename table %MART_NAME%.TEMP63 to %MART_NAME%.closure_FYPO__closure__main;
  create index I_71 on %MART_NAME%.closure_FYPO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP66 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='FYPO_EXT';
  create index I_74 on %MART_NAME%.TEMP66(parent_term_id_301);
  create table %MART_NAME%.TEMP67 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP66 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP66;
  create index I_75 on %MART_NAME%.TEMP67(ontology_id_305_r1);
  create table %MART_NAME%.TEMP68 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP67 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='FYPO_EXT';
  drop table %MART_NAME%.TEMP67;
  create index I_76 on %MART_NAME%.TEMP68(subparent_term_id_301);
  create table %MART_NAME%.TEMP69 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP68 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP68;
  create index I_77 on %MART_NAME%.TEMP69(ontology_id_305_r2);
  create table %MART_NAME%.TEMP70 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP69 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='FYPO_EXT';
  drop table %MART_NAME%.TEMP69;
  create table %MART_NAME%.TEMP71 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP70;
  drop table %MART_NAME%.TEMP70;
  create index I_78 on %MART_NAME%.TEMP71(accession_305);
  create index I_79 on %MART_NAME%.TEMP71(accession_305_r1);
  rename table %MART_NAME%.TEMP71 to %MART_NAME%.closure_FYPO_EXT__closure__main;
  create index I_80 on %MART_NAME%.closure_FYPO_EXT__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP74 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='go';
  create index I_83 on %MART_NAME%.TEMP74(parent_term_id_301);
  create table %MART_NAME%.TEMP75 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP74 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP74;
  create index I_84 on %MART_NAME%.TEMP75(ontology_id_305_r1);
  create table %MART_NAME%.TEMP76 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP75 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='go';
  drop table %MART_NAME%.TEMP75;
  create index I_85 on %MART_NAME%.TEMP76(subparent_term_id_301);
  create table %MART_NAME%.TEMP77 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP76 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP76;
  create index I_86 on %MART_NAME%.TEMP77(ontology_id_305_r2);
  create table %MART_NAME%.TEMP78 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP77 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='go';
  drop table %MART_NAME%.TEMP77;
  create table %MART_NAME%.TEMP79 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP78;
  drop table %MART_NAME%.TEMP78;
  create index I_87 on %MART_NAME%.TEMP79(accession_305);
  create index I_88 on %MART_NAME%.TEMP79(accession_305_r1);
  rename table %MART_NAME%.TEMP79 to %MART_NAME%.closure_GO__closure__main;
  create index I_89 on %MART_NAME%.closure_GO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP82 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='gro';
  create index I_92 on %MART_NAME%.TEMP82(parent_term_id_301);
  create table %MART_NAME%.TEMP83 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP82 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP82;
  create index I_93 on %MART_NAME%.TEMP83(ontology_id_305_r1);
  create table %MART_NAME%.TEMP84 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP83 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='gro';
  drop table %MART_NAME%.TEMP83;
  create index I_94 on %MART_NAME%.TEMP84(subparent_term_id_301);
  create table %MART_NAME%.TEMP85 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP84 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP84;
  create index I_95 on %MART_NAME%.TEMP85(ontology_id_305_r2);
  create table %MART_NAME%.TEMP86 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP85 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='gro';
  drop table %MART_NAME%.TEMP85;
  create table %MART_NAME%.TEMP87 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP86;
  drop table %MART_NAME%.TEMP86;
  create index I_96 on %MART_NAME%.TEMP87(accession_305);
  create index I_97 on %MART_NAME%.TEMP87(accession_305_r1);
  rename table %MART_NAME%.TEMP87 to %MART_NAME%.closure_GRO__closure__main;
  create index I_98 on %MART_NAME%.closure_GRO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP90 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='mod';
  create index I_101 on %MART_NAME%.TEMP90(parent_term_id_301);
  create table %MART_NAME%.TEMP91 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP90 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP90;
  create index I_102 on %MART_NAME%.TEMP91(ontology_id_305_r1);
  create table %MART_NAME%.TEMP92 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP91 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='mod';
  drop table %MART_NAME%.TEMP91;
  create index I_103 on %MART_NAME%.TEMP92(subparent_term_id_301);
  create table %MART_NAME%.TEMP93 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP92 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP92;
  create index I_104 on %MART_NAME%.TEMP93(ontology_id_305_r2);
  create table %MART_NAME%.TEMP94 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP93 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='mod';
  drop table %MART_NAME%.TEMP93;
  create table %MART_NAME%.TEMP95 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP94;
  drop table %MART_NAME%.TEMP94;
  create index I_105 on %MART_NAME%.TEMP95(accession_305);
  create index I_106 on %MART_NAME%.TEMP95(accession_305_r1);
  rename table %MART_NAME%.TEMP95 to %MART_NAME%.closure_MOD__closure__main;
  create index I_107 on %MART_NAME%.closure_MOD__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP98 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='ogms';
  create index I_110 on %MART_NAME%.TEMP98(parent_term_id_301);
  create table %MART_NAME%.TEMP99 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP98 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP98;
  create index I_111 on %MART_NAME%.TEMP99(ontology_id_305_r1);
  create table %MART_NAME%.TEMP100 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP99 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='ogms';
  drop table %MART_NAME%.TEMP99;
  create index I_112 on %MART_NAME%.TEMP100(subparent_term_id_301);
  create table %MART_NAME%.TEMP101 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP100 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP100;
  create index I_113 on %MART_NAME%.TEMP101(ontology_id_305_r2);
  create table %MART_NAME%.TEMP102 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP101 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='ogms';
  drop table %MART_NAME%.TEMP101;
  create table %MART_NAME%.TEMP103 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP102;
  drop table %MART_NAME%.TEMP102;
  create index I_114 on %MART_NAME%.TEMP103(accession_305);
  create index I_115 on %MART_NAME%.TEMP103(accession_305_r1);
  rename table %MART_NAME%.TEMP103 to %MART_NAME%.closure_OGMS__closure__main;
  create index I_116 on %MART_NAME%.closure_OGMS__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP106 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='pato';
  create index I_119 on %MART_NAME%.TEMP106(parent_term_id_301);
  create table %MART_NAME%.TEMP107 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP106 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP106;
  create index I_120 on %MART_NAME%.TEMP107(ontology_id_305_r1);
  create table %MART_NAME%.TEMP108 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP107 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='pato';
  drop table %MART_NAME%.TEMP107;
  create index I_121 on %MART_NAME%.TEMP108(subparent_term_id_301);
  create table %MART_NAME%.TEMP109 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP108 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP108;
  create index I_122 on %MART_NAME%.TEMP109(ontology_id_305_r2);
  create table %MART_NAME%.TEMP110 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP109 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='pato';
  drop table %MART_NAME%.TEMP109;
  create table %MART_NAME%.TEMP111 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP110;
  drop table %MART_NAME%.TEMP110;
  create index I_123 on %MART_NAME%.TEMP111(accession_305);
  create index I_124 on %MART_NAME%.TEMP111(accession_305_r1);
  rename table %MART_NAME%.TEMP111 to %MART_NAME%.closure_PATO__closure__main;
  create index I_125 on %MART_NAME%.closure_PATO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP114 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='pbo';
  create index I_128 on %MART_NAME%.TEMP114(parent_term_id_301);
  create table %MART_NAME%.TEMP115 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP114 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP114;
  create index I_129 on %MART_NAME%.TEMP115(ontology_id_305_r1);
  create table %MART_NAME%.TEMP116 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP115 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='pbo';
  drop table %MART_NAME%.TEMP115;
  create index I_130 on %MART_NAME%.TEMP116(subparent_term_id_301);
  create table %MART_NAME%.TEMP117 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP116 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP116;
  create index I_131 on %MART_NAME%.TEMP117(ontology_id_305_r2);
  create table %MART_NAME%.TEMP118 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP117 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='pbo';
  drop table %MART_NAME%.TEMP117;
  create table %MART_NAME%.TEMP119 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP118;
  drop table %MART_NAME%.TEMP118;
  create index I_132 on %MART_NAME%.TEMP119(accession_305);
  create index I_133 on %MART_NAME%.TEMP119(accession_305_r1);
  rename table %MART_NAME%.TEMP119 to %MART_NAME%.closure_PBO__closure__main;
  create index I_134 on %MART_NAME%.closure_PBO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP122 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='pbq';
  create index I_137 on %MART_NAME%.TEMP122(parent_term_id_301);
  create table %MART_NAME%.TEMP123 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP122 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP122;
  create index I_138 on %MART_NAME%.TEMP123(ontology_id_305_r1);
  create table %MART_NAME%.TEMP124 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP123 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='pbq';
  drop table %MART_NAME%.TEMP123;
  create index I_139 on %MART_NAME%.TEMP124(subparent_term_id_301);
  create table %MART_NAME%.TEMP125 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP124 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP124;
  create index I_140 on %MART_NAME%.TEMP125(ontology_id_305_r2);
  create table %MART_NAME%.TEMP126 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP125 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='pbq';
  drop table %MART_NAME%.TEMP125;
  create table %MART_NAME%.TEMP127 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP126;
  drop table %MART_NAME%.TEMP126;
  create index I_141 on %MART_NAME%.TEMP127(accession_305);
  create index I_142 on %MART_NAME%.TEMP127(accession_305_r1);
  rename table %MART_NAME%.TEMP127 to %MART_NAME%.closure_PBQ__closure__main;
  create index I_143 on %MART_NAME%.closure_PBQ__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP130 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='peco';
  create index I_146 on %MART_NAME%.TEMP130(parent_term_id_301);
  create table %MART_NAME%.TEMP131 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP130 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP130;
  create index I_147 on %MART_NAME%.TEMP131(ontology_id_305_r1);
  create table %MART_NAME%.TEMP132 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP131 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='peco';
  drop table %MART_NAME%.TEMP131;
  create index I_148 on %MART_NAME%.TEMP132(subparent_term_id_301);
  create table %MART_NAME%.TEMP133 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP132 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP132;
  create index I_149 on %MART_NAME%.TEMP133(ontology_id_305_r2);
  create table %MART_NAME%.TEMP134 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP133 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='peco';
  drop table %MART_NAME%.TEMP133;
  create table %MART_NAME%.TEMP135 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP134;
  drop table %MART_NAME%.TEMP134;
  create index I_150 on %MART_NAME%.TEMP135(accession_305);
  create index I_151 on %MART_NAME%.TEMP135(accession_305_r1);
  rename table %MART_NAME%.TEMP135 to %MART_NAME%.closure_PECO__closure__main;
  create index I_152 on %MART_NAME%.closure_PECO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP138 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='phi';
  create index I_155 on %MART_NAME%.TEMP138(parent_term_id_301);
  create table %MART_NAME%.TEMP139 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP138 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP138;
  create index I_156 on %MART_NAME%.TEMP139(ontology_id_305_r1);
  create table %MART_NAME%.TEMP140 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP139 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='phi';
  drop table %MART_NAME%.TEMP139;
  create index I_157 on %MART_NAME%.TEMP140(subparent_term_id_301);
  create table %MART_NAME%.TEMP141 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP140 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP140;
  create index I_158 on %MART_NAME%.TEMP141(ontology_id_305_r2);
  create table %MART_NAME%.TEMP142 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP141 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='phi';
  drop table %MART_NAME%.TEMP141;
  create table %MART_NAME%.TEMP143 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP142;
  drop table %MART_NAME%.TEMP142;
  create index I_159 on %MART_NAME%.TEMP143(accession_305);
  create index I_160 on %MART_NAME%.TEMP143(accession_305_r1);
  rename table %MART_NAME%.TEMP143 to %MART_NAME%.closure_PHI__closure__main;
  create index I_161 on %MART_NAME%.closure_PHI__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP146 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='po';
  create index I_164 on %MART_NAME%.TEMP146(parent_term_id_301);
  create table %MART_NAME%.TEMP147 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP146 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP146;
  create index I_165 on %MART_NAME%.TEMP147(ontology_id_305_r1);
  create table %MART_NAME%.TEMP148 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP147 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='po';
  drop table %MART_NAME%.TEMP147;
  create index I_166 on %MART_NAME%.TEMP148(subparent_term_id_301);
  create table %MART_NAME%.TEMP149 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP148 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP148;
  create index I_167 on %MART_NAME%.TEMP149(ontology_id_305_r2);
  create table %MART_NAME%.TEMP150 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP149 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='po';
  drop table %MART_NAME%.TEMP149;
  create table %MART_NAME%.TEMP151 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP150;
  drop table %MART_NAME%.TEMP150;
  create index I_168 on %MART_NAME%.TEMP151(accession_305);
  create index I_169 on %MART_NAME%.TEMP151(accession_305_r1);
  rename table %MART_NAME%.TEMP151 to %MART_NAME%.closure_PO__closure__main;
  create index I_170 on %MART_NAME%.closure_PO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP154 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='so';
  create index I_173 on %MART_NAME%.TEMP154(parent_term_id_301);
  create table %MART_NAME%.TEMP155 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP154 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP154;
  create index I_174 on %MART_NAME%.TEMP155(ontology_id_305_r1);
  create table %MART_NAME%.TEMP156 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP155 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='so';
  drop table %MART_NAME%.TEMP155;
  create index I_175 on %MART_NAME%.TEMP156(subparent_term_id_301);
  create table %MART_NAME%.TEMP157 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP156 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP156;
  create index I_176 on %MART_NAME%.TEMP157(ontology_id_305_r2);
  create table %MART_NAME%.TEMP158 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP157 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='so';
  drop table %MART_NAME%.TEMP157;
  create table %MART_NAME%.TEMP159 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP158;
  drop table %MART_NAME%.TEMP158;
  create index I_177 on %MART_NAME%.TEMP159(accession_305);
  create index I_178 on %MART_NAME%.TEMP159(accession_305_r1);
  rename table %MART_NAME%.TEMP159 to %MART_NAME%.closure_SO__closure__main;
  create index I_179 on %MART_NAME%.closure_SO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP162 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='to';
  create index I_182 on %MART_NAME%.TEMP162(parent_term_id_301);
  create table %MART_NAME%.TEMP163 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP162 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP162;
  create index I_183 on %MART_NAME%.TEMP163(ontology_id_305_r1);
  create table %MART_NAME%.TEMP164 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP163 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='to';
  drop table %MART_NAME%.TEMP163;
  create index I_184 on %MART_NAME%.TEMP164(subparent_term_id_301);
  create table %MART_NAME%.TEMP165 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP164 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP164;
  create index I_185 on %MART_NAME%.TEMP165(ontology_id_305_r2);
  create table %MART_NAME%.TEMP166 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP165 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='to';
  drop table %MART_NAME%.TEMP165;
  create table %MART_NAME%.TEMP167 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP166;
  drop table %MART_NAME%.TEMP166;
  create index I_186 on %MART_NAME%.TEMP167(accession_305);
  create index I_187 on %MART_NAME%.TEMP167(accession_305_r1);
  rename table %MART_NAME%.TEMP167 to %MART_NAME%.closure_TO__closure__main;
  create index I_188 on %MART_NAME%.closure_TO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP178 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='uo';
  create index I_200 on %MART_NAME%.TEMP178(parent_term_id_301);
  create table %MART_NAME%.TEMP179 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP178 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP178;
  create index I_201 on %MART_NAME%.TEMP179(ontology_id_305_r1);
  create table %MART_NAME%.TEMP180 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP179 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='uo';
  drop table %MART_NAME%.TEMP179;
  create index I_202 on %MART_NAME%.TEMP180(subparent_term_id_301);
  create table %MART_NAME%.TEMP181 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP180 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP180;
  create index I_203 on %MART_NAME%.TEMP181(ontology_id_305_r2);
  create table %MART_NAME%.TEMP182 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP181 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='uo';
  drop table %MART_NAME%.TEMP181;
  create table %MART_NAME%.TEMP183 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP182;
  drop table %MART_NAME%.TEMP182;
  create index I_204 on %MART_NAME%.TEMP183(accession_305);
  create index I_205 on %MART_NAME%.TEMP183(accession_305_r1);
  rename table %MART_NAME%.TEMP183 to %MART_NAME%.closure_UO__closure__main;
  create index I_206 on %MART_NAME%.closure_UO__closure__main(closure_id_301_key);
  create table %MART_NAME%.TEMP186 ENGINE=MyISAM as select a.*,b.name as name_302,b.namespace as namespace_302 from %MART_NAME%.TEMP_ONTOLOGY as a inner join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305=b.ontology_id and b.name='gr_tax';
  create index I_209 on %MART_NAME%.TEMP186(parent_term_id_301);
  create table %MART_NAME%.TEMP187 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r1,b.name as name_305_r1,b.definition as definition_305_r1,b.accession as accession_305_r1,b.subsets as subsets_305_r1 from %MART_NAME%.TEMP186 as a inner join %ONTOLOGY_DB%.term as b on a.parent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP186;
  create index I_210 on %MART_NAME%.TEMP187(ontology_id_305_r1);
  create table %MART_NAME%.TEMP188 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP187 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r1=b.ontology_id and b.name='gr_tax';
  drop table %MART_NAME%.TEMP187;
  create index I_211 on %MART_NAME%.TEMP188(subparent_term_id_301);
  create table %MART_NAME%.TEMP189 ENGINE=MyISAM as select a.*,b.ontology_id as ontology_id_305_r2,b.accession as accession_305_r2,b.subsets as subsets_305_r2 from %MART_NAME%.TEMP188 as a left join %ONTOLOGY_DB%.term as b on a.subparent_term_id_301=b.term_id;
  drop table %MART_NAME%.TEMP188;
  create index I_212 on %MART_NAME%.TEMP189(ontology_id_305_r2);
  create table %MART_NAME%.TEMP190 ENGINE=MyISAM as select a.* from %MART_NAME%.TEMP189 as a left join %ONTOLOGY_DB%.ontology as b on a.ontology_id_305_r2=b.ontology_id and b.name='gr_tax';
  drop table %MART_NAME%.TEMP189;
  create table %MART_NAME%.TEMP191 ENGINE=MyISAM as select distinct accession_305_r1,accession_305_r2,subsets_305,definition_305_r1,accession_305,definition_305,closure_id_301_key,subsets_305_r2,subsets_305_r1,namespace_302,distance_301,name_302,name_305_r1,name_305 from %MART_NAME%.TEMP190;
  drop table %MART_NAME%.TEMP190;
  create index I_213 on %MART_NAME%.TEMP191(accession_305);
  create index I_214 on %MART_NAME%.TEMP191(accession_305_r1);
  rename table %MART_NAME%.TEMP191 to %MART_NAME%.closure_GR_TAX__closure__main;
  create index I_215 on %MART_NAME%.closure_GR_TAX__closure__main(closure_id_301_key);
  CREATE TABLE %MART_NAME%.closure_SO_mini__closure_mini__main LIKE %MART_NAME%.closure_SO__closure__main;
  INSERT %MART_NAME%.closure_SO_mini__closure_mini__main SELECT * FROM %MART_NAME%.closure_SO__closure__main;
  ALTER TABLE %MART_NAME%.closure_SO_mini__closure_mini__main CHANGE COLUMN closure_id_301_key closure_mini_id_301_key int(10) unsigned NOT NULL DEFAULT '0';
  CREATE TABLE %MART_NAME%.closure_SO_regulation__closure_regulation__main LIKE %MART_NAME%.closure_SO__closure__main;
  INSERT %MART_NAME%.closure_SO_regulation__closure_regulation__main SELECT * FROM %MART_NAME%.closure_SO__closure__main;
  ALTER TABLE %MART_NAME%.closure_SO_regulation__closure_regulation__main CHANGE COLUMN closure_id_301_key closure_regulation_id_301_key int(10) unsigned NOT NULL DEFAULT '0';
  CREATE TABLE %MART_NAME%.closure_SO_motif__closure_motif__main LIKE %MART_NAME%.closure_SO__closure__main;
  INSERT %MART_NAME%.closure_SO_motif__closure_motif__main SELECT * FROM %MART_NAME%.closure_SO__closure__main;
  ALTER TABLE %MART_NAME%.closure_SO_motif__closure_motif__main CHANGE COLUMN closure_id_301_key closure_motif_id_301_key int(10) unsigned NOT NULL DEFAULT '0';
  DROP TABLE %MART_NAME%.TEMP_ONTOLOGY;
  