Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 225 | Rev 228 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 225 Rev 226
Line 7... Line 7...
7
 
7
 
8
	private $lecteur = null;
8
	private $lecteur = null;
9
	private $fichier = '';
9
	private $fichier = '';
10
	private $lotsTermes = array();
10
	private $lotsTermes = array();
-
 
11
	private $lotsRelations = array();
-
 
12
	private $lotsImages = array();
-
 
13
	private $lotsPublications = array();
-
 
14
	private $lotsAuteurs = array();
11
	private $lotsRelations = array();
15
	private $lotsHierarchie = array();
12
	private $baseIdGroupe = 10000;
16
	private $baseIdGroupe = 10000;
13
	private $baseIdSousGroupe = 20000;
17
	private $baseIdSousGroupe = 20000;
14
	private $types = array(
18
	private $types = array(
15
		'FREQUENCY_MODIFIERS' => 2,
19
		'FREQUENCY_MODIFIERS' => 2,
Line 21... Line 25...
21
		'TEMPORAL_MODIFIERS' => 8,
25
		'TEMPORAL_MODIFIERS' => 8,
22
		'UNIT_TERMS' => 9,
26
		'UNIT_TERMS' => 9,
23
		'QUANTITATIVE_PROPERTIES' => 10,
27
		'QUANTITATIVE_PROPERTIES' => 10,
24
		'NEW_QUALITATIVE_PROPERTIES' => 11,
28
		'NEW_QUALITATIVE_PROPERTIES' => 11,
25
		'DISALLOWED_TERMS' => 20,
29
		'DISALLOWED_TERMS' => 20,
26
		'QUALITATIVE_STATES' => 13);
30
		'QUALITATIVE_STATES' => 13,
-
 
31
		'TYPE_OF_STRUCTURE_TERMS' => 14,
-
 
32
		'STRUCTURE_TERMS' => 15,
-
 
33
		'REGION_TERMS' => 16,
-
 
34
		'GENERIC_STRUCTURES' => 17);
Line 27... Line 35...
27
 
35
 
28
	public function executer() {
36
	public function executer() {
29
		try {
37
		try {
30
			$this->bdd = new Bdd();
38
			$this->bdd = new Bdd();
Line 61... Line 69...
61
						$type = $this->lecteur->localName;
69
						$type = $this->lecteur->localName;
62
						$this->traiterTermes($this->types[$type], $noeud->children());
70
						$this->traiterTermes($this->types[$type], $noeud->children());
63
					} else if ($this->lecteur->localName == 'STATE_GROUPS') {
71
					} else if ($this->lecteur->localName == 'STATE_GROUPS') {
64
						$noeud = $this->obtenirNoeudSimpleXml();
72
						$noeud = $this->obtenirNoeudSimpleXml();
65
						$this->traiterGroupes($noeud->children());
73
						$this->traiterGroupes($noeud->children());
-
 
74
					} else if ($this->lecteur->localName == 'NewQualitativeProperties') {
-
 
75
						$noeud = $this->obtenirNoeudSimpleXml();
-
 
76
						$this->traiterNouvellesQualites($noeud->children());
-
 
77
					} else if ($this->lecteur->localName == 'RELATIONSHIPS') {
-
 
78
						$noeud = $this->obtenirNoeudSimpleXml();
-
 
79
						$this->traiterRelations($noeud->children());
-
 
80
					} else if ($this->lecteur->localName == 'PICTURES') {
-
 
81
						$noeud = $this->obtenirNoeudSimpleXml();
-
 
82
						$this->traiterImages($noeud->children());
-
 
83
					} else if ($this->lecteur->localName == 'CITATIONS') {
-
 
84
						$noeud = $this->obtenirNoeudSimpleXml();
-
 
85
						$this->traiterCitations($noeud->children());
-
 
86
					} else if ($this->lecteur->localName == 'AUTHORS') {
-
 
87
						$noeud = $this->obtenirNoeudSimpleXml();
-
 
88
						$this->traiterAuteurs($noeud->children());
-
 
89
					} else if ($this->lecteur->localName == 'TreeNode') {
-
 
90
						$noeud = $this->obtenirNoeudSimpleXml();
-
 
91
						$this->traiterHierarchie($noeud);
66
					}
92
					}
67
				}
93
				}
