Publications

JURI

Ci-dessous, vous trouverez les 5 dernières publications de nos membres pour chaque catégorie. Pour consulter la liste détaillée d'une catégorie, sélectionnez-la dans le menu de gauche.

#!/usr/bin/python # -*- coding: utf-8 -*- import sys import urllib import ldap import cgi import cgitb import re sys.path.append('/var/www/sites/tools/include') import HTML import mydial cgitb.enable() def getInfo(attr, publi): if attr in publi.keys(): if type(publi[attr]) == str: return publi[attr] elif type(publi[attr]) == unicode: return publi[attr].encode("utf-8") elif type(publi[attr]) == list: a = '' for j, e in enumerate(publi[attr]): if (j != 0): a += ' ; ' if type(e) == str: a += e elif type(e) == unicode: a += e.encode("utf-8") return a return 'xxx' def stringify(arg, key): if key in arg.keys(): if type(arg[key]) == list: return ", ".join(arg[key]) else: return arg[key] else: return '' def multikeysort(items, sortStr): comparers = [] for s in urllib.unquote(sortStr).split(","): l = s.strip().split() if l[1] == 'desc': polarity = -1 if l[1] == 'asc': polarity = 1 comparers.append((l[0], polarity)) def comparer(left, right): for key, polarity in comparers: argl = stringify(left, key) argr = stringify(right, key) result = cmp(argl, argr) if result: return polarity * result else: return 0 return sorted(items, cmp=comparer) pubType = { u'Article de p\u00e9riodique (Journal article)' : 'Journal Articles', \ u'Brevet (Patent)' : 'Patents', \ u'Communication \u00e0 un colloque (Conference Paper)' : 'Conference Papers', \ u'Contribution \u00e0 ouvrage collectif (Book Chapter)' : 'Book Chapters', \ u'Document de travail (Working Paper)' : 'Working Papers', \ u'Monographie (Book)' : 'Books', \ u'Preprint' : 'Preprints', \ u'Rapport (Report)' : 'Reports', \ u'Th\u00e8se (Dissertation)' : 'Dissertations' } form = cgi.FieldStorage() sortStr = urllib.quote(form.getvalue('s')) solrNum = form.getvalue('n') solrQuery = urllib.unquote(form.getvalue('q')) ### # Paramètres de base de la requête solr # baseQuery = 'http://dial.uclouvain.be/solr/repository/select?' \ '&version=2.2' \ '&start=0' \ '&rows=999999' \ '&qt=standard' \ '&wt=python' \ '&sort=&q=%s' % ( \ urllib.quote('ss_state:A AND sm_vitalSite:[3 TO 7] AND ') ) f = form.getvalue('f') ### # Affichage du code html # mydial.printheader_export('Export') for t in sorted(pubType.keys()): q = baseQuery + urllib.quote(solrQuery) + urllib.quote(' AND sm_type:"%s"' % \ t.encode("utf-8")) tmp = urllib.urlopen(q) resp = eval( urllib.urlopen(q).read() ) if ( resp['response']['numFound'] > 0 ): #print '%s (%d)' % (pubType[t].encode("utf-8"), \ # resp['response']['numFound']) if f == 'html': print '

%s


