// initialisation de la borne de départ if (!isset($start)) { $start = 0; //remise a zero de la table au début pmb_mysql_query("TRUNCATE skos_words_global_index", $dbh); pmb_mysql_query("ALTER TABLE skos_words_global_index DISABLE KEYS", $dbh); pmb_mysql_query("TRUNCATE skos_fields_global_index", $dbh); pmb_mysql_query("ALTER TABLE skos_fields_global_index DISABLE KEYS", $dbh); } $v_state = urldecode($v_state); $onto_store_config = array('db_name' => DATA_BASE, 'db_user' => USER_NAME, 'db_pwd' => USER_PASS, 'db_host' => SQL_SERVER, 'store_name' => 'ontology', 'max_errors' => 100, 'store_strip_mb_comp_str' => 0); $data_store_config = array('db_name' => DATA_BASE, 'db_user' => USER_NAME, 'db_pwd' => USER_PASS, 'db_host' => SQL_SERVER, 'store_name' => 'rdfstore', 'max_errors' => 100, 'store_strip_mb_comp_str' => 0); $tab_namespaces = array("skos" => "http://www.w3.org/2004/02/skos/core#", "dc" => "http://purl.org/dc/elements/1.1", "dct" => "http://purl.org/dc/terms/", "owl" => "http://www.w3.org/2002/07/owl#", "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdfs" => "http://www.w3.org/2000/01/rdf-schema#", "xsd" => "http://www.w3.org/2001/XMLSchema#", "pmb" => "http://www.pmbservices.fr/ontology#"); $onto_index = new onto_index(); $onto_index->load_handler($base_path . "/classes/rdf/skos_pmb.rdf", "arc2", $onto_store_config, "arc2", $data_store_config, $tab_namespaces, 'http://www.w3.org/2004/02/skos/core#prefLabel'); $onto_index->init(); $elem_query = ""; //la requete de base... $query = "select * where {\n\t\t?item <http://www.w3.org/2004/02/skos/core#prefLabel> ?label .\n\t\t?item rdf:type ?type .\n\t\tfilter("; $i = 0; foreach ($onto_index->infos as $uri => $infos) { if ($i) { $query .= " || "; } $query .= "?type=<" . $uri . ">"; $i++; } $query .= ")\n\t}"; if (!$count) { $onto_index->handler->data_query($query); $count = $onto_index->handler->data_num_rows();
function cleanConcept() { global $msg, $dbh, $charset, $base_path, $PMBusername; if (SESSrights & ADMINISTRATION_AUTH) { $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_concept"], ENT_QUOTES, $charset) . "</h3>"; //remise a zero de la table au début pmb_mysql_query("TRUNCATE skos_words_global_index", $dbh); pmb_mysql_query("ALTER TABLE skos_words_global_index DISABLE KEYS", $dbh); pmb_mysql_query("TRUNCATE skos_fields_global_index", $dbh); pmb_mysql_query("ALTER TABLE skos_fields_global_index DISABLE KEYS", $dbh); $onto_store_config = array('db_name' => DATA_BASE, 'db_user' => USER_NAME, 'db_pwd' => USER_PASS, 'db_host' => SQL_SERVER, 'store_name' => 'ontology', 'max_errors' => 100, 'store_strip_mb_comp_str' => 0); $data_store_config = array('db_name' => DATA_BASE, 'db_user' => USER_NAME, 'db_pwd' => USER_PASS, 'db_host' => SQL_SERVER, 'store_name' => 'rdfstore', 'max_errors' => 100, 'store_strip_mb_comp_str' => 0); $tab_namespaces = array("skos" => "http://www.w3.org/2004/02/skos/core#", "dc" => "http://purl.org/dc/elements/1.1", "dct" => "http://purl.org/dc/terms/", "owl" => "http://www.w3.org/2002/07/owl#", "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdfs" => "http://www.w3.org/2000/01/rdf-schema#", "xsd" => "http://www.w3.org/2001/XMLSchema#", "pmb" => "http://www.pmbservices.fr/ontology#"); $onto_index = new onto_index(); $onto_index->load_handler($base_path . "/classes/rdf/skos_pmb.rdf", "arc2", $onto_store_config, "arc2", $data_store_config, $tab_namespaces, 'http://www.w3.org/2004/02/skos/core#prefLabel'); $onto_index->init(); //la requete de base... $query = "select * where {\n\t\t\t\t?item <http://www.w3.org/2004/02/skos/core#prefLabel> ?label .\n\t\t\t\t?item rdf:type ?type .\n\t\t\t\tfilter("; $i = 0; foreach ($onto_index->infos as $uri => $infos) { if ($i) { $query .= " || "; } $query .= "?type=<" . $uri . ">"; $i++; } $query .= ")\n\t\t\t}"; $query .= " order by asc(?label)"; $onto_index->handler->data_query($query); if ($onto_index->handler->data_num_rows()) { $results = $onto_index->handler->data_result(); foreach ($results as $row) { $onto_index->maj(0, $row->item); } } $query = pmb_mysql_query("SELECT count(distinct id_item) FROM skos_words_global_index", $dbh); $count = pmb_mysql_result($query, 0, 0); pmb_mysql_query("ALTER TABLE skos_words_global_index ENABLE KEYS", $dbh); pmb_mysql_query("ALTER TABLE skos_fields_global_index ENABLE KEYS", $dbh); $concepts = pmb_mysql_query("SELECT count(distinct id_item) FROM skos_words_global_index", $dbh); $count = pmb_mysql_result($concepts, 0, 0); $result .= $count . " " . htmlentities($msg['nettoyage_res_reindex_concept'], ENT_QUOTES, $charset); } else { $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername); } return $result; }