store->getName()])) { $tab_file_rdf[$this->store->getName()] = 0; } } else { $tab_file_rdf[$this->store->getName()] = $thesaurus_ontology_filemtime; } //on charge l'ontologie seulement si la date de modification du fichier est > à la date de dernière lecture if($reset || (filemtime($onto_filepath) > $tab_file_rdf[$this->store->getName()])){ // le load ne fait qu'ajouter les nouveaux triplets sans supprimer les anciens, donc on purge avant... $this->store->reset(); //LOAD n'accepte qu'un chemin absolu $res = $this->query('LOAD '); $tab_file_rdf[$this->store->getName()] = filemtime($onto_filepath); if($res){ $thesaurus_ontology_filemtime = serialize($tab_file_rdf); $query='UPDATE parametres SET valeur_param="'.addslashes(serialize($tab_file_rdf)).'" WHERE type_param="thesaurus" AND sstype_param="ontology_filemtime"'; pmb_mysql_query($query); $bool = true; }else{ $bool = false; } }else{ $bool = false; } if ($bool) { if (!empty($this->config['params'])) { foreach ($this->config['params'] as $uri => $object) { if (empty($uri)) { continue; } $query = "insert into " . $this->rdf_serialize($object,$uri); $this->query($query,$this->namespaces); } } return true; } else { return false; } } // end of member function load public function rdf_serialize($object, $uri = "", $level = 0) { if ($uri) { $query = "{ <". $uri ."> pmb:extended [\n"; } else { $query = ""; } if (is_object($object)) { foreach ($object as $key => $value) { $query .= " ".$this->rdf_serialize($value,'',$level+1)." ;\n"; } if ($level) { $query = "[ ". $query ." ]"; } } elseif (is_array($object)) { for ($i=0; $irdf_serialize($object[$i],'',$level+1)." ;\n"; } if ($level) { $query = "[ ". $query ." ]"; } } elseif (is_numeric($object)) { $query .= $object; }else { $query .= "\"". addslashes($object) ."\""; } if ($uri) { $query .= " \n]\n}"; } return $query; } } // end of onto_store_arc2