68
			}
94
			}
69
			if (count($this->lotsTermes) > 0) {
95
			if (count($this->lotsTermes) > 0) {
70
				$this->insererLotDeTermes();
96
				$this->insererLotDeTermes();
71
			}
97
			}
72
			if (count($this->lotsRelations) > 0) {
98
			if (count($this->lotsRelations) > 0) {
73
				$this->insererLotDeRelations();
99
				$this->insererLotDeRelations();
74
			}
100
			}
-
 
101
			if (count($this->lotsImages) > 0) {
-
 
102
				$this->insererLotImages();
-
 
103
			}
-
 
104
			if (count($this->lotsPublications) > 0) {
-
 
105
				$this->insererLotDePublications();
-
 
106
			}
-
 
107
			if (count($this->lotsAuteurs) > 0) {
-
 
108
				$this->insererLotAuteurs();
-
 
109
			}
-
 
110
			if (count($this->lotsHierarchie) > 0) {
-
 
111
				$this->insererLotHierarchie();
-
 
112
			}
75
		}
113
		}
76
	}
114
	}
Line 77... Line 115...
77
 
115
 
78
	private function ouvrirFichierXml() {
116
	private function ouvrirFichierXml() {
Line 90... Line 128...
90
	}
128
	}
Line 91... Line 129...
91
 
129
 
92
	private function traiterTermes($type, $termes) {
130
	private function traiterTermes($type, $termes) {
93
		foreach ($termes as $terme) {
131
		foreach ($termes as $terme) {
94
			$id = (int) $terme->attributes()->GLOBALID;
132
			$id = (int) $terme->attributes()->GLOBALID;
95
			if (isset($lotsTermes[$id]) === false) {
133
			if (isset($this->lotsTermes[$id]) === false) {
96
				$valeur = array();
134
				$valeur = array();
97
				$valeur[] = (int) $id;
135
				$valeur[] = (int) $id;
98
				$valeur[] = (int) $type;
136
				$valeur[] = (int) $type;
99
				$valeur[] = (string) $terme->attributes()->term;
137
				$valeur[] = (string) $terme->attributes()->term;
100
				$valeur[] = (string) $this->obtenirDefinition($terme);
138
				$valeur[] = (string) $this->obtenirDefinition($terme);
101
				$valeur[] = (int) $this->obtenirPreference($terme);
139
				$valeur[] = (int) $this->obtenirPreference($terme);
102
				$valeur[] = (int) $this->obtenirAuteur($terme);
140
				$valeur[] = (int) $this->obtenirAuteur($terme);
103
				$valeur[] = (int) $terme->attributes()->citationREF;
141
				$valeur[] = (int) $this->obtenirCitation($terme);
104
				$valeur[] = (int) $this->obtenirImage($terme);
142
				$valeur[] = (int) $this->obtenirImage($terme);
105
				$this->lotsTermes[$id] = $valeur;
143
				$this->lotsTermes[$id] = $valeur;
106
			}
144
			}
107
			if (isset($terme->attributes()->parentID)) {
145
			if (isset($terme->attributes()->parentID)) {
108
				$relation = array();
146
				$relation = array();
109
				$relation[] = (int) $terme->attributes()->GLOBALID;
147
				$relation[] = (int) $terme->attributes()->GLOBALID;
110
				$relation[] = (int) $terme->attributes()->parentID;
148
				$relation[] = (int) $terme->attributes()->parentID;
111
				$relation[] = 'A POUR PARENT';
149
				$relation[] = 'A POUR PARENT';
-
 
150
				$this->ajouterRelation($relation);
-
 
151
			}
-
 
152
			if (isset($terme->attributes()->PARENT_STRUCTURE_ID)) {
-
 
153
				$relation = array();
-
 
154
				$relation[] = (int) $terme->attributes()->GLOBALID;
-
 
155
				$relation[] = (int) $terme->attributes()->PARENT_STRUCTURE_ID;
-
 
156
				$relation[] = 'A POUR STRUCTURE PARENTE';
112
				$this->lotsRelations[] = $relation;
157
				$this->ajouterRelation($relation);
113
			}
158
			}
114
			if (isset($terme->attributes()->stateOfNEWPROPERTYID)) {
159
			if (isset($terme->attributes()->stateOfNEWPROPERTYID)) {
115
				$relation = array();
160
				$relation = array();
116
				$relation[] = (int) $terme->attributes()->GLOBALID;
161
				$relation[] = (int) $terme->attributes()->GLOBALID;
117
				$relation[] = (int) $terme->attributes()->stateOfNEWPROPERTYID;
162
				$relation[] = (int) $terme->attributes()->stateOfNEWPROPERTYID;
118
				$relation[] = 'A POUR NOUVELLE QUALITE';
163
				$relation[] = 'A POUR NOUVELLE QUALITE';
119
				$this->lotsRelations[] = $relation;
164
				$this->ajouterRelation($relation);
120
			}
165
			}
121
		}
166
		}
Line 122... Line 167...
122
	}
167
	}
