Line 3... |
Line 3... |
3 |
75427 observations trouvées au 2013/07/19
|
3 |
75427 observations trouvées au 2013/07/19
|
Line 4... |
Line 4... |
4 |
|
4 |
|
5 |
Les observations problématiques sont les suivantes:
|
5 |
Les observations problématiques sont les suivantes:
|
6 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, famille
|
6 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, famille
|
7 |
FROM cel_obs
|
7 |
FROM cel_obs
|
Line 8... |
Line 8... |
8 |
WHERE (nom_referentiel IS NULL OR nom_referentiel = '') AND nom_sel != '' AND nom_sel IS NOT NULL AND nom_ret_nn IS NOT NULL;
|
8 |
WHERE nom_referentiel IS NULL AND nom_sel != '' AND nom_sel IS NOT NULL AND nom_ret_nn IS NOT NULL;
|
9 |
|
9 |
|
Line 10... |
Line 10... |
10 |
Or maj-cleanup-201307.sql reset les valeurs des observations ayant un nom_sel NULL ou '', de plus la préférence de sélection est
|
10 |
Or maj-cleanup-201307.sql reset les valeurs des observations ayant un nom_sel NULL ou '', de plus la préférence de sélection est
|
11 |
donné au nom_sel (incluant les synonymes) plutôt que nom_ret_nn.
|
11 |
donné au nom_sel (incluant les synonymes) plutôt que nom_ret_nn.
|
12 |
|
12 |
|
13 |
La requête est donc:
|
13 |
La requête est donc:
|
14 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, famille
|
14 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, famille
|
Line 15... |
Line 15... |
15 |
FROM cel_obs WHERE (nom_referentiel IS NULL OR nom_referentiel = '') AND nom_sel_nn IS NOT NULL;
|
15 |
FROM cel_obs WHERE nom_referentiel IS NULL AND nom_sel_nn IS NOT NULL;
|
Line 24... |
Line 24... |
24 |
SELECT "bdtfx" AS valid_ref, CONCAT(b.nom_sci, ' ', b.auteur) AS nom, b.num_nom, b.num_taxonomique, b.famille FROM tb_eflore.bdtfx_v1_01 b UNION ALL \
|
24 |
SELECT "bdtfx" AS valid_ref, CONCAT(b.nom_sci, ' ', b.auteur) AS nom, b.num_nom, b.num_taxonomique, b.famille FROM tb_eflore.bdtfx_v1_01 b UNION ALL \
|
25 |
SELECT "bdtxa" AS valid_ref, CONCAT(a.nom_sci, ' ', a.auteur) AS nom, a.num_nom, a.num_tax, a.famille FROM tb_eflore.bdtxa_v1_00 a;
|
25 |
SELECT "bdtxa" AS valid_ref, CONCAT(a.nom_sci, ' ', a.auteur) AS nom, a.num_nom, a.num_tax, a.famille FROM tb_eflore.bdtxa_v1_00 a;
|
Line 26... |
Line 26... |
26 |
|
26 |
|
27 |
/* Donc nous JOINons:
|
27 |
/* Donc nous JOINons:
|
28 |
-- INNER JOIN sur bdtfx: 69719
|
28 |
-- INNER JOIN sur bdtfx: 69719
|
29 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille FROM cel_obs c INNER JOIN tb_eflore.bdtfx_v1_01 b ON (b.num_nom = c.nom_sel_nn) WHERE (nom_referentiel IS NULL OR nom_referentiel = '') AND nom_sel_nn IS NOT NULL;
|
29 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille FROM cel_obs c INNER JOIN tb_eflore.bdtfx_v1_01 b ON (b.num_nom = c.nom_sel_nn) WHERE nom_referentiel IS NULL AND nom_sel_nn IS NOT NULL;
|
30 |
-- INNER JOIN sur bdtxa: 79471 dont 9752 en dup (bdtxa + bdtfx), eg: 1005047
|
30 |
-- INNER JOIN sur bdtxa: 79471 dont 9752 en dup (bdtxa + bdtfx), eg: 1005047
|
31 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille FROM cel_obs c INNER JOIN T_bis b ON (b.num_nom = c.nom_sel_nn) WHERE (nom_referentiel IS NULL OR nom_referentiel = '') AND nom_sel_nn IS NOT NULL;
|
31 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille FROM cel_obs c INNER JOIN T_bis b ON (b.num_nom = c.nom_sel_nn) WHERE nom_referentiel AND nom_sel_nn IS NOT NULL;
|
Line 32... |
Line 32... |
32 |
*/
|
32 |
*/
|
33 |
|
33 |
|
34 |
/* d'où GROUP BY id_observation HAVING count(id_observation) = 1 */
|
34 |
/* d'où GROUP BY id_observation HAVING count(id_observation) = 1 */
|
35 |
/*
|
35 |
/*
|
36 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille
|
36 |
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille
|
37 |
FROM cel_obs c
|
37 |
FROM cel_obs c
|
38 |
INNER JOIN T_bis b
|
38 |
INNER JOIN T_bis b
|
39 |
ON (b.num_nom = c.nom_sel_nn)
|
39 |
ON (b.num_nom = c.nom_sel_nn)
|
40 |
WHERE (nom_referentiel IS NULL OR nom_referentiel = '') AND nom_sel_nn IS NOT NULL GROUP BY id_observation HAVING count(id_observation) = 1;
|
40 |
WHERE nom_referentiel IS NULL AND nom_sel_nn IS NOT NULL GROUP BY id_observation HAVING count(id_observation) = 1;
|
Line 41... |
Line 41... |
41 |
-- 59967, tous bdtfx...
|
41 |
-- 59967, tous bdtfx...
|
Line 49... |
Line 49... |
49 |
DECLARE done INT DEFAULT 0;
|
49 |
DECLARE done INT DEFAULT 0;
|
50 |
DECLARE subst INT DEFAULT 0;
|
50 |
DECLARE subst INT DEFAULT 0;
|
51 |
DECLARE _id_observation bigint(20) DEFAULT 0;
|
51 |
DECLARE _id_observation bigint(20) DEFAULT 0;
|
52 |
DECLARE _valid_ref varchar(20) DEFAULT NULL;
|
52 |
DECLARE _valid_ref varchar(20) DEFAULT NULL;
|
53 |
DECLARE cur1 CURSOR FOR SELECT id_observation, valid_ref FROM cel_obs c INNER JOIN T_bis b ON (b.num_nom = c.nom_sel_nn)
|
53 |
DECLARE cur1 CURSOR FOR SELECT id_observation, valid_ref FROM cel_obs c INNER JOIN T_bis b ON (b.num_nom = c.nom_sel_nn)
|
54 |
WHERE (nom_referentiel IS NULL OR nom_referentiel = '') AND nom_sel_nn IS NOT NULL group by id_observation HAVING count(id_observation) = 1;
|
54 |
WHERE nom_referentiel IS NULL AND nom_sel_nn IS NOT NULL group by id_observation HAVING count(id_observation) = 1;
|
55 |
-- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
55 |
-- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
56 |
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
|
56 |
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
|
Line 57... |
Line 57... |
57 |
|
57 |
|
58 |
OPEN cur1;
|
58 |
OPEN cur1;
|