[Swift-commit] r5552 - provenancedb

lgadelha at ci.uchicago.edu lgadelha at ci.uchicago.edu
Tue Feb 7 05:31:21 CST 2012


Author: lgadelha
Date: 2012-02-07 05:31:20 -0600 (Tue, 07 Feb 2012)
New Revision: 5552

Modified:
   provenancedb/SPQL.g
   provenancedb/pql_functions.sql
   provenancedb/prov-init.sql
Log:
Schema update, minor fixes to SPQL.


Modified: provenancedb/SPQL.g
===================================================================
--- provenancedb/SPQL.g	2012-02-06 21:44:39 UTC (rev 5551)
+++ provenancedb/SPQL.g	2012-02-07 11:31:20 UTC (rev 5552)
@@ -1,4 +1,4 @@
-grammar ProvSQL;
+grammar SPQL;
 
 @header {
 	import java.util.HashSet;
@@ -35,9 +35,10 @@
 		schemaGraph.addVertex("produces");
 		schemaGraph.addVertex("consumes");
 		schemaGraph.addVertex("compare_run");
-		schemaGraph.addEdge("annotation", "script_run");
-		schemaGraph.addEdge("annotation", "function_call");
-		schemaGraph.addEdge("annotation", "variable");
+		schemaGraph.addVertex("variable_containment");
+		//schemaGraph.addEdge("annotation", "script_run");
+		//schemaGraph.addEdge("annotation", "function_call");
+		//schemaGraph.addEdge("annotation", "variable");
 		schemaGraph.addEdge("script_run", "function_call");
 		schemaGraph.addEdge("function_call", "consumes");
 		schemaGraph.addEdge("function_call", "produces");
@@ -47,7 +48,7 @@
 		schemaGraph.addEdge("variable", "variable_containment");
 		schemaGraph.addEdge("variable", "consumes");
 		schemaGraph.addEdge("variable", "produces");
-		
+
 		return schemaGraph;
 	}
 
@@ -120,19 +121,16 @@
 		HashMap<DefaultEdge,String> joinExpressions = new HashMap<DefaultEdge, String>();
 		String joinExpressionsString = new String();
 
-		joinExpressions.put(schemaGraph.getEdge("annotation", "script_run"), "annotation.script_run_id=script_run.id");
+		//joinExpressions.put(schemaGraph.getEdge("annotation", "script_run"), "annotation.script_run_id=script_run.id");
 		joinExpressions.put(schemaGraph.getEdge("script_run", "function_call"), "script_run.id=function_call.script_run_id");
-		joinExpressions.put(schemaGraph.getEdge("function_call", "annotation"), "function_call.id=annotation.function_call_id");
-		joinExpressions.put(schemaGraph.getEdge("function_call", "annotation"), "function_call.id=annotation.function_call_id");
+		//joinExpressions.put(schemaGraph.getEdge("function_call", "annotation"), "function_call.id=annotation.function_call_id");
 		joinExpressions.put(schemaGraph.getEdge("function_call", "produces"), "function_call.id=produces.function_call_id");
 		joinExpressions.put(schemaGraph.getEdge("function_call", "consumes"), "function_call.id=consumes.function_call_id");
-		joinExpressions.put(schemaGraph.getEdge("application_execution", "rt_info"), "application_execution.id=rt_info.application_execution_id");
+		joinExpressions.put(schemaGraph.getEdge("function_call", "application_execution"), "function_call.id=application_execution.function_call_id");
+		joinExpressions.put(schemaGraph.getEdge("application_execution", "runtime_info"), "application_execution.id=runtime_info.application_execution_id");
 		joinExpressions.put(schemaGraph.getEdge("variable", "consumes"), "variable.id=consumes.variable_id");
 		joinExpressions.put(schemaGraph.getEdge("variable", "produces"), "variable.id=produces.variable_id");
-		joinExpressions.put(schemaGraph.getEdge("variable", "annotation"), "variable.id=annotation.variable_id");
-		joinExpressions.put(schemaGraph.getEdge("variable", "annotation"), "variable.id=annotation.variable_id");
-		joinExpressions.put(schemaGraph.getEdge("variable", "file"), "variable.id=file.id");
-		joinExpressions.put(schemaGraph.getEdge("variable", "in_mem"), "variable.id=in_mem.id");
+		//joinExpressions.put(schemaGraph.getEdge("variable", "annotation"), "variable.id=annotation.variable_id");
 		joinExpressions.put(schemaGraph.getEdge("variable", "containment"), "variable.id=containment.containee");
 		joinExpressions.put(schemaGraph.getEdge("variable", "containment"), "variable.id=containment.container");
 
@@ -731,7 +729,7 @@
     ;
 
 STRING
-    :  '\'' ( 'a'..'z' | 'A'..'Z' | '_' | '-' | '0'..'9' | '.' | '%')* '\''
+    :  '\'' ( 'a'..'z' | 'A'..'Z' | '_' | '-' | '0'..'9' | '.' | '%' | '/' | ':')* '\''
     ;
     
 NEWLINE	:	'\r' ?	'\n';