Line 146... Line 191...
146
			$auteur = $terme->attributes()->authorREF;
191
			$auteur = $terme->attributes()->authorREF;
147
		}
192
		}
148
		return $auteur;
193
		return $auteur;
149
	}
194
	}
Line -... Line 195...
-
 
195
 
-
 
196
	private function obtenirCitation($terme) {
-
 
197
		$citation = 0;
-
 
198
		if (isset($terme->attributes()->citationID)) {
-
 
199
			$citation = $terme->attributes()->citationID;
-
 
200
		} elseif (isset($terme->attributes()->citationREF)) {
-
 
201
			$citation = $terme->attributes()->citationREF;
-
 
202
		}
-
 
203
		return $citation;
-
 
204
	}
150
 
205
 
151
	private function obtenirImage($terme) {
206
	private function obtenirImage($terme) {
152
		$image = 0;
207
		$image = 0;
153
		if (isset($terme->attributes()->pictureREF)) {
208
		if (isset($terme->attributes()->pictureREF)) {
154
			$image = $terme->attributes()->pictureREF;
209
			$image = $terme->attributes()->pictureREF;
155
		}
210
		}
156
		return $image;
211
		return $image;
Line 157... Line 212...
157
	}
212
	}
158
 
-
 
159
	private function traiterGroupes($groupes) {
213
 
160
		$lotsTermes = $lotsRelations = array();
214
	private function traiterGroupes($groupes) {
161
		foreach ($groupes as $groupe) {
215
		foreach ($groupes as $groupe) {
162
			$id = $this->baseIdGroupe + (int) $groupe->attributes()->GROUP_ID;
216
			$id = $this->baseIdGroupe + (int) $groupe->attributes()->GROUP_ID;
163
			if (isset($lotsTermes[$id]) === false) {
217
			if (isset($this->lotsTermes[$id]) === false) {
164
				$valeur = array();
218
				$valeur = array();
165
				$valeur[] = (int) $id;
219
				$valeur[] = (int) $id;
166
				$valeur[] = 18;
220
				$valeur[] = 18;
Line 176... Line 230...
176
				foreach ($groupe->STRUCTURES_LINKED_TO_GROUP->children() as $structure) {
230
				foreach ($groupe->STRUCTURES_LINKED_TO_GROUP->children() as $structure) {
177
					$relation = array();
231
					$relation = array();
178
					$relation[] = (int) $structure->attributes()->GLOBALID;
232
					$relation[] = (int) $structure->attributes()->GLOBALID;
179
					$relation[] = (int) $id;
233
					$relation[] = (int) $id;
180
					$relation[] = 'A POUR GROUPE';
234
					$relation[] = 'A POUR GROUPE';
181
					$this->lotsRelations[] = $relation;
235
					$this->ajouterRelation($relation);
182
				}
236
				}
183
			}
237
			}
184
			if (isset($groupe->STATES_IN_GROUP)) {
238
			if (isset($groupe->STATES_IN_GROUP)) {
185
				foreach ($groupe->STATES_IN_GROUP->children() as $etat) {
239
				foreach ($groupe->STATES_IN_GROUP->children() as $etat) {
186
					$relation = array();
240
					$relation = array();
187
					$relation[] = (int) $id;
241
					$relation[] = (int) $id;
188
					$relation[] = (int) $etat->attributes()->GLOBALID;
242
					$relation[] = (int) $etat->attributes()->GLOBALID;
189
					$relation[] = 'A POUR ETAT';
243
					$relation[] = 'A POUR ETAT';
190
					$this->lotsRelations[] = $relation;
244
					$this->ajouterRelation($relation);
191
				}
245
				}
192
			}
246
			}
193
			if (isset($groupe->STATESUBGROUPS)) {
247
			if (isset($groupe->STATESUBGROUPS)) {
194
				$this->traiterSousGroupes($id, $groupe->STATESUBGROUPS->children());
248
				$this->traiterSousGroupes($id, $groupe->STATESUBGROUPS->children());
195
			}
249
			}
196
		}
250
		}
197
	}
251
	}
