src/hdabo/management/commands/import_rdf.py
branchdocumentation
changeset 693 09e00f38d177
parent 649 434737bd64e5
--- a/src/hdabo/management/commands/import_rdf.py	Thu Apr 12 01:27:16 2018 +0200
+++ b/src/hdabo/management/commands/import_rdf.py	Wed Apr 11 12:19:47 2018 +0200
@@ -1,10 +1,29 @@
 # -*- coding: utf-8 -*-
 '''
-Created on May 25, 2011
+Importe un fichiers RDF issus d'un export de la base HDA.
+Cette commande remplace le contenu de la base existante.
 
-- after `import_rdf` call commands `import_hdabo_db -c` then `rebuild_index`
+La liste des types d'objets importés est la suivante :
+    - `Categorie`,
+    - `Tag`,
+    - `Site`,
+    - `Ville`,
+    - `Institution`,
+    - `Theme`,
+    - `Domaine`,
+    - `SousDomaine`,
+    - `Periode`,
+    - `Notice`
 
-@author: ymh
+A noter que cette commande est actuellement utilisée pour transférer le contenu de la base de donnée du site HDA vers HDALab. les commandes suivantes sont ensuite lancée:
+    #. :class:`import_hdabo_db -c <hdalab.management.commands.import_hdabo_db>`
+    #. `rebuild_index <http://django-haystack.readthedocs.io/en/master/management_commands.html#rebuild-index>`_
+
+**Usage**: ``django-admin import_rdf [options] <path_to_rdf_file>``
+
+**Options spécifiques:**
+
+    - *\-t, \-\-type=TYPE* : type d'objet à importer. Cette option peut être ajoutée plusieurs fois.
 '''
 
 import base64
@@ -33,8 +52,8 @@
 logger = logging.getLogger(__name__)
 
 RDF_EXT_MAP = {
-    '.xml': 'rdfxm',
-    '.rdf': 'rdfxm',
+    '.xml': 'rdfxml',
+    '.rdf': 'rdfxml',
     '.ttl': 'turtle',
     '.nt': 'ntriples'
 }
@@ -804,7 +823,7 @@
 
 class Command(BaseCommand):
     '''
-    Command to import csvfile
+    Command to import rdf file
     '''
     args = '<path_to_rdf_file>'
     options = '[--type TYPE]'
@@ -835,7 +854,7 @@
         self.types_list = options.get('types', TYPES_LIST) or TYPES_LIST
 
         if any([t not in TYPES_LIST for t in self.types_list]):
-            raise CommandError("Types is %r : all types mus be in %r" % (self.types_list, TYPES_LIST))
+            raise CommandError("Types is %r : all types must be in %r" % (self.types_list, TYPES_LIST))
 
         with transaction.atomic():
             connection = connections[DEFAULT_DB_ALIAS]