Modified: provenancedb/pql_functions.sql
===================================================================
--- provenancedb/pql_functions.sql	2012-02-06 21:44:39 UTC (rev 5551)
+++ provenancedb/pql_functions.sql	2012-02-07 11:31:20 UTC (rev 5552)
@@ -4,92 +4,10 @@
 -- SQL Functions
 
 -- lists variations in a parameter's value across workflows, for parameters that are in-memory variables
-drop view in_mem_in cascade;
-create view in_mem_in as
-       select proc.run_id, proc.id as proc_id, 
-              proc.name as proc_name, ds_in.ds_id, 
-              ds_in.param, in_mem.value
-       from   proc, ds_in, in_mem
-       where  proc.id=ds_in.proc_id and ds_in.ds_id=in_mem.id;
 
-drop view in_mem_out cascade;
-create view in_mem_out as
-       select proc.run_id, proc.id as proc_id, 
-              proc.name as proc_name, ds_out.ds_id, 
-              ds_out.param, in_mem.value
-       from   proc, ds_out, in_mem
-       where  proc.id=ds_out.proc_id and ds_out.ds_id=in_mem.id;
- 
-drop view in_mem_use cascade;
-create view in_mem_use as
-       select * from in_mem_in
-     union
-       select * from in_mem_out;      
 
-drop view file_in cascade;
-create view file_in as
-       select proc.run_id, proc.id as proc_id, 
-              proc.name as proc_name, ds_in.ds_id, 
-              ds_in.param, file.name as value
-       from   proc, ds_in, file
-       where  proc.id=ds_in.proc_id and ds_in.ds_id=file.id;
 
-drop view file_out cascade;
-create view file_out as
-       select proc.run_id, proc.id as proc_id, 
-              proc.name as proc_name, ds_out.ds_id, 
-              ds_out.param, file.name as value
-       from   proc, ds_out, file
-       where  proc.id=ds_out.proc_id and ds_out.ds_id=file.id;
- 	    
-drop view file_use cascade;
-create view file_use as
-       select * from file_in
-     union
-       select * from file_out;
 
-drop view ds_param_value cascade;
-create view ds_param_value as
-       select * from in_mem_use
-     union
-       select * from file_use;
-
-drop view a_t cascade;
-create view a_t as
-       select run.id, a_run_t.name, a_run_t.value
-       from   run, a_run_t 
-       where  run.id=a_run_t.run_id
-     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
-     union
-       select ds_use.run_id, a_ds_t.name, a_ds_t.value
-       from   ds_use, a_ds_t
-       where  ds_use.ds_id=a_ds_t.ds_id;
-
-drop view a_n cascade;
-create view a_n as
-       select run.id, a_run_n.name, a_run_n.value
-       from   run, a_run_n 
-       where  run.id=a_run_n.run_id
-     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
-     union
-       select ds_use.run_id, a_ds_n.name, a_ds_n.value
-       from   ds_use, a_ds_n
-       where  ds_use.ds_id=a_ds_n.ds_id;
-
-drop view ds_use cascade;
-create view ds_use as
-       select *,'I' as direction from ds_in
-     union all
-       select *,'O' as direction from ds_out;
-
-
-
 drop type compare_run_by_parameter_type cascade;
 create type compare_run_by_parameter_type as (run_id varchar, param varchar, value varchar);
 

Modified: provenancedb/prov-init.sql
===================================================================
--- provenancedb/prov-init.sql	2012-02-06 21:44:39 UTC (rev 5551)
+++ provenancedb/prov-init.sql	2012-02-07 11:31:20 UTC (rev 5552)
@@ -146,7 +146,16 @@
      primary key (proc_id,ds_id,param)
     );
 
+drop view ds_use;
 
+create view ds_use as
+ SELECT ds_in.proc_id as function_call_id, ds_in.ds_id as variable_id, ds_in.param as parameter
+   FROM ds_in
+UNION ALL 
+ SELECT ds_out.proc_id as function_call_id, ds_out.ds_id as variable_id, ds_out.param as parameter
+   FROM ds_out;
+
+
 -- annotations (_n: numeric, _t: text)
 create table a_ds_n
    ( ds_id varchar(256) references ds (id) on delete cascade, 
@@ -204,9 +213,7 @@
        union all
        select out_id as parent,in_id as child from ds_cont;
 
--- continue renaming from here
-
-
+drop view a_t cascade;
 create view a_t as
     select *
     from a_run_t 
@@ -217,6 +224,7 @@
     select * 
     from a_proc_t;
 
+drop view a_n cascade;
 create view a_n as
     select *
     from a_run_n 
@@ -231,8 +239,9 @@
 
 drop view function_call;
 
+-- TODO: move tc_name to application_execution (app_exec)
 create view function_call as 
-    select proc.id, proc.type, proc.name, proc.run_id, app_inv.proc_name, 
+    select proc.id, app_inv.proc_name as name, proc.type, proc.name as tc_name, proc.run_id as script_run_id,  
            to_timestamp(app_inv.start_time), app_inv.duration, app_inv.final_state, app_inv.scratch 
     from proc 
     left outer join 




More information about the Swift-commit mailing list