Line 198... Line 252...
198
 
252
 
199
	private function traiterSousGroupes($idGroupe, $sousGroupes) {
-
 
200
		$lotsTermes = $lotsRelations = array();
253
	private function traiterSousGroupes($idGroupe, $sousGroupes) {
201
		foreach ($sousGroupes as $sg) {
254
		foreach ($sousGroupes as $sg) {
202
			$id = $this->baseIdSousGroupe + (int) $sg->attributes()->STATESUBGROUP_GLOBALID;
255
			$id = $this->baseIdSousGroupe + (int) $sg->attributes()->STATESUBGROUP_GLOBALID;
203
			if (isset($lotsTermes[$id]) === false) {
256
			if (isset($this->lotsTermes[$id]) === false) {
204
				$valeur = array();
257
				$valeur = array();
205
				$valeur[] = (int) $id;
258
				$valeur[] = (int) $id;
206
				$valeur[] = 19;
259
				$valeur[] = 19;
207
				$valeur[] = (string) $sg->attributes()->subgGroupName;
260
				$valeur[] = (string) $sg->attributes()->subgGroupName;
Line 214... Line 267...
214
 
267
 
215
				$relation = array();
268
				$relation = array();
216
				$relation[] = (int) $idGroupe;
269
				$relation[] = (int) $idGroupe;
217
				$relation[] = (int) $id;
270
				$relation[] = (int) $id;
218
				$relation[] = 'A POUR SOUS-GROUPE';
271
				$relation[] = 'A POUR SOUS-GROUPE';
219
				$this->lotsRelations[] = $relation;
272
				$this->ajouterRelation($relation);
220
			}
273
			}
221
			if (isset($sg->STATES_IN_SUBGROUP)) {
274
			if (isset($sg->STATES_IN_SUBGROUP)) {
222
				foreach ($sg->STATES_IN_SUBGROUP->children() as $etat) {
275
				foreach ($sg->STATES_IN_SUBGROUP->children() as $etat) {
223
					$relation = array();
276
					$relation = array();
224
					$relation[] = (int) $id;
277
					$relation[] = (int) $id;
225
					$relation[] = (int) $etat->attributes()->GLOBALID;
278
					$relation[] = (int) $etat->attributes()->GLOBALID;
226
					$relation[] = 'A POUR ETAT';
279
					$relation[] = 'A POUR ETAT';
-
 
280
					$this->ajouterRelation($relation);
-
 
281
				}
-
 
282
			}
-
 
283
		}
-
 
284
	}
-
 
285
 
-
 
286
	private function traiterNouvellesQualites($qualites) {
-
 
287
		foreach ($qualites as $qualite) {
-
 
288
			$id = (int) $qualite->attributes()->IDSEQ;
-
 
289
			if (isset($this->lotsTermes[$id]) === false) {
-
 
290
				$valeur = array();
-
 
291
				$valeur[] = (int) $id;
-
 
292
				$valeur[] = 11;
-
 
293
				$valeur[] = (string) $qualite->attributes()->term;
-
 
294
				$valeur[] = (string) $this->obtenirDefinition($terme);
-
 
295
				$valeur[] = (int) $this->obtenirPreference($terme);
-
 
296
				$valeur[] = (int) $this->obtenirAuteur($terme);
-
 
297
				$valeur[] = (int) $this->obtenirCitation($terme);
-
 
298
				$valeur[] = (int) $this->obtenirImage($terme);
-
 
299
				$this->lotsTermes[$id] = $valeur;
-
 
300
			}
-
 
301
			if (isset($qualite->attributes()->ParentPropertyID)) {
-
 
302
				$relation = array();
-
 
303
				$relation[] = (int) $qualite->attributes()->IDSEQ;
-
 
304
				$relation[] = (int) $qualite->attributes()->ParentPropertyID;
-
 
305
				$relation[] = 'A POUR PARENT';
-
 
306
				$this->ajouterRelation($relation);
-
 
307
			}
-
 
308
			if (isset($qualite->MemberStates)) {
-
 
309
				$etats = $qualite->MemberStates->children();
-
 
310
				$idParent = $qualite->attributes()->IDSEQ;
-
 
311
				$this->traiterEtatsMembre($etats, $idParent);
-
 
312
			}
-
 
313
			if (isset($qualite->Structures_linked_to_Property)) {
-
 
314
				$structures = $qualite->Structures_linked_to_Property->children();
-
 
315
				$idParent = $qualite->attributes()->IDSEQ;
-
 
316
				$this->traiterStructuresLiees($structures, $idParent);
-
 
317
			}
-
 
318
			if (isset($qualite->ContextGroups)) {
-
 
319
				$contextes = $qualite->ContextGroups->children();
-
 
320
				if (count($contextes) > 0) {
-
 
321
					foreach ($contextes as $contexte) {
-
 
322
						$idParent = $contexte->attributes()->ID;
-
 
323
						$structures = $contexte->Structures_linked_to_Context->children();
-
 
324
						$this->traiterStructuresLiees($structures, $idParent);
-
 
325
						$etats = $contexte->MemberStates->children();
-
 
326
						$this->traiterEtatsMembre($etats, $idParent);
227
					$this->lotsRelations[] = $relation;
327
					}
228
				}
328
				}
229
			}
329
			}
230
		}
330
		}
Line -... Line 331...
-
 
331
	}
-
 
332
 
-
 
333
	private function ajouterRelation($relation) {
-
 
334
		$id = implode('-', $relation);
-
 
335
		if (isset($this->lotsRelations[$id]) === false) {
-
 
336
			$this->lotsRelations[$id] = $relation;
-
 
337
		}
-
 
338
	}
-
 
339
 
-
 
340
	private function traiterEtatsMembre($etats, $idParent) {
-
 
341
		if (count($etats) > 0) {
-
 
342
			foreach ($etats as $etat) {
-
 
343
				$relation = array();
-
 
344
				$relation[] = (int) $idParent;
-
 
345
				$relation[] = (int) $etat->attributes()->RefID;
-
 
346
				$relation[] = 'A POUR ETAT';
-
 
347
				$this->ajouterRelation($relation);
-
 
348
			}
-
 
349
		}
-
 
350
	}
-
 
351
 
-
 
352
	private function traiterStructuresLiees($structures, $idParent) {
-
 
353
		if (count($structures) > 0) {
-
 
354
			foreach ($structures as $structure) {
-
 
355
				$relation = array();
-
 
356
				$relation[] = (int) $structure->attributes()->RefID;
-
 
357
				$relation[] = (int) $idParent;
-
 
358
				$relation[] = 'A POUR PROPRIETE';
-
 
359
				$this->ajouterRelation($relation);
-
 
360
			}
-
 
361
		}
-
 
362
	}
-
 
363
 
-
 
364
	private function traiterRelations($relations) {
-
 
365
		foreach ($relations as $rel) {
-
 
366
			$relation = array();
-
 
367
			$relation[] = (int) $rel->attributes()->term1REF;
-
 
368
			$relation[] = (int) $rel->attributes()->term2REF;
-
 
369
			$relation[] = (string) $this->obtenirTypeRelation($rel->attributes()->relationship);
-
 
370
			$this->ajouterRelation($relation);
-
 
371
		}
-
 
372
	}
-
 
373
 
-
 
374
	private function obtenirTypeRelation($type) {
-
 
375
		switch ($type) {
-
 
376
			case 'ASSOCIATED WITH' :
-
 
377
				$relation = 'ASSOCIE AVEC';
-
 
378
				break;
-
 
379
			case 'IS A PART OF' :
-
 
380
				$relation = 'EST UNE PARTIE DE';
-
 
381
				break;
-
 
382
			case 'IS A TYPE OF' :
-
 
383
				$relation = 'EST UN TYPE DE';
-
 
384
				break;
-
 
385
			default :
-
 
386
				$relation = '';
-
 
387
		}
-
 
388
		return $relation;
-
 
389
	}
-
 
390
 
-
 
391
	private function traiterImages($images) {
-
 
392
		foreach ($images as $img) {
-
 
393
			$valeur = array();
-
 
394
			$valeur[] = (int) $img->attributes()->ID;
-
 
395
			$valeur[] = (string) $img->attributes()->NAME;
-
 
396
			$valeur[] = (int) $img->attributes()->CITATION_REFID;
-
 
397
			$this->lotsImages[] = $valeur;
-
 
398
		}
-
 
399
	}
-
 
400
 
-
 
401
	private function traiterCitations($citations) {
-
 
402
		foreach ($citations as $publi) {
-
 
403
			$valeur = array();
-
 
404
			$valeur[] = (int) $publi->attributes()->ID;
-
 
405
			$valeur[] = (int) $publi->attributes()->primaryAuthorREF;
-
 
406
			$valeur[] = (string) $publi->PUBLICATION;
-
 
407
			$valeur[] = (string) $publi->DATE;
-
 
408
			$valeur[] = (string) $publi->PAGE;
-
 
409
			$this->lotsPublications[] = $valeur;
-
 
410
		}
-
 
411
	}
-
 
412
 
-
 
413
	private function traiterAuteurs($auteurs) {
-
 
414
		foreach ($auteurs as $auteur) {
-
 
415
			$valeur = array();
-
 
416
			$valeur[] = (int) $auteur->attributes()->ID;
-
 
417
			$valeur[] = (string) $auteur->attributes()->givenNames;
-
 
418
			$valeur[] = (string) $auteur->attributes()->surname;
-
 
419
			$valeur[] = $this->obtenirDateNaissance((string) $auteur->attributes()->born);
-
 
420
			$valeur[] = (string) $auteur->attributes()->died;
-
 
421
			$this->lotsAuteurs[] = $valeur;
-
 
422
		}
-
 
423
	}
-
 
424
 
-
 
425
	private function obtenirDateNaissance($annee) {
-
 
426
		$date = $annee.'-00-00';
-
 
427
		return $date;
-
 
428
	}
-
 
429
 
-
 
430
	private function traiterHierarchie($noeud) {
-
 
431
		$valeur = array();
-
 
432
		$valeur[] = (int) $noeud->attributes()->ID;
-
 
433
		$valeur[] = (int) $noeud->attributes()->ParentNodeID;
-
 
434
		$valeur[] = (string) $noeud->attributes()->pathAsNames;
-
 
435
		$valeur[] = (string) $noeud->attributes()->pathAsID;
-
 
436
		$valeur[] = (int) $noeud->attributes()->TermID;
-
 
437
		$this->lotsHierarchie[] = $valeur;
231
	}
438
	}
