# HG changeset patch # User root@ismi.rz-berlin.mpg.de # Date 1433236156 -7200 # Node ID e55656794c82362b7f4cbf6c8c7547ab8c61ad1f # Parent 06cb81c6eeecfb60b9358b5c98388116ab69384c create and use separate export directory. diff -r 06cb81c6eeec -r e55656794c82 importFromOpenMind/importer/filterISMI.py --- 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'])