From: Claudio Sacerdoti Coen Date: Mon, 23 Feb 2004 16:29:14 +0000 (+0000) Subject: Script to create and drop tables and indexes committed. X-Git-Tag: v0_0_4~100 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=543467755945c45e36f27eac25e0a82a873430b4;p=helm.git Script to create and drop tables and indexes committed. New targets added to the Makefile. --- diff --git a/helm/metadata/Makefile b/helm/metadata/Makefile index 4708eb22d..3b6b9b08e 100644 --- a/helm/metadata/Makefile +++ b/helm/metadata/Makefile @@ -1,6 +1,17 @@ +FILLDB=fill_db.sql + all: - rm -f fill_db.sql - time for i in `cat tipi_induttivi.txt` ; do (cd tmp ; wget -t 1 -O downloaded.xml.gz "http://mowgli.cs.unibo.it:58081/getxml?format=gz&uri=$$i") ; zcat tmp/downloaded.xml.gz > tmp/inductive_type.xml ; extractor/meta_ind $$i "tmp/inductive_type.xml" >> fill_db.sql ; rm -f tmp/downloaded.xml.gz tmp/inductive_type.xml; done > log 2>&1 - time for i in `cat costanti_e_variabili.txt` ; do (cd tmp ; wget -t 1 -O downloaded.xml.gz "http://mowgli.cs.unibo.it:58081/getxml?format=gz&uri=$$i" ; wget -t 1 -O downloaded_body.xml.gz "http://mowgli.cs.unibo.it:58081/getxml?format=gz&uri=$$i.body"); zcat tmp/downloaded.xml.gz > tmp/type.xml ; zcat tmp/downloaded_body.xml.gz > tmp/body.xml ; extractor/meta $$i "tmp/body.xml" "tmp/type.xml" >> fill_db.sql ; rm -f tmp/downloaded.xml.gz tmp/downloaded_body.xml.gz tmp/type.xml tmp/body.xml ; done > log 2>&1 + rm -f $(FILLDB) + time for i in `cat tipi_induttivi.txt` ; do (cd tmp ; wget -t 1 -O downloaded.xml.gz "http://mowgli.cs.unibo.it:58081/getxml?format=gz&uri=$$i") ; zcat tmp/downloaded.xml.gz > tmp/inductive_type.xml ; extractor/meta_ind $$i "tmp/inductive_type.xml" >> $(FILLDB) ; rm -f tmp/downloaded.xml.gz tmp/inductive_type.xml; done > log 2>&1 + time for i in `cat costanti_e_variabili.txt` ; do (cd tmp ; wget -t 1 -O downloaded.xml.gz "http://mowgli.cs.unibo.it:58081/getxml?format=gz&uri=$$i" ; wget -t 1 -O downloaded_body.xml.gz "http://mowgli.cs.unibo.it:58081/getxml?format=gz&uri=$$i.body"); zcat tmp/downloaded.xml.gz > tmp/type.xml ; zcat tmp/downloaded_body.xml.gz > tmp/body.xml ; extractor/meta $$i "tmp/body.xml" "tmp/type.xml" >> $(FILLDB) ; rm -f tmp/downloaded.xml.gz tmp/downloaded_body.xml.gz tmp/type.xml tmp/body.xml ; done > log 2>&1 + +drop_tables: + cat sql/drop_mowgli_tables.sql | mysql -pbjIcRpru -u helmadmin mowgli + +create_tables: + cat sql/create_mowgli_tables.sql | mysql -pbjIcRpru -u helmadmin mowgli + +fill_db: + cat $(FILLDB) | mysql -pbjIcRpru -u helmadmin mowgli -.PHONY: all +.PHONY: all create_tables drop_tables fill_db diff --git a/helm/metadata/sql/create_mowgli_tables.sql b/helm/metadata/sql/create_mowgli_tables.sql new file mode 100644 index 000000000..046e21fc4 --- /dev/null +++ b/helm/metadata/sql/create_mowgli_tables.sql @@ -0,0 +1,28 @@ + +CREATE TABLE refObj ( + source varchar(255), + h_occurrence varchar(255), + h_position varchar(255), + h_depth integer +); +CREATE TABLE refSort ( + source varchar(255), + h_position varchar(255), + h_depth integer, + h_sort varchar(255) +); +CREATE TABLE refRel ( + source varchar(255), + h_position varchar(255), + h_depth integer +); +CREATE TABLE objectName ( + source varchar(255), + value varchar(255) +); + +CREATE INDEX refObj_source ON refObj (source); +CREATE INDEX refObj_target ON refObj (h_occurrence); +CREATE INDEX refSort_source ON refSort (source); +CREATE INDEX objectName_value ON objectName (value); + diff --git a/helm/metadata/sql/drop_mowgli_tables.sql b/helm/metadata/sql/drop_mowgli_tables.sql new file mode 100644 index 000000000..273b4d2e6 --- /dev/null +++ b/helm/metadata/sql/drop_mowgli_tables.sql @@ -0,0 +1,4 @@ +DROP TABLE refObj; +DROP TABLE refSort; +DROP TABLE refRel; +DROP TABLE objectName;