232
 
439
 
233
	private function insererLotDeTermes() {
440
	private function insererLotDeTermes() {
234
		$champs = implode(',', array('id_terme', 'ce_type', 'terme', 'definition', 'preference', 'ce_auteur', 'ce_publication', 'ce_image'));
441
		$champs = implode(',', array('id_terme', 'ce_type', 'terme', 'definition', 'preference', 'ce_auteur', 'ce_publication', 'ce_image'));
235
		$values = $this->creerValues($this->lotsTermes);
442
		$values = $this->creerValues($this->lotsTermes);
Line 242... Line 449...
242
		$values = $this->creerValues($this->lotsRelations);
449
		$values = $this->creerValues($this->lotsRelations);
243
		$requete = "INSERT INTO ontologie_relation ($champs) VALUES $values";
450
		$requete = "INSERT INTO ontologie_relation ($champs) VALUES $values";
244
		$this->executerSql($requete);
451
		$this->executerSql($requete);
245
	}
452
	}
Line -... Line 453...
-
 
453
 
-
 
454
	private function insererLotImages() {
-
 
455
		$champs = implode(',', array('id_image', 'uri', 'ce_publication'));
-
 
456
		$values = $this->creerValues($this->lotsImages);
-
 
457
		$requete = "INSERT INTO ontologie_image ($champs) VALUES $values";
-
 
458
		$this->executerSql($requete);
-
 
459
	}
