diff exportTextToSolr.py @ 4:ceac1f8e896f default tip

exportTexts
author dwinter
date Fri, 14 Dec 2012 13:47:41 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/exportTextToSolr.py	Fri Dec 14 13:47:41 2012 -0500
@@ -0,0 +1,20 @@
+import json
+
+
+import urllib2
+
+
+u = urllib2.urlopen('https://openmind-ismi-dev.mpiwg-berlin.mpg.de/om4-ismi/jsonInterface?method=get_ents&oc=TEXT')
+
+texts= json.load(u)
+
+for ent in texts['ents']:
+    id= ent['id']
+    
+    x = urllib2.urlopen('http://localhost:58180/ISMI/database/text.xml?id='+repr(id))
+    fw=file("/tmp/"+repr(id)+".xml",'w')
+    print id
+    fw.write(x.read())
+    fw.close()
+    x.close()
+u.close()
\ No newline at end of file