[Swift-commit] r5477 - provenancedb

lgadelha at ci.uchicago.edu lgadelha at ci.uchicago.edu
Mon Dec 26 05:46:39 CST 2011


Author: lgadelha
Date: 2011-12-26 05:46:38 -0600 (Mon, 26 Dec 2011)
New Revision: 5477

Removed:
   provenancedb/compare_run.py
Modified:
   provenancedb/ProvSQL.g
   provenancedb/pql_functions.sql
   provenancedb/prov-init.sql
Log:
Minor updates


Modified: provenancedb/ProvSQL.g
===================================================================
--- provenancedb/ProvSQL.g	2011-12-25 22:59:46 UTC (rev 5476)
+++ provenancedb/ProvSQL.g	2011-12-26 11:46:38 UTC (rev 5477)
@@ -443,7 +443,7 @@
 	|
 	LIKE
 	{
-		whereClause += " BETWEEN ";
+		whereClause += " LIKE ";
 	} 
 	h=STRING 
 	{
@@ -715,7 +715,7 @@
     ;
 
 STRING
-    :  '\'' ( 'a'..'z' | 'A'..'Z' | '_' | '-' | '0'..'9' | '.')* '\''
+    :  '\'' ( 'a'..'z' | 'A'..'Z' | '_' | '-' | '0'..'9' | '.' | '%')* '\''
     ;
     
 NEWLINE	:	'\r' ?	'\n';

Deleted: provenancedb/compare_run.py
===================================================================
--- provenancedb/compare_run.py	2011-12-25 22:59:46 UTC (rev 5476)
+++ provenancedb/compare_run.py	2011-12-26 11:46:38 UTC (rev 5477)
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-selectClause = 'SELECT run_id'
-fromClause = 'FROM'
-nId = 0
-for arg in sys.argv:
-    argTokens = arg.partition('=')
-    
-    if argTokens[0] == 'annot_num' or argTokens[0] == 'annot_txt' or argTokens[0] == 'param':
-        key = argTokens[2]
-        nId+=1
-        sId = 'j%s' % nId
-        selectClause += ', ' + sId + '.value as ' + key
-        if nId>1:
-            fromClause += ' INNER JOIN'
-        fromClause += ' compare_run_by_' + argTokens[0] + '(\'' + key + '\') as ' + sId
-        if nId>1:
-            fromClause += ' USING (run_id)'
-
-query = selectClause + ' ' + fromClause + ';'
-
-print query
-        
-    
-    
-    

Modified: provenancedb/pql_functions.sql
===================================================================
--- provenancedb/pql_functions.sql	2011-12-25 22:59:46 UTC (rev 5476)
+++ provenancedb/pql_functions.sql	2011-12-26 11:46:38 UTC (rev 5477)
@@ -165,6 +165,32 @@
     WHERE  run.id=a_run_n.run_id and a_run_n.name=$1
 $$ LANGUAGE SQL;
 
+DROP TYPE compare_run_by_key_numeric_type;
+CREATE TYPE compare_run_by_key_numeric_type as (run_id VARCHAR, name VARCHAR, value NUMERIC);
+
+CREATE OR REPLACE FUNCTION compare_run_by_key_numeric(name VARCHAR)
+RETURNS SETOF compare_run_by_key_numeric_type
+AS $$
+    SELECT proc.run_id, a_ds_n.name, a_ds_n.value
+    FROM   a_ds_n,ds_use,ds_cont,proc
+    WHERE  a_ds_n.ds_id=ds_cont.in_id AND ds_cont.out_id=ds_use.ds_id AND
+           ds_use.proc_id=proc.id AND a_ds_n.name=$1
+  UNION
+    SELECT proc.run_id, a_ds_n.name, a_ds_n.value 
+    FROM   proc, ds_use, a_ds_n
+    WHERE  proc.id=ds_use.proc_id and ds_use.ds_id=a_ds_n.ds_id and
+           a_ds_n.name=$1
+  UNION
+    SELECT proc.run_id, a_proc_n.name, a_proc_n.value 
+    FROM   proc, a_proc_n
+    WHERE  proc.id=a_proc_n.proc_id and a_proc_n.name=$1
+  UNION
+    SELECT run.id as run_id, a_run_n.name, a_run_n.value 
+    FROM   run, a_run_n
+    WHERE  run.id=a_run_n.run_id and a_run_n.name=$1
+$$ LANGUAGE SQL;
+
+
 DROP TYPE compare_run_by_annot_txt_type;
 CREATE TYPE compare_run_by_annot_txt_type as (run_id VARCHAR, name VARCHAR, value VARCHAR);
 
@@ -190,7 +216,31 @@
     WHERE  run.id=a_run_t.run_id and a_run_t.name=$1
 $$ LANGUAGE SQL;
 
+DROP TYPE compare_run_by_key_text_type;
+CREATE TYPE compare_run_by_key_text_type as (run_id VARCHAR, name VARCHAR, value VARCHAR);
 
+CREATE OR REPLACE FUNCTION compare_run_by_key_text(name VARCHAR)
+RETURNS SETOF compare_run_by_key_text_type
+AS $$
+    SELECT proc.run_id, a_ds_t.name, a_ds_t.value
+    FROM   a_ds_t,ds_use,ds_cont,proc
+    WHERE  a_ds_t.ds_id=ds_cont.in_id AND ds_cont.out_id=ds_use.ds_id AND
+           ds_use.proc_id=proc.id AND a_ds_t.name=$1
+  UNION
+    SELECT proc.run_id, a_ds_t.name, a_ds_t.value 
+    FROM   proc, ds_use, a_ds_t
+    WHERE  proc.id=ds_use.proc_id and ds_use.ds_id=a_ds_t.ds_id and
+           a_ds_t.name=$1
+  UNION
+    SELECT proc.run_id, a_proc_t.name, a_proc_t.value 
+    FROM   proc, a_proc_t
+    WHERE  proc.id=a_proc_t.proc_id and a_proc_t.name=$1
+  UNION
+    SELECT run.id as run_id, a_run_t.name, a_run_t.value 
+    FROM   run, a_run_t
+    WHERE  run.id=a_run_t.run_id and a_run_t.name=$1
+$$ LANGUAGE SQL;
+
 -- CREATE OR REPLACE FUNCTION compare_run_by_annot_num(name VARCHAR)
 -- RETURNS TABLE (
 --   workflow_id VARCHAR, 

Modified: provenancedb/prov-init.sql
===================================================================
--- provenancedb/prov-init.sql	2011-12-25 22:59:46 UTC (rev 5476)
+++ provenancedb/prov-init.sql	2011-12-26 11:46:38 UTC (rev 5477)
@@ -32,7 +32,10 @@
      cog_version   varchar(16),
      final_state   varchar(16),
      start_time    numeric,
-     duration      numeric
+     duration      numeric,
+     script_source text,
+     tc_file	   text,
+     sites_file	   text
     );
 
 -- process gives information about each process (in the OPM sense)
@@ -42,7 +45,7 @@
 -- has an entry for this process.
 -- process types: internal, rootthread, execute, function, compound, scope, operator
 create table proc
-           (id     varchar(256) primary key, 
+    (id     varchar(256) primary key, 
      type   varchar(16),
      name   varchar(256), -- in the case of an execute this refers to the transformation name in tc.data
      run_id varchar(256) references run (id) on delete cascade   -- normalize: workflow_id of sub-procedure determined




More information about the Swift-commit mailing list