Ejemplo n.º 1
0
$NoIndex = 1;
// $query = pmb_mysql_query("select id_faq_question from faq_questions order by id_faq_question LIMIT $start, $lot");
$query .= " order by asc(?label) limit " . $lot . " offset " . $start;
$onto_index->handler->data_query($query);
if ($onto_index->handler->data_num_rows()) {
    // 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>";
    $results = $onto_index->handler->data_result();
    foreach ($results as $row) {
        $info = $onto_index->maj(0, $row->item);
    }
    $next = $start + $lot;
    print "\n\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t<input type='hidden' name='start' value=\"{$next}\">\n\t<input type='hidden' name='count' value=\"{$count}\">\n\t</form>\n\t<script type=\"text/javascript\"><!-- \n\tsetTimeout(\"document.forms['current_state'].submit()\",1000); \n\t-->\n\t</script>";
} else {
    $spec = $spec - INDEX_CONCEPT;
    $not = pmb_mysql_query("SELECT count(distinct id_item) FROM skos_words_global_index", $dbh);
    $compte = pmb_mysql_result($not, 0, 0);
    $v_state .= "<br /><img src=../../images/d.gif hspace=3>" . htmlentities($msg["nettoyage_reindex_concept"], ENT_QUOTES, $charset) . " :";
    $v_state .= $compte . " " . htmlentities($msg["nettoyage_res_reindex_concept"], ENT_QUOTES, $charset);
    print "\n\t\t<form class='form-{$current_module}' name='process_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</form>\n\t\t<script type=\"text/javascript\"><!--\n\t\t\tdocument.forms['process_state'].submit();\n\t\t\t-->\n\t\t</script>";
    pmb_mysql_query("ALTER TABLE skos_words_global_index ENABLE KEYS", $dbh);
    pmb_mysql_query("ALTER TABLE skos_fields_global_index ENABLE KEYS", $dbh);
}
Ejemplo n.º 2
0
 public function update_display_label($label)
 {
     global $base_path;
     $this->get_data_store();
     // On commence par supprimer le label existant
     $query = "delete {\n\t\t\t\t<" . $this->get_uri() . "> <http://www.w3.org/2004/02/skos/core#prefLabel> ?obj\n\t\t\t\t}";
     $this->data_store->query($query);
     // On insert le nouveau label
     $query = "insert into <pmb> {\n\t\t\t\t<" . $this->get_uri() . "> <http://www.w3.org/2004/02/skos/core#prefLabel> '" . $label . "'\n\t\t\t\t}";
     $this->data_store->query($query);
     // On réindexe
     $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->maj($this->get_id());
     index_concept::update_linked_elements($this->get_id());
 }
Ejemplo n.º 3
0
 /**
  * Détruit une instance (l'ensemble de ses déclarations)
  *
  * @param onto_common_item $item Instance à supprimer (l'ensemble de ses déclarations)
  * @param bool $force_delete Si false, renvoie un tableau des assertions où l'item est objet. Si true, supprime toutes les occurences de l'item
  * 
  * @return bool
  * @access public
  */
 public function delete($item, $force_delete = false)
 {
     global $dbh;
     // On stockera dans un tableau tous les triplets desquels l'item est l'objet
     $is_object_of = array();
     $query = "select * where {\n\t\t\t?subject ?predicate <" . $item->get_uri() . ">\n\t\t}";
     $this->data_store->query($query);
     $result = $this->data_store->get_result();
     foreach ($result as $assertion) {
         $is_object_of[] = new onto_assertion($assertion->subject, $assertion->predicate, $item->get_uri());
     }
     if ($force_delete || !count($is_object_of)) {
         $query = "delete {\n\t\t\t\t<" . $item->get_uri() . "> ?prop ?obj\n\t\t\t}";
         $this->data_store->query($query);
         if ($errs = $this->data_store->get_errors()) {
             print "<br>Erreurs: <br>";
             print "<pre>";
             print_r($errs);
             print "</pre><br>";
         } else {
             $query = "delete {\n\t\t\t\t\t?subject ?predicate <" . $item->get_uri() . ">\n\t\t\t\t}";
             $result = $this->data_store->query($query);
             if ($errs = $this->data_store->get_errors()) {
                 print "<br>Erreurs: <br>";
                 print "<pre>";
                 print_r($errs);
                 print "</pre><br>";
             } else {
                 // On met à jour l'index
                 $index = new onto_index();
                 $index->set_handler($this);
                 $index->maj(0, $item->get_uri());
                 if (count($is_object_of)) {
                     foreach ($is_object_of as $object) {
                         $index->maj(0, $assertion->subject);
                     }
                 }
                 //on a tout viré on supprime aussi l'URI dans la table
                 $query = "delete from onto_uri where uri = '" . $item->get_uri() . "'";
                 pmb_mysql_query($query, $dbh);
             }
         }
     }
     return $is_object_of;
 }
Ejemplo n.º 4
0
 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;
 }