-
 
460
 
-
 
461
	private function insererLotDePublications() {
-
 
462
		$champs = implode(',', array('id_publication', 'ce_auteur_principal', 'titre', 'date', 'uri'));
-
 
463
		$values = $this->creerValues($this->lotsPublications);
-
 
464
		$requete = "INSERT INTO ontologie_publication ($champs) VALUES $values";
-
 
465
		$this->executerSql($requete);
-
 
466
	}
-
 
467
 
-
 
468
	private function insererLotAuteurs() {
-
 
469
		$champs = implode(',', array('id_auteur', 'prenom', 'nom', 'naissance_date', 'deces_date'));
-
 
470
		$values = $this->creerValues($this->lotsAuteurs);
-
 
471
		$requete = "INSERT INTO ontologie_auteur ($champs) VALUES $values";
-
 
472
		$this->executerSql($requete);
-
 
473
	}
-
 
474
 
-
 
475
	private function insererLotHierarchie() {
-
 
476
		$champs = implode(',', array('id_noeud', 'id_noeud_parent', 'chemin_noms', 'chemin_ids', 'ce_terme'));
-
 
477
		$values = $this->creerValues($this->lotsHierarchie);
-
 
478
		$requete = "INSERT INTO ontologie_hierarchie ($champs) VALUES $values";
-
 
479
		$this->executerSql($requete);
-
 
480
	}
