changeset 2:e55656794c82

create and use separate export directory.
author root@ismi.rz-berlin.mpg.de
date Tue, 02 Jun 2015 11:09:16 +0200
parents 06cb81c6eeec
children 667b6597a676
files importFromOpenMind/importer/filterISMI.py
diffstat 1 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/importFromOpenMind/importer/filterISMI.py	Fri May 22 12:39:37 2015 +0200
+++ b/importFromOpenMind/importer/filterISMI.py	Tue Jun 02 11:09:16 2015 +0200
@@ -4,6 +4,7 @@
 @author: dwinter
 '''
 
+import os
 import json
 import urllib.request
 
@@ -126,31 +127,35 @@
     
     #loadall = imp.loadallEnts()
     #print(loadall.encode('utf-8'))
-    
+
+    exportDir = '/tmp/ismi_data'
+    if not os.access(exportDir, os.R_OK):
+        # dir doesn't exist -> create
+        os.makedirs(exportDir)
     
-    imp.saveallEnts("/tmp/witnesses")
+    imp.saveallEnts(exportDir+"/witnesses",kind="tar")
     
-    imp.saveallEnts("/tmp/codex_src",kind="src",filterOC=['CODEX','WITNESS'])
+    imp.saveallEnts(exportDir+"/codex_src",kind="src",filterOC=['CODEX','WITNESS'])
     
     #hole jetzt alle relationen an den witnessen
     
-    imp.loadJSONFromFile("/tmp/witnesses")
+    imp.loadJSONFromFile(exportDir+"/witnesses")
     
     #ids= imp.getEntIdsMentioned(kind="src")
  
-    imp.saveallEnts("/tmp/texts",kind="src",filterOC=['CODEX','WITNESS','PERSON'])
+    imp.saveallEnts(exportDir+"/texts",kind="src",filterOC=['CODEX','WITNESS','PERSON'])
     
-    imp.loadJSONFromFile("/tmp/texts")
+    imp.loadJSONFromFile(exportDir+"/texts")
     
-    imp.saveallEnts("/tmp/authors_subjects_src",kind="src",filterOC=['CODEX','WITNESS','TEXT'])
+    imp.saveallEnts(exportDir+"/authors_subjects_src",kind="src",filterOC=['CODEX','WITNESS','TEXT'])
     
-    imp.saveallEnts("/tmp/authors_subjects_tar",kind="tar",filterOC=['CODEX','WITNESS','TEXT'])
+    imp.saveallEnts(exportDir+"/authors_subjects_tar",kind="tar",filterOC=['CODEX','WITNESS','TEXT'])
     
   
-    imp.loadJSONFromFile("/tmp/authors_subjects_src")
+    imp.loadJSONFromFile(exportDir+"/authors_subjects_src")
     
-    imp.saveallEnts("/tmp/subjects_places",kind="src",filterOC=['CODEX','WITNESS','TEXT','PERSON'])
-    imp.saveallEnts("/tmp/references_places",kind="tar",filterOC=['CODEX','WITNESS','TEXT','PERSON'])
+    imp.saveallEnts(exportDir+"/subjects_places",kind="src",filterOC=['CODEX','WITNESS','TEXT','PERSON'])
+    imp.saveallEnts(exportDir+"/references_places",kind="tar",filterOC=['CODEX','WITNESS','TEXT','PERSON'])