if (pmb_mysql_num_rows($r_sel)) { // définition de l'état de la jauge $state = floor($start / ($count / $jauge_size)); $state .= "px"; // mise à jour de l'affichage de la jauge print "<table border='0' align='center' width='{$jauge_size}' cellpadding='0'><tr><td class='jauge' width='100%'>"; print "<img src='../../images/jauge.png' width='{$state}' height='16px'></td></tr></table>"; // calcul pourcentage avancement $percent = floor($start / $count * 100); // affichage du % d'avancement et de l'état print "<div align='center'>{$percent}%</div>"; require_once "{$class_path}/rdf/ontology.class.php"; $op = new ontology_parser("{$class_path}/rdf/skos_pmb.rdf"); $sh = new skos_handler($op); while ($triple = pmb_mysql_fetch_object($r_sel)) { $type = $sh->op->from_ns($sh->get_object_type($triple->subject_uri)); $q_ins = "insert ignore into rdfstore_index "; $q_ins .= "set num_triple='" . $triple->num_triple . "', "; $q_ins .= "subject_uri='" . addslashes($triple->subject_uri) . "', "; $q_ins .= "subject_type='" . addslashes($type) . "', "; $q_ins .= "predicat_uri='" . addslashes($triple->predicat_uri) . "', "; $q_ins .= "num_object='" . $triple->num_object . "', "; $q_ins .= "object_val ='" . addslashes($triple->object_val) . "', "; $q_ins .= "object_index=' " . strip_empty_chars($triple->object_val) . " ', "; $q_ins .= "object_lang ='" . addslashes($triple->object_lang) . "' "; $r_ins = pmb_mysql_query($q_ins, $dbh); } $next = $start + $lot; print "\n\t\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t\t<input type='hidden' name='start' value=\"{$next}\">\n\t\t<input type='hidden' name='count' value=\"{$count}\">\n\t\t</form>\n\t\t<script type=\"text/javascript\"><!-- \n\t\tsetTimeout(\"document.forms['current_state'].submit()\",1000); \n\t\t-->\n\t\t</script>"; } else { $spec = $spec - INDEX_RDFSTORE;
function cleanRdfStore() { global $msg, $dbh, $charset, $PMBusername; global $class_path; if (SESSrights & ADMINISTRATION_AUTH) { $result .= "<h3>" . htmlentities($msg["nettoyage_rdfstore_reindexation"], ENT_QUOTES, $charset) . "</h3>"; //remise a zero de la table au début pmb_mysql_query("TRUNCATE rdfstore_index", $dbh); $query = "select t.t as num_triple, s.val as subject_uri, p.val as predicat_uri, o.id as num_object, o.val as object_val, l.val as object_lang \n\t\t\t\tfrom rdfstore_triple t, rdfstore_s2val s, rdfstore_id2val p, rdfstore_o2val o, rdfstore_id2val l \n\t\t\t\twhere t.o_type=2 and t.o_lang_dt=l.id and length(l.val)<3 and t.s=s.id and t.p=p.id and t.o=o.id \n\t\t\t\torder by t.t"; $rdfStore = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($rdfStore)) { $op = new ontology_parser("{$class_path}/rdf/skos_pmb.rdf"); $sh = new skos_handler($op); while ($triple = pmb_mysql_fetch_object($rdfStore)) { $type = $sh->op->from_ns($sh->get_object_type($triple->subject_uri)); $q_ins = "insert ignore into rdfstore_index "; $q_ins .= "set num_triple='" . $triple->num_triple . "', "; $q_ins .= "subject_uri='" . addslashes($triple->subject_uri) . "', "; $q_ins .= "subject_type='" . addslashes($type) . "', "; $q_ins .= "predicat_uri='" . addslashes($triple->predicat_uri) . "', "; $q_ins .= "num_object='" . $triple->num_object . "', "; $q_ins .= "object_val ='" . addslashes($triple->object_val) . "', "; $q_ins .= "object_index=' " . strip_empty_chars($triple->object_val) . " ', "; $q_ins .= "object_lang ='" . addslashes($triple->object_lang) . "' "; $r_ins = pmb_mysql_query($q_ins, $dbh); } } $rdfStore = pmb_mysql_query("select count(1) from rdfstore_triple where o_type=2", $dbh); $count = pmb_mysql_result($rdfStore, 0, 0); $result .= $count . " " . htmlentities($msg['nettoyage_rdfstore_reindex_elt'], ENT_QUOTES, $charset); } else { $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername); } return $result; }