changeset 11:69a2f0b8a932

sortieren von treffer listen nach typen
author dwinter
date Sun, 05 May 2013 17:10:22 +0200
parents 007ba22a5eb1
children 55294833888f
files zopePubmanConnector.py
diffstat 1 files changed, 34 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/zopePubmanConnector.py	Sun May 05 15:50:01 2013 +0200
+++ b/zopePubmanConnector.py	Sun May 05 17:10:22 2013 +0200
@@ -65,9 +65,11 @@
         
         
         if publicationType is None:
-            cn = self.connectorString+"cqlQuery=escidoc.any-identifier=%22"+personID+"%22&"
+           # cn = self.connectorString+"cqlQuery=escidoc.any-identifier=%22"+personID+"%22&"
+            cn = self.connectorString+"cqlQuery=escidoc.publication.creator.person.identifier=%22"+personID+"%22&"
         else:
-            cn = self.connectorString+"cqlQuery=escidoc.any-identifier=%22"+personID+"%22"
+            #cn = self.connectorString+"cqlQuery=escidoc.any-identifier=%22"+personID+"%22"
+            cn = self.connectorString+"cqlQuery=escidoc.publication.creator.person.identifier=%22"+personID+"%22&"
             cn +="%20and%20escidoc.publication.type=%22"+publicationType+"%22&"
         
         cn +="exportFormat=APA&outputFormat=snippet&language=all&sortKeys=escidoc.any-dates&sortOrder=descending"
@@ -198,9 +200,24 @@
         
         return ret
         
-         
+       
+    def getEntriesFromPubman(self,escidocids):
         
-    def getEntryFromPubman(self,escidocid):
+        doctypes={}
+        for escidocid in escidocids:
+          
+            txt, type = self.getEntryFromPubman(escidocid.escidocid, True)
+           
+            if not doctypes.has_key(type):
+                doctypes[type]=[]
+                
+            doctypes[type].append((escidocid.escidocid,txt))
+            
+        
+        return doctypes
+      
+      
+    def getEntryFromPubman(self,escidocid,extendedData=None):
         """get one entry"""
         
         escidocid=escidocid.lstrip().strip()
@@ -219,11 +236,22 @@
         
         citation=root.find(citationxpath)
         
+        
+        if citation is not None and extendedData is not None:
+            ns = {'escidocMetadataProfile':"http://escidoc.mpg.de/metadataprofile/schema/0.1/",
+                  'escidocMetadataRecords':"http://www.escidoc.de/schemas/metadatarecords/0.4"
+            }
+        
+            path = ".//escidocMetadataRecords:md-records/escidocMetadataRecords:md-record/escidocMetadataProfile:publication"
+      
+            publicationTag= root.find(path,ns);
+            return citation.text,publicationTag.get('type')
+        
         if citation is not None:
 
             return citation.text
-    
-        return ""
+        
+        return "",''
         
     def pubmanConnectorURL(self):
         return self.connectorString