246
 
481
 
247
	private function creerValues($valeurs) {
482
	private function creerValues($valeurs) {
248
		$values = array();
483
		$values = array();
249
		foreach ($valeurs as $valeur) {
484
		foreach ($valeurs as $valeur) {
250
			foreach ($valeur as $id => $val) {
485
			foreach ($valeur as $id => $val) {
Line 268... Line 503...
268
	private function proteger($chaine) {
503
	private function proteger($chaine) {
269
		return $this->bdd->proteger($chaine);
504
		return $this->bdd->proteger($chaine);
270
	}
505
	}
Line 271... Line 506...
271
 
506
 
-
 
507
	private function vider() {
-
 
508
		$requete = 'TRUNCATE TABLE ontologie_auteur';
-
 
509
		$this->executerSql($requete);
-
 
510
		$requete = 'TRUNCATE TABLE ontologie_hierarchie';
272
	private function vider() {
511
		$this->executerSql($requete);
-
 
512
		$requete = 'TRUNCATE TABLE ontologie_image';
-
 
513
		$this->executerSql($requete);
273
		$requete = 'TRUNCATE TABLE ontologie_terme';
514
		$requete = 'TRUNCATE TABLE ontologie_publication';
274
		$this->executerSql($requete);
515
		$this->executerSql($requete);
275
		$requete = 'TRUNCATE TABLE ontologie_relation';
516
		$requete = 'TRUNCATE TABLE ontologie_relation';
-
 
517
		$this->executerSql($requete);
-
 
518
		$requete = 'TRUNCATE TABLE ontologie_terme';
276
		$this->executerSql($requete);
519
		$this->executerSql($requete);
277
	}
520
	}
278
}
521
}