/**
  * Retourne le résulat de la dernière requete SPARQL sur le store de données SKOS
  * @return <p>Tableau du résultat pour la dernière requete<br>FALSE si le store n'est pas initialisé</p>
  * @access public
  */
 public static function get_result()
 {
     if (is_object(self::$store)) {
         return self::$store->get_result();
     }
     return false;
 }
Exemple #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());
 }
 /**
  * Retoune les labels PMB des propriétés d'une classe de l'ontologie SKOS. Interroge le store si nécessaire
  * @param class_uri string  <p>URI de la classe associée</p>
  * @return <p>Retourne le tableau de labels associés</p>
  * @access public
  */
 public static function get_properties_labels($class_uri)
 {
     // on trouve les libellés?
     if (!isset(self::$labels[$class_uri])) {
         //on recherche toutes les propriétés associés
         $query = "select * where {\n\t\t\t\t?property rdf:type <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> .\n\t\t\t\t?property rdfs:label ?label .\n\t\t\t\t?property pmb:name ?name . \n\t\t\t\toptional {\n\t\t\t\t\t?property rdfs:domain ?domain\n\t\t\t\t}\t\t\t\t\n\t\t\t}";
         self::query($query);
         if (self::$store->num_rows()) {
             $result = self::$store->get_result();
             //init de la static pour la classe concernée
             self::$labels[$class_uri] = array();
             foreach ($result as $property) {
                 if (!isset($property->domain) || $property->domain == $class_uri) {
                     self::$labels[$class_uri][$property->property] = array('pmb_name' => $property->name);
                     self::$labels[$class_uri][$property->property]['label'] = self::calc_label($class_uri, $property->property, $property->label);
                 }
             }
         }
     }
     return self::$labels[$class_uri];
 }