     ,GeneID NUMBER(22,0) 
     ,GeneIdentifier varchar2(255)) ON COMMIT DELETE ROWS;
 
---------------------------------------------------------
---  DDL for Bioetity annotations TEMP TABLE
---------------------------------------------------------
-
-CREATE TABLE "TMP_BIOENTITY" (
-    accession varchar2(255)
-    ,name varchar2(255)
-    ,value varchar2(255));
     
 --------------------------------------------------------
 --  TASK MANAGER DATA STRUCTURES


ALTER TRIGGER A2_BIOENTITY2BIOENTITY_INSERT ENABLE;

--------------------------------------------------------
-- BIOENTITY2BIOENTITY
--------------------------------------------------------

 CREATE TABLE "A2_BE2BE_UNFOLDED" (
   "BEIDFROM"  NUMBER(22,0) CONSTRAINT NN_BE2BE_UNF_BEIDFROM NOT NULL
  , "BEIDTO"  NUMBER(22,0) CONSTRAINT NN_BE2BE_UNF_BEIDTO NOT NULL)
 ;

 ALTER TABLE "A2_BE2BE_UNFOLDED"
  ADD CONSTRAINT "FK_BE2BE_UNF_BEFROM"
    FOREIGN KEY ("BEIDFROM")
    REFERENCES "A2_BIOENTITY" ("BIOENTITYID")
    ON DELETE CASCADE
    ENABLE;

ALTER TABLE "A2_BE2BE_UNFOLDED"
  ADD CONSTRAINT "FK_BE2BE_UNF_BETO"
    FOREIGN KEY ("BEIDTO")
    REFERENCES "A2_BIOENTITY" ("BIOENTITYID")
    ON DELETE CASCADE
    ENABLE;

  CREATE INDEX "IDX_BE2BE_UNF_FROM"
  ON "A2_BE2BE_UNFOLDED" ("BEIDFROM");

  CREATE INDEX "IDX_BE2BE_UNF_TO"
  ON "A2_BE2BE_UNFOLDED" ("BEIDTO");

  CREATE INDEX "IDX_BE2BE_UNF_FROM_TO"
  ON "A2_BE2BE_UNFOLDED" ("BEIDFROM", "BEIDTO");

/

--------------------------------------------------------
-- BIOENTITY BIOENTITYPROPERTYVALUE

for each row
begin
if(:new.BEPropertyValueID is null) then
select A2_BIOENTITYPROPERTYVALUE_SEQ.nextval into :new.BEPropertyValueID from dual;
end if;
end;
/
