$jauge_size = GAUGE_SIZE;
$jauge_size .= "px";
// 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) {
Example #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());
 }
Example #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;
 }
 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;
 }