' % pubType[t] elif f == 'latex': print '\subsection{%s}
' % pubType[t] print '\\begin{enumerate}
' for i, doc in enumerate(multikeysort(resp['response']['docs'], sortStr)[:int(solrNum)]): s = [ 'sm_creator', 'sm_title', 'sm_journal.title', \ 'sm_journal.volume', 'sm_doi', 'ss_publicationstatus', \ 'sm_handle', 'sm_book.creator', 'sm_book.title', \ 'sm_book.series', 'sm_book.volume.des', 'sm_publisher.name', \ 'sm_publisher.location', 'sm_date', 'sm_book.volume', \ 'sm_isbn', 'sm_book.pages', 'sm_conference.title', \ 'sm_conference.location', 'sm_conference.date', 'sm_promoteur', \ 'sm_date.examination', 'sm_collection.marc' ] d = {} for k in s: d[k] = getInfo(k, doc) if (t == u'Article de p\u00e9riodique (Journal article)'): if f == 'html': ref = '%(sm_creator)s. %(sm_title)s.' \ ' In: %(sm_journal.title)s, %(sm_journal.volume)s.' \ ' doi:%(sm_doi)s (%(ss_publicationstatus)s).' % d elif f == 'latex': ref = '{\sc %(sm_creator)s}. {\em %(sm_title)s}.' \ ' In: {\em %(sm_journal.title)s}, %(sm_journal.volume)s.' \ ' doi:%(sm_doi)s (%(ss_publicationstatus)s).' % d ref = re.sub('In: xxx<\/i>,', '', ref) ref = re.sub('In: {\em xxx},', '', ref) ref = re.sub('doi:xxx', '', ref) ref = re.sub('\(xxx\)', '', ref) ref = re.sub('\(Publi.*\)', '', ref) ref = re.sub('xxx', '', ref) ref = re.sub('[ ]+\.', '.', ref) ref = re.sub('\.+', '.', ref) ref = re.sub('[ ]+;', ';', ref) if (t == 'Brevet (Patent)'): if f == 'html': ref = '%(sm_creator)s. %(sm_title)s.' % d ref += ' %s' % HTML.link(d['sm_handle'],d['sm_handle']) elif f == 'latex': ref = '%(sm_creator)s. {\em %(sm_title)s}.' % d ref += ' %s' % d['sm_handle'] ref = re.sub('xxx\. ', '', ref) ref = re.sub('{\sc xxx}\.', '', ref) ref = re.sub('[ ]+', ' ', ref) ref = re.sub('[ ]+;', ';', ref) if (t == u'Communication \u00e0 un colloque (Conference Paper)'): if f == 'html': ref = '%(sm_creator)s. %(sm_title)s.' \ ' %(sm_conference.title)s (%(sm_conference.location)s,' \ ' %(sm_conference.date)s). In: %(sm_journal.title)s.' \ ' %(sm_journal.volume)s. In: %(sm_book.title)s' \ ' (%(sm_book.series)s; %(sm_book.volume.des)s),' \ ' %(sm_publisher.name)s: %(sm_publisher.location)s,' \ ' %(sm_date)s, %(sm_isbn)s, %(sm_book.volume)s.' \ ' doi:%(sm_doi)s.' % d elif f == 'latex': ref = '{\sc %(sm_creator)s}. {\em %(sm_title)s}.' \ ' %(sm_conference.title)s (%(sm_conference.location)s,' \ ' %(sm_conference.date)s). In: {\em %(sm_journal.title)s}.' \ ' %(sm_journal.volume)s. In: {\em %(sm_book.title)s}' \ ' (%(sm_book.series)s; %(sm_book.volume.des)s),' \ ' %(sm_publisher.name)s: %(sm_publisher.location)s,' \ ' %(sm_date)s, %(sm_isbn)s, %(sm_book.volume)s.' \ ' doi:%(sm_doi)s.' % d ref = re.sub('In: xxx<\/i>[ \.]', '', ref) ref = re.sub('In: {.em xxx}[ \.]', '', ref) ref = re.sub(' doi:xxx.', '', ref) ref = re.sub('[\.,:;][ ]+xxx','',ref) ref = re.sub('[ ]+\(xxx\)', '', ref) ref = re.sub('xxx,[ ]+', '', ref) ref = re.sub('\.,', '.', ref) ref = re.sub('\.[ ]+,', '.', ref) ref = re.sub('\.[ ]+\d\d\d\d\.', '.', ref) ref = re.sub('[ ]+;', ';', ref) if (t == u'Contribution \u00e0 ouvrage collectif (Book Chapter)'): if f == 'html': ref = '%(sm_creator)s. %(sm_title)s.' \ ' In: %(sm_book.creator)s, %(sm_book.title)s' \ ' (%(sm_book.series)s; %(sm_book.volume.des)s),' \ ' %(sm_publisher.name)s: %(sm_publisher.location)s,' \ ' %(sm_date)s, %(sm_book.volume)s. %(sm_isbn)s.' \ ' doi:%(sm_doi)s.' % d elif f == 'latex': ref = '{\sc %(sm_creator)s}. {\em %(sm_title)s}.' \ ' In: %(sm_book.creator)s, {\em %(sm_book.title)s}' \ ' (%(sm_book.series)s; %(sm_book.volume.des)s),' \ ' %(sm_publisher.name)s: %(sm_publisher.location)s,' \ ' %(sm_date)s, %(sm_book.volume)s. %(sm_isbn)s.' \ ' doi:%(sm_doi)s.' % d ref = re.sub('In: xxx, ', 'In: ', ref) ref = re.sub(': xxx,', ',', ref) ref = re.sub(' doi:xxx.', '', ref) ref = re.sub('\. xxx\.', '.', ref) ref = re.sub('\(xxx; xxx\)', '', ref) ref = re.sub(', xxx\.', '.', ref) ref = re.sub('[ ]+;', ';', ref) if (t == 'Document de travail (Working Paper)'): if f == 'html': ref = '%(sm_creator)s. %(sm_title)s' \ ' (%(sm_collection.marc)s), %(sm_date)s.' \ ' %(sm_book.pages)s p.' % d elif f == 'latex': ref = '{\sc %(sm_creator)s}. {\em %(sm_title)s}' \ ' (%(sm_collection.marc)s), %(sm_date)s.' \ ' %(sm_book.pages)s p.' % d ref = re.sub(' xxx p\.', '', ref) ref = re.sub('[ ]+', ' ', ref) ref = re.sub('[ ]+;', ';', ref) if (t == 'Monographie (Book)'): if f == 'html': ref = '%(sm_creator)s. %(sm_title)s.' \ ' %(sm_publisher.name)s: %(sm_publisher.location)s,' \ ' %(sm_date)s. %(sm_isbn)s. %(sm_book.pages)s pages.' % d elif f == 'latex': ref = '{\sc %(sm_creator)s}. {\em %(sm_title)s}.' \ ' %(sm_publisher.name)s: %(sm_publisher.location)s,' \ ' %(sm_date)s. %(sm_isbn)s. %(sm_book.pages)s pages.' % d ref = re.sub(': xxx', '', ref) ref = re.sub(' xxx.', '', ref) ref = re.sub('[ ]+;', ';', ref) if (t == 'Preprint'): if f == 'html': ref = '%(sm_creator)s. %(sm_title)s,' \ ' %(sm_date)s. %(sm_book.pages)s p.' % d elif f == 'latex': ref = '{\sc %(sm_creator)s}. {\em %(sm_title)}s,' \ ' %(sm_date)s. %(sm_book.pages)s p.' % d ref = re.sub(' xxx p\.', '', ref) ref = re.sub('[ ]+', ' ', ref) ref = re.sub('[ ]+;', ';', ref) if (t == 'Rapport (Report)'): if f == 'html': ref = '%(sm_creator)s. %(sm_title)s,' \ ' %(sm_date)s. %(sm_book.pages)s p.' % d elif f == 'latex': ref = '{\sc %(sm_creator)s}. {\em %(sm_title)s},' \ ' %(sm_date)s. %(sm_book.pages)s p.' % d ref = re.sub(' xxx p\.', '', ref) ref = re.sub('[ ]+', ' ', ref) ref = re.sub('[ ]+;', ';', ref) if (t == u'Th\u00e8se (Dissertation)'): if f == 'html': ref = '%(sm_creator)s. %(sm_title)s,' \ ' prom. : %(sm_promoteur)s, %(sm_date.examination)s.' % d elif f == 'latex': ref = '{\sc %(sm_creator)s}. {\em %(sm_title)s},' \ ' prom. : %(sm_promoteur)s, %(sm_date.examination)s.' % d ref = re.sub(', prom. : xxx','', ref) ref = re.sub(', xxx','', ref) ref = re.sub(':[ ]+;',':', ref) if f == 'html': #ref = ref.decode('utf-8') #ref = ref.encode('latin-1','ignore') print '%d. %s %s

' % (i+1, ref, \ HTML.link(d['sm_handle'],d['sm_handle'])) elif f == 'latex': ref = re.sub('&','\&', ref) ref = re.sub('_','\_', ref) print '\item[%d] %s \url{%s}
' % (i+1, ref, \ d['sm_handle']) if f == 'latex': print '\end{enumerate}
' ### # Affichage du code html # mydial.printfooter(False)