]> matita.cs.unibo.it Git - helm.git/blob - helm/metadata/sql/fill_all_derived.sql
ocaml 3.09 transition
[helm.git] / helm / metadata / sql / fill_all_derived.sql
1 CREATE TABLE no_inconcl_aux_tmp (
2     source varchar(255) binary unique not null,
3     no smallint(6) not null
4 );
5 CREATE TABLE no_concl_hyp_tmp (
6     source varchar(255) binary unique not null,
7     no smallint(6) not null
8 );
9 CREATE TABLE no_hyp_tmp (
10     source varchar(255) binary unique not null,
11     no smallint(6) not null
12 );
13
14 INSERT INTO no_inconcl_aux_tmp
15 SELECT source, COUNT(h_occurrence)
16 FROM refObj
17 WHERE
18   h_position='http://www.cs.unibo.it/helm/schemas/schema-helm#InConclusion'
19   OR h_position='http://www.cs.unibo.it/helm/schemas/schema-helm#MainConclusion'
20 GROUP BY source;
21
22 INSERT IGNORE INTO no_inconcl_aux_tmp
23 SELECT source, 0
24 FROM refObj
25 GROUP BY source;
26
27 INSERT INTO no_concl_hyp_tmp
28 SELECT source, COUNT(DISTINCT h_occurrence)
29 FROM refObj
30 WHERE NOT (h_position="http://www.cs.unibo.it/helm/schemas/schema-helm#InBody")
31 GROUP BY source;
32
33 INSERT IGNORE INTO no_concl_hyp_tmp
34 SELECT source, 0
35 FROM refObj
36 GROUP BY source;
37
38 INSERT INTO no_hyp_tmp
39 SELECT source, COUNT(DISTINCT h_occurrence)
40 FROM refObj
41 WHERE (h_position="http://www.cs.unibo.it/helm/schemas/schema-helm#MainHypothesis"
42     OR h_position="http://www.cs.unibo.it/helm/schemas/schema-helm#InHypothesis")
43 GROUP BY source;
44
45 INSERT IGNORE INTO no_hyp_tmp
46 SELECT source, 0
47 FROM refObj
48 GROUP BY source;
49
50 INSERT INTO count
51 SELECT no_hyp_tmp.source, 
52        no_inconcl_aux_tmp.no, 
53        no_hyp_tmp.no, 
54        no_concl_hyp_tmp.no
55 FROM no_hyp_tmp, no_concl_hyp_tmp, no_inconcl_aux_tmp
56 WHERE no_hyp_tmp.source = no_concl_hyp_tmp.source AND
57       no_hyp_tmp.source = no_inconcl_aux_tmp.source;
58
59 DROP TABLE no_hyp_tmp;
60 DROP TABLE no_inconcl_aux_tmp;
61 DROP TABLE no_concl_hyp_tmp;
62
63
64