1) Salvare la risposta SOAP di Pimpa relativa agli ultimi anni - WSDL: http://pimpa.isti.cnr.it/PERSONALE/web-services/iop/iop.webservice.php?wsdl - Method: getDataRange 2) Eseguire gli xslt sulla risposta 3) Ricreare o svuotare la tabella temporanea affiliations_temp - create table affiliations_temp(pid varchar(32), gid varchar(16), year int); - create table affiliations_temp_no_id(name varchar(255), surname varchar(255), gid varchar(16), year int); 4) Importare le nuove affiliations sulle tabelle temporanee 5) Verificare che non esistano nuovi laboratori e/o nuove persone ed eventualmente inserirle una per una - select distinct t.pid, p.name, p.surname from affiliations_temp t left outer join persons p on (t.pid = p.id) where p.name IS NULL; - select distinct t.gid, g.name, g.type from affiliations_temp t left outer join groups g on (t.gid = g.id) where g.name IS NULL; 6) Copiare i dati dalla tabella temporanea - insert into affiliations(pid,gid,year) select pid,gid,year from affiliations_temp ON DUPLICATE KEY UPDATE affiliations.pid=affiliations_temp.pid; 7) Effettuare controlli a campione 8) Cancellare la tabell temporanea - drop table affiliations_temp; 9) Cancellare e/o correggere (se possibile) le affiliations UNKNOWN - select pid, group_concat(gid) from affiliations where year = _YEAR_ group by pid having group_concat(gid) like '%UNKNOWN%' and count(gid) > 1; - delete from affiliations where pid = '_ID_' and gid = 'UNKNOWN' and year = _YEAR_;