[Swift-commit] r2929 - provenancedb

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Thu May 14 04:24:48 CDT 2009


Author: benc
Date: 2009-05-14 04:24:48 -0500 (Thu, 14 May 2009)
New Revision: 2929

Modified:
   provenancedb/prov-sql-generate-transitive-closures.sql
   provenancedb/prov-sql-iterate-transitive-closures.sql
Log:
fix up sql transitivity script: execute_id is now process_id; addition of
compounds to process table means that we get duplicates which need
eliminating with DISTINCT; and some CONSTRAINTs to check that we aren't
putting duplicates in any of the transitivity tables.

Modified: provenancedb/prov-sql-generate-transitive-closures.sql
===================================================================
--- provenancedb/prov-sql-generate-transitive-closures.sql	2009-05-14 09:02:27 UTC (rev 2928)
+++ provenancedb/prov-sql-generate-transitive-closures.sql	2009-05-14 09:24:48 UTC (rev 2929)
@@ -11,12 +11,13 @@
 
 CREATE TABLE trans 
     (before char(128),
-     after char(128)
-    );
+     after char(128),
+    CONSTRAINT no_duplicate_arcs_in_trans UNIQUE (before, after));
 
 CREATE TABLE transbase
     (before char(128),
-     after char(128)
+     after char(128),
+     CONSTRAINT no_duplicate_arcs_in_transbase UNIQUE (before, after)
     );
 
 CREATE INDEX transindex ON trans (before);
@@ -24,11 +25,10 @@
 
 INSERT INTO transbase SELECT inner_dataset_id AS before, outer_dataset_id AS after FROM dataset_containment;
 
-INSERT INTO transbase SELECT execute_id AS before, dataset_id AS after FROM dataset_usage where direction='O';
+INSERT INTO transbase SELECT process_id AS before, dataset_id AS after FROM dataset_usage where direction='O';
 
-INSERT INTO transbase SELECT dataset_id AS before, execute_id AS after FROM dataset_usage where direction='I';
+INSERT INTO transbase SELECT dataset_id AS before, process_id AS after FROM dataset_usage where direction='I';
 
 -- now seed the transitive closure table
-
 INSERT into trans SELECT before, after from transbase;
 

Modified: provenancedb/prov-sql-iterate-transitive-closures.sql
===================================================================
--- provenancedb/prov-sql-iterate-transitive-closures.sql	2009-05-14 09:02:27 UTC (rev 2928)
+++ provenancedb/prov-sql-iterate-transitive-closures.sql	2009-05-14 09:24:48 UTC (rev 2929)
@@ -3,12 +3,13 @@
 
 CREATE TEMPORARY TABLE transtemp
     (before char(128),
-     after char(128)
+     after char(128),
+CONSTRAINT no_duplicate_arcs_in_transtemp UNIQUE (before, after)
     );
 
 
 -- existing path before existing arc
-INSERT INTO transtemp SELECT transbase.before, trans.after FROM transbase, trans
+INSERT INTO transtemp SELECT DISTINCT transbase.before, trans.after FROM transbase, trans
     WHERE transbase.after = trans.before;
 
 INSERT INTO trans SELECT transtemp.before, transtemp.after FROM transtemp




More information about the Swift-commit mailing list