diff --git a/INSTALL b/INSTALL index 60030e6b5..d1a8870a8 100644 --- a/INSTALL +++ b/INSTALL @@ -1,656 +1,663 @@ CDS Invenio v0.99.1 INSTALL =========================== About ===== This document specifies how to build, customize, and install CDS Invenio v0.99.1 for the first time. See RELEASE-NOTES if you are upgrading from a previous CDS Invenio release. Contents ======== 0. Prerequisites 1. Quick instructions for the impatient CDS Invenio admin 2. Detailed instructions for the patient CDS Invenio admin 0. Prerequisites ================ Here is the software you need to have around before you start installing CDS Invenio: a) Unix-like operating system. The main development and production platforms for CDS Invenio at CERN are GNU/Linux distributions Debian, Gentoo, Scientific Linux (aka RHEL), Ubuntu, but we also develop on Mac OS X. Basically any Unix system supporting the software listed below should do. If you are using Debian GNU/Linux ``Lenny'' or later, then you can install most of the below-mentioned prerequisites and recommendations by running: $ sudo aptitude install python-dev apache2-mpm-prefork \ mysql-server mysql-client python-mysqldb \ python-4suite-xml python-simplejson python-xml \ python-libxml2 python-libxslt1 gnuplot poppler-utils \ gs-common clisp gettext libapache2-mod-wsgi unzip python-rdflib \ python-gnuplot python-magic pdftk html2text giflib-tools \ pstotext netpbm You may also want to install some of the following packages, if you have them available on your concrete architecture: $ sudo aptitude install rxp python-psyco sbcl cmucl \ pylint pychecker pyflakes python-profiler python-epydoc \ libapache2-mod-xsendfile openoffice.org Moreover, you should install some Message Transfer Agent (MTA) such as Postfix so that CDS Invenio can email notification alerts or registration information to the end users, contact moderators and reviewers of submitted documents, inform administrators about various runtime system information, etc: $ sudo aptitude install postfix After running the above-quoted aptitude command(s), you can proceed to configuring your MySQL server instance (max_allowed_packet in my.cnf, see item 0b below) and then to installing the CDS Invenio software package in the section 1 below. If you are using another operating system, then please continue reading the rest of this prerequisites section, and please consult our wiki pages for any concrete hints for your specific operating system. b) MySQL server (may be on a remote machine), and MySQL client (must be available locally too). MySQL versions 4.1 or 5.0 are supported. Please set the variable "max_allowed_packet" in your "my.cnf" init file to at least 4M. You may perhaps also want to run your MySQL server natively in UTF-8 mode by setting "default-character-set=utf8" in various parts of your "my.cnf" file, such as in the "[mysql]" part and elsewhere; but this is not really required. c) Apache 2 server, with support for loading DSO modules, and optionally with SSL support for HTTPS-secure user authentication, and mod_xsendfile for off-loading file downloads away from Invenio processes to Apache. d) Python v2.4 or above: as well as the following Python modules: - (mandatory) MySQLdb (version >= 1.2.1_p2; see below) - (recommended) PyXML, for XML processing: - (recommended) PyRXP, for very fast XML MARC processing: - (recommended) libxml2-python, for XML/XLST processing: - (recommended) simplejson, for AJAX apps: Note that if you are using Python-2.6, you don't need to install simplejson, because the module is already included in the main Python distribution. - (recommended) Gnuplot.Py, for producing graphs: - (recommended) Snowball Stemmer, for stemming: - (recommended) py-editdist, for record merging: - (recommended) numpy, for citerank methods: - (recommended) magic, for full-text file handling: - (optional) 4suite, slower alternative to PyRXP and libxml2-python: - (optional) feedparser, for web journal creation: - (optional) Psyco, if you are running on a 32-bit OS: - (optional) RDFLib, to use RDF ontologies and thesauri: - (optional) mechanize, to run regression web test suite: Note: MySQLdb version 1.2.1_p2 or higher is recommended. If you are using an older version of MySQLdb, you may get into problems with character encoding. e) mod_wsgi Apache module. Note: for the time being, the WSGI daemon must be run with threads=1, because Invenio is not fully thread safe yet. This will come later. The Apache configuration example snippets (created below) will use threads=1. Note: if you are using Python 2.4 or earlier, then you should also install the wsgiref Python module, available from: (As of Python 2.5 this module is included in standard Python distribution.) f) If you want to be able to extract references from PDF fulltext files, then you need to install pdftotext version 3 at least. g) If you want to be able to search for words in the fulltext files (i.e. to have fulltext indexing) or to stamp submitted files, then you need as well to install some of the following tools: - for Microsoft Office/OpenOffice.org document conversion: OpenOffice.org - for PDF file stamping: pdftk, pdf2ps - for PDF files: pdftotext or pstotext - for PostScript files: pstotext or ps2ascii - for DjVu creation, elaboration: DjVuLibre - to perform OCR: OCRopus (tested only with release 0.3.1) - to perform different image elaborations: ImageMagick - to generate PDF after OCR: ReportLab - to analyze images to generate PDF after OCR: netpbm h) If you have chosen to install fast XML MARC Python processors in the step d) above, then you have to install the parsers themselves: - (optional) 4suite: i) (recommended) Gnuplot, the command-line driven interactive plotting program. It is used to display download and citation history graphs on the Detailed record pages on the web interface. Note that Gnuplot must be compiled with PNG output support, that is, with the GD library. Note also that Gnuplot is not required, only recommended. j) (recommended) A Common Lisp implementation, such as CLISP, SBCL or CMUCL. It is used for the web server log analysing tool and the metadata checking program. Note that any of the three implementations CLISP, SBCL, or CMUCL will do. CMUCL produces fastest machine code, but it does not support UTF-8 yet. Pick up CLISP if you don't know what to do. Note that a Common Lisp implementation is not required, only recommended. k) GNU gettext, a set of tools that makes it possible to translate the application in multiple languages. This is available by default on many systems. Note that the configure script checks whether you have all the prerequisite software installed and that it won't let you continue unless everything is in order. It also warns you if it cannot find some optional but recommended software. 1. Quick instructions for the impatient CDS Invenio admin ========================================================= 1a. Installation ---------------- $ cd $HOME/src/ $ wget http://cdsware.cern.ch/download/cds-invenio-0.99.1.tar.gz $ wget http://cdsware.cern.ch/download/cds-invenio-0.99.1.tar.gz.md5 $ wget http://cdsware.cern.ch/download/cds-invenio-0.99.1.tar.gz.sig $ md5sum -v -c cds-invenio-0.99.1.tar.gz.md5 $ gpg --verify cds-invenio-0.99.1.tar.gz.sig cds-invenio-0.99.1.tar.gz $ tar xvfz cds-invenio-0.99.1.tar.gz $ cd cds-invenio-0.99.1 $ ./configure $ make $ make install $ make install-jsmath-plugin ## optional $ make install-jquery-plugins ## optional $ make install-fckeditor-plugin ## optional + $ make install-pdfa-helper-files ## optional 1b. Configuration ----------------- $ sudo chown -R www-data.www-data /opt/cds-invenio $ sudo -u www-data emacs /opt/cds-invenio/etc/invenio-local.conf $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --update-all $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --create-tables $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --load-webstat-conf $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --create-apache-conf $ sudo /etc/init.d/apache2 restart $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --create-demo-site $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --load-demo-records $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --run-unit-tests $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --run-regression-tests $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --run-web-tests $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --remove-demo-records $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --drop-demo-site $ firefox http://your.site.com/help/admin/howto-run 2. Detailed instructions for the patient CDS Invenio admin ========================================================== 2a. Installation ---------------- The CDS Invenio uses standard GNU autoconf method to build and install its files. This means that you proceed as follows: $ cd $HOME/src/ Change to a directory where we will build the CDS Invenio sources. (The built files will be installed into different "target" directories later.) $ wget http://cdsware.cern.ch/download/cds-invenio-0.99.1.tar.gz $ wget http://cdsware.cern.ch/download/cds-invenio-0.99.1.tar.gz.md5 $ wget http://cdsware.cern.ch/download/cds-invenio-0.99.1.tar.gz.sig Fetch CDS Invenio source tarball from the CDS Software Consortium distribution server, together with MD5 checksum and GnuPG cryptographic signature files useful for verifying the integrity of the tarball. $ md5sum -v -c cds-invenio-0.99.1.tar.gz.md5 Verify MD5 checksum. $ gpg --verify cds-invenio-0.99.1.tar.gz.sig cds-invenio-0.99.1.tar.gz Verify GnuPG cryptographic signature. Note that you may first have to import my public key into your keyring, if you haven't done that already: $ gpg --keyserver wwwkeys.eu.pgp.net --recv-keys 0xBA5A2B67 The output of the gpg --verify command should then read: Good signature from "Tibor Simko " You can safely ignore any trusted signature certification warning that may follow after the signature has been successfully verified. $ tar xvfz cds-invenio-0.99.1.tar.gz Untar the distribution tarball. $ cd cds-invenio-0.99.1 Go to the source directory. $ ./configure Configure CDS Invenio software for building on this specific platform. You can use the following optional parameters: --prefix=/opt/cds-invenio Optionally, specify the CDS Invenio general installation directory (default is /opt/cds-invenio). It will contain command-line binaries and program libraries containing the core CDS Invenio functionality, but also store web pages, runtime log and cache information, document data files, etc. Several subdirs like `bin', `etc', `lib', or `var' will be created inside the prefix directory to this effect. Note that the prefix directory should be chosen outside of the Apache htdocs tree, since only one its subdirectory (prefix/var/www) is to be accessible directly via the Web (see below). Note that CDS Invenio won't install to any other directory but to the prefix mentioned in this configuration line. --with-python=/opt/python/bin/python2.4 Optionally, specify a path to some specific Python binary. This is useful if you have more than one Python installation on your system. If you don't set this option, then the first Python that will be found in your PATH will be chosen for running CDS Invenio. --with-mysql=/opt/mysql/bin/mysql Optionally, specify a path to some specific MySQL client binary. This is useful if you have more than one MySQL installation on your system. If you don't set this option, then the first MySQL client executable that will be found in your PATH will be chosen for running CDS Invenio. --with-clisp=/opt/clisp/bin/clisp Optionally, specify a path to CLISP executable. This is useful if you have more than one CLISP installation on your system. If you don't set this option, then the first executable that will be found in your PATH will be chosen for running CDS Invenio. --with-cmucl=/opt/cmucl/bin/lisp Optionally, specify a path to CMUCL executable. This is useful if you have more than one CMUCL installation on your system. If you don't set this option, then the first executable that will be found in your PATH will be chosen for running CDS Invenio. --with-sbcl=/opt/sbcl/bin/sbcl Optionally, specify a path to SBCL executable. This is useful if you have more than one SBCL installation on your system. If you don't set this option, then the first executable that will be found in your PATH will be chosen for running CDS Invenio. --with-openoffice-python Optionally, specify the path to the Python interpreter embedded with OpenOffice.org. This is normally not contained in the normal path. If you don't specify this it won't be possible to use OpenOffice.org to convert from and to Microsoft Office and OpenOffice.org documents. This configuration step is mandatory. Usually, you do this step only once. (Note that if you are building CDS Invenio not from a released tarball, but from the Git sources, then you have to generate the configure file via autotools: $ sudo aptitude install automake1.9 autoconf $ aclocal-1.9 $ automake-1.9 -a $ autoconf after which you proceed with the usual configure command.) $ make Launch the CDS Invenio build. Since many messages are printed during the build process, you may want to run it in a fast-scrolling terminal such as rxvt or in a detached screen session. During this step all the pages and scripts will be pre-created and customized based on the config you have edited in the previous step. Note that on systems such as FreeBSD or Mac OS X you have to use GNU make ("gmake") instead of "make". $ make install Install the web pages, scripts, utilities and everything needed for CDS Invenio runtime into respective installation directories, as specified earlier by the configure command. Note that if you are installing CDS Invenio for the first time, you will be asked to create symbolic link(s) from Python's site-packages system-wide directory(ies) to the installation location. This is in order to instruct Python where to find CDS Invenio's Python files. You will be hinted as to the exact command to use based on the parameters you have used in the configure command. $ make install-jsmath-plugin ## optional This will automatically download and install in the proper place jsMath, a Javascript library to render LaTeX formulas in the client browser. Note that in order to enable the rendering you will have to set the variable CFG_WEBSEARCH_USE_JSMATH_FOR_FORMATS in invenio-local.conf to a suitable list of output format codes. For example: CFG_WEBSEARCH_USE_JSMATH_FOR_FORMATS = hd,hb $ make install-jquery-plugins ## optional This will automatically download and install in the proper place jQuery and related plugins. They are used for AJAX applications such as the record editor. Note that `unzip' is needed when installing jquery plugins. $ make install-fckeditor-plugin ## optional This will automatically download and install in the proper place FCKeditor, a WYSIWYG Javascript-based editor (e.g. for the WebComment module). Note that in order to enable the editor you have to set the CFG_WEBCOMMENT_USE_FCKEDITOR to True. + $ make install-pdfa-helper-files ## optional + + This will automatically download and install in the proper + place the helper files needed to create PDF/A files out of + existing PDF files. + 2b. Configuration ----------------- Once the basic software installation is done, we proceed to configuring your Invenio system. $ sudo chown -R www-data.www-data /opt/cds-invenio For the sake of simplicity, let us assume that your CDS Invenio installation will run under the `www-data' user process identity. The above command changes ownership of installed files to www-data, so that we shall run everything under this user identity from now on. For production purposes, you would typically enable Apache server to read all files from the installation place but to write only to the `var' subdirectory of your installation place. You could achieve this by configuring Unix directory group permissions, for example. $ sudo -u www-data emacs /opt/cds-invenio/etc/invenio-local.conf Customize your CDS Invenio installation. Please read the 'invenio.conf' file located in the same directory that contains the vanilla default configuration parameters of your CDS Invenio installation. If you want to customize some of these parameters, you should create a file named 'invenio-local.conf' in the same directory where 'invenio.conf' lives and write there only the customizations that you want to be different from the vanilla defaults. Here is a minimalist example what you would put there: $ cat /opt/cds-invenio/etc/invenio-local.conf [Invenio] CFG_SITE_URL = http://your.site.com CFG_SITE_SECURE_URL = https://your.site.com CFG_SITE_ADMIN_EMAIL = john.doe@your.site.com CFG_SITE_SUPPORT_EMAIL = john.doe@your.site.com You should override at least the parameters from the top of invenio.conf file in order to define some very essential runtime parameters such as the visible URL of your document server (look for CFG_SITE_URL and CFG_SITE_SECURE_URL), the database credentials (look for CFG_DATABASE_*), the name of your document server (look for CFG_SITE_NAME and CFG_SITE_NAME_INTL_*), or the email address of the local CDS Invenio administrator (look for CFG_SITE_SUPPORT_EMAIL and CFG_SITE_ADMIN_EMAIL). The CDS Invenio system will then read both the default invenio.conf file and your customized invenio-local.conf file and it will override any default options with the ones you have specifield in your local file. This cascading of configuration parameters will ease your future upgrades. $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --update-all Make the rest of the Invenio system aware of your invenio-local.conf changes. This step is mandatory each time you edit your conf files. $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --create-tables If you are installing CDS Invenio for the first time, you have to create database tables. Note that this step checks for potential problems such as the database connection rights and may ask you to perform some more administrative steps in case it detects a problem. Notably, it may ask you to set up database access permissions, based on your configure values. If you are installing CDS Invenio for the first time, you have to create a dedicated database on your MySQL server that the CDS Invenio can use for its purposes. Please contact your MySQL administrator and ask him to execute the commands this step proposes you. At this point you should now have successfully completed the "make install" process. We continue by setting up the Apache web server. $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --load-webstat-conf Load the configuration file of webstat module. It will create the tables in the database for register customevents, such as basket hits. $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --create-apache-conf Running this command will generate Apache virtual host configurations matching your installation. You will be instructed to check created files (usually they are located under /opt/cds-invenio/etc/apache/) and edit your httpd.conf to activate Invenio virtual hosts. If you are using Debian GNU/Linux ``Lenny'' or later, then you can do the following to create your SSL certificate and to activate your Invenio vhosts: ## make SSL certificate: $ sudo aptitude install ssl-cert $ sudo mkdir /etc/apache2/ssl $ sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf \ /etc/apache2/ssl/apache.pem ## add Invenio web sites: $ sudo ln -s /opt/cds-invenio/etc/apache/invenio-apache-vhost.conf \ /etc/apache2/sites-available/invenio $ sudo ln -s /opt/cds-invenio/etc/apache/invenio-apache-vhost-ssl.conf \ /etc/apache2/sites-available/invenio-ssl ## disable Debian's default web site: $ sudo /usr/sbin/a2dissite default ## enable Invenio web sites: $ sudo /usr/sbin/a2ensite invenio $ sudo /usr/sbin/a2ensite invenio-ssl ## enable SSL module: $ sudo /usr/sbin/a2enmod ssl ## if you are using xsendfile module, enable it too: $ sudo /usr/sbin/a2enmod xsendfile If you are using another operating system, you should do the equivalent, for example edit your system-wide httpd.conf and put the following include statements: Include /opt/cds-invenio/etc/apache/invenio-apache-vhost.conf Include /opt/cds-invenio/etc/apache/invenio-apache-vhost-ssl.conf Note that you may need to adapt generated vhost file snippets to match your concrete operating system specifics. Note also that you may want to tweak the generated example configurations, especially with respect to the WSGIDaemonProcess parameters. E.g. increase the `processes' parameter if you have lots of RAM and many concurrent users accessing your site in parallel. $ sudo /etc/init.d/apache2 restart Please ask your webserver administrator to restart the Apache server after the above "httpd.conf" changes. $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --create-demo-site This step is recommended to test your local CDS Invenio installation. It should give you our "Atlantis Institute of Science" demo installation, exactly as you see it at . $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --load-demo-records Optionally, load some demo records to be able to test indexing and searching of your local CDS Invenio demo installation. $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --run-unit-tests Optionally, you can run the unit test suite to verify the unit behaviour of your local CDS Invenio installation. Note that this command should be run only after you have installed the whole system via `make install'. $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --run-regression-tests Optionally, you can run the full regression test suite to verify the functional behaviour of your local CDS Invenio installation. Note that this command requires to have created the demo site and loaded the demo records. Note also that running the regression test suite may alter the database content with junk data, so that rebuilding the demo site is strongly recommended afterwards. $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --run-web-tests Optionally, you can run additional automated web tests running in a real browser. This requires to have Firefox with the Selenium IDE extension installed. $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --remove-demo-records Optionally, remove the demo records loaded in the previous step, but keeping otherwise the demo collection, submission, format, and other configurations that you may reuse and modify for your own production purposes. $ sudo -u www-data /opt/cds-invenio/bin/inveniocfg --drop-demo-site Optionally, drop also all the demo configuration so that you'll end up with a completely blank CDS Invenio system. However, you may want to find it more practical not to drop the demo site configuration but to start customizing from there. $ firefox http://your.site.com/help/admin/howto-run In order to start using your CDS Invenio installation, you can start indexing, formatting and other daemons as indicated in the "HOWTO Run" guide on the above URL. You can also use the Admin Area web interfaces to perform further runtime configurations such as the definition of data collections, document types, document formats, word indexes, etc. Good luck, and thanks for choosing CDS Invenio. - CDS Development Group diff --git a/modules/bibedit/lib/bibrecord_tests.py b/modules/bibedit/lib/bibrecord_tests.py index 4edbcef1d..54ca9eff3 100644 --- a/modules/bibedit/lib/bibrecord_tests.py +++ b/modules/bibedit/lib/bibrecord_tests.py @@ -1,1539 +1,1540 @@ # -*- coding: utf-8 -*- ## ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """ The BibRecord test suite. """ import unittest from invenio.config import CFG_TMPDIR from invenio import bibrecord, bibrecord_config from invenio.testutils import make_test_suite, run_test_suite try: import pyRXP parser_pyrxp_available = True except ImportError: parser_pyrxp_available = False try: import Ft.Xml.Domlette parser_4suite_available = True except ImportError: parser_4suite_available = False try: import xml.dom.minidom import xml.parsers.expat parser_minidom_available = True except ImportError: parser_minidom_available = False class BibRecordSuccessTest(unittest.TestCase): """ bibrecord - demo file parsing test """ def setUp(self): """Initialize stuff""" f = open(CFG_TMPDIR + '/demobibdata.xml', 'r') xmltext = f.read() f.close() self.recs = [rec[0] for rec in bibrecord.create_records(xmltext)] def test_records_created(self): """ bibrecord - demo file how many records are created """ self.assertEqual(104, len(self.recs)) def test_tags_created(self): """ bibrecord - demo file which tags are created """ ## check if the tags are correct tags = ['003', '005', '020', '024', '035', '037', '041', '080', '088', '100', '242', '245', '246', '250', '260', '269', '270', '300', '340', '490', '500', '502', '520', '590', '595', '650', '653', '690', '694', '695', '700', '710', '720', '773', '856', '859', '901', '909', '916', '960', '961', '962', '963', '964', '970', '980', '999', 'FFT'] t = [] for rec in self.recs: t.extend(rec.keys()) t.sort() #eliminate the elements repeated tt = [] for x in t: if not x in tt: tt.append(x) self.assertEqual(tags, tt) def test_fields_created(self): """bibrecord - demo file how many fields are created""" ## check if the number of fields for each record is correct fields = [14, 14, 8, 11, 11, 12, 11, 15, 10, 18, 14, 16, 10, 9, 15, 10, - 11, 11, 11, 9, 11, 11, 10, 9, 9, 9, 10, 9, 10, 10, 8, 9, 8, 9, 14, - 13, 14, 14, 15, 12, 12, 12, 15, 14, 12, 16, 16, 15, 15, 14, 16, 15, - 15, 15, 16, 15, 16, 15, 15, 16, 15, 14, 14, 15, 12, 13, 11, 15, 8, - 11, 14, 13, 12, 13, 6, 6, 25, 24, 27, 26, 26, 24, 26, 27, 25, 28, - 24, 23, 27, 25, 25, 26, 26, 24, 19, 26, 25, 22, 9, 8, 9, 9, 8] + 11, 11, 11, 9, 11, 11, 10, 9, 9, 9, 10, 9, 10, 10, 8, 9, 8, + 9, 14, 13, 14, 14, 15, 12, 12, 12, 15, 14, 12, 16, 16, 15, + 15, 14, 16, 15, 15, 15, 16, 15, 16, 15, 15, 16, 15, 14, 14, + 15, 12, 13, 11, 15, 8, 11, 14, 13, 12, 13, 6, 6, 25, 24, 27, + 26, 26, 24, 26, 27, 25, 28, 24, 23, 27, 25, 25, 26, 26, 24, + 19, 26, 25, 22, 9, 8, 9, 9, 8, 7] cr = [] ret = [] for rec in self.recs: cr.append(len(rec.values())) ret.append(rec) self.assertEqual(fields, cr) def test_create_record_with_collection_tag(self): """ bibrecord - create_record() for single record in collection""" xmltext = """ 33 eng """ record = bibrecord.create_record(xmltext) record1 = bibrecord.create_records(xmltext)[0] self.assertEqual(record1, record) class BibRecordParsersTest(unittest.TestCase): """ bibrecord - testing the creation of records with different parsers""" def setUp(self): """Initialize stuff""" self.xmltext = """ 33 eng """ self.expected_record = { '001': [([], ' ', ' ', '33', 1)], '041': [([('a', 'eng')], ' ', ' ', '', 2)] } if parser_pyrxp_available: def test_pyRXP(self): """ bibrecord - create_record() with pyRXP """ record = bibrecord._create_record_rxp(self.xmltext) self.assertEqual(record, self.expected_record) if parser_4suite_available: def test_4suite(self): """ bibrecord - create_record() with 4suite """ record = bibrecord._create_record_4suite(self.xmltext) self.assertEqual(record, self.expected_record) if parser_minidom_available: def test_minidom(self): """ bibrecord - create_record() with minidom """ record = bibrecord._create_record_minidom(self.xmltext) self.assertEqual(record, self.expected_record) class BibRecordBadInputTreatmentTest(unittest.TestCase): """ bibrecord - testing for bad input treatment """ def test_empty_collection(self): """bibrecord - empty collection""" xml_error0 = """""" rec = bibrecord.create_record(xml_error0)[0] self.assertEqual(rec, {}) records = bibrecord.create_records(xml_error0) self.assertEqual(len(records), 0) def test_wrong_attribute(self): """bibrecord - bad input subfield \'cde\' instead of \'code\'""" ws = bibrecord.CFG_BIBRECORD_WARNING_MSGS xml_error1 = """ 33 eng Doe, John On the foo and bar """ e = bibrecord.create_record(xml_error1, 1, 1)[2] ee ='' for i in e: if type(i).__name__ == 'str': if i.count(ws[3])>0: ee = i self.assertEqual(bibrecord._warning((3, '(field number: 4)')), ee) def test_missing_attribute(self): """ bibrecord - bad input missing \"tag\" """ ws = bibrecord.CFG_BIBRECORD_WARNING_MSGS xml_error2 = """ 33 eng Doe, John On the foo and bar """ e = bibrecord.create_record(xml_error2, 1, 1)[2] ee = '' for i in e: if type(i).__name__ == 'str': if i.count(ws[1])>0: ee = i self.assertEqual(bibrecord._warning((1, '(field number(s): [2])')), ee) def test_empty_datafield(self): """ bibrecord - bad input no subfield """ ws = bibrecord.CFG_BIBRECORD_WARNING_MSGS xml_error3 = """ 33 Doe, John On the foo and bar """ e = bibrecord.create_record(xml_error3, 1, 1)[2] ee = '' for i in e: if type(i).__name__ == 'str': if i.count(ws[8])>0: ee = i self.assertEqual(bibrecord._warning((8, '(field number: 2)')), ee) def test_missing_tag(self): """bibrecord - bad input missing end \"tag\" """ ws = bibrecord.CFG_BIBRECORD_WARNING_MSGS xml_error4 = """ 33 eng Doe, John On the foo and bar """ e = bibrecord.create_record(xml_error4, 1, 1)[2] ee = '' for i in e: if type(i).__name__ == 'str': if i.count(ws[99])>0: ee = i self.assertEqual(bibrecord._warning((99, '(Tagname : datafield)')), ee) class BibRecordAccentedUnicodeLettersTest(unittest.TestCase): """ bibrecord - testing accented UTF-8 letters """ def setUp(self): """Initialize stuff""" self.xml_example_record = """ 33 eng Döè1, John Doe2, J>ohn editor Пушкин On the foo and bar2 """ self.rec = bibrecord.create_record(self.xml_example_record, 1, 1)[0] def test_accented_unicode_characters(self): """bibrecord - accented Unicode letters""" self.assertEqual(self.xml_example_record, bibrecord.record_xml_output(self.rec)) self.assertEqual(bibrecord.record_get_field_instances(self.rec, "100", " ", " "), [([('a', 'Döè1, John')], " ", " ", "", 3), ([('a', 'Doe2, J>ohn'), ('b', 'editor')], " ", " ", "", 4)]) self.assertEqual(bibrecord.record_get_field_instances(self.rec, "245", " ", "1"), [([('a', 'Пушкин')], " ", '1', "", 5)]) class BibRecordGettingFieldValuesTest(unittest.TestCase): """ bibrecord - testing for getting field/subfield values """ def setUp(self): """Initialize stuff""" xml_example_record = """ 33 eng Doe1, John Doe2, John editor On the foo and bar1 On the foo and bar2 """ self.rec = bibrecord.create_record(xml_example_record, 1, 1)[0] def test_get_field_instances(self): """bibrecord - getting field instances""" self.assertEqual(bibrecord.record_get_field_instances(self.rec, "100", " ", " "), [([('a', 'Doe1, John')], " ", " ", "", 3), ([('a', 'Doe2, John'), ('b', 'editor')], " ", " ", "", 4)]) self.assertEqual(bibrecord.record_get_field_instances(self.rec, "", " ", " "), [('245', [([('a', 'On the foo and bar1')], " ", '1', "", 5), ([('a', 'On the foo and bar2')], " ", '2', "", 6)]), ('001', [([], " ", " ", '33', 1)]), ('100', [([('a', 'Doe1, John')], " ", " ", "", 3), ([('a', 'Doe2, John'), ('b', 'editor')], " ", " ", "", 4)]), ('041', [([('a', 'eng')], " ", " ", "", 2)])]) def test_get_field_values(self): """bibrecord - getting field values""" self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", "a"), ['Doe1, John', 'Doe2, John']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", "b"), ['editor']) def test_get_field_value(self): """bibrecord - getting first field value""" self.assertEqual(bibrecord.record_get_field_value(self.rec, "100", " ", " ", "a"), 'Doe1, John') self.assertEqual(bibrecord.record_get_field_value(self.rec, "100", " ", " ", "b"), 'editor') def test_get_subfield_values(self): """bibrecord - getting subfield values""" fi1, fi2 = bibrecord.record_get_field_instances(self.rec, "100", " ", " ") self.assertEqual(bibrecord.field_get_subfield_values(fi1, "b"), []) self.assertEqual(bibrecord.field_get_subfield_values(fi2, "b"), ["editor"]) class BibRecordGettingFieldValuesViaWildcardsTest(unittest.TestCase): """ bibrecord - testing for getting field/subfield values via wildcards """ def setUp(self): """Initialize stuff""" xml_example_record = """ 1 val1 val2 val3 val4a val4b val5 val6 val7a val7b """ self.rec = bibrecord.create_record(xml_example_record, 1, 1)[0] def test_get_field_instances_via_wildcard(self): """bibrecord - getting field instances via wildcards""" self.assertEqual(bibrecord.record_get_field_instances(self.rec, "100", " ", " "), []) self.assertEqual(bibrecord.record_get_field_instances(self.rec, "100", "%", " "), []) self.assertEqual(bibrecord.record_get_field_instances(self.rec, "100", "%", "%"), [([('a', 'val1')], 'C', '5', "", 2)]) self.assertEqual(bibrecord.record_get_field_instances(self.rec, "55%", "A", "%"), [([('a', 'val2')], 'A', 'B', "", 3), ([('a', 'val3')], 'A', " ", "", 4), ([('a', 'val6')], 'A', 'C', "", 7), ([('a', 'val7a'), ('b', 'val7b')], 'A', " ", "", 8)]) self.assertEqual(bibrecord.record_get_field_instances(self.rec, "55%", "A", " "), [([('a', 'val3')], 'A', " ", "", 4), ([('a', 'val7a'), ('b', 'val7b')], 'A', " ", "", 8)]) self.assertEqual(bibrecord.record_get_field_instances(self.rec, "556", "A", " "), [([('a', 'val7a'), ('b', 'val7b')], 'A', " ", "", 8)]) def test_get_field_values_via_wildcard(self): """bibrecord - getting field values via wildcards""" self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", " "), []) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", "%", " ", " "), []) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", "%", " "), []) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", "%", "%", " "), []) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", "%", "%", "z"), []) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", "%"), []) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", "a"), []) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", "%", " ", "a"), []) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", "%", "%", "a"), ['val1']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", "%", "%", "%"), ['val1']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "55%", "A", "%", "a"), ['val2', 'val3', 'val6', 'val7a']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "55%", "A", " ", "a"), ['val3', 'val7a']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "556", "A", " ", "a"), ['val7a']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "555", " ", " ", " "), []) self.assertEqual(bibrecord.record_get_field_values(self.rec, "555", " ", " ", "z"), []) self.assertEqual(bibrecord.record_get_field_values(self.rec, "555", " ", " ", "%"), ['val4a', 'val4b']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "55%", " ", " ", "b"), ['val4b']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "55%", "%", "%", "b"), ['val4b', 'val7b']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "55%", "A", " ", "b"), ['val7b']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "55%", "A", "%", "b"), ['val7b']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "55%", "A", " ", "a"), ['val3', 'val7a']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "55%", "A", "%", "a"), ['val2', 'val3', 'val6', 'val7a']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "55%", "%", "%", "a"), ['val2', 'val3', 'val4a', 'val5', 'val6', 'val7a']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "55%", " ", " ", "a"), ['val4a']) def test_get_field_value_via_wildcard(self): """bibrecord - getting first field value via wildcards""" self.assertEqual(bibrecord.record_get_field_value(self.rec, "100", " ", " ", " "), '') self.assertEqual(bibrecord.record_get_field_value(self.rec, "100", "%", " ", " "), '') self.assertEqual(bibrecord.record_get_field_value(self.rec, "100", " ", "%", " "), '') self.assertEqual(bibrecord.record_get_field_value(self.rec, "100", "%", "%", " "), '') self.assertEqual(bibrecord.record_get_field_value(self.rec, "100", " ", " ", "%"), '') self.assertEqual(bibrecord.record_get_field_value(self.rec, "100", " ", " ", "a"), '') self.assertEqual(bibrecord.record_get_field_value(self.rec, "100", "%", " ", "a"), '') self.assertEqual(bibrecord.record_get_field_value(self.rec, "100", "%", "%", "a"), 'val1') self.assertEqual(bibrecord.record_get_field_value(self.rec, "100", "%", "%", "%"), 'val1') self.assertEqual(bibrecord.record_get_field_value(self.rec, "55%", "A", "%", "a"), 'val2') self.assertEqual(bibrecord.record_get_field_value(self.rec, "55%", "A", " ", "a"), 'val3') self.assertEqual(bibrecord.record_get_field_value(self.rec, "556", "A", " ", "a"), 'val7a') self.assertEqual(bibrecord.record_get_field_value(self.rec, "555", " ", " ", " "), '') self.assertEqual(bibrecord.record_get_field_value(self.rec, "555", " ", " ", "%"), 'val4a') self.assertEqual(bibrecord.record_get_field_value(self.rec, "55%", " ", " ", "b"), 'val4b') self.assertEqual(bibrecord.record_get_field_value(self.rec, "55%", "%", "%", "b"), 'val4b') self.assertEqual(bibrecord.record_get_field_value(self.rec, "55%", "A", " ", "b"), 'val7b') self.assertEqual(bibrecord.record_get_field_value(self.rec, "55%", "A", "%", "b"), 'val7b') self.assertEqual(bibrecord.record_get_field_value(self.rec, "55%", "A", " ", "a"), 'val3') self.assertEqual(bibrecord.record_get_field_value(self.rec, "55%", "A", "%", "a"), 'val2') self.assertEqual(bibrecord.record_get_field_value(self.rec, "55%", "%", "%", "a"), 'val2') self.assertEqual(bibrecord.record_get_field_value(self.rec, "55%", " ", " ", "a"), 'val4a') class BibRecordAddFieldTest(unittest.TestCase): """ bibrecord - testing adding field """ def setUp(self): """Initialize stuff""" xml_example_record = """ 33 eng Doe1, John Doe2, John editor On the foo and bar1 On the foo and bar2 """ self.rec = bibrecord.create_record(xml_example_record, 1, 1)[0] def test_add_controlfield(self): """bibrecord - adding controlfield""" field_position_global_1 = bibrecord.record_add_field(self.rec, "003", controlfield_value="SzGeCERN") field_position_global_2 = bibrecord.record_add_field(self.rec, "004", controlfield_value="Test") self.assertEqual(field_position_global_1, 2) self.assertEqual(field_position_global_2, 3) self.assertEqual(bibrecord.record_get_field_values(self.rec, "003", " ", " ", ""), ['SzGeCERN']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "004", " ", " ", ""), ['Test']) def test_add_datafield(self): """bibrecord - adding datafield""" field_position_global_1 = bibrecord.record_add_field(self.rec, "100", subfields=[('a', 'Doe3, John')]) field_position_global_2 = bibrecord.record_add_field(self.rec, "100", subfields= [('a', 'Doe4, John'), ('b', 'editor')]) self.assertEqual(field_position_global_1, 5) self.assertEqual(field_position_global_2, 6) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", "a"), ['Doe1, John', 'Doe2, John', 'Doe3, John', 'Doe4, John']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", "b"), ['editor', 'editor']) def test_add_controlfield_on_desired_position(self): """bibrecord - adding controlfield on desired position""" field_position_global_1 = bibrecord.record_add_field(self.rec, "005", controlfield_value="Foo", field_position_global=0) field_position_global_2 = bibrecord.record_add_field(self.rec, "006", controlfield_value="Bar", field_position_global=0) self.assertEqual(field_position_global_1, 7) self.assertEqual(field_position_global_2, 8) def test_add_datafield_on_desired_position_field_position_global(self): """bibrecord - adding datafield on desired global field position""" field_position_global_1 = bibrecord.record_add_field(self.rec, "100", subfields=[('a', 'Doe3, John')], field_position_global=0) field_position_global_2 = bibrecord.record_add_field(self.rec, "100", subfields=[('a', 'Doe4, John'), ('b', 'editor')], field_position_global=0) self.assertEqual(field_position_global_1, 3) self.assertEqual(field_position_global_2, 3) def test_add_datafield_on_desired_position_field_position_local(self): """bibrecord - adding datafield on desired local field position""" field_position_global_1 = bibrecord.record_add_field(self.rec, "100", subfields=[('a', 'Doe3, John')], field_position_local=0) field_position_global_2 = bibrecord.record_add_field(self.rec, "100", subfields=[('a', 'Doe4, John'), ('b', 'editor')], field_position_local=2) self.assertEqual(field_position_global_1, 3) self.assertEqual(field_position_global_2, 5) class BibRecordManageMultipleFieldsTest(unittest.TestCase): """ bibrecord - testing the management of multiple fields """ def setUp(self): """Initialize stuff""" xml_example_record = """ 33 subfield1 subfield2 subfield3 subfield4 """ self.rec = bibrecord.create_record(xml_example_record, 1, 1)[0] def test_delete_multiple_datafields(self): """bibrecord - deleting multiple datafields""" self.fields = bibrecord.record_delete_fields(self.rec, '245', [1, 2]) self.assertEqual(self.fields[0], ([('a', 'subfield2')], ' ', ' ', '', 3)) self.assertEqual(self.fields[1], ([('a', 'subfield3')], ' ', ' ', '', 4)) def test_add_multiple_datafields_default_index(self): """bibrecord - adding multiple fields with the default index""" fields = [([('a', 'subfield5')], ' ', ' ', '', 4), ([('a', 'subfield6')], ' ', ' ', '', 19)] index = bibrecord.record_add_fields(self.rec, '245', fields) self.assertEqual(index, None) self.assertEqual(self.rec['245'][-2], ([('a', 'subfield5')], ' ', ' ', '', 6)) self.assertEqual(self.rec['245'][-1], ([('a', 'subfield6')], ' ', ' ', '', 7)) def test_add_multiple_datafields_with_index(self): """bibrecord - adding multiple fields with an index""" fields = [([('a', 'subfield5')], ' ', ' ', '', 4), ([('a', 'subfield6')], ' ', ' ', '', 19)] index = bibrecord.record_add_fields(self.rec, '245', fields, field_position_local=0) self.assertEqual(index, 0) self.assertEqual(self.rec['245'][0], ([('a', 'subfield5')], ' ', ' ', '', 2)) self.assertEqual(self.rec['245'][1], ([('a', 'subfield6')], ' ', ' ', '', 3)) self.assertEqual(self.rec['245'][2], ([('a', 'subfield1')], ' ', ' ', '', 4)) def test_move_multiple_fields(self): """bibrecord - move multiple fields""" bibrecord.record_move_fields(self.rec, '245', [1, 3]) self.assertEqual(self.rec['245'][0], ([('a', 'subfield1')], ' ', ' ', '', 2)) self.assertEqual(self.rec['245'][1], ([('a', 'subfield3')], ' ', ' ', '', 4)) self.assertEqual(self.rec['245'][2], ([('a', 'subfield2')], ' ', ' ', '', 5)) self.assertEqual(self.rec['245'][3], ([('a', 'subfield4')], ' ', ' ', '', 6)) class BibRecordDeleteFieldTest(unittest.TestCase): """ bibrecord - testing field deletion """ def setUp(self): """Initialize stuff""" xml_example_record = """ 33 eng Doe1, John Doe2, John editor On the foo and bar1 On the foo and bar2 """ self.rec = bibrecord.create_record(xml_example_record, 1, 1)[0] xml_example_record_empty = """ """ self.rec_empty = bibrecord.create_record(xml_example_record_empty, 1, 1)[0] def test_delete_controlfield(self): """bibrecord - deleting controlfield""" bibrecord.record_delete_field(self.rec, "001", " ", " ") self.assertEqual(bibrecord.record_get_field_values(self.rec, "001", " ", " ", " "), []) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", "b"), ['editor']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "245", " ", "2", "a"), ['On the foo and bar2']) def test_delete_datafield(self): """bibrecord - deleting datafield""" bibrecord.record_delete_field(self.rec, "100", " ", " ") self.assertEqual(bibrecord.record_get_field_values(self.rec, "001", " ", " ", ""), ['33']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", "b"), []) bibrecord.record_delete_field(self.rec, "245", " ", " ") self.assertEqual(bibrecord.record_get_field_values(self.rec, "245", " ", "1", "a"), ['On the foo and bar1']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "245", " ", "2", "a"), ['On the foo and bar2']) bibrecord.record_delete_field(self.rec, "245", " ", "2") self.assertEqual(bibrecord.record_get_field_values(self.rec, "245", " ", "1", "a"), ['On the foo and bar1']) self.assertEqual(bibrecord.record_get_field_values(self.rec, "245", " ", "2", "a"), []) def test_add_delete_add_field_to_empty_record(self): """bibrecord - adding, deleting, and adding back a field to an empty record""" field_position_global_1 = bibrecord.record_add_field(self.rec_empty, "003", controlfield_value="SzGeCERN") self.assertEqual(field_position_global_1, 1) self.assertEqual(bibrecord.record_get_field_values(self.rec_empty, "003", " ", " ", ""), ['SzGeCERN']) bibrecord.record_delete_field(self.rec_empty, "003", " ", " ") self.assertEqual(bibrecord.record_get_field_values(self.rec_empty, "003", " ", " ", ""), []) field_position_global_1 = bibrecord.record_add_field(self.rec_empty, "003", controlfield_value="SzGeCERN2") self.assertEqual(field_position_global_1, 1) self.assertEqual(bibrecord.record_get_field_values(self.rec_empty, "003", " ", " ", ""), ['SzGeCERN2']) class BibRecordDeleteFieldFromTest(unittest.TestCase): """ bibrecord - testing field deletion from position""" def setUp(self): """Initialize stuff""" xml_example_record = """ 33 eng Doe1, John Doe2, John editor On the foo and bar1 On the foo and bar2 """ self.rec = bibrecord.create_record(xml_example_record, 1, 1)[0] def test_delete_field_from(self): """bibrecord - deleting field from position""" bibrecord.record_delete_field(self.rec, "100", field_position_global=4) self.assertEqual(self.rec['100'], [([('a', 'Doe1, John')], ' ', ' ', '', 3)]) bibrecord.record_delete_field(self.rec, "100", field_position_global=3) self.failIf(self.rec.has_key('100')) bibrecord.record_delete_field(self.rec, "001", field_position_global=1) bibrecord.record_delete_field(self.rec, "245", field_position_global=6) self.failIf(self.rec.has_key('001')) self.assertEqual(self.rec['245'], [([('a', 'On the foo and bar1')], ' ', '1', '', 5)]) # Some crash tests bibrecord.record_delete_field(self.rec, '999', field_position_global=1) bibrecord.record_delete_field(self.rec, '245', field_position_global=999) class BibRecordAddSubfieldIntoTest(unittest.TestCase): """ bibrecord - testing subfield addition """ def setUp(self): """Initialize stuff""" xml_example_record = """ 33 eng Doe2, John editor On the foo and bar1 On the foo and bar2 """ self.rec = bibrecord.create_record(xml_example_record, 1, 1)[0] def test_add_subfield_into(self): """bibrecord - adding subfield into position""" bibrecord.record_add_subfield_into(self.rec, "100", "b", "Samekniv", field_position_global=3) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", "b"), ['editor', 'Samekniv']) bibrecord.record_add_subfield_into(self.rec, "245", "x", "Elgokse", field_position_global=4) bibrecord.record_add_subfield_into(self.rec, "245", "x", "Fiskeflue", subfield_position=0, field_position_global=4) bibrecord.record_add_subfield_into(self.rec, "245", "z", "Ulriken", subfield_position=2, field_position_global=4) bibrecord.record_add_subfield_into(self.rec, "245", "z", "Stortinget", subfield_position=999, field_position_global=4) self.assertEqual(bibrecord.record_get_field_values(self.rec, "245", " ", "1", "%"), ['Fiskeflue', 'On the foo and bar1', 'Ulriken', 'Elgokse', 'Stortinget']) # Some crash tests self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_add_subfield_into, self.rec, "187", "x", "Crash", field_position_global=1) self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_add_subfield_into, self.rec, "245", "x", "Crash", field_position_global=999) class BibRecordModifyControlfieldTest(unittest.TestCase): """ bibrecord - testing controlfield modification """ def setUp(self): """Initialize stuff""" xml_example_record = """ 33 A Foo's Tale Skeech Skeech Whoop Whoop eng On the foo and bar2 """ self.rec = bibrecord.create_record(xml_example_record, 1, 1)[0] def test_modify_controlfield(self): """bibrecord - modify controlfield""" bibrecord.record_modify_controlfield(self.rec, "001", "34", field_position_global=1) bibrecord.record_modify_controlfield(self.rec, "008", "Foo Foo", field_position_global=3) self.assertEqual(bibrecord.record_get_field_values(self.rec, "001"), ["34"]) self.assertEqual(bibrecord.record_get_field_values(self.rec, "005"), ["A Foo's Tale"]) self.assertEqual(bibrecord.record_get_field_values(self.rec, "008"), ["Foo Foo", "Whoop Whoop"]) # Some crash tests self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_modify_controlfield, self.rec, "187", "Crash", field_position_global=1) self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_modify_controlfield, self.rec, "008", "Test", field_position_global=10) self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_modify_controlfield, self.rec, "245", "Burn", field_position_global=5) self.assertEqual(bibrecord.record_get_field_values(self.rec, "245", " ", "2", "%"), ["On the foo and bar2"]) class BibRecordModifySubfieldTest(unittest.TestCase): """ bibrecord - testing subfield modification """ def setUp(self): """Initialize stuff""" xml_example_record = """ 33 eng Doe2, John editor On the foo and bar1 On writing unit tests On the foo and bar2 """ self.rec = bibrecord.create_record(xml_example_record, 1, 1)[0] def test_modify_subfield(self): """bibrecord - modify subfield""" bibrecord.record_modify_subfield(self.rec, "245", "a", "Holmenkollen", 0, field_position_global=4) bibrecord.record_modify_subfield(self.rec, "245", "x", "Brann", 1, field_position_global=4) self.assertEqual(bibrecord.record_get_field_values(self.rec, "245", " ", "1", "%"), ['Holmenkollen', 'Brann']) # Some crash tests self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_modify_subfield, self.rec, "187", "x", "Crash", 0, field_position_global=1) self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_modify_subfield, self.rec, "245", "x", "Burn", 1, field_position_global=999) self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_modify_subfield, self.rec, "245", "a", "Burn", 999, field_position_global=4) class BibRecordDeleteSubfieldFromTest(unittest.TestCase): """ bibrecord - testing subfield deletion """ def setUp(self): """Initialize stuff""" xml_example_record = """ 33 eng Doe2, John editor Skal vi danse? On the foo and bar1 On the foo and bar2 """ self.rec = bibrecord.create_record(xml_example_record, 1, 1)[0] def test_delete_subfield_from(self): """bibrecord - delete subfield from position""" bibrecord.record_delete_subfield_from(self.rec, "100", 2, field_position_global=3) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", "z"), []) bibrecord.record_delete_subfield_from(self.rec, "100", 0, field_position_global=3) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", "%"), ['editor']) bibrecord.record_delete_subfield_from(self.rec, "100", 0, field_position_global=3) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", "%"), []) # Some crash tests self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_delete_subfield_from, self.rec, "187", 0, field_position_global=1) self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_delete_subfield_from, self.rec, "245", 0, field_position_global=999) self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_delete_subfield_from, self.rec, "245", 999, field_position_global=4) class BibRecordDeleteSubfieldTest(unittest.TestCase): """ bibrecord - testing subfield deletion """ def setUp(self): """Initialize stuff""" self.xml_example_record = """ 33 eng Doe2, John editor Skal vi danse? Doe3, Zbigniew Doe4, Joachim On the foo and bar1 On the foo and bar2 On the foo and bar1 On the foo and bar2 """ def test_simple_removals(self): """ bibrecord - delete subfield by its code""" # testing a simple removals where all the fields are removed rec = bibrecord.create_record(self.xml_example_record, 1, 1)[0] bibrecord.record_delete_subfield(rec, "041", "b") # nothing should change self.assertEqual(rec["041"][0][0], [("a", "eng")]) bibrecord.record_delete_subfield(rec, "041", "a") self.assertEqual(rec["041"][0][0], []) def test_indices_important(self): """ bibrecord - delete subfield where indices are important""" rec = bibrecord.create_record(self.xml_example_record, 1, 1)[0] bibrecord.record_delete_subfield(rec, "245", "a", " ", "1") self.assertEqual(rec["245"][0][0], []) self.assertEqual(rec["245"][1][0], [("a", "On the foo and bar2")]) bibrecord.record_delete_subfield(rec, "245", "a", " ", "2") self.assertEqual(rec["245"][1][0], []) def test_remove_some(self): """ bibrecord - delete subfield when some should be preserved and some removed""" rec = bibrecord.create_record(self.xml_example_record, 1, 1)[0] bibrecord.record_delete_subfield(rec, "100", "a", " ", " ") self.assertEqual(rec["100"][0][0], [("b", "editor"), ("z", "Skal vi danse?"), ("d", "Doe4, Joachim")]) def test_more_fields(self): """ bibrecord - delete subfield where more fits criteria""" rec = bibrecord.create_record(self.xml_example_record, 1, 1)[0] bibrecord.record_delete_subfield(rec, "246", "c", "1", "2") self.assertEqual(rec["246"][1][0], []) self.assertEqual(rec["246"][0][0], []) def test_nonexisting_removals(self): """ bibrecord - delete subfield that does not exist """ rec = bibrecord.create_record(self.xml_example_record, 1, 1)[0] # further preparation bibrecord.record_delete_subfield(rec, "100", "a", " ", " ") self.assertEqual(rec["100"][0][0], [("b", "editor"), ("z", "Skal vi danse?"), ("d", "Doe4, Joachim")]) #the real tests begin # 1) removing the subfield from an empty list of subfields bibrecord.record_delete_subfield(rec, "246", "c", "1", "2") self.assertEqual(rec["246"][1][0], []) self.assertEqual(rec["246"][0][0], []) bibrecord.record_delete_subfield(rec, "246", "8", "1", "2") self.assertEqual(rec["246"][1][0], []) self.assertEqual(rec["246"][0][0], []) # 2) removing a subfield from a field that has some subfields but none has an appropriate code bibrecord.record_delete_subfield(rec, "100", "a", " ", " ") self.assertEqual(rec["100"][0][0], [("b", "editor"), ("z", "Skal vi danse?"), ("d", "Doe4, Joachim")]) bibrecord.record_delete_subfield(rec, "100", "e", " ", " ") self.assertEqual(rec["100"][0][0], [("b", "editor"), ("z", "Skal vi danse?"), ("d", "Doe4, Joachim")]) class BibRecordMoveSubfieldTest(unittest.TestCase): """ bibrecord - testing subfield moving """ def setUp(self): """Initialize stuff""" xml_example_record = """ 33 eng Doe2, John editor fisk eple hammer On the foo and bar1 """ self.rec = bibrecord.create_record(xml_example_record, 1, 1)[0] def test_move_subfield(self): """bibrecord - move subfields""" bibrecord.record_move_subfield(self.rec, "100", 2, 4, field_position_global=3) bibrecord.record_move_subfield(self.rec, "100", 1, 0, field_position_global=3) bibrecord.record_move_subfield(self.rec, "100", 2, 999, field_position_global=3) self.assertEqual(bibrecord.record_get_field_values(self.rec, "100", " ", " ", "%"), ['editor', 'Doe2, John', 'hammer', 'fisk', 'eple']) # Some crash tests self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_move_subfield, self.rec, "187", 0, 1, field_position_global=3) self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_move_subfield, self.rec, "100", 1, 0, field_position_global=999) self.assertRaises(bibrecord.InvenioBibRecordFieldError, bibrecord.record_move_subfield, self.rec, "100", 999, 0, field_position_global=3) class BibRecordSpecialTagParsingTest(unittest.TestCase): """ bibrecord - parsing special tags (FMT, FFT)""" def setUp(self): """setting up example records""" self.xml_example_record_with_fmt = """ 33 eng HB Let us see if this gets inserted well. """ self.xml_example_record_with_fft = """ 33 eng file:///foo.pdf http://bar.com/baz.ps.gz """ self.xml_example_record_with_xyz = """ 33 eng HB Let us see if this gets inserted well. """ def test_parsing_file_containing_fmt_special_tag_with_correcting(self): """bibrecord - parsing special FMT tag, correcting on""" rec = bibrecord.create_record(self.xml_example_record_with_fmt, 1, 1)[0] self.assertEqual(rec, {u'001': [([], " ", " ", '33', 1)], 'FMT': [([('f', 'HB'), ('g', 'Let us see if this gets inserted well.')], " ", " ", "", 3)], '041': [([('a', 'eng')], " ", " ", "", 2)]}) self.assertEqual(bibrecord.record_get_field_values(rec, "041", " ", " ", "a"), ['eng']) self.assertEqual(bibrecord.record_get_field_values(rec, "FMT", " ", " ", "f"), ['HB']) self.assertEqual(bibrecord.record_get_field_values(rec, "FMT", " ", " ", "g"), ['Let us see if this gets inserted well.']) def test_parsing_file_containing_fmt_special_tag_without_correcting(self): """bibrecord - parsing special FMT tag, correcting off""" rec = bibrecord.create_record(self.xml_example_record_with_fmt, 1, 0)[0] self.assertEqual(rec, {u'001': [([], " ", " ", '33', 1)], 'FMT': [([('f', 'HB'), ('g', 'Let us see if this gets inserted well.')], " ", " ", "", 3)], '041': [([('a', 'eng')], " ", " ", "", 2)]}) self.assertEqual(bibrecord.record_get_field_values(rec, "041", " ", " ", "a"), ['eng']) self.assertEqual(bibrecord.record_get_field_values(rec, "FMT", " ", " ", "f"), ['HB']) self.assertEqual(bibrecord.record_get_field_values(rec, "FMT", " ", " ", "g"), ['Let us see if this gets inserted well.']) def test_parsing_file_containing_fft_special_tag_with_correcting(self): """bibrecord - parsing special FFT tag, correcting on""" rec = bibrecord.create_record(self.xml_example_record_with_fft, 1, 1)[0] self.assertEqual(rec, {u'001': [([], " ", " ", '33', 1)], 'FFT': [([('a', 'file:///foo.pdf'), ('a', 'http://bar.com/baz.ps.gz')], " ", " ", "", 3)], '041': [([('a', 'eng')], " ", " ", "", 2)]}) self.assertEqual(bibrecord.record_get_field_values(rec, "041", " ", " ", "a"), ['eng']) self.assertEqual(bibrecord.record_get_field_values(rec, "FFT", " ", " ", "a"), ['file:///foo.pdf', 'http://bar.com/baz.ps.gz']) def test_parsing_file_containing_fft_special_tag_without_correcting(self): """bibrecord - parsing special FFT tag, correcting off""" rec = bibrecord.create_record(self.xml_example_record_with_fft, 1, 0)[0] self.assertEqual(rec, {u'001': [([], " ", " ", '33', 1)], 'FFT': [([('a', 'file:///foo.pdf'), ('a', 'http://bar.com/baz.ps.gz')], " ", " ", "", 3)], '041': [([('a', 'eng')], " ", " ", "", 2)]}) self.assertEqual(bibrecord.record_get_field_values(rec, "041", " ", " ", "a"), ['eng']) self.assertEqual(bibrecord.record_get_field_values(rec, "FFT", " ", " ", "a"), ['file:///foo.pdf', 'http://bar.com/baz.ps.gz']) def test_parsing_file_containing_xyz_special_tag_with_correcting(self): """bibrecord - parsing unrecognized special XYZ tag, correcting on""" # XYZ should not get accepted when correcting is on; should get changed to 000 rec = bibrecord.create_record(self.xml_example_record_with_xyz, 1, 1)[0] self.assertEqual(rec, {u'001': [([], " ", " ", '33', 1)], '000': [([('f', 'HB'), ('g', 'Let us see if this gets inserted well.')], " ", " ", "", 3)], '041': [([('a', 'eng')], " ", " ", "", 2)]}) self.assertEqual(bibrecord.record_get_field_values(rec, "041", " ", " ", "a"), ['eng']) self.assertEqual(bibrecord.record_get_field_values(rec, "XYZ", " ", " ", "f"), []) self.assertEqual(bibrecord.record_get_field_values(rec, "XYZ", " ", " ", "g"), []) self.assertEqual(bibrecord.record_get_field_values(rec, "000", " ", " ", "f"), ['HB']) self.assertEqual(bibrecord.record_get_field_values(rec, "000", " ", " ", "g"), ['Let us see if this gets inserted well.']) def test_parsing_file_containing_xyz_special_tag_without_correcting(self): """bibrecord - parsing unrecognized special XYZ tag, correcting off""" # XYZ should get accepted without correcting rec = bibrecord.create_record(self.xml_example_record_with_xyz, 1, 0)[0] self.assertEqual(rec, {u'001': [([], " ", " ", '33', 1)], 'XYZ': [([('f', 'HB'), ('g', 'Let us see if this gets inserted well.')], " ", " ", "", 3)], '041': [([('a', 'eng')], " ", " ", "", 2)]}) self.assertEqual(bibrecord.record_get_field_values(rec, "041", " ", " ", "a"), ['eng']) self.assertEqual(bibrecord.record_get_field_values(rec, "XYZ", " ", " ", "f"), ['HB']) self.assertEqual(bibrecord.record_get_field_values(rec, "XYZ", " ", " ", "g"), ['Let us see if this gets inserted well.']) class BibRecordPrintingTest(unittest.TestCase): """ bibrecord - testing for printing record """ def setUp(self): """Initialize stuff""" self.xml_example_record = """ 81 TEST-ARTICLE-2006-001 ARTICLE-2006-001 Test ti """ self.xml_example_record_short = """ 81 TEST-ARTICLE-2006-001 ARTICLE-2006-001 """ self.xml_example_multi_records = """ 81 TEST-ARTICLE-2006-001 ARTICLE-2006-001 Test ti 82 Author, t """ self.xml_example_multi_records_short = """ 81 TEST-ARTICLE-2006-001 ARTICLE-2006-001 82 """ def test_record_xml_output(self): """bibrecord - xml output""" rec = bibrecord.create_record(self.xml_example_record, 1, 1)[0] rec_short = bibrecord.create_record(self.xml_example_record_short, 1, 1)[0] self.assertEqual(bibrecord.create_record(bibrecord.record_xml_output(rec, tags=[]), 1, 1)[0], rec) self.assertEqual(bibrecord.create_record(bibrecord.record_xml_output(rec, tags=["001", "037"]), 1, 1)[0], rec_short) self.assertEqual(bibrecord.create_record(bibrecord.record_xml_output(rec, tags=["037"]), 1, 1)[0], rec_short) class BibRecordCreateFieldTest(unittest.TestCase): """ bibrecord - testing for creating field """ def test_create_valid_field(self): """bibrecord - create and check a valid field""" bibrecord.create_field() bibrecord.create_field([('a', 'testa'), ('b', 'testb')], '2', 'n', 'controlfield', 15) def test_invalid_field_raises_exception(self): """bibrecord - exception raised when creating an invalid field""" # Invalid subfields. self.assertRaises(bibrecord_config.InvenioBibRecordFieldError, bibrecord.create_field, 'subfields', '1', '2', 'controlfield', 10) self.assertRaises(bibrecord_config.InvenioBibRecordFieldError, bibrecord.create_field, ('1', 'value'), '1', '2', 'controlfield', 10) self.assertRaises(bibrecord_config.InvenioBibRecordFieldError, bibrecord.create_field, [('value')], '1', '2', 'controlfield', 10) self.assertRaises(bibrecord_config.InvenioBibRecordFieldError, bibrecord.create_field, [('1', 'value', '2')], '1', '2', 'controlfield', 10) # Invalid indicators. self.assertRaises(bibrecord_config.InvenioBibRecordFieldError, bibrecord.create_field, [], 1, '2', 'controlfield', 10) self.assertRaises(bibrecord_config.InvenioBibRecordFieldError, bibrecord.create_field, [], '1', 2, 'controlfield', 10) # Invalid controlfield value self.assertRaises(bibrecord_config.InvenioBibRecordFieldError, bibrecord.create_field, [], '1', '2', 13, 10) # Invalid global position self.assertRaises(bibrecord_config.InvenioBibRecordFieldError, bibrecord.create_field, [], '1', '2', 'controlfield', 'position') def test_compare_fields(self): """bibrecord - compare fields""" # Identical field0 = ([('a', 'test')], '1', '2', '', 0) field1 = ([('a', 'test')], '1', '2', '', 3) self.assertEqual(True, bibrecord._compare_fields(field0, field1, strict=True)) self.assertEqual(True, bibrecord._compare_fields(field0, field1, strict=False)) # Order of the subfields changed. field0 = ([('a', 'testa'), ('b', 'testb')], '1', '2', '', 0) field1 = ([('b', 'testb'), ('a', 'testa')], '1', '2', '', 3) self.assertEqual(False, bibrecord._compare_fields(field0, field1, strict=True)) self.assertEqual(True, bibrecord._compare_fields(field0, field1, strict=False)) # Different field0 = ([], '3', '2', '', 0) field1 = ([], '1', '2', '', 3) self.assertEqual(False, bibrecord._compare_fields(field0, field1, strict=True)) self.assertEqual(False, bibrecord._compare_fields(field0, field1, strict=False)) class BibRecordFindFieldTest(unittest.TestCase): """ bibrecord - testing for finding field """ def setUp(self): """Initialize stuff""" xml = """ 81 TEST-ARTICLE-2006-001 ARTICLE-2007-001 """ self.rec = bibrecord.create_record(xml)[0] self.field0 = self.rec['001'][0] self.field1 = self.rec['037'][0] self.field2 = ( [self.field1[0][1], self.field1[0][0]], self.field1[1], self.field1[2], self.field1[3], self.field1[4], ) def test_finding_field_strict(self): """bibrecord - test finding field strict""" self.assertEqual((1, 0), bibrecord.record_find_field(self.rec, '001', self.field0, strict=True)) self.assertEqual((2, 0), bibrecord.record_find_field(self.rec, '037', self.field1, strict=True)) self.assertEqual((None, None), bibrecord.record_find_field(self.rec, '037', self.field2, strict=True)) def test_finding_field_loose(self): """bibrecord - test finding field loose""" self.assertEqual((1, 0), bibrecord.record_find_field(self.rec, '001', self.field0, strict=False)) self.assertEqual((2, 0), bibrecord.record_find_field(self.rec, '037', self.field1, strict=False)) self.assertEqual((2, 0), bibrecord.record_find_field(self.rec, '037', self.field2, strict=False)) class BibRecordSingletonTest(unittest.TestCase): """ bibrecord - testing singleton removal """ def setUp(self): """Initialize stuff""" self.xml = """ 33 Some value """ self.rec_expected = { '001': [([], ' ', ' ', '33', 1)], '100': [([('a', 'Some value')], ' ', ' ', '', 2)], } if parser_minidom_available: def test_singleton_removal_minidom(self): """bibrecord - singleton removal with minidom""" rec = bibrecord.create_records(self.xml, verbose=1, correct=1, parser='minidom')[0][0] self.assertEqual(rec, self.rec_expected) if parser_4suite_available: def test_singleton_removal_4suite(self): """bibrecord - singleton removal with 4suite""" rec = bibrecord.create_records(self.xml, verbose=1, correct=1, parser='4suite')[0][0] self.assertEqual(rec, self.rec_expected) if parser_pyrxp_available: def test_singleton_removal_pyrxp(self): """bibrecord - singleton removal with pyrxp""" rec = bibrecord.create_records(self.xml, verbose=1, correct=1, parser='pyrxp')[0][0] self.assertEqual(rec, self.rec_expected) class BibRecordNumCharRefTest(unittest.TestCase): """ bibrecord - testing numerical character reference expansion""" def setUp(self): """Initialize stuff""" self.xml = """ 33 Σ & Σ use & in XML """ self.rec_expected = { '001': [([], ' ', ' ', '33', 1)], '123': [([('a', '\xce\xa3 & \xce\xa3'), ('a', 'use & in XML'),], ' ', ' ', '', 2)], } if parser_minidom_available: def test_numcharref_expansion_minidom(self): """bibrecord - numcharref expansion with minidom""" rec = bibrecord.create_records(self.xml, verbose=1, correct=1, parser='minidom')[0][0] self.assertEqual(rec, self.rec_expected) if parser_4suite_available: def test_numcharref_expansion_4suite(self): """bibrecord - numcharref expansion with 4suite""" rec = bibrecord.create_records(self.xml, verbose=1, correct=1, parser='4suite')[0][0] self.assertEqual(rec, self.rec_expected) if parser_pyrxp_available: def test_numcharref_expansion_pyrxp(self): """bibrecord - but *no* numcharref expansion with pyrxp (see notes) FIXME: pyRXP does not seem to like num char ref entities, so this test is mostly left here in a TDD style in order to remind us of this fact. If we want to fix this situation, then we should probably use pyRXPU that uses Unicode strings internally, hence it is num char ref friendly. Maybe we should use pyRXPU by default, if performance is acceptable, or maybe we should introduce a flag to govern this behaviour. """ rec = bibrecord.create_records(self.xml, verbose=1, correct=1, parser='pyrxp')[0][0] #self.assertEqual(rec, self.rec_expected) self.assertEqual(rec, None) TEST_SUITE = make_test_suite( BibRecordSuccessTest, BibRecordParsersTest, BibRecordBadInputTreatmentTest, BibRecordGettingFieldValuesTest, BibRecordGettingFieldValuesViaWildcardsTest, BibRecordAddFieldTest, BibRecordDeleteFieldTest, BibRecordManageMultipleFieldsTest, BibRecordDeleteFieldFromTest, BibRecordAddSubfieldIntoTest, BibRecordModifyControlfieldTest, BibRecordModifySubfieldTest, BibRecordDeleteSubfieldFromTest, BibRecordMoveSubfieldTest, BibRecordAccentedUnicodeLettersTest, BibRecordSpecialTagParsingTest, BibRecordPrintingTest, BibRecordCreateFieldTest, BibRecordFindFieldTest, BibRecordDeleteSubfieldTest, BibRecordSingletonTest, BibRecordNumCharRefTest ) if __name__ == '__main__': run_test_suite(TEST_SUITE) diff --git a/modules/bibformat/etc/format_templates/Picture_HTML_detailed.bft b/modules/bibformat/etc/format_templates/Picture_HTML_detailed.bft index 8490a45e1..1e852b4ce 100644 --- a/modules/bibformat/etc/format_templates/Picture_HTML_detailed.bft +++ b/modules/bibformat/etc/format_templates/Picture_HTML_detailed.bft @@ -1,62 +1,62 @@ Picture HTML detailed The detailed HTML format suitable for displaying pictures.


- +
© CERN Geneva: The use of photos requires prior authorization (from CERN copyright). The words CERN Photo must be quoted for each use.
-
\ No newline at end of file + diff --git a/modules/bibformat/lib/elements/Makefile.am b/modules/bibformat/lib/elements/Makefile.am index daee07c3b..3c2f9ed2a 100644 --- a/modules/bibformat/lib/elements/Makefile.am +++ b/modules/bibformat/lib/elements/Makefile.am @@ -1,40 +1,40 @@ ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. pylibdir=$(libdir)/python/invenio/bibformat_elements pylib_DATA = bfe_field.py bfe_title.py bfe_authors.py bfe_abstract.py bfe_affiliation.py \ bfe_imprint.py bfe_fulltext.py bfe_place.py bfe_publisher.py bfe_topbanner.py \ bfe_date_rec.py bfe_keywords.py bfe_notes.py bfe_reprints.py bfe_publi_info.py \ - bfe_cited_by.py bfe_references.py bfe_photo_resources.py bfe_title_brief.py \ + bfe_cited_by.py bfe_references.py bfe_title_brief.py \ bfe_report_numbers.py bfe_additional_report_numbers.py bfe_url.py \ bfe_addresses.py bfe_contact.py bfe_photo_resources_brief.py \ bfe_collection.py bfe_editors.py bfe_bibtex.py bfe_edit_record.py \ bfe_date.py bfe_xml_record.py bfe_external_publications.py __init__.py \ bfe_bfx_engine.py bfe_creation_date.py bfe_server_info.py bfe_issn.py \ bfe_client_info.py bfe_language.py bfe_record_id.py bfe_comments.py \ bfe_pagination.py bfe_fulltext_mini.py bfe_year.py bfe_isbn.py \ bfe_appears_in_collections.py bfe_photos.py bfe_record_stats.py tmpdir = $(prefix)/var/tmp/tests_bibformat_elements tmp_DATA = test_1.py bfe_test_2.py bfe_test_4.py test3.py test_5.py \ test_no_element.test __init__.py EXTRA_DIST = $(pylib_DATA) $(tmp_DATA) CLEANFILES = *~ *.tmp *.pyc diff --git a/modules/bibformat/lib/elements/bfe_photo_resources.py b/modules/bibformat/lib/elements/bfe_photo_resources.py deleted file mode 100644 index dcf6e37a2..000000000 --- a/modules/bibformat/lib/elements/bfe_photo_resources.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- -## -## This file is part of CDS Invenio. -## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. -## -## CDS Invenio is free software; you can redistribute it and/or -## modify it under the terms of the GNU General Public License as -## published by the Free Software Foundation; either version 2 of the -## License, or (at your option) any later version. -## -## CDS Invenio is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., -## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -"""BibFormat element - Prints HTML picture and links to resources -""" -__revision__ = "$Id$" - -def format(bfo): - """ - Prints html image and link to photo resources. - """ - - resources = bfo.fields("8564_", escape=1) - out = "" - for resource in resources: - - if resource.get("x", "") == "icon" and resource.get("u", "") == "": - out += '

' - - if resource.get("x", "") == "1": - out += '
High resolution: '+ resource.get("q", "") +"" - - out += '
© CERN Geneva' - out += '
'+ bfo.field("8564_z") + "" - return out - -def escape_values(bfo): - """ - Called by BibFormat in order to check if output of this element - should be escaped. - """ - return 0 diff --git a/modules/bibformat/lib/elements/bfe_photo_resources_brief.py b/modules/bibformat/lib/elements/bfe_photo_resources_brief.py index af9bee08e..f21d55ddb 100644 --- a/modules/bibformat/lib/elements/bfe_photo_resources_brief.py +++ b/modules/bibformat/lib/elements/bfe_photo_resources_brief.py @@ -1,45 +1,45 @@ # -*- coding: utf-8 -*- ## ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """BibFormat element - Prints brief HTML picture and links to resources """ __revision__ = "$Id$" def format(bfo): """ Prints html image and link to photo resources. """ from invenio.config import CFG_SITE_URL resources = bfo.fields("8564_") out = "" for resource in resources: - if resource.get("x", "") == "icon" and resource.get("u", "") == "": + if resource.get("x", "") == "icon": out += '' return out def escape_values(bfo): """ Called by BibFormat in order to check if output of this element should be escaped. """ return 0 diff --git a/modules/bibformat/lib/elements/bfe_photos.py b/modules/bibformat/lib/elements/bfe_photos.py index 6acbd8634..a41112116 100644 --- a/modules/bibformat/lib/elements/bfe_photos.py +++ b/modules/bibformat/lib/elements/bfe_photos.py @@ -1,56 +1,66 @@ # -*- coding: utf-8 -*- ## ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """BibFormat element - Print photos of the record (if bibdoc file) """ -from invenio.bibdocfile import BibRecDocs + +import cgi +from invenio.bibdocfile import BibRecDocs, get_subformat_from_format def format(bfo, separator=" ", style='', print_links='yes'): """ Lists the photos of a record. Display the icon version, linked to its original version. This element works for photos appended to a record as BibDoc files, for which a preview icon has been generated. If there are several formats for one photo, use the first one found. @param separator: separator between each photo @param print_links: if 'yes', print links to the original photo @param style: style attributes of the images. Eg: "width:50px;border:none" """ photos = [] bibarchive = BibRecDocs(bfo.recID) for doc in bibarchive.list_bibdocs(): - if doc.get_icon() is not None: - original_url = doc.list_latest_files()[0].get_url() - icon_url = doc.get_icon().list_latest_files()[0].get_url() + found_url = '' + found_icon = '' + for docfile in doc.list_latest_files(): + if docfile.is_icon(): + if not found_icon: + found_icon = docfile.get_url() + else: + if not found_url: + found_url = docfile.get_url() + + if found_icon: name = doc.get_docname() - img = '%s' % (icon_url, name, style) + img = '%s' % (cgi.escape(found_icon, True), cgi.escape(name, True), cgi.escape(style, True)) if print_links.lower() == 'yes': - img = '%s' % (original_url, img) + img = '%s' % (cgi.escape(found_url, True), img) photos.append(img) return separator.join(photos) def escape_values(bfo): """ Called by BibFormat in order to check if output of this element should be escaped. """ return 0 diff --git a/modules/bibupload/doc/admin/bibupload-admin-guide.webdoc b/modules/bibupload/doc/admin/bibupload-admin-guide.webdoc index bde9e6489..7e60cb42d 100644 --- a/modules/bibupload/doc/admin/bibupload-admin-guide.webdoc +++ b/modules/bibupload/doc/admin/bibupload-admin-guide.webdoc @@ -1,355 +1,349 @@ ## -*- mode: html; coding: utf-8; -*- ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

Contents

1. Overview
2. Configuring BibUpload
3. Running BibUpload
       3.1. Inserting new records
       3.2. Updating existing records
       3.3. Inserting and updating at the same time
       3.4. Updating preformatted output formats
       3.5. Uploading fulltext files

1. Overview

BibUpload enables you to upload bibliographic data in MARCXML format into CDS Invenio bibliographic database. It is also used internally by other CDS Invenio modules as the sole entrance of metadata into the bibliographic databases.

Note that before uploading a MARCXML file, you may want to run provided /opt/cds-invenio/bin/xmlmarclint on it in order to verify its correctness.

2. Configuring BibUpload

BibUpload takes a MARCXML file as its input. There is nothing to be configured for these files. If the files have to be coverted into MARCXML from some other format, structured or not, this is usually done beforehand via BibConvert module.

Note that if you are using external system numbers for your records, such as when your records are being synchronized from an external system, then BibUpload knows about the tag 970 as the one containing external system number. (To change this 970 tag into something else, you would have to edit BibUpload config source file.)

Note also that in the similar way BibUpload knows about OAI identifiers, so that it will refuse to insert the same OAI harvested record twice, for example.

3. Running BibUpload

3.1 Inserting new records

Consider that you have an MARCXML file containing new records that is to be uploaded into the CDS Invenio. (For example, it might have been produced by BibConvert.) To finish the upload, you would call the BibUpload script in the insert mode as follows:

 $ bibupload -i file.xml
 
 
In the insert mode, all the records from the file will be treated as new. This means that they should not contain neither 001 tags (holding record IDs) nor 970 tags (holding external system numbers). BibUpload would refuse to upload records having these tags, in order to prevent potential double uploading. If your file does contain 001 or 970, then chances are that you want to update existing records, not re-upload them as new, and so BibUpload will warn you about this and will refuse to continue.

For example, to insert a new record, your file should look like this:

     <record>
         <datafield tag="100" ind1=" " ind2=" ">
             <subfield code="a">Doe, John</subfield>
         </datafield>
         <datafield tag="245" ind1=" " ind2=" ">
             <subfield code="a">On The Foo And Bar</subfield>
         </datafield>
     </record>
 

3.2 Updating existing records

When you want to update existing records, with the new content from your input MARCXML file, then your input file should contain either tags 001 (holding record IDs) or tag 970 (holding external system numbers). BibUpload will try to match existing records via 001 and 970 and if it finds a record in the database that corresponds to a record from the file, it will update its content. Otherwise it will signal an error saying that it could not find the record-to-be-updated.

For example, to update a title of record #123 via correct mode, your input file should contain record ID in the 001 tag and the title in 245 tag as follows:

     <record>
         <controlfield tag="001">123</controlfield>
         <datafield tag="245" ind1=" " ind2=" ">
             <subfield code="a">My Newly Updated Title</subfield>
         </datafield>
     </record>
 

There are several updating modes:

 
     -r, --replace Replace existing records by those from the XML
                   MARC file.  The original content is wiped out
                   and fully replaced.  Signals error if record
                   is not found via matching record IDs or system
                   numbers.
 
                   Note also that `-r' can be combined with `-i'
                   into an `-ir' option that would automatically
                   either insert records as new if they are not
                   found in the system, or correct existing
                   records if they are found to exist.
 
     -a, --append  Append fields from XML MARC file at the end of
                   existing records.  The original content is
                   enriched only.  Signals error if record is not
                   found via matching record IDs or system
                   numbers.
 
     -c, --correct Correct fields of existing records by those
                   from XML MARC file.  The original record
                   content is modified only on those fields from
                   the XML MARC file where both the tags and the
                   indicators match: the original fields are
                   removed and replaced by those from the XML
                   MARC file.  Fields not present in XML MARC
                   file are not changed (unlike the -r option).
                   Signals error if record is not found via
                   matching record IDs or system numbers.
 
     -d, --delete  Delete fields of existing records that are
                   contained in the XML MARC file. The fields in
                   the original record that are not present in
                   the XML MARC file are preserved.
                   This is incompatible with FFT (see below).
 

3.3 Inserting and updating at the same time

Note that the insert/update modes can be combined together. For example, if you have a file that contains a mixture of new records with possibly some records to be updated, then you can run:

 $ bibupload -i -r file.xml
 
 
In this case BibUpload will try to do an update (for records having either 001 or 970 identifiers), or an insert (for the other ones).

3.4 Updating preformatted output formats

BibFormat can use this special upload mode during which metadata will not be updated, only the preformatted output formats for records:

     -f, --format        Upload only the format (FMT) fields.
                         The original content is not changed, and neither its modification date.
 
This is useful for bibreformat daemon only; human administrators don't need to explicitly know about this mode.

3.5 Uploading fulltext files

The fulltext files can be uploaded and revised via a special FFT ("fulltext file transfer") tag with the following semantic:

     FFT $a  ...  location of the docfile to upload (a filesystem path or a URL)
         $n  ...  docfile name (optional; if not set, deduced from $a)
         $m  ...  new desired docfile name (optional; used for renaming files)
         $t  ...  docfile type (e.g. Main, Additional)
         $d  ...  docfile description (optional)
         $f  ...  format (optional; if not set, deduced from $a)
         $z  ...  comment (optional)
         $r  ...  restriction (optional, see below)
         $v  ...  version (used only with REVERT and DELETE-FILE, see below)
         $x  ...  url/path for an icon (optional)
 

For example, to upload a new fulltext file thesis.pdf associated to record ID 123:

     <record>
         <controlfield tag="001">123</controlfield>
         <datafield tag="FFT" ind1=" " ind2=" ">
             <subfield code="a">/tmp/thesis.pdf</subfield>
             <subfield code="t">Main</subfield>
             <subfield code="d">
               This is the fulltext version of my thesis in the PDF format.
               Chapter 5 still needs some revision.
             </subfield>
         </datafield>
     </record>
 

The FFT tag can be repetitive, so one can pass along another FFT tag instance containing a pointer to e.g. the thesis defence slides. The subfields of an FFT tag are non-repetitive.

When more than one FFT tag is specified for the same document (e.g. for adding more than one format at a time), if $t (docfile type), $m (new desired docfile name), $r (restriction), $v (version), $x (url/path for an icon), are specified, they should be identically specified for each single entry of FFT. E.g. if you want to specify an icon for a document with two formats (say .pdf and .doc), you'll write two FFT tags, both containing the same $x subfield.

The bibupload process, when it encounters FFT tags, will automatically populate fulltext storage space (/opt/cds-invenio/var/data/files) and metadata record associated tables (bibrec_bibdoc, bibdoc) as appropriate. It will also enrich the 856 tags (URL tags) of the MARC metadata of the record in question with references to the latest versions of each file.

Note that for $a and $x subfields filesystem paths must be absolute (e.g. /tmp/icon.gif is valid, while Destkop/icon.gif is not) and they must be readable by the user/group of the bibupload process that will handle the FFT.

The bibupload process supports the usual modes correct, append, replace, insert with a semantic that is somewhat similar to the semantic of the metadata upload:

Metadata Fulltext
objects being uploaded MARC field instances characterized by tags (010-999) fulltext files characterized by unique file names (FFT $n)
insert insert new record; must not exist insert new files; must not exist
append append new tag instances for the given tag XXX, regardless of existing tag instances append new files, if filename (i.e. new format) not already present
correct correct tag instances for the given tag XXX; delete existing ones and replace with given ones correct files with the given filename; add new revision or delete file; if the docname does not exist the file is added
replace replace all tags, whatever XXX are replace all files, whatever filenames are
delete delete all existing tag instances not supported

Note, in append and insert mode,

$m
is ignored.

In order to rename a document just use the the correct mode specifing in the $n subfield the original docname that should be renamed and in $m the new name.

Special values can be assigned to the $t subfield.

ValueMeaning
PURGEIn order to purge previous file revisions (i.e. in order to keep only the latest file version), please use the correct mode with $n docname and $t PURGE as the special keyword.
DELETEIn order to delete all existing versions of a file, making it effectively hidden, please use the correct mode with $n docname and $t DELETE as the special keyword.
EXPUNGEIn order to expunge (i.e. remove completely, also from the filesystem) all existing versions of a file, making it effectively disappear, please use the correct mode with $n docname and $t EXPUNGE as the special keyword.
FIX-MARCIn order to synchronize MARC to the bibrec/bibdoc structure (e.g. after an update or a tweak in the database), please use the correct mode with $n docname and $t FIX-MARC as the special keyword.
FIX-ALLIn order to fix a record (i.e. put all its linked documents in a coherent state) and synchronize the MARC to the table, please use the correct mode with $n docname and $t FIX-ALL as the special keyword.
REVERTIn order to revert to a previous file revision (i.e. to create a new revision with the same content as some previous revision had), please use the correct mode with $n docname, $t REVERT as the special keyword and $v the number corresponding to the desired version.
DELETE-FILEIn order to delete a particular file added by mistake, please use the correct mode with $n docname, $t DELETE-FILE, specifing $v version and $f format. Note that this operation is not reversible. Note that if you don't spcify a version, the last version will be used.

In order to preserve previous comments and descriptions when correcting, please use the KEEP-OLD-VALUE special keyword with the desired $d and $z subfield.

-

In order to add an icon representing a document, you must use a $x -subfields. All the FFT for different format of the document must have -then the same $x subfield. You can use KEEP-OLD-VALUE in order to keep -the previous icon when correcting. -

-

The $r subfield can contain a keyword that can be use to restrict the given document. The same keyword must be specified for all the format of a given document. The keyword will be used as the status parameter for the "viewrestrdoc" action, which can be used to give access right/restriction to desired user. e.g. if you set the keyword "thesis", you can the connect the "thesisviewer" to the action "viewrestrdoc" with parameter "status" set to "thesis". Then all the user which are linked with the "thesisviewer" role will be able to download the document. Instead any other user will not be allowed. Note, if you use the keyword "KEEP-OLD-VALUE" the previous restrictions if applicable will be kept.

Note that each time bibupload is called on a record, the 8564 tags pointing to locally stored files are recreated on the basis of the full-text files connected to the record. Thus, if you whish to update some 8564 tag pointing to a locally managed file, the only way to perform this is through the FFT tag, not by editing 8564 directly.

diff --git a/modules/bibupload/lib/bibupload.py b/modules/bibupload/lib/bibupload.py index b930a2b56..ad07c4446 100644 --- a/modules/bibupload/lib/bibupload.py +++ b/modules/bibupload/lib/bibupload.py @@ -1,2060 +1,2011 @@ # -*- coding: utf-8 -*- ## ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """ BibUpload: Receive MARC XML file and update the appropriate database tables according to options. Usage: bibupload [options] input.xml Examples: $ bibupload -i input.xml Options: -a, --append new fields are appended to the existing record -c, --correct fields are replaced by the new ones in the existing record -f, --format takes only the FMT fields into account. Does not update -i, --insert insert the new record in the database -r, --replace the existing record is entirely replaced by the new one -d, --delete specified fields are deleted if existing -z, --reference update references (update only 999 fields) -s, --stage=STAGE stage to start from in the algorithm (0: always done; 1: FMT tags; 2: FFT tags; 3: BibFmt; 4: Metadata update; 5: time update) -n, --notimechange do not change record last modification date when updating -o, --holdingpen Makes bibupload insert into holding pen instead the normal database Scheduling options: -u, --user=USER user name to store task, password needed General options: -h, --help print this help and exit -v, --verbose=LEVEL verbose level (from 0 to 9, default 1) -V --version print the script version """ __revision__ = "$Id$" import os import re import sys import time from zlib import compress import urllib2 import socket import marshal import copy from invenio.config import CFG_OAI_ID_FIELD, \ CFG_BIBUPLOAD_REFERENCE_TAG, \ CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG, \ CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG, \ CFG_BIBUPLOAD_EXTERNAL_OAIID_PROVENANCE_TAG, \ CFG_BIBUPLOAD_STRONG_TAGS, \ CFG_BIBUPLOAD_CONTROLLED_PROVENANCE_TAGS, \ CFG_BIBUPLOAD_SERIALIZE_RECORD_STRUCTURE from invenio.bibupload_config import CFG_BIBUPLOAD_CONTROLFIELD_TAGS, \ CFG_BIBUPLOAD_SPECIAL_TAGS from invenio.dbquery import run_sql, \ Error from invenio.bibrecord import create_records, \ record_add_field, \ record_delete_field, \ record_xml_output, \ record_get_field_instances, \ record_get_field_values, \ field_get_subfield_values, \ field_get_subfield_instances, \ record_extract_oai_id, \ record_modify_subfield, \ record_delete_subfield_from, \ record_delete_fields, \ record_add_subfield_into, \ record_find_field, \ record_extract_oai_id from invenio.search_engine import get_record from invenio.dateutils import convert_datestruct_to_datetext from invenio.errorlib import register_exception from invenio.intbitset import intbitset from invenio.config import CFG_WEBSUBMIT_FILEDIR from invenio.bibtask import task_init, write_message, \ task_set_option, task_get_option, task_get_task_param, task_update_status, \ task_update_progress, task_sleep_now_if_required, fix_argv_paths from invenio.bibdocfile import BibRecDocs, file_strip_ext, normalize_format, \ get_docname_from_url, check_valid_url, download_url, \ KEEP_OLD_VALUE, decompose_bibdocfile_url, InvenioWebSubmitFileError, \ bibdocfile_url_p, CFG_BIBDOCFILE_AVAILABLE_FLAGS, guess_format_from_url from invenio.search_engine import search_pattern #Statistic variables stat = {} stat['nb_records_to_upload'] = 0 stat['nb_records_updated'] = 0 stat['nb_records_inserted'] = 0 stat['nb_errors'] = 0 stat['nb_holdingpen'] = 0 stat['exectime'] = time.localtime() ## Let's set a reasonable timeout for URL request (e.g. FFT) socket.setdefaulttimeout(40) _re_find_001 = re.compile('\\s*(\\d*)\\s*', re.S) def bibupload_pending_recids(): """This function embed a bit of A.I. and is more a hack than an elegant algorithm. It should be updated in case bibupload/bibsched are modified in incompatible ways. This function return the intbitset of all the records that are being (or are scheduled to be) touched by other bibuploads. """ options = run_sql("""SELECT arguments FROM schTASK WHERE status<>'DONE' AND proc='bibupload' AND (status='RUNNING' OR status='CONTINUING' OR status='WAITING' OR status='SCHEDULED' OR status='ABOUT TO STOP' OR status='ABOUT TO SLEEP')""") ret = intbitset() xmls = [] if options: for arguments in options: arguments = marshal.loads(arguments[0]) for argument in arguments[1:]: if argument.startswith('/'): # XMLs files are recognizable because they're absolute # files... xmls.append(argument) for xmlfile in xmls: # Let's grep for the 001 try: xml = open(xmlfile).read() ret += [int(group[1]) for group in _re_find_001.findall(xml)] except: continue return ret ### bibupload engine functions: def bibupload(record, opt_tag=None, opt_mode=None, opt_stage_to_start_from=1, opt_notimechange=0, oai_rec_id = ""): """Main function: process a record and fit it in the tables bibfmt, bibrec, bibrec_bibxxx, bibxxx with proper record metadata. Return (error_code, recID) of the processed record. """ assert(opt_mode in ('insert', 'replace', 'replace_or_insert', 'reference', 'correct', 'append', 'format', 'holdingpen', 'delete')) error = None # If there are special tags to proceed check if it exists in the record if opt_tag is not None and not(record.has_key(opt_tag)): write_message(" Failed: Tag not found, enter a valid tag to update.", verbose=1, stream=sys.stderr) return (1, -1) # Extraction of the Record Id from 001, SYSNO or OAIID tags: rec_id = retrieve_rec_id(record, opt_mode) if rec_id == -1: return (1, -1) elif rec_id > 0: write_message(" -Retrieve record ID (found %s): DONE." % rec_id, verbose=2) if not record.has_key('001'): # Found record ID by means of SYSNO or OAIID, and the # input MARCXML buffer does not have this 001 tag, so we # should add it now: error = record_add_field(record, '001', controlfield_value=rec_id) if error is None: write_message(" Failed: " \ "Error during adding the 001 controlfield " \ "to the record", verbose=1, stream=sys.stderr) return (1, int(rec_id)) else: error = None write_message(" -Added tag 001: DONE.", verbose=2) write_message(" -Check if the xml marc file is already in the database: DONE" , verbose=2) # Reference mode check if there are reference tag if opt_mode == 'reference': error = extract_tag_from_record(record, CFG_BIBUPLOAD_REFERENCE_TAG) if error is None: write_message(" Failed: No reference tags has been found...", verbose=1, stream=sys.stderr) return (1, -1) else: error = None write_message(" -Check if reference tags exist: DONE", verbose=2) record_deleted_p = False if opt_mode == 'insert' or \ (opt_mode == 'replace_or_insert' and rec_id is None): insert_mode_p = True # Insert the record into the bibrec databases to have a recordId rec_id = create_new_record() write_message(" -Creation of a new record id (%d): DONE" % rec_id, verbose=2) # we add the record Id control field to the record error = record_add_field(record, '001', controlfield_value=rec_id) if error is None: write_message(" Failed: " \ "Error during adding the 001 controlfield " \ "to the record", verbose=1, stream=sys.stderr) return (1, int(rec_id)) else: error = None elif opt_mode != 'insert' and opt_mode != 'format' and \ opt_stage_to_start_from != 5: insert_mode_p = False # Update Mode # Retrieve the old record to update rec_old = get_record(rec_id) # Also save a copy to restore previous situation in case of errors original_record = get_record(rec_id) if rec_old is None: write_message(" Failed during the creation of the old record!", verbose=1, stream=sys.stderr) return (1, int(rec_id)) else: write_message(" -Retrieve the old record to update: DONE", verbose=2) # In Replace mode, take over old strong tags if applicable: if opt_mode == 'replace' or \ opt_mode == 'replace_or_insert': copy_strong_tags_from_old_record(record, rec_old) # Delete tags to correct in the record if opt_mode == 'correct' or opt_mode == 'reference': delete_tags_to_correct(record, rec_old, opt_tag) write_message(" -Delete the old tags to correct in the old record: DONE", verbose=2) # Delete tags specified if in delete mode if opt_mode == 'delete': record = delete_tags(record, rec_old) write_message(" -Delete specified tags in the old record: DONE", verbose=2) # Append new tag to the old record and update the new record with the old_record modified if opt_mode == 'append' or opt_mode == 'correct' or \ opt_mode == 'reference': record = append_new_tag_to_old_record(record, rec_old, opt_tag, opt_mode) write_message(" -Append new tags to the old record: DONE", verbose=2) # now we clear all the rows from bibrec_bibxxx from the old # record (they will be populated later (if needed) during # stage 4 below): delete_bibrec_bibxxx(rec_old, rec_id) record_deleted_p = True write_message(" -Clean bibrec_bibxxx: DONE", verbose=2) write_message(" -Stage COMPLETED", verbose=2) try: # Have a look if we have FMT tags write_message("Stage 1: Start (Insert of FMT tags if exist).", verbose=2) if opt_stage_to_start_from <= 1 and \ extract_tag_from_record(record, 'FMT') is not None: record = insert_fmt_tags(record, rec_id, opt_mode) if record is None: write_message(" Stage 1 failed: Error while inserting FMT tags", verbose=1, stream=sys.stderr) return (1, int(rec_id)) elif record == 0: # Mode format finished stat['nb_records_updated'] += 1 return (0, int(rec_id)) write_message(" -Stage COMPLETED", verbose=2) else: write_message(" -Stage NOT NEEDED", verbose=2) # Have a look if we have FFT tags write_message("Stage 2: Start (Process FFT tags if exist).", verbose=2) record_had_FFT = False if opt_stage_to_start_from <= 2 and \ extract_tag_from_record(record, 'FFT') is not None: record_had_FFT = True if not writing_rights_p(): write_message(" Stage 2 failed: Error no rights to write fulltext files", verbose=1, stream=sys.stderr) task_update_status("ERROR") sys.exit(1) try: record = elaborate_fft_tags(record, rec_id, opt_mode) except Exception, e: register_exception() write_message(" Stage 2 failed: Error while elaborating FFT tags: %s" % e, verbose=1, stream=sys.stderr) return (1, int(rec_id)) if record is None: write_message(" Stage 2 failed: Error while elaborating FFT tags", verbose=1, stream=sys.stderr) return (1, int(rec_id)) write_message(" -Stage COMPLETED", verbose=2) else: write_message(" -Stage NOT NEEDED", verbose=2) # Have a look if we have FFT tags write_message("Stage 2B: Start (Synchronize 8564 tags).", verbose=2) has_bibdocs = run_sql("SELECT count(id_bibdoc) FROM bibrec_bibdoc JOIN bibdoc ON id_bibdoc=id WHERE id_bibrec=%s AND status<>'DELETED'", (rec_id, ))[0][0] > 0 if opt_stage_to_start_from <= 2 and (has_bibdocs or record_had_FFT or extract_tag_from_record(record, '856') is not None): try: record = synchronize_8564(rec_id, record, record_had_FFT) except Exception, e: register_exception(alert_admin=True) write_message(" Stage 2B failed: Error while synchronizing 8564 tags: %s" % e, verbose=1, stream=sys.stderr) return (1, int(rec_id)) if record is None: write_message(" Stage 2B failed: Error while synchronizing 8564 tags", verbose=1, stream=sys.stderr) return (1, int(rec_id)) write_message(" -Stage COMPLETED", verbose=2) else: write_message(" -Stage NOT NEEDED", verbose=2) # Update of the BibFmt write_message("Stage 3: Start (Update bibfmt).", verbose=2) if opt_stage_to_start_from <= 3: # format the single record as xml rec_xml_new = record_xml_output(record) # Update bibfmt with the format xm of this record if opt_mode != 'format': error = update_bibfmt_format(rec_id, rec_xml_new, 'xm') if error == 1: write_message(" Failed: error during update_bibfmt_format 'xm'", verbose=1, stream=sys.stderr) return (1, int(rec_id)) if CFG_BIBUPLOAD_SERIALIZE_RECORD_STRUCTURE: error = update_bibfmt_format(rec_id, marshal.dumps(record), 'recstruct') if error == 1: write_message(" Failed: error during update_bibfmt_format 'recstruct'", verbose=1, stream=sys.stderr) return (1, int(rec_id)) # archive MARCXML format of this record for version history purposes: error = archive_marcxml_for_history(rec_id) if error == 1: write_message(" Failed to archive MARCXML for history", verbose=1, stream=sys.stderr) return (1, int(rec_id)) else: write_message(" -Archived MARCXML for history : DONE", verbose=2) write_message(" -Stage COMPLETED", verbose=2) # Update the database MetaData write_message("Stage 4: Start (Update the database with the metadata).", verbose=2) if opt_stage_to_start_from <= 4: if opt_mode in ('insert', 'replace', 'replace_or_insert', 'append', 'correct', 'reference', 'delete'): update_database_with_metadata(record, rec_id, oai_rec_id) record_deleted_p = False else: write_message(" -Stage NOT NEEDED in mode %s" % opt_mode, verbose=2) write_message(" -Stage COMPLETED", verbose=2) else: write_message(" -Stage NOT NEEDED", verbose=2) # Finally we update the bibrec table with the current date write_message("Stage 5: Start (Update bibrec table with current date).", verbose=2) if opt_stage_to_start_from <= 5 and \ opt_notimechange == 0 and \ not insert_mode_p: now = convert_datestruct_to_datetext(time.localtime()) write_message(" -Retrieved current localtime: DONE", verbose=2) update_bibrec_modif_date(now, rec_id) write_message(" -Stage COMPLETED", verbose=2) else: write_message(" -Stage NOT NEEDED", verbose=2) # Increase statistics if insert_mode_p: stat['nb_records_inserted'] += 1 else: stat['nb_records_updated'] += 1 # Upload of this record finish write_message("Record "+str(rec_id)+" DONE", verbose=1) return (0, int(rec_id)) finally: if record_deleted_p: ## BibUpload has failed living the record deleted. We should ## back the original record then. update_database_with_metadata(original_record, rec_id, oai_rec_id) write_message(" Restored original record", verbose=1, stream=sys.stderr) def find_record_ids_by_oai_id(oaiId): """ A method finding the records identifier provided the oai identifier returns a list of identifiers matching a given oai identifier """ # Is this record already in invenio (matching by oaiid) recids1 = search_pattern( p = oaiId, f = CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG, m = 'e' ).tolist() # Is this record already in invenio (matching by reportnumber i.e. # particularly 037. Idea: to avoid doubbles insertions) repnumber = oaiId.split(":")[-1] recids2 = search_pattern(p = repnumber, f = "reportnumber", m = 'e' ).tolist() # Is this record already in invenio (matching by reportnumber i.e. # particularly 037. Idea: to avoid doubbles insertions) repnumber = "arXiv:" + oaiId.split(":")[-1] recids3 = search_pattern(p = repnumber, f = "reportnumber", m = 'e' ).tolist() # now assuring, the results are unique res = {} for rid in recids1 + recids2 + recids3: res[rid] = 1 return res.keys() def insert_record_into_holding_pen(record, oai_id): query = "INSERT INTO bibHOLDINGPEN (oai_id, changeset_date, changeset_xml, id_bibrec) VALUES (%s, NOW(), %s, %s)" xml_record = record_xml_output(record) bibrec_ids = find_record_ids_by_oai_id(oai_id) # here determining the identifier of the record if len(bibrec_ids) > 0: bibrec_id = bibrec_ids[0] else: bibrec_id = 0 run_sql(query, (oai_id, xml_record, bibrec_id)) # record_id is logged as 0! ( We are not inserting into the main database) log_record_uploading(oai_id, task_get_task_param('task_id', 0), 0, 'H') stat['nb_holdingpen'] += 1 def print_out_bibupload_statistics(): """Print the statistics of the process""" out = "Task stats: %(nb_input)d input records, %(nb_updated)d updated, " \ "%(nb_inserted)d inserted, %(nb_errors)d errors, %(nb_holdingpen)d inserted to holding pen. " \ "Time %(nb_sec).2f sec." % { \ 'nb_input': stat['nb_records_to_upload'], 'nb_updated': stat['nb_records_updated'], 'nb_inserted': stat['nb_records_inserted'], 'nb_errors': stat['nb_errors'], 'nb_holdingpen': stat['nb_holdingpen'], 'nb_sec': time.time() - time.mktime(stat['exectime']) } write_message(out) def open_marc_file(path): """Open a file and return the data""" try: # open the file containing the marc document marc_file = open(path,'r') marc = marc_file.read() marc_file.close() except IOError, erro: write_message("Error: %s" % erro, verbose=1, stream=sys.stderr) write_message("Exiting.", sys.stderr) task_update_status("ERROR") sys.exit(1) return marc def xml_marc_to_records(xml_marc): """create the records""" # Creation of the records from the xml Marc in argument recs = create_records(xml_marc, 1, 1) if recs == []: write_message("Error: Cannot parse MARCXML file.", verbose=1, stream=sys.stderr) write_message("Exiting.", sys.stderr) task_update_status("ERROR") sys.exit(1) elif recs[0][0] is None: write_message("Error: MARCXML file has wrong format: %s" % recs, verbose=1, stream=sys.stderr) write_message("Exiting.", sys.stderr) task_update_status("ERROR") sys.exit(1) else: recs = map((lambda x:x[0]), recs) return recs def find_record_format(rec_id, format): """Look whether record REC_ID is formatted in FORMAT, i.e. whether FORMAT exists in the bibfmt table for this record. Return the number of times it is formatted: 0 if not, 1 if yes, 2 if found more than once (should never occur). """ out = 0 query = """SELECT COUNT(id) FROM bibfmt WHERE id_bibrec=%s AND format=%s""" params = (rec_id, format) res = [] try: res = run_sql(query, params) out = res[0][0] except Error, error: write_message(" Error during find_record_format() : %s " % error, verbose=1, stream=sys.stderr) return out def find_record_from_recid(rec_id): """ Try to find record in the database from the REC_ID number. Return record ID if found, None otherwise. """ try: res = run_sql("SELECT id FROM bibrec WHERE id=%s", (rec_id,)) except Error, error: write_message(" Error during find_record_bibrec() : %s " % error, verbose=1, stream=sys.stderr) if res: return res[0][0] else: return None def find_record_from_sysno(sysno): """ Try to find record in the database from the external SYSNO number. Return record ID if found, None otherwise. """ bibxxx = 'bib'+CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[0:2]+'x' bibrec_bibxxx = 'bibrec_' + bibxxx try: res = run_sql("""SELECT bb.id_bibrec FROM %(bibrec_bibxxx)s AS bb, %(bibxxx)s AS b WHERE b.tag=%%s AND b.value=%%s AND bb.id_bibxxx=b.id""" % \ {'bibxxx': bibxxx, 'bibrec_bibxxx': bibrec_bibxxx}, (CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG, sysno,)) except Error, error: write_message(" Error during find_record_from_sysno(): %s " % error, verbose=1, stream=sys.stderr) if res: return res[0][0] else: return None def find_records_from_extoaiid(extoaiid, extoaisrc=None): """ Try to find records in the database from the external EXTOAIID number. Return list of record ID if found, None otherwise. """ assert(CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[:5] == CFG_BIBUPLOAD_EXTERNAL_OAIID_PROVENANCE_TAG[:5]) bibxxx = 'bib'+CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[0:2]+'x' bibrec_bibxxx = 'bibrec_' + bibxxx try: write_message(' Looking for extoaiid="%s" with extoaisrc="%s"' % (extoaiid, extoaisrc), verbose=9) id_bibrecs = intbitset(run_sql("""SELECT bb.id_bibrec FROM %(bibrec_bibxxx)s AS bb, %(bibxxx)s AS b WHERE b.tag=%%s AND b.value=%%s AND bb.id_bibxxx=b.id""" % \ {'bibxxx': bibxxx, 'bibrec_bibxxx': bibrec_bibxxx}, (CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG, extoaiid,))) write_message(' Partially found %s for extoaiid="%s"' % (id_bibrecs, extoaiid), verbose=9) ret = intbitset() for id_bibrec in id_bibrecs: record = get_record(id_bibrec) instances = record_get_field_instances(record, CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[0:3], CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3], CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4]) write_message(' recid %s -> instances "%s"' % (id_bibrec, instances), verbose=9) for instance in instances: provenance = field_get_subfield_values(instance, CFG_BIBUPLOAD_EXTERNAL_OAIID_PROVENANCE_TAG[5]) write_message(' recid %s -> provenance "%s"' % (id_bibrec, provenance), verbose=9) provenance = provenance and provenance[0] or None if provenance is None: if extoaisrc is None: write_message('Found recid %s for extoaiid="%s"' % (id_bibrec, extoaiid), verbose=9) ret.add(id_bibrec) break else: raise Error('Found recid %s for extoaiid="%s" that doesn\'t specify any provenance, while input record does.' % (id_bibrec, extoaiid)) else: if extoaiid is None: raise Error('Found recid %s for extoaiid="%s" that specifies as provenance "%s", while input record does not specify any provenance.' % (id_bibrec, extoaiid, provenance)) elif provenance == extoaisrc: write_message('Found recid %s for extoaiid="%s" with provenance="%s"' % (id_bibrec, extoaiid, extoaisrc), verbose=9) ret.add(id_bibrec) break return ret except Error, error: write_message(" Error during find_records_from_extoaiid(): %s " % error, verbose=1, stream=sys.stderr) raise def find_record_from_oaiid(oaiid): """ Try to find record in the database from the OAI ID number and OAI SRC. Return record ID if found, None otherwise. """ bibxxx = 'bib'+CFG_OAI_ID_FIELD[0:2]+'x' bibrec_bibxxx = 'bibrec_' + bibxxx try: res = run_sql("""SELECT bb.id_bibrec FROM %(bibrec_bibxxx)s AS bb, %(bibxxx)s AS b WHERE b.tag=%%s AND b.value=%%s AND bb.id_bibxxx=b.id""" % \ {'bibxxx': bibxxx, 'bibrec_bibxxx': bibrec_bibxxx}, (CFG_OAI_ID_FIELD, oaiid,)) except Error, error: write_message(" Error during find_record_from_oaiid(): %s " % error, verbose=1, stream=sys.stderr) if res: return res[0][0] else: return None def extract_tag_from_record(record, tag_number): """ Extract the tag_number for record.""" # first step verify if the record is not already in the database if record: return record.get(tag_number, None) return None def retrieve_rec_id(record, opt_mode): """Retrieve the record Id from a record by using tag 001 or SYSNO or OAI ID tag. opt_mod is the desired mode.""" rec_id = None # 1st step: we look for the tag 001 tag_001 = extract_tag_from_record(record, '001') if tag_001 is not None: # We extract the record ID from the tag rec_id = tag_001[0][3] # if we are in insert mode => error if opt_mode == 'insert': write_message(" Failed : Error tag 001 found in the xml" \ " submitted, you should use the option replace," \ " correct or append to replace an existing" \ " record. (-h for help)", verbose=1, stream=sys.stderr) return -1 else: # we found the rec id and we are not in insert mode => continue # we try to match rec_id against the database: if find_record_from_recid(rec_id) is not None: # okay, 001 corresponds to some known record return int(rec_id) else: # The record doesn't exist yet. We shall have try to check # the SYSNO or OAI id later. write_message(" -Tag 001 value not found in database.", verbose=9) rec_id = None else: write_message(" -Tag 001 not found in the xml marc file.", verbose=9) if rec_id is None: # 2nd step we look for the SYSNO sysnos = record_get_field_values(record, CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[0:3], CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[3:4] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[3:4] or "", CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[4:5] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[4:5] or "", CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[5:6]) if sysnos: sysno = sysnos[0] # there should be only one external SYSNO write_message(" -Checking if SYSNO " + sysno + \ " exists in the database", verbose=9) # try to find the corresponding rec id from the database rec_id = find_record_from_sysno(sysno) if rec_id is not None: # rec_id found pass else: # The record doesn't exist yet. We will try to check # external and internal OAI ids later. write_message(" -Tag SYSNO value not found in database.", verbose=9) rec_id = None else: write_message(" -Tag SYSNO not found in the xml marc file.", verbose=9) if rec_id is None: # 2nd step we look for the external OAIID extoai_fields = record_get_field_instances(record, CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[0:3], CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3:4] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3:4] or "", CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4:5] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4:5] or "") if extoai_fields: for field in extoai_fields: extoaiid = field_get_subfield_values(field, CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[5:6]) extoaisrc = field_get_subfield_values(field, CFG_BIBUPLOAD_EXTERNAL_OAIID_PROVENANCE_TAG[5:6]) if extoaiid: extoaiid = extoaiid[0] if extoaisrc: extoaisrc = extoaisrc[0] else: extoaisrc = None write_message(" -Checking if EXTOAIID %s (%s) exists in the database" % (extoaiid, extoaisrc), verbose=9) # try to find the corresponding rec id from the database try: rec_ids = find_records_from_extoaiid(extoaiid, extoaisrc) except Error, e: write_message(e, verbose=1, stream=sys.stderr) return -1 if rec_ids: # rec_id found rec_id = rec_ids.pop() break else: # The record doesn't exist yet. We will try to check # OAI id later. write_message(" -Tag EXTOAIID value not found in database.", verbose=9) rec_id = None else: write_message(" -Tag EXTOAIID not found in the xml marc file.", verbose=9) if rec_id is None: # 4th step we look for the OAI ID oaiidvalues = record_get_field_values(record, CFG_OAI_ID_FIELD[0:3], CFG_OAI_ID_FIELD[3:4] != "_" and \ CFG_OAI_ID_FIELD[3:4] or "", CFG_OAI_ID_FIELD[4:5] != "_" and \ CFG_OAI_ID_FIELD[4:5] or "", CFG_OAI_ID_FIELD[5:6]) if oaiidvalues: oaiid = oaiidvalues[0] # there should be only one OAI ID write_message(" -Check if local OAI ID " + oaiid + \ " exist in the database", verbose=9) # try to find the corresponding rec id from the database rec_id = find_record_from_oaiid(oaiid) if rec_id is not None: # rec_id found pass else: write_message(" -Tag OAI ID value not found in database.", verbose=9) rec_id = None else: write_message(" -Tag SYSNO not found in the xml marc file.", verbose=9) # Now we should have detected rec_id from SYSNO or OAIID # tags. (None otherwise.) if rec_id: if opt_mode == 'insert': write_message(" Failed : Record found in the database," \ " you should use the option replace," \ " correct or append to replace an existing" \ " record. (-h for help)", verbose=1, stream=sys.stderr) return -1 else: if opt_mode != 'insert' and \ opt_mode != 'replace_or_insert': write_message(" Failed : Record not found in the database."\ " Please insert the file before updating it."\ " (-h for help)", verbose=1, stream=sys.stderr) return -1 return rec_id and int(rec_id) or None ### Insert functions def create_new_record(): """Create new record in the database""" now = convert_datestruct_to_datetext(time.localtime()) query = """INSERT INTO bibrec (creation_date, modification_date) VALUES (%s, %s)""" params = (now, now) try: rec_id = run_sql(query, params) return rec_id except Error, error: write_message(" Error during the creation_new_record function : %s " % error, verbose=1, stream=sys.stderr) return None def insert_bibfmt(id_bibrec, marc, format, modification_date='1970-01-01 00:00:00'): """Insert the format in the table bibfmt""" # compress the marc value pickled_marc = compress(marc) try: time.strptime(modification_date, "%Y-%m-%d %H:%M:%S") except ValueError: modification_date = '1970-01-01 00:00:00' query = """INSERT INTO bibfmt (id_bibrec, format, last_updated, value) VALUES (%s, %s, %s, %s)""" try: row_id = run_sql(query, (id_bibrec, format, modification_date, pickled_marc)) return row_id except Error, error: write_message(" Error during the insert_bibfmt function : %s " % error, verbose=1, stream=sys.stderr) return None def insert_record_bibxxx(tag, value): """Insert the record into bibxxx""" # determine into which table one should insert the record table_name = 'bib'+tag[0:2]+'x' # check if the tag, value combination exists in the table query = """SELECT id,value FROM %s """ % table_name query += """ WHERE tag=%s AND value=%s""" params = (tag, value) try: res = run_sql(query, params) except Error, error: write_message(" Error during the insert_record_bibxxx function : %s " % error, verbose=1, stream=sys.stderr) # Note: compare now the found values one by one and look for # string binary equality (e.g. to respect lowercase/uppercase # match), regardless of the charset etc settings. Ideally we # could use a BINARY operator in the above SELECT statement, but # we would have to check compatibility on various MySQLdb versions # etc; this approach checks all matched values in Python, not in # MySQL, which is less cool, but more conservative, so it should # work better on most setups. for row in res: row_id = row[0] row_value = row[1] if row_value == value: return (table_name, row_id) # We got here only when the tag,value combination was not found, # so it is now necessary to insert the tag,value combination into # bibxxx table as new. query = """INSERT INTO %s """ % table_name query += """ (tag, value) values (%s , %s)""" params = (tag, value) try: row_id = run_sql(query, params) except Error, error: write_message(" Error during the insert_record_bibxxx function : %s " % error, verbose=1, stream=sys.stderr) return (table_name, row_id) def insert_record_bibrec_bibxxx(table_name, id_bibxxx, field_number, id_bibrec): """Insert the record into bibrec_bibxxx""" # determine into which table one should insert the record full_table_name = 'bibrec_'+ table_name # insert the proper row into the table query = """INSERT INTO %s """ % full_table_name query += """(id_bibrec,id_bibxxx, field_number) values (%s , %s, %s)""" params = (id_bibrec, id_bibxxx, field_number) try: res = run_sql(query, params) except Error, error: write_message(" Error during the insert_record_bibrec_bibxxx" " function 2nd query : %s " % error, verbose=1, stream=sys.stderr) return res def synchronize_8564(rec_id, record, record_had_FFT): """ Synchronize 8564_ tags and BibDocFile tables. This function directly manipulate the record parameter. @type rec_id: positive integer @param rec_id: the record identifier. @param record: the record structure as created by bibrecord.create_record @type record_had_FFT: boolean @param record_had_FFT: True if the incoming bibuploaded-record used FFT @return: the manipulated record (which is also modified as a side effect) """ def merge_marc_into_bibdocfile(field): """ Internal function that reads a single field and store its content in BibDocFile tables. @param field: the 8564_ field containing a BibDocFile URL. """ write_message('Merging field: %s' % (field, ), verbose=9) url = field_get_subfield_values(field, 'u')[:1] or field_get_subfield_values(field, 'q')[:1] description = field_get_subfield_values(field, 'y')[:1] comment = field_get_subfield_values(field, 'z')[:1] if url: recid, docname, format = decompose_bibdocfile_url(url[0]) if recid != rec_id: write_message("INFO: URL %s is not pointing to a fulltext owned by this record (%s)" % (url, recid), stream=sys.stderr) else: try: bibdoc = BibRecDocs(recid).get_bibdoc(docname) if description: bibdoc.set_description(description[0], format) if comment: bibdoc.set_comment(comment[0], format) except InvenioWebSubmitFileError: ## Apparently the referenced docname doesn't exist anymore. ## Too bad. Let's skip it. write_message("WARNING: docname %s doesn't exist for record %s. Has it been renamed outside FFT?" % (docname, recid), stream=sys.stderr) def merge_bibdocfile_into_marc(field, subfields): """ Internal function that reads BibDocFile table entries referenced by the URL in the given 8564_ field and integrate the given information directly with the provided subfields. @param field: the 8564_ field containing a BibDocFile URL. @param subfields: the subfields corresponding to the BibDocFile URL generated after BibDocFile tables. """ write_message('Merging subfields %s into field %s' % (subfields, field), verbose=9) subfields = dict(subfields) ## We make a copy not to have side-effects subfield_to_delete = [] for subfield_position, (code, value) in enumerate(field_get_subfield_instances(field)): ## For each subfield instance already existing... if code in subfields: ## ...We substitute it with what is in BibDocFile tables record_modify_subfield(record, '856', code, subfields[code], subfield_position, field_position_global=field[4]) del subfields[code] else: ## ...We delete it otherwise subfield_to_delete.append(subfield_position) subfield_to_delete.sort() for counter, position in enumerate(subfield_to_delete): ## FIXME: Very hackish algorithm. Since deleting a subfield ## will alterate the position of following subfields, we ## are taking note of this and adjusting further position ## by using a counter. record_delete_subfield_from(record, '856', position - counter, field_position_global=field[4]) subfields = subfields.items() subfields.sort() for code, value in subfields: ## Let's add non-previously existing subfields record_add_subfield_into(record, '856', code, value, field_position_global=field[4]) def get_bibdocfile_managed_info(): """ Internal function to eturns a dictionary of BibDocFile URL -> wanna-be subfields. @rtype: mapping @return: BibDocFile URL -> wanna-be subfields dictionary """ ret = {} bibrecdocs = BibRecDocs(rec_id) latest_files = bibrecdocs.list_latest_files() for afile in latest_files: url = afile.get_url() ret[url] = {'u' : url} description = afile.get_description() comment = afile.get_comment() + subformat = afile.get_subformat() if description: ret[url]['y'] = description if comment: ret[url]['z'] = comment + if subformat: + ret[url]['x'] = subformat - for bibdoc in bibrecdocs.list_bibdocs(): - icon = bibdoc.get_icon() - if icon: - icon = icon.list_all_files() - if icon: - url = icon[0].get_url() - ret[url] = {'q' : url, 'x' : 'icon'} return ret write_message("Synchronizing MARC of recid '%s' with:\n%s" % (rec_id, record), verbose=9) tags856s = record_get_field_instances(record, '856', '%', '%') write_message("Original 856%% instances: %s" % tags856s, verbose=9) tags8564s_to_add = get_bibdocfile_managed_info() write_message("BibDocFile instances: %s" % tags8564s_to_add, verbose=9) positions_tags8564s_to_remove = [] for local_position, field in enumerate(tags856s): if field[1] == '4' and field[2] == ' ': write_message('Analysing %s' % (field, ), verbose=9) for url in field_get_subfield_values(field, 'u') + field_get_subfield_values(field, 'q'): if url in tags8564s_to_add: if record_had_FFT: merge_bibdocfile_into_marc(field, tags8564s_to_add[url]) else: merge_marc_into_bibdocfile(field) del tags8564s_to_add[url] break elif bibdocfile_url_p(url) and decompose_bibdocfile_url(url)[0] == rec_id: positions_tags8564s_to_remove.append(local_position) write_message("%s to be deleted and re-synchronized" % (field, ), verbose=9) break record_delete_fields(record, '856', positions_tags8564s_to_remove) tags8564s_to_add = tags8564s_to_add.values() tags8564s_to_add.sort() for subfields in tags8564s_to_add: subfields = subfields.items() subfields.sort() record_add_field(record, '856', '4', ' ', subfields=subfields) write_message('Final record: %s' % record, verbose=9) return record def elaborate_fft_tags(record, rec_id, mode): """ Process FFT tags that should contain $a with file pathes or URLs to get the fulltext from. This function enriches record with proper 8564 URL tags, downloads fulltext files and stores them into var/data structure where appropriate. CFG_BIBUPLOAD_WGET_SLEEP_TIME defines time to sleep in seconds in between URL downloads. Note: if an FFT tag contains multiple $a subfields, we upload them into different 856 URL tags in the metadata. See regression test case test_multiple_fft_insert_via_http(). """ # Let's define some handy sub procedure. def _add_new_format(bibdoc, url, format, docname, doctype, newname, description, comment, flags): """Adds a new format for a given bibdoc. Returns True when everything's fine.""" write_message('Add new format to %s url: %s, format: %s, docname: %s, doctype: %s, newname: %s, description: %s, comment: %s, flags: %s' % (repr(bibdoc), url, format, docname, doctype, newname, description, comment, flags), verbose=9) try: if not url: # Not requesting a new url. Just updating comment & description return _update_description_and_comment(bibdoc, docname, format, description, comment, flags) tmpurl = download_url(url, format) try: try: bibdoc.add_file_new_format(tmpurl, description=description, comment=comment, flags=flags) except StandardError, e: write_message("('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') not inserted because format already exists (%s)." % (url, format, docname, doctype, newname, description, comment, flags, e), stream=sys.stderr) raise finally: os.remove(tmpurl) except Exception, e: write_message("Error in downloading '%s' because of: %s" % (url, e), stream=sys.stderr) raise return True def _add_new_version(bibdoc, url, format, docname, doctype, newname, description, comment, flags): """Adds a new version for a given bibdoc. Returns True when everything's fine.""" write_message('Add new version to %s url: %s, format: %s, docname: %s, doctype: %s, newname: %s, description: %s, comment: %s, flags: %s' % (repr(bibdoc), url, format, docname, doctype, newname, description, comment, flags)) try: if not url: return _update_description_and_comment(bibdoc, docname, format, description, comment, flags) tmpurl = download_url(url, format) try: try: bibdoc.add_file_new_version(tmpurl, description=description, comment=comment, flags=flags) except StandardError, e: write_message("('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') not inserted because '%s'." % (url, format, docname, doctype, newname, description, comment, flags, e), stream=sys.stderr) raise finally: os.remove(tmpurl) except Exception, e: write_message("Error in downloading '%s' because of: %s" % (url, e), stream=sys.stderr) raise return True def _update_description_and_comment(bibdoc, docname, format, description, comment, flags): """Directly update comments and descriptions.""" write_message('Just updating description and comment for %s with format %s with description %s, comment %s and flags %s' % (docname, format, description, comment, flags), verbose=9) try: bibdoc.set_description(description, format) bibdoc.set_comment(comment, format) for flag in CFG_BIBDOCFILE_AVAILABLE_FLAGS: if flag in flags: bibdoc.set_flag(flag, format) else: bibdoc.unset_flag(flag, format) except StandardError, e: write_message("('%s', '%s', '%s', '%s', '%s') description and comment not updated because '%s'." % (docname, format, description, comment, flags, e)) raise return True - def _add_new_icon(bibdoc, url, restriction): - """Adds a new icon to an existing bibdoc, replacing the previous one if it exists. If url is empty, just remove the current icon.""" - if not url: - bibdoc.delete_icon() - else: - try: - path = urllib2.urlparse.urlsplit(url)[2] - filename = os.path.split(path)[-1] - format = filename[len(file_strip_ext(filename)):] - tmpurl = download_url(url, format) - try: - try: - icondoc = bibdoc.add_icon(tmpurl, 'icon-%s' % bibdoc.get_docname()) - if restriction and restriction != KEEP_OLD_VALUE: - icondoc.set_status(restriction) - except StandardError, e: - write_message("('%s', '%s') icon not added because '%s'." % (url, format, e), stream=sys.stderr) - raise - finally: - os.remove(tmpurl) - except Exception, e: - write_message("Error in downloading '%s' because of: %s" % (url, e), stream=sys.stderr) - raise - return True - if mode == 'delete': raise StandardError('FFT tag specified but bibupload executed in --delete mode') tuple_list = extract_tag_from_record(record, 'FFT') if tuple_list: # FFT Tags analysis write_message("FFTs: "+str(tuple_list), verbose=9) docs = {} # docnames and their data for fft in record_get_field_instances(record, 'FFT', ' ', ' '): # Let's discover the type of the document # This is a legacy field and will not be enforced any particular # check on it. doctype = field_get_subfield_values(fft, 't') if doctype: doctype = doctype[0] else: # Default is Main doctype = 'Main' # Let's discover the url. url = field_get_subfield_values(fft, 'a') if url: url = url[0] try: check_valid_url(url) except StandardError, e: raise StandardError, "fft '%s' specifies in $a a location ('%s') with problems: %s" % (fft, url, e) else: url = '' # Let's discover the description description = field_get_subfield_values(fft, 'd') if description != []: description = description[0] else: if mode == 'correct' and doctype != 'FIX-MARC': ## If the user require to correct, and do not specify ## a description this means she really want to ## modify the description. description = '' else: description = KEEP_OLD_VALUE # Let's discover the desired docname to be created/altered name = field_get_subfield_values(fft, 'n') if name: ## Let's remove undesired extensions name = file_strip_ext(name[0] + '.pdf') else: if url: name = get_docname_from_url(url) elif mode != 'correct' and doctype != 'FIX-MARC': raise StandardError, "Warning: fft '%s' doesn't specifies either a location in $a or a docname in $n" % str(fft) else: continue # Let's discover the desired new docname in case we want to change it newname = field_get_subfield_values(fft, 'm') if newname: newname = file_strip_ext(newname[0] + '.pdf') else: newname = name # Let's discover the desired format format = field_get_subfield_values(fft, 'f') if format: format = format[0] else: if url: format = guess_format_from_url(url) else: format = "" format = normalize_format(format) # Let's discover the icon icon = field_get_subfield_values(fft, 'x') if icon != []: icon = icon[0] if icon != KEEP_OLD_VALUE: try: check_valid_url(icon) except StandardError, e: raise StandardError, "fft '%s' specifies in $x an icon ('%s') with problems: %s" % (fft, icon, e) else: - if mode == 'correct' and doctype != 'FIX-MARC': - ## See comment on description - icon = '' - else: - icon = KEEP_OLD_VALUE + icon = '' # Let's discover the comment comment = field_get_subfield_values(fft, 'z') if comment != []: comment = comment[0] else: if mode == 'correct' and doctype != 'FIX-MARC': ## See comment on description comment = '' else: comment = KEEP_OLD_VALUE # Let's discover the restriction restriction = field_get_subfield_values(fft, 'r') if restriction != []: restriction = restriction[0] else: if mode == 'correct' and doctype != 'FIX-MARC': ## See comment on description restriction = '' else: restriction = KEEP_OLD_VALUE version = field_get_subfield_values(fft, 'v') if version: version = version[0] else: version = '' flags = field_get_subfield_values(fft, 'o') for flag in flags: if flag not in CFG_BIBDOCFILE_AVAILABLE_FLAGS: raise StandardError, "fft '%s' specifies a non available flag: %s" % (fft, flag) if docs.has_key(name): # new format considered - (doctype2, newname2, restriction2, icon2, version2, urls) = docs[name] + (doctype2, newname2, restriction2, version2, urls) = docs[name] if doctype2 != doctype: raise StandardError, "fft '%s' specifies a different doctype from previous fft with docname '%s'" % (str(fft), name) if newname2 != newname: raise StandardError, "fft '%s' specifies a different newname from previous fft with docname '%s'" % (str(fft), name) if restriction2 != restriction: raise StandardError, "fft '%s' specifies a different restriction from previous fft with docname '%s'" % (str(fft), name) - if icon2 != icon: - raise StandardError, "fft '%x' specifies a different icon than the previous fft with docname '%s'" % (str(fft), name) if version2 != version: raise StandardError, "fft '%x' specifies a different version than the previous fft with docname '%s'" % (str(fft), name) for (url2, format2, description2, comment2, flags2) in urls: if format == format2: raise StandardError, "fft '%s' specifies a second file '%s' with the same format '%s' from previous fft with docname '%s'" % (str(fft), url, format, name) if url or format: urls.append((url, format, description, comment, flags)) + if icon: + urls.append((icon, icon[len(file_strip_ext(icon)):] + ';icon', description, comment, flags)) else: if url or format: - docs[name] = (doctype, newname, restriction, icon, version, [(url, format, description, comment, flags)]) + docs[name] = (doctype, newname, restriction, version, [(url, format, description, comment, flags)]) + if icon: + docs[name][4].append((icon, icon[len(file_strip_ext(icon)):] + ';icon', description, comment, flags)) + elif icon: + docs[name] = (doctype, newname, restriction, version, [(icon, icon[len(file_strip_ext(icon)):] + ';icon', description, comment, flags)]) else: - docs[name] = (doctype, newname, restriction, icon, version, []) + docs[name] = (doctype, newname, restriction, version, []) write_message('Result of FFT analysis:\n\tDocs: %s' % (docs,), verbose=9) # Let's remove all FFT tags record_delete_field(record, 'FFT', ' ', ' ') # Preprocessed data elaboration bibrecdocs = BibRecDocs(rec_id) if mode == 'replace': # First we erase previous bibdocs for bibdoc in bibrecdocs.list_bibdocs(): bibdoc.delete() bibrecdocs.build_bibdoc_list() - for docname, (doctype, newname, restriction, icon, version, urls) in docs.iteritems(): - write_message("Elaborating olddocname: '%s', newdocname: '%s', doctype: '%s', restriction: '%s', icon: '%s', urls: '%s', mode: '%s'" % (docname, newname, doctype, restriction, icon, urls, mode), verbose=9) + for docname, (doctype, newname, restriction, version, urls) in docs.iteritems(): + write_message("Elaborating olddocname: '%s', newdocname: '%s', doctype: '%s', restriction: '%s', urls: '%s', mode: '%s'" % (docname, newname, doctype, restriction, urls, mode), verbose=9) if mode in ('insert', 'replace'): # new bibdocs, new docnames, new marc if newname in bibrecdocs.get_bibdoc_names(): write_message("('%s', '%s') not inserted because docname already exists." % (newname, urls), stream=sys.stderr) raise StandardError try: bibdoc = bibrecdocs.add_bibdoc(doctype, newname) bibdoc.set_status(restriction) except Exception, e: write_message("('%s', '%s', '%s') not inserted because: '%s'." % (doctype, newname, urls, e), stream=sys.stderr) raise StandardError for (url, format, description, comment, flags) in urls: assert(_add_new_format(bibdoc, url, format, docname, doctype, newname, description, comment, flags)) - if icon and not icon == KEEP_OLD_VALUE: - assert(_add_new_icon(bibdoc, icon, restriction)) elif mode == 'replace_or_insert': # to be thought as correct_or_insert for bibdoc in bibrecdocs.list_bibdocs(): if bibdoc.get_docname() == docname: if doctype not in ('PURGE', 'DELETE', 'EXPUNGE', 'REVERT', 'FIX-ALL', 'FIX-MARC', 'DELETE-FILE'): if newname != docname: try: bibdoc.change_name(newname) - icon = bibdoc.get_icon() - if icon: - icon.change_name('icon-%s' % newname) except StandardError, e: write_message(e, stream=sys.stderr) raise found_bibdoc = False for bibdoc in bibrecdocs.list_bibdocs(): if bibdoc.get_docname() == newname: found_bibdoc = True if doctype == 'PURGE': bibdoc.purge() elif doctype == 'DELETE': bibdoc.delete() elif doctype == 'EXPUNGE': bibdoc.expunge() elif doctype == 'FIX-ALL': bibrecdocs.fix(docname) elif doctype == 'FIX-MARC': pass elif doctype == 'DELETE-FILE': if urls: for (url, format, description, comment, flags) in urls: bibdoc.delete_file(format, version) elif doctype == 'REVERT': try: bibdoc.revert(version) except Exception, e: write_message('(%s, %s) not correctly reverted: %s' % (newname, version, e), stream=sys.stderr) raise else: if restriction != KEEP_OLD_VALUE: bibdoc.set_status(restriction) # Since the docname already existed we have to first # bump the version by pushing the first new file # then pushing the other files. if urls: (first_url, first_format, first_description, first_comment, first_flags) = urls[0] other_urls = urls[1:] assert(_add_new_version(bibdoc, first_url, first_format, docname, doctype, newname, first_description, first_comment, first_flags)) for (url, format, description, comment, flags) in other_urls: assert(_add_new_format(bibdoc, url, format, docname, doctype, newname, description, comment, flags)) - if icon != KEEP_OLD_VALUE: - assert(_add_new_icon(bibdoc, icon, restriction)) if not found_bibdoc: bibdoc = bibrecdocs.add_bibdoc(doctype, newname) for (url, format, description, comment, flags) in urls: assert(_add_new_format(bibdoc, url, format, docname, doctype, newname, description, comment, flags)) - if icon and not icon == KEEP_OLD_VALUE: - assert(_add_new_icon(bibdoc, icon, restriction)) elif mode == 'correct': for bibdoc in bibrecdocs.list_bibdocs(): if bibdoc.get_docname() == docname: if doctype not in ('PURGE', 'DELETE', 'EXPUNGE', 'REVERT', 'FIX-ALL', 'FIX-MARC', 'DELETE-FILE'): if newname != docname: try: bibdoc.change_name(newname) - icon = bibdoc.get_icon() - if icon: - icon.change_name('icon-%s' % newname) except StandardError, e: write_message('Error in renaming %s to %s: %s' % (docname, newname, e), stream=sys.stderr) raise found_bibdoc = False for bibdoc in bibrecdocs.list_bibdocs(): if bibdoc.get_docname() == newname: found_bibdoc = True if doctype == 'PURGE': bibdoc.purge() elif doctype == 'DELETE': bibdoc.delete() elif doctype == 'EXPUNGE': bibdoc.expunge() elif doctype == 'FIX-ALL': bibrecdocs.fix(newname) elif doctype == 'FIX-MARC': pass elif doctype == 'DELETE-FILE': if urls: for (url, format, description, comment, flags) in urls: bibdoc.delete_file(format, version) elif doctype == 'REVERT': try: bibdoc.revert(version) except Exception, e: write_message('(%s, %s) not correctly reverted: %s' % (newname, version, e), stream=sys.stderr) raise else: if restriction != KEEP_OLD_VALUE: bibdoc.set_status(restriction) if urls: (first_url, first_format, first_description, first_comment, first_flags) = urls[0] other_urls = urls[1:] assert(_add_new_version(bibdoc, first_url, first_format, docname, doctype, newname, first_description, first_comment, first_flags)) for (url, format, description, comment, flags) in other_urls: assert(_add_new_format(bibdoc, url, format, docname, description, doctype, newname, description, comment, flags)) - if icon != KEEP_OLD_VALUE: - _add_new_icon(bibdoc, icon, restriction) if not found_bibdoc: if doctype in ('PURGE', 'DELETE', 'EXPUNGE', 'FIX-ALL', 'FIX-MARC', 'DELETE-FILE', 'REVERT'): write_message("('%s', '%s', '%s') not performed because '%s' docname didn't existed." % (doctype, newname, urls, docname), stream=sys.stderr) raise StandardError else: bibdoc = bibrecdocs.add_bibdoc(doctype, newname) for (url, format, description, comment) in urls: assert(_add_new_format(bibdoc, url, format, docname, doctype, newname, description, comment)) - if icon and not icon == KEEP_OLD_VALUE: - assert(_add_new_icon(bibdoc, icon, restriction)) elif mode == 'append': try: found_bibdoc = False for bibdoc in bibrecdocs.list_bibdocs(): if bibdoc.get_docname() == docname: found_bibdoc = True for (url, format, description, comment, flags) in urls: assert(_add_new_format(bibdoc, url, format, docname, doctype, newname, description, comment, flags)) - if icon not in ('', KEEP_OLD_VALUE): - assert(_add_new_icon(bibdoc, icon, restriction)) if not found_bibdoc: try: bibdoc = bibrecdocs.add_bibdoc(doctype, docname) bibdoc.set_status(restriction) for (url, format, description, comment, flags) in urls: assert(_add_new_format(bibdoc, url, format, docname, doctype, newname, description, comment, flags)) - if icon and not icon == KEEP_OLD_VALUE: - assert(_add_new_icon(bibdoc, icon, restriction)) except Exception, e: register_exception() write_message("('%s', '%s', '%s') not appended because: '%s'." % (doctype, newname, urls, e), stream=sys.stderr) raise except: register_exception() raise return record def insert_fmt_tags(record, rec_id, opt_mode): """Process and insert FMT tags""" fmt_fields = record_get_field_instances(record, 'FMT') if fmt_fields: for fmt_field in fmt_fields: # Get the d, f, g subfields of the FMT tag try: d_value = field_get_subfield_values(fmt_field, "d")[0] except IndexError: d_value = "" try: f_value = field_get_subfield_values(fmt_field, "f")[0] except IndexError: f_value = "" try: g_value = field_get_subfield_values(fmt_field, "g")[0] except IndexError: g_value = "" # Update the format res = update_bibfmt_format(rec_id, g_value, f_value, d_value) if res == 1: write_message(" Failed: Error during update_bibfmt", verbose=1, stream=sys.stderr) # If we are in format mode, we only care about the FMT tag if opt_mode == 'format': return 0 # We delete the FMT Tag of the record record_delete_field(record, 'FMT') write_message(" -Delete field FMT from record : DONE", verbose=2) return record elif opt_mode == 'format': write_message(" Failed: Format updated failed : No tag FMT found", verbose=1, stream=sys.stderr) return None else: return record ### Update functions def update_bibrec_modif_date(now, bibrec_id): """Update the date of the record in bibrec table """ query = """UPDATE bibrec SET modification_date=%s WHERE id=%s""" params = (now, bibrec_id) try: run_sql(query, params) write_message(" -Update record modification date : DONE" , verbose=2) except Error, error: write_message(" Error during update_bibrec_modif_date function : %s" % error, verbose=1, stream=sys.stderr) def update_bibfmt_format(id_bibrec, format_value, format_name, modification_date=None): """Update the format in the table bibfmt""" if modification_date is None: modification_date = time.strftime('%Y-%m-%d %H:%M:%S') else: try: time.strptime(modification_date, "%Y-%m-%d %H:%M:%S") except ValueError: modification_date = '1970-01-01 00:00:00' # We check if the format is already in bibFmt nb_found = find_record_format(id_bibrec, format_name) if nb_found == 1: # we are going to update the format # compress the format_value value pickled_format_value = compress(format_value) # update the format: query = """UPDATE bibfmt SET last_updated=%s, value=%s WHERE id_bibrec=%s AND format=%s""" params = (modification_date, pickled_format_value, id_bibrec, format_name) try: row_id = run_sql(query, params) if row_id is None: write_message(" Failed: Error during update_bibfmt_format function", verbose=1, stream=sys.stderr) return 1 else: write_message(" -Update the format %s in bibfmt : DONE" % format_name , verbose=2) return 0 except Error, error: write_message(" Error during the update_bibfmt_format function : %s " % error, verbose=1, stream=sys.stderr) elif nb_found > 1: write_message(" Failed: Same format %s found several time in bibfmt for the same record." % format_name, verbose=1, stream=sys.stderr) return 1 else: # Insert the format information in BibFMT res = insert_bibfmt(id_bibrec, format_value, format_name, modification_date) if res is None: write_message(" Failed: Error during insert_bibfmt", verbose=1, stream=sys.stderr) return 1 else: write_message(" -Insert the format %s in bibfmt : DONE" % format_name , verbose=2) return 0 def archive_marcxml_for_history(recID): """ Archive current MARCXML format of record RECID from BIBFMT table into hstRECORD table. Useful to keep MARCXML history of records. Return 0 if everything went fine. Return 1 otherwise. """ try: res = run_sql("SELECT id_bibrec, value, last_updated FROM bibfmt WHERE format='xm' AND id_bibrec=%s", (recID,)) if res: run_sql("""INSERT INTO hstRECORD (id_bibrec, marcxml, job_id, job_name, job_person, job_date, job_details) VALUES (%s,%s,%s,%s,%s,%s,%s)""", (res[0][0], res[0][1], task_get_task_param('task_id', 0), 'bibupload', task_get_task_param('user','UNKNOWN'), res[0][2], 'mode: ' + task_get_option('mode','UNKNOWN') + '; file: ' + task_get_option('file_path','UNKNOWN') + '.')) except Error, error: write_message(" Error during archive_marcxml_for_history: %s " % error, verbose=1, stream=sys.stderr) return 1 return 0 def update_database_with_metadata(record, rec_id, oai_rec_id = "oai"): """Update the database tables with the record and the record id given in parameter""" for tag in record.keys(): # check if tag is not a special one: if tag not in CFG_BIBUPLOAD_SPECIAL_TAGS: # for each tag there is a list of tuples representing datafields tuple_list = record[tag] # this list should contain the elements of a full tag [tag, ind1, ind2, subfield_code] tag_list = [] tag_list.append(tag) for single_tuple in tuple_list: # these are the contents of a single tuple subfield_list = single_tuple[0] ind1 = single_tuple[1] ind2 = single_tuple[2] # append the ind's to the full tag if ind1 == '' or ind1 == ' ': tag_list.append('_') else: tag_list.append(ind1) if ind2 == '' or ind2 == ' ': tag_list.append('_') else: tag_list.append(ind2) datafield_number = single_tuple[4] if tag in CFG_BIBUPLOAD_SPECIAL_TAGS: # nothing to do for special tags (FFT, FMT) pass elif tag in CFG_BIBUPLOAD_CONTROLFIELD_TAGS and tag != "001": value = single_tuple[3] # get the full tag full_tag = ''.join(tag_list) # update the tables write_message(" insertion of the tag "+full_tag+" with the value "+value, verbose=9) # insert the tag and value into into bibxxx (table_name, bibxxx_row_id) = insert_record_bibxxx(full_tag, value) #print 'tname, bibrow', table_name, bibxxx_row_id; if table_name is None or bibxxx_row_id is None: write_message(" Failed : during insert_record_bibxxx", verbose=1, stream=sys.stderr) # connect bibxxx and bibrec with the table bibrec_bibxxx res = insert_record_bibrec_bibxxx(table_name, bibxxx_row_id, datafield_number, rec_id) if res is None: write_message(" Failed : during insert_record_bibrec_bibxxx", verbose=1, stream=sys.stderr) else: # get the tag and value from the content of each subfield for subfield in subfield_list: subtag = subfield[0] value = subfield[1] tag_list.append(subtag) # get the full tag full_tag = ''.join(tag_list) # update the tables write_message(" insertion of the tag "+full_tag+" with the value "+value, verbose=9) # insert the tag and value into into bibxxx (table_name, bibxxx_row_id) = insert_record_bibxxx(full_tag, value) if table_name is None or bibxxx_row_id is None: write_message(" Failed : during insert_record_bibxxx", verbose=1, stream=sys.stderr) # connect bibxxx and bibrec with the table bibrec_bibxxx res = insert_record_bibrec_bibxxx(table_name, bibxxx_row_id, datafield_number, rec_id) if res is None: write_message(" Failed : during insert_record_bibrec_bibxxx", verbose=1, stream=sys.stderr) # remove the subtag from the list tag_list.pop() tag_list.pop() tag_list.pop() tag_list.pop() write_message(" -Update the database with metadata : DONE", verbose=2) log_record_uploading(oai_rec_id, task_get_task_param('task_id', 0), rec_id, 'P') def append_new_tag_to_old_record(record, rec_old, opt_tag, opt_mode): """Append new tags to a old record""" def _append_tag(tag): # Reference mode append only reference tag if opt_mode == 'reference': if tag == CFG_BIBUPLOAD_REFERENCE_TAG: for single_tuple in record[tag]: # We retrieve the information of the tag subfield_list = single_tuple[0] ind1 = single_tuple[1] ind2 = single_tuple[2] # We add the datafield to the old record write_message(" Adding tag: %s ind1=%s ind2=%s code=%s" % (tag, ind1, ind2, subfield_list), verbose=9) newfield_number = record_add_field(rec_old, tag, ind1, ind2, subfields=subfield_list) if newfield_number is None: write_message(" Error when adding the field"+tag, verbose=1, stream=sys.stderr) else: if tag in CFG_BIBUPLOAD_CONTROLFIELD_TAGS: if tag == '001': pass else: # if it is a controlfield,just access the value for single_tuple in record[tag]: controlfield_value = single_tuple[3] # add the field to the old record newfield_number = record_add_field(rec_old, tag, controlfield_value=controlfield_value) if newfield_number is None: write_message(" Error when adding the field"+tag, verbose=1, stream=sys.stderr) else: # For each tag there is a list of tuples representing datafields for single_tuple in record[tag]: # We retrieve the information of the tag subfield_list = single_tuple[0] ind1 = single_tuple[1] ind2 = single_tuple[2] if '%s%s%s' % (tag, ind1 == ' ' and '_' or ind1, ind2 == ' ' and '_' or ind2) in (CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[:5], CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[:5]): ## We don't want to append the external identifier ## if it is already existing. if record_find_field(rec_old, tag, single_tuple)[0] is not None: write_message(" Not adding tag: %s ind1=%s ind2=%s subfields=%s: it's already there" % (tag, ind1, ind2, subfield_list), verbose=9) continue # We add the datafield to the old record write_message(" Adding tag: %s ind1=%s ind2=%s subfields=%s" % (tag, ind1, ind2, subfield_list), verbose=9) newfield_number = record_add_field(rec_old, tag, ind1, ind2, subfields=subfield_list) if newfield_number is None: write_message(" Error when adding the field"+tag, verbose=1, stream=sys.stderr) if opt_tag is not None: _append_tag(opt_tag) else: # Go through each tag in the appended record for tag in record: _append_tag(tag) return rec_old def copy_strong_tags_from_old_record(record, rec_old): """ Look for strong tags in RECORD and REC_OLD. If no strong tags are found in RECORD, then copy them over from REC_OLD. This function modifies RECORD structure on the spot. """ for strong_tag in CFG_BIBUPLOAD_STRONG_TAGS: if not record_get_field_instances(record, strong_tag): strong_tag_old_field_instances = record_get_field_instances(rec_old, strong_tag) if strong_tag_old_field_instances: for strong_tag_old_field_instance in strong_tag_old_field_instances: sf_vals, fi_ind1, fi_ind2, controlfield, dummy = strong_tag_old_field_instance record_add_field(record, strong_tag, fi_ind1, fi_ind2, controlfield, sf_vals) return ### Delete functions def delete_tags(record, rec_old): """ Returns a record structure with all the fields in rec_old minus the fields in record. @param record: The record containing tags to delete. @type record: record structure @param rec_old: The original record. @type rec_old: record structure @return: The modified record. @rtype: record structure """ returned_record = copy.deepcopy(rec_old) for tag, fields in record.iteritems(): if tag in ('001', ): continue for field in fields: local_position = record_find_field(returned_record, tag, field)[1] if local_position is not None: record_delete_field(returned_record, tag, field_position_local=local_position) return returned_record def delete_tags_to_correct(record, rec_old, opt_tag): """ Delete tags from REC_OLD which are also existing in RECORD. When deleting, pay attention not only to tags, but also to indicators, so that fields with the same tags but different indicators are not deleted. """ ## Some fields are controlled via provenance information. ## We should re-add saved fields at the end. fields_to_readd = {} for tag in CFG_BIBUPLOAD_CONTROLLED_PROVENANCE_TAGS: if tag[:3] in record: tmp_field_instances = record_get_field_instances(record, tag[:3], tag[3], tag[4]) ## Let's discover the provenance that will be updated provenances_to_update = [] for instance in tmp_field_instances: for code, value in instance[0]: if code == tag[5]: if value not in provenances_to_update: provenances_to_update.append(value) break else: ## The provenance is not specified. ## let's add the special empty provenance. if '' not in provenances_to_update: provenances_to_update.append('') potential_fields_to_readd = record_get_field_instances(rec_old, tag[:3], tag[3], tag[4]) ## Let's take all the field corresponding to tag ## Let's save apart all the fields that should be updated, but ## since they have a different provenance not mentioned in record ## they should be preserved. fields = [] for sf_vals, ind1, ind2, dummy_cf, dummy_line in potential_fields_to_readd: for code, value in sf_vals: if code == tag[5]: if value not in provenances_to_update: fields.append(sf_vals) break else: if '' not in provenances_to_update: ## Empty provenance, let's protect in any case fields.append(sf_vals) fields_to_readd[tag] = fields # browse through all the tags from the MARCXML file: for tag in record: # do we have to delete only a special tag or any tag? if opt_tag is None or opt_tag == tag: # check if the tag exists in the old record too: if tag in rec_old and tag != '001': # the tag does exist, so delete all record's tag+ind1+ind2 combinations from rec_old for dummy_sf_vals, ind1, ind2, dummy_cf, field_number in record[tag]: write_message(" Delete tag: " + tag + " ind1=" + ind1 + " ind2=" + ind2, verbose=9) record_delete_field(rec_old, tag, ind1, ind2) ## Ok, we readd necessary fields! for tag, fields in fields_to_readd.iteritems(): for sf_vals in fields: write_message(" Adding tag: " + tag[:3] + " ind1=" + tag[3] + " ind2=" + tag[4] + " code=" + str(sf_vals), verbose=9) record_add_field(rec_old, tag[:3], tag[3], tag[4], subfields=sf_vals) def delete_bibrec_bibxxx(record, id_bibrec): """Delete the database record from the table bibxxx given in parameters""" # we clear all the rows from bibrec_bibxxx from the old record for tag in record.keys(): if tag not in CFG_BIBUPLOAD_SPECIAL_TAGS: # for each name construct the bibrec_bibxxx table name table_name = 'bibrec_bib'+tag[0:2]+'x' # delete all the records with proper id_bibrec query = """DELETE FROM `%s` where id_bibrec = %s""" params = (table_name, id_bibrec) try: run_sql(query % params) except Error, error: write_message(" Error during the delete_bibrec_bibxxx function : %s " % error, verbose=1, stream=sys.stderr) def wipe_out_record_from_all_tables(recid): """ Wipe out completely the record and all its traces of RECID from the database (bibrec, bibrec_bibxxx, bibxxx, bibfmt). Useful for the time being for test cases. """ # delete all the linked bibdocs for bibdoc in BibRecDocs(recid).list_bibdocs(): bibdoc.expunge() # delete from bibrec: run_sql("DELETE FROM bibrec WHERE id=%s", (recid,)) # delete from bibrec_bibxxx: for i in range(0, 10): for j in range(0, 10): run_sql("DELETE FROM %(bibrec_bibxxx)s WHERE id_bibrec=%%s" % \ {'bibrec_bibxxx': "bibrec_bib%i%ix" % (i, j)}, (recid,)) # delete all unused bibxxx values: for i in range(0, 10): for j in range(0, 10): run_sql("DELETE %(bibxxx)s FROM %(bibxxx)s " \ " LEFT JOIN %(bibrec_bibxxx)s " \ " ON %(bibxxx)s.id=%(bibrec_bibxxx)s.id_bibxxx " \ " WHERE %(bibrec_bibxxx)s.id_bibrec IS NULL" % \ {'bibxxx': "bib%i%ix" % (i, j), 'bibrec_bibxxx': "bibrec_bib%i%ix" % (i, j)}) # delete from bibfmt: run_sql("DELETE FROM bibfmt WHERE id_bibrec=%s", (recid,)) # delete from bibrec_bibdoc: run_sql("DELETE FROM bibrec_bibdoc WHERE id_bibrec=%s", (recid,)) return def delete_bibdoc(id_bibrec): """Delete document from bibdoc which correspond to the bibrec id given in parameter""" query = """UPDATE bibdoc SET status='DELETED' WHERE id IN (SELECT id_bibdoc FROM bibrec_bibdoc WHERE id_bibrec=%s)""" params = (id_bibrec,) try: run_sql(query, params) except Error, error: write_message(" Error during the delete_bibdoc function : %s " % error, verbose=1, stream=sys.stderr) def delete_bibrec_bibdoc(id_bibrec): """Delete the bibrec record from the table bibrec_bibdoc given in parameter""" # delete all the records with proper id_bibrec query = """DELETE FROM bibrec_bibdoc WHERE id_bibrec=%s""" params = (id_bibrec,) try: run_sql(query, params) except Error, error: write_message(" Error during the delete_bibrec_bibdoc function : %s " % error, verbose=1, stream=sys.stderr) def main(): """Main that construct all the bibtask.""" task_init(authorization_action='runbibupload', authorization_msg="BibUpload Task Submission", description="""Receive MARC XML file and update appropriate database tables according to options. Examples: $ bibupload -i input.xml """, help_specific_usage=""" -a, --append\t\tnew fields are appended to the existing record -c, --correct\t\tfields are replaced by the new ones in the existing record -f, --format\t\ttakes only the FMT fields into account. Does not update -i, --insert\t\tinsert the new record in the database -r, --replace\t\tthe existing record is entirely replaced by the new one -z, --reference\tupdate references (update only 999 fields) -d, --delete\t\tspecified fields are deleted in existing record -S, --stage=STAGE\tstage to start from in the algorithm (0: always done; 1: FMT tags; \t\t\t2: FFT tags; 3: BibFmt; 4: Metadata update; 5: time update) -n, --notimechange\tdo not change record last modification date when updating -o, --holdingpen\t\tInsert record into holding pen instead of the normal database """, version=__revision__, specific_params=("ircazdS:fno", [ "insert", "replace", "correct", "append", "reference", "delete", "stage=", "format", "notimechange", "holdingpen", ]), task_submit_elaborate_specific_parameter_fnc=task_submit_elaborate_specific_parameter, task_run_fnc=task_run_core) def task_submit_elaborate_specific_parameter(key, value, opts, args): """ Given the string key it checks it's meaning, eventually using the value. Usually it fills some key in the options dict. It must return True if it has elaborated the key, False, if it doesn't know that key. eg: if key in ['-n', '--number']: task_get_option(\1) = value return True return False """ # No time change option if key in ("-n", "--notimechange"): task_set_option('notimechange', 1) # Insert mode option elif key in ("-i", "--insert"): if task_get_option('mode') == 'replace': # if also replace found, then set to replace_or_insert task_set_option('mode', 'replace_or_insert') else: task_set_option('mode', 'insert') fix_argv_paths([args[0]]) task_set_option('file_path', os.path.abspath(args[0])) # Replace mode option elif key in ("-r", "--replace"): if task_get_option('mode') == 'insert': # if also insert found, then set to replace_or_insert task_set_option('mode', 'replace_or_insert') else: task_set_option('mode', 'replace') fix_argv_paths([args[0]]) task_set_option('file_path', os.path.abspath(args[0])) # Holding pen mode option elif key in ("-o", "--holdingpen"): write_message("Holding pen mode", verbose=3) task_set_option('mode', 'holdingpen') fix_argv_paths([args[0]]) task_set_option('file_path', os.path.abspath(args[0])) # Correct mode option elif key in ("-c", "--correct"): task_set_option('mode', 'correct') fix_argv_paths([args[0]]) task_set_option('file_path', os.path.abspath(args[0])) # Append mode option elif key in ("-a", "--append"): task_set_option('mode', 'append') fix_argv_paths([args[0]]) task_set_option('file_path', os.path.abspath(args[0])) # Reference mode option elif key in ("-z", "--reference"): task_set_option('mode', 'reference') fix_argv_paths([args[0]]) task_set_option('file_path', os.path.abspath(args[0])) elif key in ("-d", "--delete"): task_set_option('mode', 'delete') fix_argv_paths([args[0]]) task_set_option('file_path', os.path.abspath(args[0])) # Format mode option elif key in ("-f", "--format"): task_set_option('mode', 'format') fix_argv_paths([args[0]]) task_set_option('file_path', os.path.abspath(args[0])) # Stage elif key in ("-S", "--stage"): try: value = int(value) except ValueError: print >> sys.stderr, """The value specified for --stage must be a valid integer, not %s""" % value return False if not (0 <= value <= 5): print >> sys.stderr, """The value specified for --stage must be comprised between 0 and 5""" return False task_set_option('stage_to_start_from', value) else: return False return True def task_submit_check_options(): """ Reimplement this method for having the possibility to check options before submitting the task, in order for example to provide default values. It must return False if there are errors in the options. """ if task_get_option('mode') is None: write_message("Please specify at least one update/insert mode!") return False if task_get_option('file_path') is None: write_message("Missing filename! -h for help.") return False return True def writing_rights_p(): """Return True in case bibupload has the proper rights to write in the fulltext file folder.""" filename = os.path.join(CFG_WEBSUBMIT_FILEDIR, 'test.txt') try: if not os.path.exists(CFG_WEBSUBMIT_FILEDIR): os.makedirs(CFG_WEBSUBMIT_FILEDIR) open(filename, 'w').write('TEST') assert(open(filename).read() == 'TEST') os.remove(filename) except: register_exception() return False return True def task_run_core(): """ Reimplement to add the body of the task.""" error = 0 write_message("Input file '%s', input mode '%s'." % (task_get_option('file_path'), task_get_option('mode'))) write_message("STAGE 0:", verbose=2) if task_get_option('file_path') is not None: write_message("start preocessing", verbose=3) task_update_progress("Reading XML input") recs = xml_marc_to_records(open_marc_file(task_get_option('file_path'))) stat['nb_records_to_upload'] = len(recs) write_message(" -Open XML marc: DONE", verbose=2) task_sleep_now_if_required(can_stop_too=True) write_message("Entering records loop", verbose=3) if recs is not None: # We proceed each record by record for record in recs: record_id = record_extract_oai_id(record) task_sleep_now_if_required(can_stop_too=True) if task_get_option("mode") == "holdingpen": #inserting into the holding pen write_message("Inserting into holding pen", verbose=3) insert_record_into_holding_pen(record, record_id) else: write_message("Inserting into main database", verbose=3) error = bibupload( record, opt_tag=task_get_option('tag'), opt_mode=task_get_option('mode'), opt_stage_to_start_from=task_get_option('stage_to_start_from'), opt_notimechange=task_get_option('notimechange'), oai_rec_id = record_id) if error[0] == 1: if record: write_message(record_xml_output(record), stream=sys.stderr) else: write_message("Record could not have been parsed", stream=sys.stderr) stat['nb_errors'] += 1 elif error[0] == 2: if record: write_message(record_xml_output(record), stream=sys.stderr) else: write_message("Record could not have been parsed", stream=sys.stderr) task_update_progress("Done %d out of %d." % \ (stat['nb_records_inserted'] + \ stat['nb_records_updated'], stat['nb_records_to_upload'])) else: write_message(" Error bibupload failed: No record found", verbose=1, stream=sys.stderr) if task_get_task_param('verbose') >= 1: # Print out the statistics print_out_bibupload_statistics() # Check if they were errors return not stat['nb_errors'] >= 1 def log_record_uploading(oai_rec_id, task_id, bibrec_id, insertion_db): if oai_rec_id != "" and oai_rec_id != None: query = """UPDATE oaiHARVESTLOG SET date_inserted=NOW(), inserted_to_db=%s, id_bibrec=%s WHERE oai_id = %s AND bibupload_task_id = %s ORDER BY date_harvested LIMIT 1""" try: run_sql(query, (str(insertion_db), str(bibrec_id), str(oai_rec_id), str(task_id), )) except Error, error: write_message(" Error during the log_record_uploading function : %s " % error, verbose=1, stream=sys.stderr) if __name__ == "__main__": main() diff --git a/modules/bibupload/lib/bibupload_regression_tests.py b/modules/bibupload/lib/bibupload_regression_tests.py index aabf17222..6c6e877e9 100644 --- a/modules/bibupload/lib/bibupload_regression_tests.py +++ b/modules/bibupload/lib/bibupload_regression_tests.py @@ -1,3522 +1,3519 @@ # -*- coding: utf-8 -*- ## ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # pylint: disable-msg=C0301 """Regression tests for the BibUpload.""" __revision__ = "$Id$" import re import unittest import datetime import os import time import sys -from urllib2 import urlopen +from urllib2 import urlopen, HTTPError if sys.hexversion < 0x2060000: from md5 import md5 else: from hashlib import md5 from invenio.config import CFG_OAI_ID_FIELD, CFG_PREFIX, CFG_SITE_URL, CFG_TMPDIR, \ CFG_WEBSUBMIT_FILEDIR, \ CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG, \ CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG, \ CFG_BIBUPLOAD_EXTERNAL_OAIID_PROVENANCE_TAG from invenio import bibupload from invenio.search_engine import print_record from invenio.dbquery import run_sql from invenio.dateutils import convert_datestruct_to_datetext from invenio.testutils import make_test_suite, run_test_suite from invenio.bibdocfile import BibRecDocs from invenio.bibtask import task_set_task_param # helper functions: def remove_tag_001_from_xmbuffer(xmbuffer): """Remove tag 001 from MARCXML buffer. Useful for testing two MARCXML buffers without paying attention to recIDs attributed during the bibupload. """ return re.sub(r'.*', '', xmbuffer) def compare_xmbuffers(xmbuffer1, xmbuffer2): """Compare two XM (XML MARC) buffers by removing whitespaces before testing. """ def remove_blanks_from_xmbuffer(xmbuffer): """Remove \n and blanks from XMBUFFER.""" out = xmbuffer.replace("\n", "") out = out.replace(" ", "") return out # remove whitespace: xmbuffer1 = remove_blanks_from_xmbuffer(xmbuffer1) xmbuffer2 = remove_blanks_from_xmbuffer(xmbuffer2) if xmbuffer1 != xmbuffer2: return "\n=" + xmbuffer1 + "=\n" + '!=' + "\n=" + xmbuffer2 + "=\n" return '' def remove_tag_001_from_hmbuffer(hmbuffer): """Remove tag 001 from HTML MARC buffer. Useful for testing two HTML MARC buffers without paying attention to recIDs attributed during the bibupload. """ return re.sub(r'(^|\n)(

)?[0-9]{9}\s001__\s\d+($|\n)', '', hmbuffer)
 
 def compare_hmbuffers(hmbuffer1, hmbuffer2):
     """Compare two HM (HTML MARC) buffers by removing whitespaces
        before testing.
     """
 
     hmbuffer1 = hmbuffer1.strip()
     hmbuffer2 = hmbuffer2.strip()
 
     # remove eventual 
...
formatting: hmbuffer1 = re.sub(r'^
', '', hmbuffer1)
     hmbuffer2 = re.sub(r'^
', '', hmbuffer2)
     hmbuffer1 = re.sub(r'
$', '', hmbuffer1) hmbuffer2 = re.sub(r'
$', '', hmbuffer2) # remove leading recid, leaving only field values: hmbuffer1 = re.sub(r'(^|\n)[0-9]{9}\s', '', hmbuffer1) hmbuffer2 = re.sub(r'(^|\n)[0-9]{9}\s', '', hmbuffer2) # remove leading whitespace: hmbuffer1 = re.sub(r'(^|\n)\s+', '', hmbuffer1) hmbuffer2 = re.sub(r'(^|\n)\s+', '', hmbuffer2) compare_hmbuffers = hmbuffer1 == hmbuffer2 if not compare_hmbuffers: return "\n=" + hmbuffer1 + "=\n" + '!=' + "\n=" + hmbuffer2 + "=\n" return '' def try_url_download(url): """Try to download a given URL""" try: open_url = urlopen(url) open_url.read() except Exception, e: - raise StandardError, "Downloading %s is impossible because of %s" \ + raise e, "Downloading %s is impossible because of %s" \ % (url, str(e)) return True class BibUploadInsertModeTest(unittest.TestCase): """Testing insert mode.""" def setUp(self): # pylint: disable-msg=C0103 """Initialise the MARCXML variable""" self.test = """ something Tester, J Y MIT Tester, K J CERN2 Tester, G CERN3 test11 test31 test12 test32 test13 test33 test21 test41 test22 test42 test14 test51 test52 Tester, T CERN """ self.test_hm = """ 100__ $$aTester, T$$uCERN 111__ $$atest11$$ctest31 111__ $$atest12$$ctest32 111__ $$atest13$$ctest33 111__ $$btest21$$dtest41 111__ $$btest22$$dtest42 111__ $$atest14 111__ $$etest51 111__ $$etest52 245__ $$asomething 700__ $$aTester, J Y$$uMIT 700__ $$aTester, K J$$uCERN2 700__ $$aTester, G$$uCERN3 """ def test_create_record_id(self): """bibupload - insert mode, trying to create a new record ID in the database""" rec_id = bibupload.create_new_record() self.assertNotEqual(-1, rec_id) def test_no_retrieve_record_id(self): """bibupload - insert mode, detection of record ID in the input file""" # We create create the record out of the xml marc recs = bibupload.xml_marc_to_records(self.test) # We call the function which should retrieve the record id rec_id = bibupload.retrieve_rec_id(recs[0], 'insert') # We compare the value found with None self.assertEqual(None, rec_id) def test_insert_complete_xmlmarc(self): """bibupload - insert mode, trying to insert complete MARCXML file""" # Initialize the global variable task_set_task_param('verbose', 0) # We create create the record out of the xml marc recs = bibupload.xml_marc_to_records(self.test) # We call the main function with the record as a parameter err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # We retrieve the inserted xml inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') # Compare if the two MARCXML are the same self.assertEqual(compare_xmbuffers(remove_tag_001_from_xmbuffer(inserted_xm), self.test), '') self.assertEqual(compare_hmbuffers(remove_tag_001_from_hmbuffer(inserted_hm), self.test_hm), '') class BibUploadAppendModeTest(unittest.TestCase): """Testing append mode.""" def setUp(self): # pylint: disable-msg=C0103 """Initialize the MARCXML variable""" self.test_existing = """ 123456789 Tester, T DESY 0003719PHOPHO """ self.test_to_append = """ 123456789 Tester, U CERN 0003719PHOPHO """ self.test_expected_xm = """ 123456789 Tester, T DESY Tester, U CERN 0003719PHOPHO """ self.test_expected_hm = """ 001__ 123456789 100__ $$aTester, T$$uDESY 100__ $$aTester, U$$uCERN 970__ $$a0003719PHOPHO """ # insert test record: test_to_upload = self.test_existing.replace('123456789', '') recs = bibupload.xml_marc_to_records(test_to_upload) task_set_task_param('verbose', 0) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') self.test_recid = recid # replace test buffers with real recid of inserted test record: self.test_existing = self.test_existing.replace('123456789', str(self.test_recid)) self.test_to_append = self.test_to_append.replace('123456789', str(self.test_recid)) self.test_expected_xm = self.test_expected_xm.replace('123456789', str(self.test_recid)) self.test_expected_hm = self.test_expected_hm.replace('123456789', str(self.test_recid)) def test_retrieve_record_id(self): """bibupload - append mode, the input file should contain a record ID""" task_set_task_param('verbose', 0) # We create create the record out of the xml marc recs = bibupload.xml_marc_to_records(self.test_to_append) # We call the function which should retrieve the record id rec_id = bibupload.retrieve_rec_id(recs[0], 'append') # We compare the value found with None self.assertEqual(self.test_recid, rec_id) # clean up after ourselves: bibupload.wipe_out_record_from_all_tables(self.test_recid) return def test_update_modification_record_date(self): """bibupload - append mode, checking the update of the modification date""" # Initialize the global variable task_set_task_param('verbose', 0) # We create create the record out of the xml marc recs = bibupload.xml_marc_to_records(self.test_existing) # We call the function which should retrieve the record id rec_id = bibupload.retrieve_rec_id(recs[0], opt_mode='append') # Retrieve current localtime now = time.localtime() # We update the modification date bibupload.update_bibrec_modif_date(convert_datestruct_to_datetext(now), rec_id) # We retrieve the modification date from the database query = """SELECT DATE_FORMAT(modification_date,'%%Y-%%m-%%d %%H:%%i:%%s') FROM bibrec where id = %s""" res = run_sql(query % rec_id) # We compare the two results self.assertEqual(res[0][0], convert_datestruct_to_datetext(now)) # clean up after ourselves: bibupload.wipe_out_record_from_all_tables(self.test_recid) return def test_append_complete_xml_marc(self): """bibupload - append mode, appending complete MARCXML file""" # Now we append a datafield # We create create the record out of the xml marc recs = bibupload.xml_marc_to_records(self.test_to_append) # We call the main function with the record as a parameter err, recid = bibupload.bibupload(recs[0], opt_mode='append') # We retrieve the inserted xm after_append_xm = print_record(recid, 'xm') after_append_hm = print_record(recid, 'hm') # Compare if the two MARCXML are the same self.assertEqual(compare_xmbuffers(after_append_xm, self.test_expected_xm), '') self.assertEqual(compare_hmbuffers(after_append_hm, self.test_expected_hm), '') # clean up after ourselves: bibupload.wipe_out_record_from_all_tables(self.test_recid) return class BibUploadCorrectModeTest(unittest.TestCase): """ Testing correcting a record containing similar tags (identical tag, different indicators). Currently CDS Invenio replaces only those tags that have matching indicators too, unlike ALEPH500 that does not pay attention to indicators, it corrects all fields with the same tag, regardless of the indicator values. """ def setUp(self): """Initialize the MARCXML test record.""" self.testrec1_xm = """ 123456789 SzGeCERN Test, Jane Test Institute Test, John Test University Cool Test, Jim Test Laboratory """ self.testrec1_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, Jane$$uTest Institute 10047 $$aTest, John$$uTest University 10048 $$aCool 10047 $$aTest, Jim$$uTest Laboratory """ self.testrec1_xm_to_correct = """ 123456789 Test, Joseph Test Academy Test2, Joseph Test2 Academy """ self.testrec1_corrected_xm = """ 123456789 SzGeCERN Test, Jane Test Institute Cool Test, Joseph Test Academy Test2, Joseph Test2 Academy """ self.testrec1_corrected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, Jane$$uTest Institute 10048 $$aCool 10047 $$aTest, Joseph$$uTest Academy 10047 $$aTest2, Joseph$$uTest2 Academy """ # insert test record: task_set_task_param('verbose', 0) test_record_xm = self.testrec1_xm.replace('123456789', '') recs = bibupload.xml_marc_to_records(test_record_xm) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recID: self.testrec1_xm = self.testrec1_xm.replace('123456789', str(recid)) self.testrec1_hm = self.testrec1_hm.replace('123456789', str(recid)) self.testrec1_xm_to_correct = self.testrec1_xm_to_correct.replace('123456789', str(recid)) self.testrec1_corrected_xm = self.testrec1_corrected_xm.replace('123456789', str(recid)) self.testrec1_corrected_hm = self.testrec1_corrected_hm.replace('123456789', str(recid)) # test of the inserted record: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(inserted_xm, self.testrec1_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.testrec1_hm), '') def test_record_correction(self): """bibupload - correct mode, similar MARCXML tags/indicators""" # correct some tags: recs = bibupload.xml_marc_to_records(self.testrec1_xm_to_correct) err, recid = bibupload.bibupload(recs[0], opt_mode='correct') corrected_xm = print_record(recid, 'xm') corrected_hm = print_record(recid, 'hm') # did it work? self.assertEqual(compare_xmbuffers(corrected_xm, self.testrec1_corrected_xm), '') self.assertEqual(compare_hmbuffers(corrected_hm, self.testrec1_corrected_hm), '') # clean up after ourselves: bibupload.wipe_out_record_from_all_tables(recid) return class BibUploadDeleteModeTest(unittest.TestCase): """ Testing deleting specific tags from a record while keeping anything else untouched. Currently CDS Invenio deletes only those tags that have matching indicators too, unlike ALEPH500 that does not pay attention to indicators, it corrects all fields with the same tag, regardless of the indicator values. """ def setUp(self): """Initialize the MARCXML test record.""" self.testrec1_xm = """ 123456789 SzGeCERN Test, Jane Test Institute Test, John Test University Cool Test, Jim Test Laboratory dumb text """ self.testrec1_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, Jane$$uTest Institute 10047 $$aTest, John$$uTest University 10048 $$aCool 10047 $$aTest, Jim$$uTest Laboratory 888__ $$adumb text """ self.testrec1_xm_to_delete = """ 123456789 Test, Jane Test Institute Test, Johnson Test University Cool dumb text """ self.testrec1_corrected_xm = """ 123456789 SzGeCERN Test, John Test University Test, Jim Test Laboratory """ self.testrec1_corrected_hm = """ 001__ 123456789 003__ SzGeCERN 10047 $$aTest, John$$uTest University 10047 $$aTest, Jim$$uTest Laboratory """ # insert test record: task_set_task_param('verbose', 0) test_record_xm = self.testrec1_xm.replace('123456789', '') recs = bibupload.xml_marc_to_records(test_record_xm) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recID: self.testrec1_xm = self.testrec1_xm.replace('123456789', str(recid)) self.testrec1_hm = self.testrec1_hm.replace('123456789', str(recid)) self.testrec1_xm_to_delete = self.testrec1_xm_to_delete.replace('123456789', str(recid)) self.testrec1_corrected_xm = self.testrec1_corrected_xm.replace('123456789', str(recid)) self.testrec1_corrected_hm = self.testrec1_corrected_hm.replace('123456789', str(recid)) # test of the inserted record: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(inserted_xm, self.testrec1_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.testrec1_hm), '') # Checking dumb text is in bibxxx self.failUnless(run_sql("SELECT * from bibrec_bib88x WHERE id_bibrec=%s", (recid, ))) def test_record_tags_deletion(self): """bibupload - delete mode, deleting specific tags""" # correct some tags: recs = bibupload.xml_marc_to_records(self.testrec1_xm_to_delete) err, recid = bibupload.bibupload(recs[0], opt_mode='delete') corrected_xm = print_record(recid, 'xm') corrected_hm = print_record(recid, 'hm') # did it work? self.assertEqual(compare_xmbuffers(corrected_xm, self.testrec1_corrected_xm), '') self.assertEqual(compare_hmbuffers(corrected_hm, self.testrec1_corrected_hm), '') # Checking dumb text is no more in bibxxx self.failIf(run_sql("SELECT * from bibrec_bib88x WHERE id_bibrec=%s", (recid, ))) # clean up after ourselves: bibupload.wipe_out_record_from_all_tables(recid) return class BibUploadReplaceModeTest(unittest.TestCase): """Testing replace mode.""" def setUp(self): """Initialize the MARCXML test record.""" self.testrec1_xm = """ 123456789 SzGeCERN Test, Jane Test Institute Test, John Test University Cool Test, Jim Test Laboratory """ self.testrec1_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, Jane$$uTest Institute 10047 $$aTest, John$$uTest University 10048 $$aCool 10047 $$aTest, Jim$$uTest Laboratory """ self.testrec1_xm_to_replace = """ 123456789 Test, Joseph Test Academy Test2, Joseph Test2 Academy """ self.testrec1_replaced_xm = """ 123456789 Test, Joseph Test Academy Test2, Joseph Test2 Academy """ self.testrec1_replaced_hm = """ 001__ 123456789 10047 $$aTest, Joseph$$uTest Academy 10047 $$aTest2, Joseph$$uTest2 Academy """ # insert test record: task_set_task_param('verbose', 0) test_record_xm = self.testrec1_xm.replace('123456789', '') recs = bibupload.xml_marc_to_records(test_record_xm) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recID: self.testrec1_xm = self.testrec1_xm.replace('123456789', str(recid)) self.testrec1_hm = self.testrec1_hm.replace('123456789', str(recid)) self.testrec1_xm_to_replace = self.testrec1_xm_to_replace.replace('123456789', str(recid)) self.testrec1_replaced_xm = self.testrec1_replaced_xm.replace('123456789', str(recid)) self.testrec1_replaced_hm = self.testrec1_replaced_hm.replace('123456789', str(recid)) # test of the inserted record: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(inserted_xm, self.testrec1_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.testrec1_hm), '') def test_record_replace(self): """bibupload - replace mode, similar MARCXML tags/indicators""" # replace some tags: recs = bibupload.xml_marc_to_records(self.testrec1_xm_to_replace) err, recid = bibupload.bibupload(recs[0], opt_mode='replace') replaced_xm = print_record(recid, 'xm') replaced_hm = print_record(recid, 'hm') # did it work? self.assertEqual(compare_xmbuffers(replaced_xm, self.testrec1_replaced_xm), '') self.assertEqual(compare_hmbuffers(replaced_hm, self.testrec1_replaced_hm), '') # clean up after ourselves: bibupload.wipe_out_record_from_all_tables(recid) return class BibUploadReferencesModeTest(unittest.TestCase): """Testing references mode.""" def setUp(self): # pylint: disable-msg=C0103 """Initialize the MARCXML variable""" self.test_insert = """ 123456789 Tester, T CERN """ self.test_reference = """ 123456789 M. Lüscher and P. Weisz, String excitation energies in SU(N) gauge theories beyond the free-string approximation, J. High Energy Phys. 07 (2004) 014 """ self.test_reference_expected_xm = """ 123456789 Tester, T CERN M. Lüscher and P. Weisz, String excitation energies in SU(N) gauge theories beyond the free-string approximation, J. High Energy Phys. 07 (2004) 014 """ self.test_insert_hm = """ 001__ 123456789 100__ $$aTester, T$$uCERN """ self.test_reference_expected_hm = """ 001__ 123456789 100__ $$aTester, T$$uCERN %(reference_tag)sC5 $$mM. Lüscher and P. Weisz, String excitation energies in SU(N) gauge theories beyond the free-string approximation,$$sJ. High Energy Phys. 07 (2004) 014 """ % {'reference_tag': bibupload.CFG_BIBUPLOAD_REFERENCE_TAG} # insert test record: task_set_task_param('verbose', 0) test_insert = self.test_insert.replace('123456789', '') recs = bibupload.xml_marc_to_records(test_insert) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recID: self.test_insert = self.test_insert.replace('123456789', str(recid)) self.test_insert_hm = self.test_insert_hm.replace('123456789', str(recid)) self.test_reference = self.test_reference.replace('123456789', str(recid)) self.test_reference_expected_xm = self.test_reference_expected_xm.replace('123456789', str(recid)) self.test_reference_expected_hm = self.test_reference_expected_hm.replace('123456789', str(recid)) # test of the inserted record: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(inserted_xm, self.test_insert), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.test_insert_hm), '') self.test_recid = recid def test_reference_complete_xml_marc(self): """bibupload - reference mode, inserting references MARCXML file""" # We create create the record out of the xml marc recs = bibupload.xml_marc_to_records(self.test_reference) # We call the main function with the record as a parameter err, recid = bibupload.bibupload(recs[0], opt_mode='reference') # We retrieve the inserted xml reference_xm = print_record(recid, 'xm') reference_hm = print_record(recid, 'hm') # Compare if the two MARCXML are the same self.assertEqual(compare_xmbuffers(reference_xm, self.test_reference_expected_xm), '') self.assertEqual(compare_hmbuffers(reference_hm, self.test_reference_expected_hm), '') # clean up after ourselves: bibupload.wipe_out_record_from_all_tables(self.test_recid) return class BibUploadFMTModeTest(unittest.TestCase): """Testing FMT mode.""" def setUp(self): # pylint: disable-msg=C0103 """Initialize the MARCXML variable""" self.new_xm_with_fmt = """ SzGeCERN HB Test. Okay. 2008-03-14 15:14:00 Bar, Baz Foo On the quux and huux """ self.expected_xm_after_inserting_new_xm_with_fmt = """ 123456789 SzGeCERN Bar, Baz Foo On the quux and huux """ self.expected_hm_after_inserting_new_xm_with_fmt = """ 001__ 123456789 003__ SzGeCERN 100__ $$aBar, Baz$$uFoo 245__ $$aOn the quux and huux """ self.recid76_xm_before_all_the_tests = print_record(76, 'xm') self.recid76_hm_before_all_the_tests = print_record(76, 'hm') self.recid76_fmts = run_sql("""SELECT last_updated, value, format FROM bibfmt WHERE id_bibrec=76""") self.recid76_xm_with_fmt = """ 76 SzGeCERN HB Test. Here is some format value. Doe, John CERN On the foos and bars """ self.recid76_xm_with_fmt_only_first = """ 76 HB Test. Let us see if this gets inserted well. """ self.recid76_xm_with_fmt_only_second = """ 76 HB Test. Yet another test, to be run after the first one. HD Test. Let's see what will be stored in the detailed format field. """ def tearDown(self): """Helper function that restores recID 76 MARCXML, using the value saved before all the tests started to execute. (see self.recid76_xm_before_all_the_tests). Does not restore HB and HD formats. """ recs = bibupload.xml_marc_to_records(self.recid76_xm_before_all_the_tests) err, recid = bibupload.bibupload(recs[0], opt_mode='replace') for (last_updated, value, format) in self.recid76_fmts: run_sql("""UPDATE bibfmt SET last_updated=%s, value=%s WHERE id_bibrec=76 AND format=%s""", (last_updated, value, format)) inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(inserted_xm, self.recid76_xm_before_all_the_tests), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.recid76_hm_before_all_the_tests), '') def test_inserting_new_record_containing_fmt_tag(self): """bibupload - FMT tag, inserting new record containing FMT tag""" recs = bibupload.xml_marc_to_records(self.new_xm_with_fmt) (dummy, new_recid) = bibupload.bibupload(recs[0], opt_mode='insert') xm_after = print_record(new_recid, 'xm') hm_after = print_record(new_recid, 'hm') hb_after = print_record(new_recid, 'hb') self.assertEqual(compare_xmbuffers(xm_after, self.expected_xm_after_inserting_new_xm_with_fmt.replace('123456789', str(new_recid))), '') self.assertEqual(compare_hmbuffers(hm_after, self.expected_hm_after_inserting_new_xm_with_fmt.replace('123456789', str(new_recid))), '') self.assertEqual(run_sql('SELECT last_updated from bibfmt WHERE id_bibrec=%s', (new_recid, ))[0][0], datetime.datetime(2008, 3, 14, 15, 14)) self.failUnless(hb_after.startswith("Test. Okay.")) def test_updating_existing_record_formats_in_format_mode(self): """bibupload - FMT tag, updating existing record via format mode""" xm_before = print_record(76, 'xm') hm_before = print_record(76, 'hm') # insert first format value: recs = bibupload.xml_marc_to_records(self.recid76_xm_with_fmt_only_first) bibupload.bibupload(recs[0], opt_mode='format') xm_after = print_record(76, 'xm') hm_after = print_record(76, 'hm') hb_after = print_record(76, 'hb') self.assertEqual(xm_after, xm_before) self.assertEqual(hm_after, hm_before) self.failUnless(hb_after.startswith("Test. Let us see if this gets inserted well.")) # now insert another format value and recheck: recs = bibupload.xml_marc_to_records(self.recid76_xm_with_fmt_only_second) bibupload.bibupload(recs[0], opt_mode='format') xm_after = print_record(76, 'xm') hm_after = print_record(76, 'hm') hb_after = print_record(76, 'hb') hd_after = print_record(76, 'hd') self.assertEqual(xm_after, xm_before) self.assertEqual(hm_after, hm_before) self.failUnless(hb_after.startswith("Test. Yet another test, to be run after the first one.")) self.failUnless(hd_after.startswith("Test. Let's see what will be stored in the detailed format field.")) def test_updating_existing_record_formats_in_correct_mode(self): """bibupload - FMT tag, updating existing record via correct mode""" xm_before = print_record(76, 'xm') hm_before = print_record(76, 'hm') # insert first format value: recs = bibupload.xml_marc_to_records(self.recid76_xm_with_fmt_only_first) bibupload.bibupload(recs[0], opt_mode='correct') xm_after = print_record(76, 'xm') hm_after = print_record(76, 'hm') hb_after = print_record(76, 'hb') self.assertEqual(xm_after, xm_before) self.assertEqual(hm_after, hm_before) self.failUnless(hb_after.startswith("Test. Let us see if this gets inserted well.")) # now insert another format value and recheck: recs = bibupload.xml_marc_to_records(self.recid76_xm_with_fmt_only_second) bibupload.bibupload(recs[0], opt_mode='correct') xm_after = print_record(76, 'xm') hm_after = print_record(76, 'hm') hb_after = print_record(76, 'hb') hd_after = print_record(76, 'hd') self.assertEqual(xm_after, xm_before) self.assertEqual(hm_after, hm_before) self.failUnless(hb_after.startswith("Test. Yet another test, to be run after the first one.")) self.failUnless(hd_after.startswith("Test. Let's see what will be stored in the detailed format field.")) def test_updating_existing_record_formats_in_replace_mode(self): """bibupload - FMT tag, updating existing record via replace mode""" # insert first format value: recs = bibupload.xml_marc_to_records(self.recid76_xm_with_fmt_only_first) bibupload.bibupload(recs[0], opt_mode='replace') xm_after = print_record(76, 'xm') hm_after = print_record(76, 'hm') hb_after = print_record(76, 'hb') self.assertEqual(compare_xmbuffers(xm_after, '76'), '') self.assertEqual(compare_hmbuffers(hm_after, '000000076 001__ 76'), '') self.failUnless(hb_after.startswith("Test. Let us see if this gets inserted well.")) # now insert another format value and recheck: recs = bibupload.xml_marc_to_records(self.recid76_xm_with_fmt_only_second) bibupload.bibupload(recs[0], opt_mode='replace') xm_after = print_record(76, 'xm') hm_after = print_record(76, 'hm') hb_after = print_record(76, 'hb') hd_after = print_record(76, 'hd') self.assertEqual(compare_xmbuffers(xm_after, """ 76 """), '') self.assertEqual(compare_hmbuffers(hm_after, '000000076 001__ 76'), '') self.failUnless(hb_after.startswith("Test. Yet another test, to be run after the first one.")) self.failUnless(hd_after.startswith("Test. Let's see what will be stored in the detailed format field.")) # final insertion and recheck: recs = bibupload.xml_marc_to_records(self.recid76_xm_with_fmt) bibupload.bibupload(recs[0], opt_mode='replace') xm_after = print_record(76, 'xm') hm_after = print_record(76, 'hm') hb_after = print_record(76, 'hb') hd_after = print_record(76, 'hd') self.assertEqual(compare_xmbuffers(xm_after, """ 76 SzGeCERN Doe, John CERN On the foos and bars """), '') self.assertEqual(compare_hmbuffers(hm_after, """ 001__ 76 003__ SzGeCERN 100__ $$aDoe, John$$uCERN 245__ $$aOn the foos and bars """), '') self.failUnless(hb_after.startswith("Test. Here is some format value.")) self.failUnless(hd_after.startswith("Test. Let's see what will be stored in the detailed format field.")) class BibUploadRecordsWithSYSNOTest(unittest.TestCase): """Testing uploading of records that have external SYSNO present.""" def setUp(self): # pylint: disable-msg=C0103 """Initialize the MARCXML test records.""" self.verbose = 0 # Note that SYSNO fields are repeated but with different # subfields, this is to test whether bibupload would not # mistakenly pick up wrong values. self.xm_testrec1 = """ 123456789 SzGeCERN Bar, Baz Foo On the quux and huux 1 sysno1 sysno2 """ % {'sysnotag': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[0:3], 'sysnoind1': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[3:4] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[3:4] or " ", 'sysnoind2': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[4:5] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[4:5] or " ", 'sysnosubfieldcode': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[5:6], } self.hm_testrec1 = """ 001__ 123456789 003__ SzGeCERN 100__ $$aBar, Baz$$uFoo 245__ $$aOn the quux and huux 1 %(sysnotag)s%(sysnoind1)s%(sysnoind2)s $$%(sysnosubfieldcode)ssysno1 %(sysnotag)s%(sysnoind1)s%(sysnoind2)s $$0sysno2 """ % {'sysnotag': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[0:3], 'sysnoind1': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[3:4], 'sysnoind2': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[4:5], 'sysnosubfieldcode': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[5:6], } self.xm_testrec1_to_update = """ SzGeCERN Bar, Baz Foo On the quux and huux 1 Updated sysno1 sysno2 """ % {'sysnotag': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[0:3], 'sysnoind1': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[3:4] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[3:4] or " ", 'sysnoind2': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[4:5] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[4:5] or " ", 'sysnosubfieldcode': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[5:6], } self.xm_testrec1_updated = """ 123456789 SzGeCERN Bar, Baz Foo On the quux and huux 1 Updated sysno1 sysno2 """ % {'sysnotag': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[0:3], 'sysnoind1': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[3:4] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[3:4] or " ", 'sysnoind2': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[4:5] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[4:5] or " ", 'sysnosubfieldcode': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[5:6], } self.hm_testrec1_updated = """ 001__ 123456789 003__ SzGeCERN 100__ $$aBar, Baz$$uFoo 245__ $$aOn the quux and huux 1 Updated %(sysnotag)s%(sysnoind1)s%(sysnoind2)s $$%(sysnosubfieldcode)ssysno1 %(sysnotag)s%(sysnoind1)s%(sysnoind2)s $$0sysno2 """ % {'sysnotag': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[0:3], 'sysnoind1': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[3:4], 'sysnoind2': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[4:5], 'sysnosubfieldcode': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[5:6], } self.xm_testrec2 = """ 987654321 SzGeCERN Bar, Baz Foo On the quux and huux 2 sysno2 sysno1 """ % {'sysnotag': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[0:3], 'sysnoind1': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[3:4] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[3:4] or " ", 'sysnoind2': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[4:5] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[4:5] or " ", 'sysnosubfieldcode': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[5:6], } self.hm_testrec2 = """ 001__ 987654321 003__ SzGeCERN 100__ $$aBar, Baz$$uFoo 245__ $$aOn the quux and huux 2 %(sysnotag)s%(sysnoind1)s%(sysnoind2)s $$%(sysnosubfieldcode)ssysno2 %(sysnotag)s%(sysnoind1)s%(sysnoind2)s $$0sysno1 """ % {'sysnotag': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[0:3], 'sysnoind1': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[3:4], 'sysnoind2': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[4:5], 'sysnosubfieldcode': CFG_BIBUPLOAD_EXTERNAL_SYSNO_TAG[5:6], } def test_insert_the_same_sysno_record(self): """bibupload - SYSNO tag, refuse to insert the same SYSNO record""" # initialize bibupload mode: if self.verbose: print "test_insert_the_same_sysno_record() started" # insert record 1 first time: testrec_to_insert_first = self.xm_testrec1.replace('123456789', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) task_set_task_param('verbose', 0) err1, recid1 = bibupload.bibupload(recs[0], opt_mode='insert') inserted_xm = print_record(recid1, 'xm') inserted_hm = print_record(recid1, 'hm') # use real recID when comparing whether it worked: self.xm_testrec1 = self.xm_testrec1.replace('123456789', str(recid1)) self.hm_testrec1 = self.hm_testrec1.replace('123456789', str(recid1)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec1), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec1), '') # insert record 2 first time: testrec_to_insert_first = self.xm_testrec2.replace('987654321', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) task_set_task_param('verbose', 0) err2, recid2 = bibupload.bibupload(recs[0], opt_mode='insert') inserted_xm = print_record(recid2, 'xm') inserted_hm = print_record(recid2, 'hm') # use real recID when comparing whether it worked: self.xm_testrec2 = self.xm_testrec2.replace('987654321', str(recid2)) self.hm_testrec2 = self.hm_testrec2.replace('987654321', str(recid2)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec2), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec2), '') # try to insert updated record 1, it should fail: recs = bibupload.xml_marc_to_records(self.xm_testrec1_to_update) task_set_task_param('verbose', 0) err1_updated, recid1_updated = bibupload.bibupload(recs[0], opt_mode='insert') self.assertEqual(-1, recid1_updated) # delete test records bibupload.wipe_out_record_from_all_tables(recid1) bibupload.wipe_out_record_from_all_tables(recid2) bibupload.wipe_out_record_from_all_tables(recid1_updated) if self.verbose: print "test_insert_the_same_sysno_record() finished" def test_insert_or_replace_the_same_sysno_record(self): """bibupload - SYSNO tag, allow to insert or replace the same SYSNO record""" # initialize bibupload mode: task_set_task_param('verbose', self.verbose) if self.verbose: print "test_insert_or_replace_the_same_sysno_record() started" # insert/replace record 1 first time: testrec_to_insert_first = self.xm_testrec1.replace('123456789', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) err1, recid1 = bibupload.bibupload(recs[0], opt_mode='replace_or_insert') inserted_xm = print_record(recid1, 'xm') inserted_hm = print_record(recid1, 'hm') # use real recID in test buffers when comparing whether it worked: self.xm_testrec1 = self.xm_testrec1.replace('123456789', str(recid1)) self.hm_testrec1 = self.hm_testrec1.replace('123456789', str(recid1)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec1), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec1), '') # try to insert/replace updated record 1, it should be okay: task_set_task_param('verbose', self.verbose) recs = bibupload.xml_marc_to_records(self.xm_testrec1_to_update) err1_updated, recid1_updated = bibupload.bibupload(recs[0], opt_mode='replace_or_insert') inserted_xm = print_record(recid1_updated, 'xm') inserted_hm = print_record(recid1_updated, 'hm') self.assertEqual(recid1, recid1_updated) # use real recID in test buffers when comparing whether it worked: self.xm_testrec1_updated = self.xm_testrec1_updated.replace('123456789', str(recid1)) self.hm_testrec1_updated = self.hm_testrec1_updated.replace('123456789', str(recid1)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec1_updated), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec1_updated), '') # delete test records bibupload.wipe_out_record_from_all_tables(recid1) bibupload.wipe_out_record_from_all_tables(recid1_updated) if self.verbose: print "test_insert_or_replace_the_same_sysno_record() finished" def test_replace_nonexisting_sysno_record(self): """bibupload - SYSNO tag, refuse to replace non-existing SYSNO record""" # initialize bibupload mode: task_set_task_param('verbose', self.verbose) if self.verbose: print "test_replace_nonexisting_sysno_record() started" # insert record 1 first time: testrec_to_insert_first = self.xm_testrec1.replace('123456789', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) err1, recid1 = bibupload.bibupload(recs[0], opt_mode='replace_or_insert') inserted_xm = print_record(recid1, 'xm') inserted_hm = print_record(recid1, 'hm') # use real recID in test buffers when comparing whether it worked: self.xm_testrec1 = self.xm_testrec1.replace('123456789', str(recid1)) self.hm_testrec1 = self.hm_testrec1.replace('123456789', str(recid1)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec1), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec1), '') # try to replace record 2 it should fail: testrec_to_insert_first = self.xm_testrec2.replace('987654321', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) err2, recid2 = bibupload.bibupload(recs[0], opt_mode='replace') self.assertEqual(-1, recid2) # delete test records bibupload.wipe_out_record_from_all_tables(recid1) bibupload.wipe_out_record_from_all_tables(recid2) if self.verbose: print "test_replace_nonexisting_sysno_record() finished" class BibUploadRecordsWithEXTOAIIDTest(unittest.TestCase): """Testing uploading of records that have external EXTOAIID present.""" def setUp(self): # pylint: disable-msg=C0103 """Initialize the MARCXML test records.""" self.verbose = 0 # Note that EXTOAIID fields are repeated but with different # subfields, this is to test whether bibupload would not # mistakenly pick up wrong values. self.xm_testrec1 = """ 123456789 SzGeCERN extoaiid1 extoaisrc1 extoaiid2 Bar, Baz Foo On the quux and huux 1 """ % {'extoaiidtag': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[0:3], 'extoaiidind1': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3:4] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3:4] or " ", 'extoaiidind2': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4:5] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4:5] or " ", 'extoaiidsubfieldcode': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[5:6], 'extoaisrcsubfieldcode' : CFG_BIBUPLOAD_EXTERNAL_OAIID_PROVENANCE_TAG[5:6], } self.hm_testrec1 = """ 001__ 123456789 003__ SzGeCERN %(extoaiidtag)s%(extoaiidind1)s%(extoaiidind2)s $$%(extoaisrcsubfieldcode)sextoaisrc1$$%(extoaiidsubfieldcode)sextoaiid1 %(extoaiidtag)s%(extoaiidind1)s%(extoaiidind2)s $$0extoaiid2 100__ $$aBar, Baz$$uFoo 245__ $$aOn the quux and huux 1 """ % {'extoaiidtag': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[0:3], 'extoaiidind1': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3:4], 'extoaiidind2': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4:5], 'extoaiidsubfieldcode': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[5:6], 'extoaisrcsubfieldcode' : CFG_BIBUPLOAD_EXTERNAL_OAIID_PROVENANCE_TAG[5:6], } self.xm_testrec1_to_update = """ SzGeCERN extoaiid1 extoaisrc1 extoaiid2 Bar, Baz Foo On the quux and huux 1 Updated """ % {'extoaiidtag': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[0:3], 'extoaiidind1': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3:4] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3:4] or " ", 'extoaiidind2': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4:5] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4:5] or " ", 'extoaiidsubfieldcode': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[5:6], 'extoaisrcsubfieldcode' : CFG_BIBUPLOAD_EXTERNAL_OAIID_PROVENANCE_TAG[5:6], } self.xm_testrec1_updated = """ 123456789 SzGeCERN extoaiid1 extoaisrc1 extoaiid2 Bar, Baz Foo On the quux and huux 1 Updated """ % {'extoaiidtag': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[0:3], 'extoaiidind1': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3:4] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3:4] or " ", 'extoaiidind2': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4:5] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4:5] or " ", 'extoaiidsubfieldcode': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[5:6], 'extoaisrcsubfieldcode' : CFG_BIBUPLOAD_EXTERNAL_OAIID_PROVENANCE_TAG[5:6], } self.hm_testrec1_updated = """ 001__ 123456789 003__ SzGeCERN %(extoaiidtag)s%(extoaiidind1)s%(extoaiidind2)s $$%(extoaisrcsubfieldcode)sextoaisrc1$$%(extoaiidsubfieldcode)sextoaiid1 %(extoaiidtag)s%(extoaiidind1)s%(extoaiidind2)s $$0extoaiid2 100__ $$aBar, Baz$$uFoo 245__ $$aOn the quux and huux 1 Updated """ % {'extoaiidtag': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[0:3], 'extoaiidind1': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3:4], 'extoaiidind2': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4:5], 'extoaiidsubfieldcode': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[5:6], 'extoaisrcsubfieldcode' : CFG_BIBUPLOAD_EXTERNAL_OAIID_PROVENANCE_TAG[5:6], } self.xm_testrec2 = """ 987654321 SzGeCERN extoaiid2 extoaisrc1 extoaiid1 Bar, Baz Foo On the quux and huux 2 """ % {'extoaiidtag': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[0:3], 'extoaiidind1': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3:4] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3:4] or " ", 'extoaiidind2': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4:5] != "_" and \ CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4:5] or " ", 'extoaiidsubfieldcode': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[5:6], 'extoaisrcsubfieldcode' : CFG_BIBUPLOAD_EXTERNAL_OAIID_PROVENANCE_TAG[5:6], } self.hm_testrec2 = """ 001__ 987654321 003__ SzGeCERN %(extoaiidtag)s%(extoaiidind1)s%(extoaiidind2)s $$%(extoaisrcsubfieldcode)sextoaisrc1$$%(extoaiidsubfieldcode)sextoaiid2 %(extoaiidtag)s%(extoaiidind1)s%(extoaiidind2)s $$0extoaiid1 100__ $$aBar, Baz$$uFoo 245__ $$aOn the quux and huux 2 """ % {'extoaiidtag': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[0:3], 'extoaiidind1': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[3:4], 'extoaiidind2': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[4:5], 'extoaiidsubfieldcode': CFG_BIBUPLOAD_EXTERNAL_OAIID_TAG[5:6], 'extoaisrcsubfieldcode' : CFG_BIBUPLOAD_EXTERNAL_OAIID_PROVENANCE_TAG[5:6], } def test_insert_the_same_extoaiid_record(self): """bibupload - EXTOAIID tag, refuse to insert the same EXTOAIID record""" # initialize bibupload mode: task_set_task_param('verbose', self.verbose) if self.verbose: print "test_insert_the_same_extoaiid_record() started" # insert record 1 first time: testrec_to_insert_first = self.xm_testrec1.replace('123456789', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) err1, recid1 = bibupload.bibupload(recs[0], opt_mode='insert') inserted_xm = print_record(recid1, 'xm') inserted_hm = print_record(recid1, 'hm') # use real recID when comparing whether it worked: self.xm_testrec1 = self.xm_testrec1.replace('123456789', str(recid1)) self.hm_testrec1 = self.hm_testrec1.replace('123456789', str(recid1)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec1), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec1), '') # insert record 2 first time: testrec_to_insert_first = self.xm_testrec2.replace('987654321', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) err2, recid2 = bibupload.bibupload(recs[0], opt_mode='insert') inserted_xm = print_record(recid2, 'xm') inserted_hm = print_record(recid2, 'hm') # use real recID when comparing whether it worked: self.xm_testrec2 = self.xm_testrec2.replace('987654321', str(recid2)) self.hm_testrec2 = self.hm_testrec2.replace('987654321', str(recid2)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec2), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec2), '') # try to insert updated record 1, it should fail: recs = bibupload.xml_marc_to_records(self.xm_testrec1_to_update) err1_updated, recid1_updated = bibupload.bibupload(recs[0], opt_mode='insert') self.assertEqual(-1, recid1_updated) # delete test records bibupload.wipe_out_record_from_all_tables(recid1) bibupload.wipe_out_record_from_all_tables(recid2) bibupload.wipe_out_record_from_all_tables(recid1_updated) if self.verbose: print "test_insert_the_same_extoaiid_record() finished" def test_insert_or_replace_the_same_extoaiid_record(self): """bibupload - EXTOAIID tag, allow to insert or replace the same EXTOAIID record""" # initialize bibupload mode: task_set_task_param('verbose', self.verbose) if self.verbose: print "test_insert_or_replace_the_same_extoaiid_record() started" # insert/replace record 1 first time: testrec_to_insert_first = self.xm_testrec1.replace('123456789', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) err1, recid1 = bibupload.bibupload(recs[0], opt_mode='replace_or_insert') inserted_xm = print_record(recid1, 'xm') inserted_hm = print_record(recid1, 'hm') # use real recID in test buffers when comparing whether it worked: self.xm_testrec1 = self.xm_testrec1.replace('123456789', str(recid1)) self.hm_testrec1 = self.hm_testrec1.replace('123456789', str(recid1)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec1), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec1), '') # try to insert/replace updated record 1, it should be okay: recs = bibupload.xml_marc_to_records(self.xm_testrec1_to_update) err1_updated, recid1_updated = bibupload.bibupload(recs[0], opt_mode='replace_or_insert') inserted_xm = print_record(recid1_updated, 'xm') inserted_hm = print_record(recid1_updated, 'hm') self.assertEqual(recid1, recid1_updated) # use real recID in test buffers when comparing whether it worked: self.xm_testrec1_updated = self.xm_testrec1_updated.replace('123456789', str(recid1)) self.hm_testrec1_updated = self.hm_testrec1_updated.replace('123456789', str(recid1)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec1_updated), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec1_updated), '') # delete test records bibupload.wipe_out_record_from_all_tables(recid1) bibupload.wipe_out_record_from_all_tables(recid1_updated) if self.verbose: print "test_insert_or_replace_the_same_extoaiid_record() finished" def test_replace_nonexisting_extoaiid_record(self): """bibupload - EXTOAIID tag, refuse to replace non-existing EXTOAIID record""" # initialize bibupload mode: task_set_task_param('verbose', self.verbose) if self.verbose: print "test_replace_nonexisting_extoaiid_record() started" # insert record 1 first time: testrec_to_insert_first = self.xm_testrec1.replace('123456789', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) err1, recid1 = bibupload.bibupload(recs[0], opt_mode='replace_or_insert') inserted_xm = print_record(recid1, 'xm') inserted_hm = print_record(recid1, 'hm') # use real recID in test buffers when comparing whether it worked: self.xm_testrec1 = self.xm_testrec1.replace('123456789', str(recid1)) self.hm_testrec1 = self.hm_testrec1.replace('123456789', str(recid1)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec1), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec1), '') # try to replace record 2 it should fail: testrec_to_insert_first = self.xm_testrec2.replace('987654321', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) err2, recid2 = bibupload.bibupload(recs[0], opt_mode='replace') self.assertEqual(-1, recid2) # delete test records bibupload.wipe_out_record_from_all_tables(recid1) bibupload.wipe_out_record_from_all_tables(recid2) if self.verbose: print "test_replace_nonexisting_extoaiid_record() finished" class BibUploadRecordsWithOAIIDTest(unittest.TestCase): """Testing uploading of records that have OAI ID present.""" def setUp(self): # pylint: disable-msg=C0103 """Initialize the MARCXML test records.""" self.verbose = 0 # Note that OAI fields are repeated but with different # subfields, this is to test whether bibupload would not # mistakenly pick up wrong values. self.xm_testrec1 = """ 123456789 SzGeCERN Bar, Baz Foo On the quux and huux 1 oai:foo:1 oai:foo:2 """ % {'oaitag': CFG_OAI_ID_FIELD[0:3], 'oaiind1': CFG_OAI_ID_FIELD[3:4] != "_" and \ CFG_OAI_ID_FIELD[3:4] or " ", 'oaiind2': CFG_OAI_ID_FIELD[4:5] != "_" and \ CFG_OAI_ID_FIELD[4:5] or " ", 'oaisubfieldcode': CFG_OAI_ID_FIELD[5:6], } self.hm_testrec1 = """ 001__ 123456789 003__ SzGeCERN 100__ $$aBar, Baz$$uFoo 245__ $$aOn the quux and huux 1 %(oaitag)s%(oaiind1)s%(oaiind2)s $$%(oaisubfieldcode)soai:foo:1 %(oaitag)s%(oaiind1)s%(oaiind2)s $$0oai:foo:2 """ % {'oaitag': CFG_OAI_ID_FIELD[0:3], 'oaiind1': CFG_OAI_ID_FIELD[3:4], 'oaiind2': CFG_OAI_ID_FIELD[4:5], 'oaisubfieldcode': CFG_OAI_ID_FIELD[5:6], } self.xm_testrec1_to_update = """ SzGeCERN Bar, Baz Foo On the quux and huux 1 Updated oai:foo:1 oai:foo:2 """ % {'oaitag': CFG_OAI_ID_FIELD[0:3], 'oaiind1': CFG_OAI_ID_FIELD[3:4] != "_" and \ CFG_OAI_ID_FIELD[3:4] or " ", 'oaiind2': CFG_OAI_ID_FIELD[4:5] != "_" and \ CFG_OAI_ID_FIELD[4:5] or " ", 'oaisubfieldcode': CFG_OAI_ID_FIELD[5:6], } self.xm_testrec1_updated = """ 123456789 SzGeCERN Bar, Baz Foo On the quux and huux 1 Updated oai:foo:1 oai:foo:2 """ % {'oaitag': CFG_OAI_ID_FIELD[0:3], 'oaiind1': CFG_OAI_ID_FIELD[3:4] != "_" and \ CFG_OAI_ID_FIELD[3:4] or " ", 'oaiind2': CFG_OAI_ID_FIELD[4:5] != "_" and \ CFG_OAI_ID_FIELD[4:5] or " ", 'oaisubfieldcode': CFG_OAI_ID_FIELD[5:6], } self.hm_testrec1_updated = """ 001__ 123456789 003__ SzGeCERN 100__ $$aBar, Baz$$uFoo 245__ $$aOn the quux and huux 1 Updated %(oaitag)s%(oaiind1)s%(oaiind2)s $$%(oaisubfieldcode)soai:foo:1 %(oaitag)s%(oaiind1)s%(oaiind2)s $$0oai:foo:2 """ % {'oaitag': CFG_OAI_ID_FIELD[0:3], 'oaiind1': CFG_OAI_ID_FIELD[3:4], 'oaiind2': CFG_OAI_ID_FIELD[4:5], 'oaisubfieldcode': CFG_OAI_ID_FIELD[5:6], } self.xm_testrec2 = """ 987654321 SzGeCERN Bar, Baz Foo On the quux and huux 2 oai:foo:2 oai:foo:1 """ % {'oaitag': CFG_OAI_ID_FIELD[0:3], 'oaiind1': CFG_OAI_ID_FIELD[3:4] != "_" and \ CFG_OAI_ID_FIELD[3:4] or " ", 'oaiind2': CFG_OAI_ID_FIELD[4:5] != "_" and \ CFG_OAI_ID_FIELD[4:5] or " ", 'oaisubfieldcode': CFG_OAI_ID_FIELD[5:6], } self.hm_testrec2 = """ 001__ 987654321 003__ SzGeCERN 100__ $$aBar, Baz$$uFoo 245__ $$aOn the quux and huux 2 %(oaitag)s%(oaiind1)s%(oaiind2)s $$%(oaisubfieldcode)soai:foo:2 %(oaitag)s%(oaiind1)s%(oaiind2)s $$0oai:foo:1 """ % {'oaitag': CFG_OAI_ID_FIELD[0:3], 'oaiind1': CFG_OAI_ID_FIELD[3:4], 'oaiind2': CFG_OAI_ID_FIELD[4:5], 'oaisubfieldcode': CFG_OAI_ID_FIELD[5:6], } def test_insert_the_same_oai_record(self): """bibupload - OAIID tag, refuse to insert the same OAI record""" task_set_task_param('verbose', self.verbose) # insert record 1 first time: testrec_to_insert_first = self.xm_testrec1.replace('123456789', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) err1, recid1 = bibupload.bibupload(recs[0], opt_mode='insert') inserted_xm = print_record(recid1, 'xm') inserted_hm = print_record(recid1, 'hm') # use real recID when comparing whether it worked: self.xm_testrec1 = self.xm_testrec1.replace('123456789', str(recid1)) self.hm_testrec1 = self.hm_testrec1.replace('123456789', str(recid1)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec1), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec1), '') # insert record 2 first time: testrec_to_insert_first = self.xm_testrec2.replace('987654321', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) err2, recid2 = bibupload.bibupload(recs[0], opt_mode='insert') inserted_xm = print_record(recid2, 'xm') inserted_hm = print_record(recid2, 'hm') # use real recID when comparing whether it worked: self.xm_testrec2 = self.xm_testrec2.replace('987654321', str(recid2)) self.hm_testrec2 = self.hm_testrec2.replace('987654321', str(recid2)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec2), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec2), '') # try to insert updated record 1, it should fail: recs = bibupload.xml_marc_to_records(self.xm_testrec1_to_update) err1_updated, recid1_updated = bibupload.bibupload(recs[0], opt_mode='insert') self.assertEqual(-1, recid1_updated) # delete test records bibupload.wipe_out_record_from_all_tables(recid1) bibupload.wipe_out_record_from_all_tables(recid2) bibupload.wipe_out_record_from_all_tables(recid1_updated) def test_insert_or_replace_the_same_oai_record(self): """bibupload - OAIID tag, allow to insert or replace the same OAI record""" # initialize bibupload mode: task_set_task_param('verbose', self.verbose) # insert/replace record 1 first time: testrec_to_insert_first = self.xm_testrec1.replace('123456789', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) err1, recid1 = bibupload.bibupload(recs[0], opt_mode='replace_or_insert') inserted_xm = print_record(recid1, 'xm') inserted_hm = print_record(recid1, 'hm') # use real recID in test buffers when comparing whether it worked: self.xm_testrec1 = self.xm_testrec1.replace('123456789', str(recid1)) self.hm_testrec1 = self.hm_testrec1.replace('123456789', str(recid1)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec1), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec1), '') # try to insert/replace updated record 1, it should be okay: recs = bibupload.xml_marc_to_records(self.xm_testrec1_to_update) err1_updated, recid1_updated = bibupload.bibupload(recs[0], opt_mode='replace_or_insert') inserted_xm = print_record(recid1_updated, 'xm') inserted_hm = print_record(recid1_updated, 'hm') self.assertEqual(recid1, recid1_updated) # use real recID in test buffers when comparing whether it worked: self.xm_testrec1_updated = self.xm_testrec1_updated.replace('123456789', str(recid1)) self.hm_testrec1_updated = self.hm_testrec1_updated.replace('123456789', str(recid1)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec1_updated), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec1_updated), '') # delete test records bibupload.wipe_out_record_from_all_tables(recid1) bibupload.wipe_out_record_from_all_tables(recid1_updated) def test_replace_nonexisting_oai_record(self): """bibupload - OAIID tag, refuse to replace non-existing OAI record""" task_set_task_param('verbose', self.verbose) # insert record 1 first time: testrec_to_insert_first = self.xm_testrec1.replace('123456789', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) err1, recid1 = bibupload.bibupload(recs[0], opt_mode='replace_or_insert') inserted_xm = print_record(recid1, 'xm') inserted_hm = print_record(recid1, 'hm') # use real recID in test buffers when comparing whether it worked: self.xm_testrec1 = self.xm_testrec1.replace('123456789', str(recid1)) self.hm_testrec1 = self.hm_testrec1.replace('123456789', str(recid1)) self.assertEqual(compare_xmbuffers(inserted_xm, self.xm_testrec1), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.hm_testrec1), '') # try to replace record 2 it should fail: testrec_to_insert_first = self.xm_testrec2.replace('987654321', '') recs = bibupload.xml_marc_to_records(testrec_to_insert_first) err2, recid2 = bibupload.bibupload(recs[0], opt_mode='replace') self.assertEqual(-1, recid2) # delete test records bibupload.wipe_out_record_from_all_tables(recid1) bibupload.wipe_out_record_from_all_tables(recid2) class BibUploadIndicatorsTest(unittest.TestCase): """ Testing uploading of a MARCXML record with indicators having either blank space (as per MARC schema) or empty string value (old behaviour). """ def setUp(self): """Initialize the MARCXML test record.""" self.testrec1_xm = """ SzGeCERN Test, John Test University """ self.testrec1_hm = """ 003__ SzGeCERN 100__ $$aTest, John$$uTest University """ self.testrec2_xm = """ SzGeCERN Test, John Test University """ self.testrec2_hm = """ 003__ SzGeCERN 100__ $$aTest, John$$uTest University """ def test_record_with_spaces_in_indicators(self): """bibupload - inserting MARCXML with spaces in indicators""" task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(self.testrec1_xm) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(remove_tag_001_from_xmbuffer(inserted_xm), self.testrec1_xm), '') self.assertEqual(compare_hmbuffers(remove_tag_001_from_hmbuffer(inserted_hm), self.testrec1_hm), '') bibupload.wipe_out_record_from_all_tables(recid) def test_record_with_no_spaces_in_indicators(self): """bibupload - inserting MARCXML with no spaces in indicators""" task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(self.testrec2_xm) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(remove_tag_001_from_xmbuffer(inserted_xm), self.testrec2_xm), '') self.assertEqual(compare_hmbuffers(remove_tag_001_from_hmbuffer(inserted_hm), self.testrec2_hm), '') bibupload.wipe_out_record_from_all_tables(recid) class BibUploadUpperLowerCaseTest(unittest.TestCase): """ Testing treatment of similar records with only upper and lower case value differences in the bibxxx table. """ def setUp(self): """Initialize the MARCXML test records.""" self.testrec1_xm = """ SzGeCERN Test, John Test University """ self.testrec1_hm = """ 003__ SzGeCERN 100__ $$aTest, John$$uTest University """ self.testrec2_xm = """ SzGeCERN TeSt, JoHn Test UniVeRsity """ self.testrec2_hm = """ 003__ SzGeCERN 100__ $$aTeSt, JoHn$$uTest UniVeRsity """ def test_record_with_upper_lower_case_letters(self): """bibupload - inserting similar MARCXML records with upper/lower case""" task_set_task_param('verbose', 0) # insert test record #1: recs = bibupload.xml_marc_to_records(self.testrec1_xm) err1, recid1 = bibupload.bibupload(recs[0], opt_mode='insert') recid1_inserted_xm = print_record(recid1, 'xm') recid1_inserted_hm = print_record(recid1, 'hm') # insert test record #2: recs = bibupload.xml_marc_to_records(self.testrec2_xm) err1, recid2 = bibupload.bibupload(recs[0], opt_mode='insert') recid2_inserted_xm = print_record(recid2, 'xm') recid2_inserted_hm = print_record(recid2, 'hm') # let us compare stuff now: self.assertEqual(compare_xmbuffers(remove_tag_001_from_xmbuffer(recid1_inserted_xm), self.testrec1_xm), '') self.assertEqual(compare_hmbuffers(remove_tag_001_from_hmbuffer(recid1_inserted_hm), self.testrec1_hm), '') self.assertEqual(compare_xmbuffers(remove_tag_001_from_xmbuffer(recid2_inserted_xm), self.testrec2_xm), '') self.assertEqual(compare_hmbuffers(remove_tag_001_from_hmbuffer(recid2_inserted_hm), self.testrec2_hm), '') # clean up after ourselves: bibupload.wipe_out_record_from_all_tables(recid1) bibupload.wipe_out_record_from_all_tables(recid2) class BibUploadControlledProvenanceTest(unittest.TestCase): """Testing treatment of tags under controlled provenance in the correct mode.""" def setUp(self): """Initialize the MARCXML test record.""" self.testrec1_xm = """ 123456789 SzGeCERN Test, Jane Test Institute Test title blabla sam blublu sim human """ self.testrec1_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, Jane$$uTest Institute 245__ $$aTest title 6531_ $$9sam$$ablabla 6531_ $$9sim$$ablublu 6531_ $$ahuman """ self.testrec1_xm_to_correct = """ 123456789 bleble sim bloblo som """ self.testrec1_corrected_xm = """ 123456789 SzGeCERN Test, Jane Test Institute Test title blabla sam human bleble sim bloblo som """ self.testrec1_corrected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, Jane$$uTest Institute 245__ $$aTest title 6531_ $$9sam$$ablabla 6531_ $$ahuman 6531_ $$9sim$$ableble 6531_ $$9som$$abloblo """ # insert test record: task_set_task_param('verbose', 0) test_record_xm = self.testrec1_xm.replace('123456789', '') recs = bibupload.xml_marc_to_records(test_record_xm) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recID: self.testrec1_xm = self.testrec1_xm.replace('123456789', str(recid)) self.testrec1_hm = self.testrec1_hm.replace('123456789', str(recid)) self.testrec1_xm_to_correct = self.testrec1_xm_to_correct.replace('123456789', str(recid)) self.testrec1_corrected_xm = self.testrec1_corrected_xm.replace('123456789', str(recid)) self.testrec1_corrected_hm = self.testrec1_corrected_hm.replace('123456789', str(recid)) # test of the inserted record: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(inserted_xm, self.testrec1_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.testrec1_hm), '') def test_controlled_provenance_persistence(self): """bibupload - correct mode, tags with controlled provenance""" # correct metadata tags; will the protected tags be kept? task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(self.testrec1_xm_to_correct) err, recid = bibupload.bibupload(recs[0], opt_mode='correct') corrected_xm = print_record(recid, 'xm') corrected_hm = print_record(recid, 'hm') # did it work? self.assertEqual(compare_xmbuffers(corrected_xm, self.testrec1_corrected_xm), '') self.assertEqual(compare_hmbuffers(corrected_hm, self.testrec1_corrected_hm), '') # clean up after ourselves: bibupload.wipe_out_record_from_all_tables(recid) class BibUploadStrongTagsTest(unittest.TestCase): """Testing treatment of strong tags and the replace mode.""" def setUp(self): """Initialize the MARCXML test record.""" self.testrec1_xm = """ 123456789 SzGeCERN Test, Jane Test Institute Test title A value Another value """ % {'strong_tag': bibupload.CFG_BIBUPLOAD_STRONG_TAGS[0]} self.testrec1_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, Jane$$uTest Institute 245__ $$aTest title %(strong_tag)s__ $$aA value$$bAnother value """ % {'strong_tag': bibupload.CFG_BIBUPLOAD_STRONG_TAGS[0]} self.testrec1_xm_to_replace = """ 123456789 Test, Joseph Test Academy """ self.testrec1_replaced_xm = """ 123456789 Test, Joseph Test Academy A value Another value """ % {'strong_tag': bibupload.CFG_BIBUPLOAD_STRONG_TAGS[0]} self.testrec1_replaced_hm = """ 001__ 123456789 100__ $$aTest, Joseph$$uTest Academy %(strong_tag)s__ $$aA value$$bAnother value """ % {'strong_tag': bibupload.CFG_BIBUPLOAD_STRONG_TAGS[0]} # insert test record: task_set_task_param('verbose', 0) test_record_xm = self.testrec1_xm.replace('123456789', '') recs = bibupload.xml_marc_to_records(test_record_xm) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recID: self.testrec1_xm = self.testrec1_xm.replace('123456789', str(recid)) self.testrec1_hm = self.testrec1_hm.replace('123456789', str(recid)) self.testrec1_xm_to_replace = self.testrec1_xm_to_replace.replace('123456789', str(recid)) self.testrec1_replaced_xm = self.testrec1_replaced_xm.replace('123456789', str(recid)) self.testrec1_replaced_hm = self.testrec1_replaced_hm.replace('123456789', str(recid)) # test of the inserted record: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(inserted_xm, self.testrec1_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, self.testrec1_hm), '') def test_strong_tags_persistence(self): """bibupload - strong tags, persistence in replace mode""" # replace all metadata tags; will the strong tags be kept? recs = bibupload.xml_marc_to_records(self.testrec1_xm_to_replace) err, recid = bibupload.bibupload(recs[0], opt_mode='replace') replaced_xm = print_record(recid, 'xm') replaced_hm = print_record(recid, 'hm') # did it work? self.assertEqual(compare_xmbuffers(replaced_xm, self.testrec1_replaced_xm), '') self.assertEqual(compare_hmbuffers(replaced_hm, self.testrec1_replaced_hm), '') # clean up after ourselves: bibupload.wipe_out_record_from_all_tables(recid) return class BibUploadFFTModeTest(unittest.TestCase): """ Testing treatment of fulltext file transfer import mode. """ def _test_bibdoc_status(self, recid, docname, status): res = run_sql('SELECT bd.status FROM bibrec_bibdoc as bb JOIN bibdoc as bd ON bb.id_bibdoc = bd.id WHERE bb.id_bibrec = %s AND bd.docname = %s', (recid, docname)) self.failUnless(res) self.assertEqual(status, res[0][0]) def test_writing_rights(self): """bibupload - FFT has writing rights""" self.failUnless(bibupload.writing_rights_p()) def test_simple_fft_insert(self): """bibupload - simple FFT insert""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University http://cds.cern.ch/img/cds.gif """ testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University %(siteurl)s/record/123456789/files/cds.gif """ % {'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$u%(siteurl)s/record/123456789/files/cds.gif """ % {'siteurl': CFG_SITE_URL} testrec_expected_url = "%(siteurl)s/record/123456789/files/cds.gif" \ % {'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url = testrec_expected_url.replace('123456789', str(recid)) # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') self.failUnless(try_url_download(testrec_expected_url)) bibupload.wipe_out_record_from_all_tables(recid) def test_exotic_format_fft_append(self): """bibupload - exotic format FFT append""" # define the test case: testfile = os.path.join(CFG_TMPDIR, 'test.ps.Z') open(testfile, 'w').write('TEST') test_to_upload = """ SzGeCERN Test, John Test University """ testrec_to_append = """ 123456789 %s """ % testfile testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University %(siteurl)s/record/123456789/files/test.ps.Z """ % {'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$u%(siteurl)s/record/123456789/files/test.ps.Z """ % {'siteurl': CFG_SITE_URL} testrec_expected_url = "%(siteurl)s/record/123456789/files/test.ps.Z" \ % {'siteurl': CFG_SITE_URL} testrec_expected_url2 = "%(siteurl)s/record/123456789/files/test?format=ps.Z" \ % {'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_to_append = testrec_to_append.replace('123456789', str(recid)) testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url = testrec_expected_url.replace('123456789', str(recid)) testrec_expected_url2 = testrec_expected_url.replace('123456789', str(recid)) recs = bibupload.xml_marc_to_records(testrec_to_append) err, recid = bibupload.bibupload(recs[0], opt_mode='append') # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') self.assertEqual(urlopen(testrec_expected_url).read(), 'TEST') self.assertEqual(urlopen(testrec_expected_url2).read(), 'TEST') bibupload.wipe_out_record_from_all_tables(recid) def test_fft_check_md5_through_bibrecdoc_str(self): """bibupload - simple FFT insert, check md5 through BibRecDocs.str()""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University %s/img/head.gif """ % CFG_SITE_URL # insert test record: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') original_md5 = md5(urlopen('%s/img/head.gif' % CFG_SITE_URL).read()).hexdigest() bibrec_str = str(BibRecDocs(int(recid))) md5_found = False for row in bibrec_str.split('\n'): if 'checksum' in row: if original_md5 in row: md5_found = True self.failUnless(md5_found) bibupload.wipe_out_record_from_all_tables(recid) def test_detailed_fft_insert(self): """bibupload - detailed FFT insert""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University http://cds.cern.ch/img/cds.gif SuperMain This is a description This is a comment CIDIESSE http://cds.cern.ch/img/cds.gif SuperMain .jpeg This is a description This is a second comment CIDIESSE """ testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University %(siteurl)s/record/123456789/files/CIDIESSE.gif This is a description This is a comment %(siteurl)s/record/123456789/files/CIDIESSE.jpeg This is a description This is a second comment """ % {'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$u%(siteurl)s/record/123456789/files/CIDIESSE.gif$$yThis is a description$$zThis is a comment 8564_ $$u%(siteurl)s/record/123456789/files/CIDIESSE.jpeg$$yThis is a description$$zThis is a second comment """ % {'siteurl': CFG_SITE_URL} testrec_expected_url1 = "%(siteurl)s/record/123456789/files/CIDIESSE.gif" % {'siteurl': CFG_SITE_URL} testrec_expected_url2 = "%(siteurl)s/record/123456789/files/CIDIESSE.jpeg" % {'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url1 = testrec_expected_url1.replace('123456789', str(recid)) testrec_expected_url2 = testrec_expected_url1.replace('123456789', str(recid)) # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') self.failUnless(try_url_download(testrec_expected_url1)) self.failUnless(try_url_download(testrec_expected_url2)) bibupload.wipe_out_record_from_all_tables(recid) def test_simple_fft_insert_with_restriction(self): """bibupload - simple FFT insert with restriction""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University http://cds.cern.ch/img/cds.gif thesis http://cds.cern.ch/img/cds.gif """ testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University %(siteurl)s/record/123456789/files/cds.gif - %(siteurl)s/record/123456789/files/icon-cds.gif + %(siteurl)s/record/123456789/files/cds.gif?subformat=icon icon """ % {'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$u%(siteurl)s/record/123456789/files/cds.gif - 8564_ $$q%(siteurl)s/record/123456789/files/icon-cds.gif$$xicon + 8564_ $$u%(siteurl)s/record/123456789/files/cds.gif?subformat=icon$$xicon """ % {'siteurl': CFG_SITE_URL} testrec_expected_url = "%(siteurl)s/record/123456789/files/cds.gif" \ % {'siteurl': CFG_SITE_URL} - testrec_expected_icon = "%(siteurl)s/record/123456789/files/icon-cds.gif" \ + testrec_expected_icon = "%(siteurl)s/record/123456789/files/cds.gif?subformat=icon" \ % {'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url = testrec_expected_url.replace('123456789', str(recid)) testrec_expected_icon = testrec_expected_icon.replace('123456789', str(recid)) # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') - open_url = urlopen(testrec_expected_url) - self.failUnless("This file is restricted" in open_url.read()) + self.assertRaises(HTTPError, urlopen, testrec_expected_url) + self.assertRaises(HTTPError, urlopen, testrec_expected_icon) - open_icon = urlopen(testrec_expected_icon) - restricted_icon = urlopen("%s/img/restricted.gif" % CFG_SITE_URL) - self.failUnless(open_icon.read() == restricted_icon.read()) bibupload.wipe_out_record_from_all_tables(recid) def test_simple_fft_insert_with_icon(self): """bibupload - simple FFT insert with icon""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University http://cds.cern.ch/img/cds.gif http://cds.cern.ch/img/cds.gif """ testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University %(siteurl)s/record/123456789/files/cds.gif - %(siteurl)s/record/123456789/files/icon-cds.gif + %(siteurl)s/record/123456789/files/cds.gif?subformat=icon icon """ % {'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$u%(siteurl)s/record/123456789/files/cds.gif - 8564_ $$q%(siteurl)s/record/123456789/files/icon-cds.gif$$xicon + 8564_ $$u%(siteurl)s/record/123456789/files/cds.gif?subformat=icon$$xicon """ % {'siteurl': CFG_SITE_URL} testrec_expected_url = "%(siteurl)s/record/123456789/files/cds.gif" \ % {'siteurl': CFG_SITE_URL} - testrec_expected_icon = "%(siteurl)s/record/123456789/files/icon-cds.gif" \ + testrec_expected_icon = "%(siteurl)s/record/123456789/files/cds.gif?subformat=icon" \ % {'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url = testrec_expected_url.replace('123456789', str(recid)) testrec_expected_icon = testrec_expected_icon.replace('123456789', str(recid)) # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') self.failUnless(try_url_download(testrec_expected_url)) self.failUnless(try_url_download(testrec_expected_icon)) bibupload.wipe_out_record_from_all_tables(recid) def test_multiple_fft_insert(self): """bibupload - multiple FFT insert""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University http://cds.cern.ch/img/cds.gif http://cdsweb.cern.ch/img/head.gif http://doc.cern.ch/archive/electronic/hep-th/0101/0101001.pdf %(prefix)s/var/tmp/demobibdata.xml """ % { 'prefix': CFG_PREFIX } testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University %(siteurl)s/record/123456789/files/0101001.pdf %(siteurl)s/record/123456789/files/cds.gif %(siteurl)s/record/123456789/files/demobibdata.xml %(siteurl)s/record/123456789/files/head.gif """ % { 'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$u%(siteurl)s/record/123456789/files/0101001.pdf 8564_ $$u%(siteurl)s/record/123456789/files/cds.gif 8564_ $$u%(siteurl)s/record/123456789/files/demobibdata.xml 8564_ $$u%(siteurl)s/record/123456789/files/head.gif """ % { 'siteurl': CFG_SITE_URL} # insert test record: testrec_expected_urls = [] for files in ('cds.gif', 'head.gif', '0101001.pdf', 'demobibdata.xml'): testrec_expected_urls.append('%(siteurl)s/record/123456789/files/%(files)s' % {'siteurl' : CFG_SITE_URL, 'files' : files}) task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_urls = [] for files in ('cds.gif', 'head.gif', '0101001.pdf', 'demobibdata.xml'): testrec_expected_urls.append('%(siteurl)s/record/%(recid)s/files/%(files)s' % {'siteurl' : CFG_SITE_URL, 'files' : files, 'recid' : recid}) # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') # FIXME: Next test has been commented out since, appearently, the # returned xml can have non predictable row order (but still correct) # Using only html marc output is fine because a value is represented # by a single row, so a row to row comparison can be employed. self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') for url in testrec_expected_urls: self.failUnless(try_url_download(url)) self._test_bibdoc_status(recid, 'head', '') self._test_bibdoc_status(recid, '0101001', '') self._test_bibdoc_status(recid, 'cds', '') self._test_bibdoc_status(recid, 'demobibdata', '') bibupload.wipe_out_record_from_all_tables(recid) def test_simple_fft_correct(self): """bibupload - simple FFT correct""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University http://cds.cern.ch/img/cds.gif """ test_to_correct = """ 123456789 http://cds.cern.ch/img/cds.gif """ testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University %(siteurl)s/record/123456789/files/cds.gif """ % { 'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$u%(siteurl)s/record/123456789/files/cds.gif """ % { 'siteurl': CFG_SITE_URL} testrec_expected_url = "%(siteurl)s/record/123456789/files/cds.gif" \ % {'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url = testrec_expected_url.replace('123456789', str(recid)) test_to_correct = test_to_correct.replace('123456789', str(recid)) # correct test record with new FFT: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_correct) bibupload.bibupload(recs[0], opt_mode='correct') # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.failUnless(try_url_download(testrec_expected_url)) self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') self._test_bibdoc_status(recid, 'cds', '') #print "\nRecid: " + str(recid) + "\n" #print testrec_expected_hm + "\n" #print print_record(recid, 'hm') + "\n" bibupload.wipe_out_record_from_all_tables(recid) def test_fft_implicit_fix_marc(self): """bibupload - FFT implicit FIX-MARC""" test_to_upload = """ SzGeCERN Test, John Test University foo@bar.com http://cds.cern.ch/img/cds.gif """ test_to_correct = """ 123456789 foo@bar.com http://cds.cern.ch/img/cds.gif %(siteurl)s/record/123456789/files/cds.gif """ % { 'siteurl': CFG_SITE_URL} testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University foo@bar.com http://cds.cern.ch/img/cds.gif """ testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8560_ $$ffoo@bar.com 8564_ $$uhttp://cds.cern.ch/img/cds.gif """ task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: test_to_correct = test_to_correct.replace('123456789', str(recid)) testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) # correct test record with implicit FIX-MARC: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_correct) bibupload.bibupload(recs[0], opt_mode='correct') # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') bibupload.wipe_out_record_from_all_tables(recid) def test_fft_vs_bibedit(self): """bibupload - FFT Vs. BibEdit compatibility""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University http://cds.cern.ch/img/cds.gif """ test_to_replace = """ 123456789 SzGeCERN Test, John Test University http://www.google.com/ BibEdit Comment %(siteurl)s/record/123456789/files/cds.gif BibEdit Description 01 http://cern.ch/ """ % { 'siteurl': CFG_SITE_URL} testrec_expected_xm = str(test_to_replace) testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$uhttp://www.google.com/ 8564_ $$u%(siteurl)s/record/123456789/files/cds.gif$$x01$$yBibEdit Description$$zBibEdit Comment 8564_ $$uhttp://cern.ch/ """ % { 'siteurl': CFG_SITE_URL} testrec_expected_url = "%(siteurl)s/record/123456789/files/cds.gif" \ % {'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url = testrec_expected_url.replace('123456789', str(recid)) test_to_replace = test_to_replace.replace('123456789', str(recid)) # correct test record with new FFT: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_replace) bibupload.bibupload(recs[0], opt_mode='replace') # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.failUnless(try_url_download(testrec_expected_url)) self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') self._test_bibdoc_status(recid, 'cds', '') bibrecdocs = BibRecDocs(recid) bibdoc = bibrecdocs.get_bibdoc('cds') self.assertEqual(bibdoc.get_description('.gif'), 'BibEdit Description') bibupload.wipe_out_record_from_all_tables(recid) def test_detailed_fft_correct(self): """bibupload - detailed FFT correct""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University http://cds.cern.ch/img/cds.gif Try Comment """ test_to_correct = """ 123456789 http://cdsweb.cern.ch/img/head.gif cds patata Next Try KEEP-OLD-VALUE """ testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University %(siteurl)s/record/123456789/files/patata.gif Next Try Comment """ % { 'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$u%(siteurl)s/record/123456789/files/patata.gif$$yNext Try$$zComment """ % { 'siteurl': CFG_SITE_URL} testrec_expected_url = "%(siteurl)s/record/123456789/files/patata.gif" \ % {'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url = testrec_expected_url.replace('123456789', str(recid)) test_to_correct = test_to_correct.replace('123456789', str(recid)) # correct test record with new FFT: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_correct) bibupload.bibupload(recs[0], opt_mode='correct') # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.failUnless(try_url_download(testrec_expected_url)) self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') self._test_bibdoc_status(recid, 'patata', '') #print "\nRecid: " + str(recid) + "\n" #print testrec_expected_hm + "\n" #print print_record(recid, 'hm') + "\n" bibupload.wipe_out_record_from_all_tables(recid) def test_no_url_fft_correct(self): """bibupload - no_url FFT correct""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University http://cds.cern.ch/img/cds.gif Try Comment """ test_to_correct = """ 123456789 cds patata .gif KEEP-OLD-VALUE Next Comment """ testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University %(siteurl)s/record/123456789/files/patata.gif Try Next Comment """ % { 'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$u%(siteurl)s/record/123456789/files/patata.gif$$yTry$$zNext Comment """ % { 'siteurl': CFG_SITE_URL} testrec_expected_url = "%(siteurl)s/record/123456789/files/patata.gif" \ % {'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url = testrec_expected_url.replace('123456789', str(recid)) test_to_correct = test_to_correct.replace('123456789', str(recid)) # correct test record with new FFT: recs = bibupload.xml_marc_to_records(test_to_correct) bibupload.bibupload(recs[0], opt_mode='correct') # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.failUnless(try_url_download(testrec_expected_url)) self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') self._test_bibdoc_status(recid, 'patata', '') #print "\nRecid: " + str(recid) + "\n" #print testrec_expected_hm + "\n" #print print_record(recid, 'hm') + "\n" bibupload.wipe_out_record_from_all_tables(recid) def test_new_icon_fft_append(self): """bibupload - new icon FFT append""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University """ test_to_correct = """ 123456789 cds http://cds.cern.ch/img/cds.gif """ testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University - %(siteurl)s/record/123456789/files/icon-cds.gif + %(siteurl)s/record/123456789/files/cds.gif?subformat=icon icon """ % { 'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University - 8564_ $$q%(siteurl)s/record/123456789/files/icon-cds.gif$$xicon + 8564_ $$u%(siteurl)s/record/123456789/files/cds.gif?subformat=icon$$xicon """ % { 'siteurl': CFG_SITE_URL} - testrec_expected_url = "%(siteurl)s/record/123456789/files/icon-cds.gif" \ + testrec_expected_url = "%(siteurl)s/record/123456789/files/cds.gif?subformat=icon" \ % {'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 9) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url = testrec_expected_url.replace('123456789', str(recid)) test_to_correct = test_to_correct.replace('123456789', str(recid)) # correct test record with new FFT: task_set_task_param('verbose', 9) recs = bibupload.xml_marc_to_records(test_to_correct) bibupload.bibupload(recs[0], opt_mode='append') # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.failUnless(try_url_download(testrec_expected_url)) self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') self._test_bibdoc_status(recid, 'cds', '') #print "\nRecid: " + str(recid) + "\n" #print testrec_expected_hm + "\n" #print print_record(recid, 'hm') + "\n" bibupload.wipe_out_record_from_all_tables(recid) def test_multiple_fft_correct(self): """bibupload - multiple FFT correct""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University http://cds.cern.ch/img/cds.gif Try Comment Restricted http://cds.cern.ch/img/cds.gif .jpeg Try jpeg Comment jpeg Restricted """ test_to_correct = """ 123456789 http://cds.cern.ch/img/cds.gif patata .gif New restricted """ testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University %(siteurl)s/record/123456789/files/patata.gif """ % { 'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$u%(siteurl)s/record/123456789/files/patata.gif """ % { 'siteurl': CFG_SITE_URL} testrec_expected_url = "%(siteurl)s/record/123456789/files/patata.gif" \ % {'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url = testrec_expected_url.replace('123456789', str(recid)) test_to_correct = test_to_correct.replace('123456789', str(recid)) # correct test record with new FFT: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_correct) bibupload.bibupload(recs[0], opt_mode='correct') # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') - self.failUnless(try_url_download(testrec_expected_url)) + self.assertRaises(StandardError, try_url_download, testrec_expected_url) self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') self._test_bibdoc_status(recid, 'patata', 'New restricted') #print "\nRecid: " + str(recid) + "\n" #print testrec_expected_hm + "\n" #print print_record(recid, 'hm') + "\n" bibupload.wipe_out_record_from_all_tables(recid) def test_purge_fft_correct(self): """bibupload - purge FFT correct""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University http://cds.cern.ch/img/cds.gif http://cdsweb.cern.ch/img/head.gif """ test_to_correct = """ 123456789 http://cds.cern.ch/img/cds.gif """ test_to_purge = """ 123456789 http://cds.cern.ch/img/cds.gif PURGE """ testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University %(siteurl)s/record/123456789/files/cds.gif %(siteurl)s/record/123456789/files/head.gif """ % { 'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$u%(siteurl)s/record/123456789/files/cds.gif 8564_ $$u%(siteurl)s/record/123456789/files/head.gif """ % { 'siteurl': CFG_SITE_URL} testrec_expected_url = "%(siteurl)s/record/123456789/files/cds.gif" % { 'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url = testrec_expected_url.replace('123456789', str(recid)) test_to_correct = test_to_correct.replace('123456789', str(recid)) test_to_purge = test_to_purge.replace('123456789', str(recid)) # correct test record with new FFT: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_correct) bibupload.bibupload(recs[0], opt_mode='correct') # purge test record with new FFT: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_purge) bibupload.bibupload(recs[0], opt_mode='correct') # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.failUnless(try_url_download(testrec_expected_url)) self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') self._test_bibdoc_status(recid, 'cds', '') self._test_bibdoc_status(recid, 'head', '') #print "\nRecid: " + str(recid) + "\n" #print testrec_expected_hm + "\n" #print print_record(recid, 'hm') + "\n" bibupload.wipe_out_record_from_all_tables(recid) def test_revert_fft_correct(self): """bibupload - revert FFT correct""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University %s/img/iconpen.gif cds """ % CFG_SITE_URL test_to_correct = """ 123456789 %s/img/head.gif cds """ % CFG_SITE_URL test_to_revert = """ 123456789 cds REVERT 1 """ testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University %(siteurl)s/record/123456789/files/cds.gif """ % { 'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$u%(siteurl)s/record/123456789/files/cds.gif """ % { 'siteurl': CFG_SITE_URL} testrec_expected_url = "%(siteurl)s/record/123456789/files/cds.gif" % { 'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 9) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url = testrec_expected_url.replace('123456789', str(recid)) test_to_correct = test_to_correct.replace('123456789', str(recid)) test_to_revert = test_to_revert.replace('123456789', str(recid)) # correct test record with new FFT: task_set_task_param('verbose', 9) recs = bibupload.xml_marc_to_records(test_to_correct) bibupload.bibupload(recs[0], opt_mode='correct') # revert test record with new FFT: task_set_task_param('verbose', 9) recs = bibupload.xml_marc_to_records(test_to_revert) bibupload.bibupload(recs[0], opt_mode='correct') # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.failUnless(try_url_download(testrec_expected_url)) self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') self._test_bibdoc_status(recid, 'cds', '') expected_content_version1 = urlopen('%s/img/iconpen.gif' % CFG_SITE_URL).read() expected_content_version2 = urlopen('%s/img/head.gif' % CFG_SITE_URL).read() expected_content_version3 = expected_content_version1 content_version1 = urlopen('%s/record/%s/files/cds.gif?version=1' % (CFG_SITE_URL, recid)).read() content_version2 = urlopen('%s/record/%s/files/cds.gif?version=2' % (CFG_SITE_URL, recid)).read() content_version3 = urlopen('%s/record/%s/files/cds.gif?version=3' % (CFG_SITE_URL, recid)).read() self.assertEqual(expected_content_version1, content_version1) self.assertEqual(expected_content_version2, content_version2) self.assertEqual(expected_content_version3, content_version3) #print "\nRecid: " + str(recid) + "\n" #print testrec_expected_hm + "\n" #print print_record(recid, 'hm') + "\n" bibupload.wipe_out_record_from_all_tables(recid) def test_simple_fft_replace(self): """bibupload - simple FFT replace""" # define the test case: test_to_upload = """ SzGeCERN Test, John Test University %s/img/iconpen.gif cds """ % CFG_SITE_URL test_to_replace = """ 123456789 SzGeCERN Test, John Test University %s/img/head.gif """ % CFG_SITE_URL testrec_expected_xm = """ 123456789 SzGeCERN Test, John Test University %(siteurl)s/record/123456789/files/head.gif """ % { 'siteurl': CFG_SITE_URL} testrec_expected_hm = """ 001__ 123456789 003__ SzGeCERN 100__ $$aTest, John$$uTest University 8564_ $$u%(siteurl)s/record/123456789/files/head.gif """ % { 'siteurl': CFG_SITE_URL} testrec_expected_url = "%(siteurl)s/record/123456789/files/head.gif" % { 'siteurl': CFG_SITE_URL} # insert test record: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_upload) err, recid = bibupload.bibupload(recs[0], opt_mode='insert') # replace test buffers with real recid of inserted test record: testrec_expected_xm = testrec_expected_xm.replace('123456789', str(recid)) testrec_expected_hm = testrec_expected_hm.replace('123456789', str(recid)) testrec_expected_url = testrec_expected_url.replace('123456789', str(recid)) test_to_replace = test_to_replace.replace('123456789', str(recid)) # replace test record with new FFT: task_set_task_param('verbose', 0) recs = bibupload.xml_marc_to_records(test_to_replace) bibupload.bibupload(recs[0], opt_mode='replace') # compare expected results: inserted_xm = print_record(recid, 'xm') inserted_hm = print_record(recid, 'hm') self.failUnless(try_url_download(testrec_expected_url)) self.assertEqual(compare_xmbuffers(inserted_xm, testrec_expected_xm), '') self.assertEqual(compare_hmbuffers(inserted_hm, testrec_expected_hm), '') expected_content_version = urlopen('%s/img/head.gif' % CFG_SITE_URL).read() content_version = urlopen('%s/record/%s/files/head.gif' % (CFG_SITE_URL, recid)).read() self.assertEqual(expected_content_version, content_version) #print "\nRecid: " + str(recid) + "\n" #print testrec_expected_hm + "\n" #print print_record(recid, 'hm') + "\n" bibupload.wipe_out_record_from_all_tables(recid) TEST_SUITE = make_test_suite(BibUploadInsertModeTest, BibUploadAppendModeTest, BibUploadCorrectModeTest, BibUploadDeleteModeTest, BibUploadReplaceModeTest, BibUploadReferencesModeTest, BibUploadRecordsWithSYSNOTest, BibUploadRecordsWithEXTOAIIDTest, BibUploadRecordsWithOAIIDTest, BibUploadFMTModeTest, BibUploadIndicatorsTest, BibUploadUpperLowerCaseTest, BibUploadControlledProvenanceTest, BibUploadStrongTagsTest, BibUploadFFTModeTest, ) if __name__ == "__main__": run_test_suite(TEST_SUITE, warn_user=True) diff --git a/modules/miscutil/demo/demobibdata.xml b/modules/miscutil/demo/demobibdata.xml index bc0f7de5f..ca552205c 100644 --- a/modules/miscutil/demo/demobibdata.xml +++ b/modules/miscutil/demo/demobibdata.xml @@ -1,22835 +1,22838 @@ CERN-EX-0106015 Photolab ALEPH experiment: Candidate of Higgs boson production Expérience ALEPH: Candidat de la production d'un boson Higgs 14 06 2000 FILM Candidate for the associated production of the Higgs boson and Z boson. Both, the Higgs and Z boson decay into 2 jets each. The green and the yellow jets belong to the Higgs boson. They represent the fragmentation of a bottom andanti-bottom quark. The red and the blue jets stem from the decay of the Z boson into a quark anti-quark pair. Left: View of the event along the beam axis. Bottom right: Zoom around the interaction point at the centre showing detailsof the fragmentation of the bottom and anti-bottom quarks. As expected for b quarks, in each jet the decay of a long-lived B meson is visible. Top right: "World map" showing the spatial distribution of the jets in the event. Press SzGeCERN Experiments and Tracks LEP neil.calder@cern.ch http://cdsware.cern.ch/download/invenio-demo-site-files/0106015_01.jpg - http://cdsware.cern.ch/download/invenio-demo-site-files/0106015_01.gif - restricted_picture + + + http://cdsware.cern.ch/download/invenio-demo-site-files/0106015_01.gif + .gif;icon + restricted_picture 0003717PHOPHO 2000 81 2001-06-14 50 2001-08-27 CM Bldg. 2 Calder, N n 200231 PICTURE CERN-EX-0104007 Patrice Loïez The first CERN-built module of the barrel section of ATLAS's electromagnetic calorimeter Premier module du tonneau du calorimètre electromagnétique d'ATLAS 10 Apr 2001 DIGITAL Behind the module, left to right Ralf Huber, Andreas Bies and Jorgen Beck Hansen. In front of the module, left to right: Philippe Lançon and Edward Wood. Derrière le module, de gauche à droite: Ralf Huber, Andreas Bies, Jorgen Beck Hansen. Devant le module, de gauche à droite : Philippe Lançon et Edward Wood. CERN EDS SzGeCERN Experiments and Tracks marie.noelle.pages.ribeiro@cern.ch http://cdsware.cern.ch/download/invenio-demo-site-files/0104007_02.jpeg http://cdsware.cern.ch/download/invenio-demo-site-files/0104007_02.gif 0003601PHOPHO 2001 81 2001-04-23 50 2001-06-18 CM 0020699 ADMBUL CERN Bulletin 18/2001 : 30 April 2001 (English) 0020700 ADMBUL CERN Bulletin 18/2001 : 30 avril 2001 (French) Bldg. 184 Fassnacht, P n 200231 PICTURE CERN-HI-6902127 European Molecular Biology Conference Jul 1969 In February, the Agreement establishing the European Molecular Biology Conference was signed at CERN. Willy Spuhler is signing for Switzerland. SzGeCERN Personalities and History of CERN http://cdsware.cern.ch/download/invenio-demo-site-files/6902127.jpeg http://cdsware.cern.ch/download/invenio-demo-site-files/6902127.gif 0002690PHOPHO 1969 81 2000-06-13 50 2000-06-13 CM 127-2-69 n 200024 PICTURE CERN-DI-9906028 J.L. Caron The Twenty Member States of CERN (with dates of accession) on 1 June 1999 Jun 1999 CERN Member States. Les Etats membres du CERN. Press SzGeCERN Diagrams and Charts http://cdsware.cern.ch/download/invenio-demo-site-files/9906028_01.jpeg http://cdsware.cern.ch/download/invenio-demo-site-files/9906028_01.gif 0001754PHOPHO 1999 81 1999-06-17 50 2000-10-30 CM n 199924 PICTURE CERN-DI-9905005 High energy cosmic rays striking atoms at the top of the atmosphere give the rise to showers of particles striking the Earth's surface Des rayons cosmiques de haute energie heurtent des atomes dans la haute atmosphere et donnent ainsi naissance a des gerbes de particules projetees sur la surface terrestre 10 May 1999 DIGITAL Press SzGeCERN Diagrams and Charts neil.calder@cern.ch http://cdsware.cern.ch/download/invenio-demo-site-files/9905005_01.jpeg http://cdsware.cern.ch/download/invenio-demo-site-files/9905005_01.gif 0001626PHOPHO 1999 81 1999-05-10 50 2000-09-12 CM Bldg. 60 Calder, N n 200231 PICTURE CERN-HI-6206002 eng At CERN in 1962 eight Nobel prizewinners 1962 In 1962, CERN hosted the 11th International Conference on High Energy Physics. Among the distinguished visitors were eight Nobel prizewinners.Left to right: Cecil F. Powell, Isidor I. Rabi, Werner Heisenberg, Edwin M. McMillan, Emile Segre, Tsung Dao Lee, Chen Ning Yang and Robert Hofstadter. En 1962, le CERN est l'hote de la onzieme Conference Internationale de Physique des Hautes Energies. Parmi les visiteurs eminents se trouvaient huit laureats du prix Nobel.De gauche a droite: Cecil F. Powell, Isidor I. Rabi, Werner Heisenberg, Edwin M. McMillan, Emile Segre, Tsung Dao Lee, Chen Ning Yang et Robert Hofstadter. Press SzGeCERN Personalities and History of CERN Nobel laureate http://cdsware.cern.ch/download/invenio-demo-site-files/6206002.jpg http://cdsware.cern.ch/download/invenio-demo-site-files/6206002.gif 0000736PHOPHO 1962 81 1998-07-23 50 2002-07-15 CM http://www.nobel.se/physics/laureates/1950/index.html The Nobel Prize in Physics 1950 : Cecil Frank Powell http://www.nobel.se/physics/laureates/1944/index.html The Nobel Prize in Physics 1944 : Isidor Isaac Rabi http://www.nobel.se/physics/laureates/1932/index.html The Nobel Prize in Physics 1932 : Werner Karl Heisenberg http://www.nobel.se/chemistry/laureates/1951/index.html The Nobel Prize in Chemistry 1951 : Edwin Mattison McMillan http://www.nobel.se/physics/laureates/1959/index.html The Nobel Prize in Physics 1959 : Emilio Gino Segre http://www.nobel.se/physics/laureates/1957/index.html The Nobel Prize in Physics 1957 : Chen Ning Yang and Tsung-Dao Lee http://www.nobel.se/physics/laureates/1961/index.html The Nobel Prize in Physics 1961 : Robert Hofstadter 6206002 (1962) n 199830 PICTURE CERN-GE-9806033 Tim Berners-Lee World-Wide Web inventor 28 Jun 1998 Conference "Internet, Web, What's next?" on 26 June 1998 at CERN : Tim Berners-Lee, inventor of the World-Wide Web and Director of the W3C, explains how the Web came to be and give his views on the future. Conference "Internet, Web, What's next?" le 26 juin 1998 au CERN: Tim Berners-Lee, inventeur du World-Wide Web et directeur du W3C, explique comment le Web est ne, et donne ses opinions sur l'avenir. Press SzGeCERN Life at CERN neil.calder@cern.ch http://cdsware.cern.ch/download/invenio-demo-site-files/9806033.jpeg http://cdsware.cern.ch/download/invenio-demo-site-files/9806033.gif 0000655PHOPHO 1998 81 1998-07-03 50 2001-07-10 CM http://www.cern.ch/CERN/Announcements/1998/WebNext.html "Internet, Web, What's next?" 26 June 1998 http://Bulletin.cern.ch/9828/art2/Text_E.html CERN Bulletin no 28/98 (6 July 1998) (English) http://Bulletin.cern.ch/9828/art2/Text_F.html CERN Bulletin no 28/98 (6 juillet 1998) (French) http://www.w3.org/People/Berners-Lee/ Biography 0000990 PRSPRS Le Pays Gessien : 3 Jul 1998 0001037 PRSPRS Le Temps : 27 Jun 1998 0000809 PRSPRS La Tribune de Geneve : 27 Jun 1998 Bldg. 60 Calder, N n 199827 PICTURE astro-ph/9812226 eng Efstathiou, G P Cambridge University Constraints on $\Omega_{\Lambda}$ and $\Omega_{m}$from Distant Type 1a Supernovae and Cosmic Microwave Background Anisotropies 14 Dec 1998 6 p We perform a combined likelihood analysis of the latest cosmic microwave background anisotropy data and distant Type 1a Supernova data of Perlmutter etal (1998a). Our analysis is restricted tocosmological models where structure forms from adiabatic initial fluctuations characterised by a power-law spectrum with negligible tensor component. Marginalizing over other parameters, our bestfit solution gives Omega_m = 0.25 (+0.18, -0.12) and Omega_Lambda = 0.63 (+0.17, -0.23) (95 % confidence errors) for the cosmic densities contributed by matter and a cosmological constantrespectively. The results therefore strongly favour a nearly spatially flat Universe with a non-zero cosmological constant. LANL EDS SzGeCERN Astrophysics and Astronomy Lasenby, A N Hobson, M P Ellis, R S Bridle, S L George Efstathiou <gpe@ast.cam.ac.uk> http://cdsware.cern.ch/download/invenio-demo-site-files/9812226.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/9812226.fig1.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/9812226.fig3.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/9812226.fig5.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/9812226.fig6.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/9812226.fig7.ps.gz Additional 1998 11 1998-12-14 50 2001-04-07 BATCH Mon. Not. R. Astron. Soc. SLAC 4162242 CER n 200231 PREPRINT Bond, J.R. 1996, Theory and Observations of the Cosmic Background Radiation, in "Cosmology and Large Scale Structure", Les Houches Session LX, August 1993, eds. R. Schaeffer, J. Silk, M. Spiro and J. Zinn-Justin, Elsevier SciencePress, Amsterdam, p469 Bond J.R., Efstathiou G., Tegmark M., 1997 L33 Mon. Not. R. Astron. Soc. 291 1997 Mon. Not. R. Astron. Soc. 291 (1997) L33 Bond, J.R., Jaffe, A. 1997, in Proc. XXXI Rencontre de Moriond, ed. F. Bouchet, Edition Fronti eres, in press astro-ph/9610091 Bond J.R., Jaffe A.H. and Knox L.E., 1998 astro-ph/9808264 Astrophys.J. 533 (2000) 19 Burles S., Tytler D., 1998a, to appear in the Proceedings of the Second Oak Ridge Symposium on Atomic & Nuclear Astrophysics, ed. A. Mezzacappa, Institute of Physics, Bristol astro-ph/9803071 Burles S., Tytler D., 1998b, Astrophys. J.in press astro-ph/9712109 Astrophys.J. 507 (1998) 732 Caldwell, R.R., Dave, R., Steinhardt P.J., 1998 1582 Phys. Rev. Lett. 80 1998 Phys. Rev. Lett. 80 (1998) 1582 Carroll S.M., Press W.H., Turner E.L., 1992, Ann. Rev. Astr. Astrophys., 30, 499. Chaboyer B., 1998 astro-ph/9808200 Phys.Rept. 307 (1998) 23 Devlin M.J., De Oliveira-Costa A., Herbig T., Miller A.D., Netterfield C.B., Page L., Tegmark M., 1998, submitted to Astrophys. J astro-ph/9808043 Astrophys. J. 509 (1998) L69-72 Efstathiou G. 1996, Observations of Large-Scale Structure in the Universe, in "Cosmology and Large Scale Structure", Les Houches Session LX, August 1993, eds. R. Schaeffer, J. Silk, M. Spiro and J. Zinn-Justin, Elsevier SciencePress, Amsterdam, p135. Efstathiou G., Bond J.R., Mon. Not. R. Astron. Soc.in press astro-ph/9807130 Astrophys. J. 518 (1999) 2-23 Evrard G., 1998, submitted to Mon. Not. R. Astron. Soc astro-ph/9701148 Mon.Not.Roy.Astron.Soc. 292 (1997) 289 Freedman J.B., Mould J.R., Kennicutt R.C., Madore B.F., 1998 astro-ph/9801090 Astrophys. J. 480 (1997) 705 Garnavich P.M. et al. 1998 astro-ph/9806396 Astrophys.J. 509 (1998) 74-79 Goobar A., Perlmutter S., 1995 14 Astrophys. J. 450 1995 Astrophys. J. 450 (1995) 14 Hamuy M., Phillips M.M., Maza J., Suntzeff N.B., Schommer R.A., Aviles R. 1996 2391 Astrophys. J. 112 1996 Astrophys. J. 112 (1996) 2391 Hancock S., Gutierrez C.M., Davies R.D., Lasenby A.N., Rocha G., Rebolo R., Watson R.A., Tegmark M., 1997 505 Mon. Not. R. Astron. Soc. 298 1997 Mon. Not. R. Astron. Soc. 298 (1997) 505 Hancock S., Rocha G., Lasenby A.N., Gutierrez C.M., 1998 L1 Mon. Not. R. Astron. Soc. 294 1998 Mon. Not. R. Astron. Soc. 294 (1998) L1 Herbig T., De Oliveira-Costa A., Devlin M.J., Miller A.D., Page L., Tegmark M., 1998, submitted to Astrophys. J astro-ph/9808044 Astrophys.J. 509 (1998) L73-76 Lineweaver C.H., 1998. Astrophys. J.505, L69. Lineweaver, C.H., Barbosa D., 1998a 624 Astrophys. J. 446 1998 Astrophys. J. 446 (1998) 624 Lineweaver, C.H., Barbosa D., 1998b 799 Astron. Astrophys. 329 1998 Astron. Astrophys. 329 (1998) 799 De Oliveira-Costa A., Devlin M.J., Herbig T., Miller A.D., Netterfield C.B. Page L., Tegmark M., 1998, submitted to Astrophys. J astro-ph/9808045 Astrophys. J. 509 (1998) L77-80 Ostriker J.P., Steinhardt P.J., 1995 600 Nature 377 1995 Nature 377 (1995) 600 Peebles P.J.E., 1993, Principles of Physical Cosmology, Princeton University Press, Princeton, New Jersey. Perlmutter S, et al., 1995, In Presentations at the NATO ASI in Aiguablava, Spain, LBL-38400; also published in Thermonuclear Supernova, P. Ruiz-Lapuente, R. Cana and J. Isern (eds), Dordrecht, Kluwer, 1997, p749. Perlmutter S, et al., 1997 565 Astrophys. J. 483 1997 Astrophys. J. 483 (1997) 565 Perlmutter S. et al., 1998a, Astrophys. J.in press. (P98) astro-ph/9812133 Astrophys. J. 517 (1999) 565-586 Perlmutter S. et al., 1998b, In Presentation at the January 1988 Meeting of the American Astronomical Society, Washington D.C., LBL-42230, available at www-supernova.lbl.gov; B.A.A.S., volume : 29 (1997) 1351Perlmutter S, et al., 1998c 51 Nature 391 1998 Nature 391 (1998) 51 Ratra B., Peebles P.J.E., 1988 3406 Phys. Rev., D 37 1988 Phys. Rev. D 37 (1988) 3406 Riess A. et al. 1998, Astrophys. J.in press astro-ph/9805201 Astron. J. 116 (1998) 1009-1038 Seljak U., Zaldarriaga M. 1996 437 Astrophys. J. 469 1996 Astrophys. J. 469 (1996) 437 Seljak U. & Zaldarriaga M., 1998 astro-ph/9811123 Phys. Rev. D60 (1999) 043504 Tegmark M., 1997 3806 Phys. Rev. Lett. 79 1997 Phys. Rev. Lett. 79 (1997) 3806 Tegmark M. 1998, submitted to Astrophys. J astro-ph/9809201 Astrophys. J. 514 (1999) L69-L72 Tegmark, M., Eisenstein D.J., Hu W., Kron R.G., 1998 astro-ph/9805117 Wambsganss J., Cen R., Ostriker J.P., 1998 29 Astrophys. J. 494 1998 Astrophys. J. 494 (1998) 29 Webster M., Bridle S.L., Hobson M.P., Lasenby A.N., Lahav O., Rocha, G., 1998, Astrophys. J.in press astro-ph/9802109 White M., 1998, Astrophys. J.in press astro-ph/9802295 Astrophys. J. 506 (1998) 495 Zaldarriaga, M., Spergel D.N., Seljak U., 1997 1 Astrophys. J. 488 1997 Astrophys. J. 488 (1997) 1 eng PRE-25553 RL-82-024 Ellis, J University of Oxford Grand unification with large supersymmetry breaking Mar 1982 18 p SzGeCERN General Theoretical Physics Ibanez, L E Ross, G G 1982 11 Oxford Univ. Univ. Auton. Madrid Rutherford Lab. 1990-01-28 50 2002-01-04 BATCH h 1982n PREPRINT hep-ex/0201013 eng CERN-EP-2001-094 Heister, A Aachen, Tech. Hochsch. Search for R-Parity Violating Production of Single Sneutrinos in $e^{+}e^{-}$ Collisions at $\sqrt{s}$ = 189-209 GeV Geneva CERN 17 Dec 2001 22 p ALEPH Papers A search for single sneutrino production under the assumption that $R$-parity is violated via a single dominant $LL\bar{E}$ coupling is presented. This search considers the process ${\rm e} \gamma\;{\smash{\mathop{\rightarrow}}}\;\tilde{\nu}\ell$ and is performed using the data collected by the ALEPH detector at centre-of-mass energies from 189\,GeV up to 209\,GeV corresponding to an integrated luminosity of637.1\,$\mathrm{pb}^{-1}$. The numbers of observed candidate events are in agreement with Standard Model expectations and 95\% confidence level upper limits on five of the $LL\bar{E}$ couplings are given as a function of the assumedsneutrino mass. CERN EDS 20011220SLAC giva LANL EDS SzGeCERN Particle Physics - Experimental Results Schael, S Barate, R Bruneliere, R De Bonis, I Decamp, D Goy, C Jezequel, S Lees, J P Martin, F Merle, E Minard, M N Pietrzyk, B Trocme, B Boix, G Bravo, S Casado, M P Chmeissani, M Crespo, J M Fernandez, E Fernandez-Bosman, M Garrido, L Grauges, E Lopez, J Martinez, M Merino, G Miquel, R Mir, L M Pacheco, A Paneque, D Ruiz, H Colaleo, A Creanza, D De Filippis, N De Palma, M Iaselli, G Maggi, G Maggi, M Nuzzo, S Ranieri, A Raso, G Ruggieri, F Selvaggi, G Silvestris, L Tempesta, P Tricomi, A Zito, G Huang, X Lin, J Ouyang, Q Wang, T Xie, Y Xu, R Xue, S Zhang, J Zhang, L Zhao, W Abbaneo, D Azzurri, P Barklow, T Buchmuller, O Cattaneo, M Cerutti, F Clerbaux, B Drevermann, H Forty, R W Frank, M Gianotti, F Greening, T C Hansen, J B Harvey, J Hutchcroft, D E Janot, P Jost, B Kado, M Maley, P Mato, P Moutoussi, A Ranjard, F Rolandi, L Schlatter, D Sguazzoni, G Tejessy, W Teubert, F Valassi, A Videau, I Ward, J J Badaud, F Dessagne, S Falvard, A Fayolle, D Gay, P Jousset, J Michel, B Monteil, S Pallin, D Pascolo, J M Perret, P Hansen, J D Hansen, J R Hansen, P H Nilsson, B S Waananen, A Kyriakis, A Markou, C Simopoulou, E Vayaki, A Zachariadou, K Blondel, A Brient, J C Machefert, F P Rouge, A Swynghedauw, M Tanaka, R Videau, H L Ciulli, V Focardi, E Parrini, G Antonelli, A Antonelli, M Bencivenni, G Bologna, G Bossi, F Campana, P Capon, G Chiarella, V Laurelli, P Mannocchi, G Murtas, F Murtas, G P Passalacqua, L Pepe-Altarelli, M Spagnolo, P Kennedy, J Lynch, J G Negus, P O'Shea, V Smith, D Thompson, A S Wasserbaech, S R Cavanaugh, R Dhamotharan, S Geweniger, C Hanke, P Hepp, V Kluge, E E Leibenguth, G Putzer, A Stenzel, H Tittel, K Werner, S Wunsch, M Beuselinck, R Binnie, D M Cameron, W Davies, G Dornan, P J Girone, M Hill, R D Marinelli, N Nowell, J Przysiezniak, H Rutherford, S A Sedgbeer, J K Thompson, J C White, R Ghete, V M Girtler, P Kneringer, E Kuhn, D Rudolph, G Bouhova-Thacker, E Bowdery, C K Clarke, D P Ellis, G Finch, A J Foster, F Hughes, G Jones, R W L Pearson, M R Robertson, N A Smizanska, M Lemaître, V Blumenschein, U Holldorfer, F Jakobs, K Kayser, F Kleinknecht, K Muller, A S Quast, G Renk, B Sander, H G Schmeling, S Wachsmuth, H Zeitnitz, C Ziegler, T Bonissent, A Carr, J Coyle, P Curtil, C Ealet, A Fouchez, D Leroy, O Kachelhoffer, T Payre, P Rousseau, D Tilquin, A Ragusa, F David, A Dietl, H Ganis, G Huttmann, K Lutjens, G Mannert, C Manner, W Moser, H G Settles, R Wolf, G Boucrot, J Callot, O Davier, M Duflot, L Grivaz, J F Heusse, P Jacholkowska, A Loomis, C Serin, L Veillet, J J De Vivie de Regie, J B Yuan, C Bagliesi, G Boccali, T Foà, L Giammanco, A Giassi, A Ligabue, F Messineo, A Palla, F Sanguinetti, G Sciaba, A Tenchini, R Venturi, A Verdini, P G Awunor, O Blair, G A Coles, J Cowan, G García-Bellido, A Green, M G Jones, L T Medcalf, T Misiejuk, A Strong, J A Teixeira-Dias, P Clifft, R W Edgecock, T R Norton, P R Tomalin, I R Bloch-Devaux, B Boumediene, D Colas, P Fabbro, B Lancon, E Lemaire, M C Locci, E Perez, P Rander, J Renardy, J F Rosowsky, A Seager, P Trabelsi, A Tuchming, B Vallage, B Konstantinidis, N P Litke, A M Taylor, G Booth, C N Cartwright, S Combley, F Hodgson, P N Lehto, M H Thompson, L F Affholderbach, K Bohrer, A Brandt, S Grupen, C Hess, J Ngac, A Prange, G Sieler, U Borean, C Giannini, G He, H Putz, J Rothberg, J E Armstrong, S R Berkelman, K Cranmer, K Ferguson, D P S Gao, Y Gonzalez, S Hayes, O J Hu, H Jin, S Kile, J McNamara, P A Nielsen, J Pan, Y B Von Wimmersperg-Toller, J H Wiedenmann, W Wu, J Wu, S L Wu, X Zobernig, G Dissertori, G ALEPH Collaboration valerie.brunner@cern.ch http://cdsware.cern.ch/download/invenio-demo-site-files/ep-2001-094.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/ep-2001-094.ps.gz 2002 ALEPH 11 EP CERN LEP 2001-12-19 50 2002-02-19 BATCH CERN Eur. Phys. J., C SLAC 4823672 oai:cds.cern.ch:CERN-EP-2001-094 CER n 200231 PREPRINT [1] For reviews, see for example: H.P. Nilles 1 Phys. Rep. 110 1984 Phys. Rep. 110 (1984) 1 H.E. Haber and G. L. Kane 75 Phys. Rep. 117 1985 Phys. Rep. 117 (1985) 75 [2] G. Farrar and P. Fayet 575 Phys. Lett., B 76 1978 Phys. Lett. B 76 (1978) 575 [3] S. Weinberg 287 Phys. Rev., B 26 1982 Phys. Rev. B 26 (1982) 287 N. Sakai and T. Yanagida 83 Nucl. Phys., B 197 1982 Nucl. Phys. B 197 (1982) 83 S. Dimopoulos, S. Raby and F. Wilczek 133 Phys. Lett., B 212 1982 Phys. Lett. B 212 (1982) 133 [4] B.C. Allanach, H. Dreiner, P. Morawitz and M.D. Williams, "Single Sneutrino/Slepton Production at LEP2 and the NLC" 307 Phys. Lett., B 420 1998 Phys. Lett. B 420 (1998) 307 [5] ALEPH Collaboration, "Search for R-Parity Violating Decays of Supersymmetric Particles in e+e- Collisions at Centre-of-Mass Energies between s = 189­202 GeV" 415 Eur. Phys. J., C 19 2001 Eur. Phys. J. C 19 (2001) 415 [6] ALEPH Collaboration, "ALEPH: a detector for electron-positron annihilations at LEP", Nucl. Instrum. and Methods. A : 294 (1990) 121 [7] S. Cantini, Yu. L. Dokshitzer, M. Olsson, G. Turnock and B.R. Webber, `New clustering algorithm for multijet cross sections in e+e- annihilation" 432 Phys. Lett., B 269 1991 Phys. Lett. B 269 (1991) 432 [8] ALEPH Collaboration, "Performance of the ALEPH detector at LEP", Nucl. Instrum. and Methods. A : 360 (1995) 481 Nucl. Instrum. and Methods. 360 (1995) 481 [9] S. Katsanevas and P. Morawitz, "SUSYGEN 2.2 - A Monte Carlo Event Generator for MSSM Sparticle Production at e+e- Colliders" 227 Comput. Phys. Commun. 112 1998 Comput. Phys. Commun. 112 (1998) 227 [10] E. Barberio, B. van Eijk and Z. W¸as 115 Comput. Phys. Commun. 66 1991 Comput. Phys. Commun. 66 (1991) 115 [11] S. Jadach and Z. W¸as, R. Decker and J.H. Kühn, "The decay library TAUOLA" 361 Comput. Phys. Commun. 76 1993 Comput. Phys. Commun. 76 (1993) 361 [12] T. Sjöstrand, " High-Energy Physics Event Generation with PYTHIA 5.7 and JETSET 7.4" 74 Comput. Phys. Commun. 82 1994 Comput. Phys. Commun. 82 (1994) 74 [13] S. Jadach et al 276 Comput. Phys. Commun. 66 1991 Comput. Phys. Commun. 66 (1991) 276 11 [14] M. Skrzypek, S. Jadach, W. Placzek and Z. Was 216 Comput. Phys. Commun. 94 1996 Comput. Phys. Commun. 94 (1996) 216 [15] S. Jadach et al 298 Phys. Lett., B 390 1997 Phys. Lett. B 390 (1997) 298 [16] J.A.M. Vermaseren, in Proceedings of the IVth International Workshop on Gamma Gamma Interactions, Eds. G. Cochard and P. Kessler, Springer Verlag, 1980 [17] J. -F. Grivaz and F. Le Diberder, "Complementary analyses and acceptance optimization in new particle searches", LAL preprint # 92-37 (1992) [18] ALEPH Collaboration, "Search for Supersymmetry with a dominant R-Parity Violating LL ¯ E Coupling in e+e- Collisions at Centre-of-Mass Energies of 130 GeV to 172 GeV" 433 Eur. Phys. J., C 4 1998 Eur. Phys. J. C 4 (1998) 433 [19] For reviews see for example: H. Dreiner, "An Introduction to Explicit R-parity Violation" hep-ph/9707435 published in Perspectives on Supersymmetry, ed. G.L. Kane, World Scientific, Singapore (1998); G. Bhattacharyya 83 Nucl. Phys. B, Proc. Suppl. 52 1997 Nucl. Phys. B Proc. Suppl. 52 (1997) 83 12 astro-ph/0101431 eng Gray, M E Cambridge University Infrared constraints on the dark mass concentration observed in the cluster Abell 1942 24 Jan 2001 8 p We present a deep H-band image of the region in the vicinity of the cluster Abell 1942 containing the puzzling dark matter concentration detected in an optical weak lensing study by Erben et al. (2000). We demonstrate that ourlimiting magnitude, H=22, would be sufficient to detect clusters of appropriate mass out to redshifts comparable with the mean redshift of the background sources. Despite this, our infrared image reveals no obvious overdensity ofsources at the location of the lensing mass peak, nor an excess of sources in the I-H vs. H colour-magnitude diagram. We use this to further constrain the luminosity and mass-to-light ratio of the putative dark clump as a function ofits redshift. We find that for spatially-flat cosmologies, background lensing clusters with reasonable mass-to-light ratios lying in the redshift range 0<z<1 are strongly excluded, leaving open the possibility that the massconcentration is a new type of truly dark object. LANL EDS SzGeCERN Astrophysics and Astronomy Ellis, R S Lewis, J R McMahon, R G Firth, A E Meghan Gray <meg@ast.cam.ac.uk> http://cdsware.cern.ch/download/invenio-demo-site-files/0101431.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0101431.ps.gz http://cdsware.cern.ch/download/invenio-demo-site-files/0101431.fig1.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0101431.fig2.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0101431.fig3.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0101431.fig4.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0101431.fig5a.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0101431.fig5b.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0101431.fig6.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0101431.fig7.ps.gz Additional 2001 11 Caltech IoA, Cambridge 2001-01-25 00 2001-11-02 BATCH Gray, Meghan E. Ellis, Richard S. Lewis, James R. Mahon, Richard G. Mc Firth, Andrew E. Mon. Not. R. Astron. Soc. n 200104 PREPRINT hep-ph/0105155 eng CERN-TH-2001-131 Mangano, M L CERN Physics at the front-end of a neutrino factory : a quantitative appraisal Geneva CERN 16 May 2001 1 p We present a quantitative appraisal of the physics potential for neutrino experiments at the front-end of a muon storage ring. We estimate the forseeable accuracy in the determination of several interesting observables, and explorethe consequences of these measurements. We discuss the extraction of individual quark and antiquark densities from polarized and unpolarized deep-inelastic scattering. In particular we study the implications for the undertanding ofthe nucleon spin structure. We assess the determination of alpha_s from scaling violation of structure functions, and from sum rules, and the determination of sin^2(theta_W) from elastic nu-e and deep-inelastic nu-p scattering. Wethen consider the production of charmed hadrons, and the measurement of their absolute branching ratios. We study the polarization of Lambda baryons produced in the current and target fragmentation regions. Finally, we discuss thesensitivity to physics beyond the Standard Model. LANL EDS SzGeCERN Particle Physics - Phenomenology Alekhin, S I Anselmino, M Ball, R D Boglione, M D'Alesio, U Davidson, S De Lellis, G Ellis, J Forte, S Gambino, P Gehrmann, T Kataev, A L Kotzinian, A Kulagin, S A Lehmann-Dronke, B Migliozzi, P Murgia, F Ridolfi, G Michelangelo MANGANO <Michelangelo.Mangano@cern.ch> http://cdsware.cern.ch/download/invenio-demo-site-files/0105155.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0105155.ps.gz 2001 11 TH CERN nuDIS Working group of the ECFA-CERN Neutrino-Factory Study Group 2001-05-17 50 2001-05-25 MH SLAC 4628020 CER n 200231 PREPRINT [1] S. Geer 6989 Phys. Rev., D 57 1998 Phys. Rev. D 57 (1998) 6989 hep-ph/9712290 Phys. Rev. D 57 (1998) 6989-6997 039903 Phys. Rev., D 59 1999 Phys. Rev. D 59 (1999) 039903 ] [2] The Muon Collider Collab., µ+µ- Collider: a feasibility study, Report BNL-52503, Fermilab-Conf-96/092, LBNL-38946 (1996); B. Autin, A. Blondel and J. Ellis (eds.), Prospective study of muon storage rings at CERN, Report CERN 99-02, ECFA 99-197 (Geneva, 1999) [3] I. Bigi et al., The potential for neutrino physics at muon colliders and dedicated high current muon storage rings, Report BNL-67404 [4] C. Albright et al hep-ex/0008064 [5] R.D. Ball, D.A. Harris and K.S. McFarland hep-ph/0009223 submitted to the Proceedings of the Nufact '00 Workshop, June 2000, Monterey [6] H.L. Lai et al 1280 Phys. Rev., D 55 1997 Phys. Rev. D 55 (1997) 1280 hep-ph/9606399 Phys. Rev. D 55 (1997) 1280-1296 [7] V. Barone, C. Pascaud and F. Zomer 243 Eur. Phys. J., C 12 2000 Eur. Phys. J. C 12 (2000) 243 hep-ph/9907512 Eur. Phys. J. C 12 (2000) 243-262 [8] S. I. Alekhin 094022 Phys. Rev., D 63 2001 Phys. Rev. D 63 (2001) 094022 hep-ph/0011002 Phys. Rev. D 63 (2001) 094022 65 [9] G. Ridolfi 278 Nucl. Phys., A 666 2000 Nucl. Phys. A 666 (2000) 278 R.D. Ball and H.A.M. Tallini 1327 J. Phys., G 25 1999 J. Phys. G 25 (1999) 1327 S. Forte hep-ph/9409416 and hep-ph/9610238 [10] S. Forte, M.L. Mangano and G. Ridolfi hep-ph/0101192 Nucl. Phys. B 602 (2001) 585-621 to appear in Nucl. Phys., B [11] J. Blümlein and N. Kochelev 296 Phys. Lett., B 381 1996 Phys. Lett. B 381 (1996) 296 and 285 Nucl. Phys., B 498 1997 Nucl. Phys. B 498 (1997) 285 [12] D.A. Dicus 1637 Phys. Rev., D 5 1972 Phys. Rev. D 5 (1972) 1637 [13] M. Anselmino, P. Gambino and J. Kalinowski 267 Z. Phys., C 64 1994 Z. Phys. C 64 (1994) 267 M. Maul et al 443 Z. Phys., A 356 1997 Z. Phys. A 356 (1997) 443 J. Blümlein and N. Kochelev 285 Nucl. Phys., B 498 1997 Nucl. Phys. B 498 (1997) 285 V. Ravishankar 309 Nucl. Phys., B 374 1992 Nucl. Phys. B 374 (1992) 309 [14] B. Ehrnsperger and A. Schäfer 619 Phys. Lett., B 348 1995 Phys. Lett. B 348 (1995) 619 J. Lichtenstadt and H.J. Lipkin 119 Phys. Lett., B 353 1995 Phys. Lett. B 353 (1995) 119 J. Dai et al 273 Phys. Rev., D 53 1996 Phys. Rev. D 53 (1996) 273 P.G. Ratcliffe 383 Phys. Lett., B 365 1996 Phys. Lett. B 365 (1996) 383 N.W. Park, J. Schechter and H. Weigel 420 Phys. Lett., B 228 1989 Phys. Lett. B 228 (1989) 420 [15] A.O. Bazarko et al 189 Z. Phys., C 65 1989 Z. Phys. C 65 (1989) 189 [16] R. Mertig and W.L. van Neerven 637 Z. Phys., C 70 1996 Z. Phys. C 70 (1996) 637 W. Vogelsang 2023 Phys. Rev., D 54 1996 Phys. Rev. D 54 (1996) 2023 [17] D. de Florian and R. Sassot 6052 Phys. Rev., D 51 1995 Phys. Rev. D 51 (1995) 6052 [18] R.D. Ball, S. Forte and G. Ridolfi 255 Phys. Lett., B 378 1996 Phys. Lett. B 378 (1996) 255 [19] G. Altarelli, S. Forte and G. Ridolfi 277 Nucl. Phys., B 534 1998 Nucl. Phys. B 534 (1998) 277 and 138 Nucl. Phys. B, Proc. Suppl. 74 1999 Nucl. Phys. B Proc. Suppl. 74 (1999) 138 [20] G. Altarelli, R.D. Ball, S. Forte and G. Ridolfi 1145 Acta Phys. Pol., B 29 1998 Acta Phys. Pol. B 29 (1998) 1145 hep-ph/9803237 Acta Phys. Pol. B 29 (1998) 1145-1173 [21] H.L. Lai et al. (CTEQ Collab.) 375 Eur. Phys. J., C 12 2000 Eur. Phys. J. C 12 (2000) 375 hep-ph/9903282 Eur. Phys. J. C 12 (2000) 375-392 [22] G. Altarelli, R.D. Ball, S. Forte and G. Ridolfi 337 Nucl. Phys., B 496 1997 Nucl. Phys. B 496 (1997) 337 and 1145 Acta Phys. Pol., B 29 1998 Acta Phys. Pol. B 29 (1998) 1145 [23] G. Altarelli and G.G. Ross 391 Phys. Lett., B 212 1988 Phys. Lett. B 212 (1988) 391 A. V. Efremov and O. V. Teryaev, JINR-E2-88-287, in Proceedings of Symposium on Hadron Interactions-Theory and Phenomenology, Bechyne, June 26- July 1, 1988; ed. by J. Fischer et al (Czech. Acad. ScienceInst. Phys., 1988) p.432; R.D. Carlitz, J.C. Collins and A.H. Mueller 229 Phys. Lett., B 214 1988 Phys. Lett. B 214 (1988) 229 G. Altarelli and B. Lampe 315 Z. Phys. C 47 1990 Z. Phys. C 47 (1990) 315 W. Vogelsang 275 Z. Phys., C 50 1991 Z. Phys. C 50 (1991) 275 [24] G.M. Shore and G. Veneziano 75 Phys. Lett., B 244 1990 Phys. Lett. B 244 (1990) 75 and 23 Nucl. Phys., B 381 1992 Nucl. Phys. B 381 (1992) 23 see also G. M. Shore hep-ph/9812355 [25] S. Forte 189 Phys. Lett., B 224 1989 Phys. Lett. B 224 (1989) 189 and 1 Nucl. Phys., B 331 1990 Nucl. Phys. B 331 (1990) 1 S. Forte and E.V. Shuryak 153 Nucl. Phys., B 357 1991 Nucl. Phys. B 357 (1991) 153 [26] S.J. Brodsky and B.-Q. Ma 317 Phys. Lett., B 381 1996 Phys. Lett. B 381 (1996) 317 66 [27] S.J. Brodsky, J. Ellis and M. Karliner 309 Phys. Lett., B 206 1988 Phys. Lett. B 206 (1988) 309 J. Ellis and M. Karliner hep-ph/9601280 [28] M. Glück et al hep-ph/0011215 Phys.Rev. D63 (2001) 094005 [29] D. Adams et al. (Spin Muon Collab.) 23 Nucl. Instrum. Methods Phys. Res., A 437 1999 Nucl. Instrum. Methods Phys. Res. A 437 (1999) 23 [30] B. Adeva et al. (SMC Collab.) 112001 Phys. Rev., D 58 1998 Phys. Rev. D 58 (1998) 112001 P. L. Anthony et al. (E155 Collab.) 19 Phys. Lett., B 493 2000 Phys. Lett. B 493 (2000) 19 [31] R.M. Barnett 1163 Phys. Rev. Lett. 36 1976 Phys. Rev. Lett. 36 (1976) 1163 [32] M.A. Aivazis, J.C. Collins, F.I. Olness and W. Tung 3102 Phys. Rev., D 50 1994 Phys. Rev. D 50 (1994) 3102 [33] T. Gehrmann and W.J. Stirling 6100 Phys. Rev., D 53 1996 Phys. Rev. D 53 (1996) 6100 [34] M. Glück, E. Reya, M. Stratmann and W. Vogelsang 4775 Phys. Rev., D 53 1996 Phys. Rev. D 53 (1996) 4775 [35] D.J. Gross and C.H. Llewellyn Smith 337 Nucl. Phys., B 14 1969 Nucl. Phys. B 14 (1969) 337 [36] R. D. Ball and S. Forte 365 Phys. Lett., B 358 1995 Phys. Lett. B 358 (1995) 365 hep-ph/9506233 Phys.Lett. B358 (1995) 365-378 and hep-ph/9607289 [37] J. Santiago and F.J. Yndurain 45 Nucl. Phys., B 563 1999 Nucl. Phys. B 563 (1999) 45 hep-ph/9904344 Nucl.Phys. B563 (1999) 45-62 [38] V.S. Fadin and L.N. Lipatov 127 Phys. Lett., B 429 1998 Phys. Lett. B 429 (1998) 127 M. Ciafaloni, D. Colferai and G. Salam 114036 Phys. Rev., D 60 1999 Phys. Rev. D 60 (1999) 114036 G. Altarelli, R.D. Ball and S. Forte hep-ph/0011270 Nucl.Phys. B599 (2001) 383-423 [39] W.G. Seligman et al 1213 Phys. Rev. Lett. 79 1997 Phys. Rev. Lett. 79 (1997) 1213 [40] A. L. Kataev, G. Parente and A.V. Sidorov 405 Nucl. Phys., B 573 2000 Nucl. Phys. B 573 (2000) 405 hep-ph/9905310 Nucl.Phys. B573 (2000) 405-433 [41] A.L. Kataev, G. Parente and A.V. Sidorov, preprint CERN-TH/2000-343 hep-ph/0012014 and work in progress [42] S.I. Alekhin and A.L. Kataev 402 Phys. Lett., B 452 1999 Phys. Lett. B 452 (1999) 402 hep-ph/9812348 Phys.Lett. B452 (1999) 402-408 [43] S. Bethke R27 J. Phys., G 26 2000 J. Phys. G 26 (2000) R27 hep-ex/0004021 J.Phys. G26 (2000) R27 [44] I. Hinchliffe and A.V. Manohar 643 Annu. Rev. Nucl. Part. Sci. 50 2000 Annu. Rev. Nucl. Part. Sci. 50 (2000) 643 hep-ph/0004186 Ann.Rev.Nucl.Part.Sci. 50 (2000) 643-678 [45] H. Georgi and H.D. Politzer 1829 Phys. Rev., D 14 1976 Phys. Rev. D 14 (1976) 1829 [46] E.B. Zijlstra and W.L. van Neerven 377 Phys. Lett., B 297 1992 Phys. Lett. B 297 (1992) 377 [47] W.L. van Neerven and A. Vogt 263 Nucl. Phys., B 568 2000 Nucl. Phys. B 568 (2000) 263 hep-ph/9907472 Nucl.Phys. B568 (2000) 263-286 and hep-ph/0103123 Nucl.Phys. B603 (2001) 42-68 [48] W.L. van Neerven and A. Vogt 111 Phys. Lett., B 490 2000 Phys. Lett. B 490 (2000) 111 hep-ph/0007362 Phys.Lett. B490 (2000) 111-118 [49] S.A. Larin, T. van Ritbergen and J.A. Vermaseren 41 Nucl. Phys., B 427 1994 Nucl. Phys. B 427 (1994) 41 [50] S.A. Larin, P. Nogueira, T. van Ritbergen and J.A. Vermaseren 338 Nucl. Phys., B 492 1997 Nucl. Phys. B 492 (1997) 338 hep-ph/9605317 Nucl.Phys. B492 (1997) 338-378 [51] A. Retey and J.A. Vermaseren, preprint TTP00-13, NIKHEF-2000-018 hep-ph/0007294 Nucl.Phys. B604 (2001) 281-311 [52] J.A. Gracey 141 Phys. Lett., B 322 1994 Phys. Lett. B 322 (1994) 141 hep-ph/9401214 Phys.Lett. B322 (1994) 141-146 67 [53] J. Blümlein and A. Vogt 149 Phys. Lett., B 370 1996 Phys. Lett. B 370 (1996) 149 hep-ph/9510410 Phys.Lett. B370 (1996) 149-155 [54] S. Catani et al., preprint CERN-TH/2000-131 hep-ph/0005025 in Standard model physics (and more) at the LHC, eds. G. Altarelli and M. Mangano, Report CERN 2000-004 (Geneva, 2000) [55] A.L. Kataev, A.V. Kotikov, G. Parente and A.V. Sidorov 374 Phys. Lett. B 417 1998 Phys. Lett. B 417 (1998) 374 hep-ph/9706534 Phys.Lett. B417 (1998) 374-384 [56] M. Beneke 1 Phys. Rep. 317 1999 Phys. Rep. 317 (1999) 1 hep-ph/9807443 Phys.Rept. 317 (1999) 1-142 [57] M. Beneke and V.M. Braun hep-ph/0010208 [58] M. Dasgupta and B.R. Webber 273 Phys. Lett., B 382 1996 Phys. Lett. B 382 (1996) 273 hep-ph/9604388 [59] M. Maul, E. Stein, A. Schafer and L. Mankiewicz 100 Phys. Lett., B 401 1997 Phys. Lett. B 401 (1997) 100 hep-ph/9612300 [60] A.V. Sidorov et al. (IHEP­JINR Neutrino Detector Collab.) 405 Eur. Phys. J., C 10 1999 Eur. Phys. J. C 10 (1999) 405 hep-ex/9905038 [61] S.I. Alekhin et al. (IHEP-JINR Neutrino Detector Collab), preprint IHEP-01-18 (2001) hep-ex/0104013 [62] C. Adloff et al. (H1 Collab.) hep-ex/0012052 [63] A.D. Martin, R.G. Roberts, W.J. Stirling and R.S. Thorne 117 Eur. Phys. J., C 18 2000 Eur. Phys. J. C 18 (2000) 117 hep-ph/0007099 [64] E.B. Zijlstra and W.L. van Neerven 525 Nucl. Phys., B 383 1992 Nucl. Phys. B 383 (1992) 525 [65] S.G. Gorishny and S.A. Larin 109 Phys. Lett., B 172 1986 Phys. Lett. B 172 (1986) 109 S.A. Larin and J.A.M. Vermaseren 345 Phys. Lett., B 259 1991 Phys. Lett. B 259 (1991) 345 [66] A.L. Kataev and A.V. Sidorov, preprint CERN-TH/7235-94 hep-ph/9405254 in Proceedings of Rencontre de Moriond - Hadronic session of `QCD and high energy hadronic interactions', M´eribel-les-Allues, 1994, ed. J. Tr an Thanh V an (Editions Fronti eres, Gif-sur-Yvette, 1995), p. 189 [67] J.H. Kim et al 3595 Phys. Rev. Lett. 81 1998 Phys. Rev. Lett. 81 (1998) 3595 hep-ex/9808015 [68] J. Chyla and A.L. Kataev 385 Phys. Lett., B 297 1992 Phys. Lett. B 297 (1992) 385 hep-ph/9209213 [69] A.L. Kataev and A.V. Sidorov 179 Phys. Lett., B 331 1994 Phys. Lett. B 331 (1994) 179 hep-ph/9402342 [70] J. Blümlein and W. L. van Neerven 417 Phys. Lett., B 450 1999 Phys. Lett. B 450 (1999) 417 hep-ph/9811351 [71] A.L. Kataev and V.V. Starshenko 235 Mod. Phys. Lett., A 10 1995 Mod. Phys. Lett. A 10 (1995) 235 hep-ph/9502348 M.A. Samuel, J. Ellis and M. Karliner 4380 Phys. Rev. Lett. 74 1995 Phys. Rev. Lett. 74 (1995) 4380 hep-ph/9503411 [72] W. Bernreuther and W. Wetzel 228 Nucl. Phys., B 197 1982 Nucl. Phys. B 197 (1982) 228 [Erratum 758 Nucl. Phys., B 513 1998 Nucl. Phys. B 513 (1998) 758 ]; S.A. Larin, T. van Ritbergen and J.A. Vermaseren 278 Nucl. Phys., B 438 1995 Nucl. Phys. B 438 (1995) 278 hep-ph/9411260 K.G. Chetyrkin, B.A. Kniehl and M. Steinhauser 2184 Phys. Rev. Lett. 79 1997 Phys. Rev. Lett. 79 (1997) 2184 hep-ph/9706430 [73] E.V. Shuryak and A.I. Vainshtein 451 Nucl. Phys. B 199 1982 Nucl. Phys. B 199 (1982) 451 [74] M.A. Shifman, A.I. Vainshtein and V.I. Zakharov 385 Nucl. Phys., B 147 1979 Nucl. Phys. B 147 (1979) 385 [75] V.M. Braun and A.V. Kolesnichenko 723 Nucl. Phys., B 283 1987 Nucl. Phys. B 283 (1987) 723 68 [76] G.G. Ross and R.G. Roberts 425 Phys. Lett., B 322 1994 Phys. Lett. B 322 (1994) 425 hep-ph/9312237 [77] J. Balla, M.V. Polyakov and C. Weiss 327 Nucl. Phys., B 510 1998 Nucl. Phys. B 510 (1998) 327 hep-ph/9707515 [78] R.G. Oldeman (CHORUS Collab.) 96 Nucl. Phys. B, Proc. Suppl. 79 1999 Nucl. Phys. B, Proc. Suppl. 79 (1999) 96 R.G. Oldeman, PhD Thesis, Amsterdam University, June 2000 (unpublished) [79] U.K. Yang et al. (CCFR­NuTeV Collab.) hep-ex/0010001 [80] J.D. Bjorken 1767 Phys. Rev. 163 1967 Phys. Rev. 163 (1967) 1767 [81] W.A. Bardeen, A.J. Buras, D.W. Duke and T. Muta 3998 Phys. Rev., D 18 1978 Phys. Rev. D 18 (1978) 3998 G. Altarelli, R.K. Ellis and G. Martinelli 521 Nucl. Phys., B 143 1978 Nucl. Phys. B 143 (1978) 521 [82] K.G. Chetyrkin, S.G. Gorishny, S.A. Larin and F.V. Tkachov 230 Phys. Lett., B 137 1984 Phys. Lett. B 137 (1984) 230 [83] S.A. Larin, F.V. Tkachov and J.A. Vermaseren 862 Phys. Rev. Lett. 66 1991 Phys. Rev. Lett. 66 (1991) 862 [84] M. Arneodo 301 Phys. Rep. 240 1994 Phys. Rep. 240 (1994) 301 [85] G. Piller and W. Weise 1 Phys. Rep. 330 2000 Phys. Rep. 330 (2000) 1 hep-ph/9908230 [86] P. Amaudruz et al 3 Nucl. Phys., B 441 1995 Nucl. Phys. B 441 (1995) 3 M. Arneodo et al 12 Nucl. Phys., B 441 1995 Nucl. Phys. B 441 (1995) 12 [87] A.C. Benvenuti et al. (BCDMS Collab.) 483 Phys. Lett., B 189 1987 Phys. Lett. B 189 (1987) 483 [88] J. Gomez et al 4348 Phys. Rev., D 49 1994 Phys. Rev. D 49 (1994) 4348 [89] M.R. Adams et al. (E665 Collab.) 403 Z. Phys., C 67 1995 Z. Phys. C 67 (1995) 403 hep-ex/9505006 [90] S.L. Adler 963 Phys. Rev., B 135 1964 Phys. Rev. B 135 (1964) 963 [91] J.S. Bell 57 Phys. Rev. Lett. 13 1964 Phys. Rev. Lett. 13 (1964) 57 [92] C.A. Piketti and L. Stodolsky 571 Nucl. Phys., B 15 1970 Nucl. Phys. B 15 (1970) 571 [93] B.Z. Kopeliovich and P. Marage 1513 Int. J. Mod. Phys., A 8 1993 Int. J. Mod. Phys. A 8 (1993) 1513 [94] P.P. Allport et al. (BEBC WA59 Collab.) 417 Phys. Lett., B 232 1989 Phys. Lett. B 232 (1989) 417 [95] C. Boros, J.T. Londergan and A.W. Thomas 114030 Phys. Rev., D 58 1998 Phys. Rev. D 58 (1998) 114030 hep-ph/9804410 [96] U.K. Yang et al. (CCFR­NuTeV Collab.) hep-ex/0009041 [97] M.A. Aivazis, F.I. Olness and W. Tung 2339 Phys. Rev. Lett. 65 1990 Phys. Rev. Lett. 65 (1990) 2339 V. Barone, M. Genovese, N.N. Nikolaev, E. Predazzi and B. Zakharov 279 Phys. Lett., B 268 1991 Phys. Lett. B 268 (1991) 279 and 83 Z. Phys., C 70 1996 Z. Phys. C 70 (1996) 83 hep-ph/9505343 [98] R.S. Thorne and R.G. Roberts 303 Phys. Lett., B 421 1998 Phys. Lett. B 421 (1998) 303 hep-ph/9711223 [99] A.D. Martin, R.G. Roberts, W.J. Stirling and R.S. Thorne 463 Eur. Phys. J., C 4 1998 Eur. Phys. J. C 4 (1998) 463 hep-ph/9803445 [100] L.L. Frankfurt, M.I. Strikman and S. Liuti 1725 Phys. Rev. Lett. 65 1990 Phys. Rev. Lett. 65 (1990) 1725 [101] R. Kobayashi, S. Kumano and M. Miyama 465 Phys. Lett., B 354 1995 Phys. Lett. B 354 (1995) 465 hep-ph/9501313 [102] K.J. Eskola, V.J. Kolhinen and P.V. Ruuskanen 351 Nucl. Phys., B 535 1998 Nucl. Phys. B 535 (1998) 351 hep-ph/9802350 69 [103] S.A. Kulagin hep-ph/9812532 [104] P.V. Landshoff, J.C. Polkinghorne and R.D. Short 225 Nucl. Phys., B 28 1971 Nucl. Phys. B 28 (1971) 225 [105] S.A. Kulagin, G. Piller and W. Weise 1154 Phys. Rev., C 50 1994 Phys. Rev. C 50 (1994) 1154 nucl-th/9402015 [106] S.V. Akulinichev, S.A. Kulagin and G.M. Vagradov 485 Phys. Lett., B 158 1985 Phys. Lett. B 158 (1985) 485 [107] S.A. Kulagin 653 Nucl. Phys., A 500 1989 Nucl. Phys. A 500 (1989) 653 [108] G.B. West, Ann. Phys.NY : 74 (1972) 464 [109] S.A. Kulagin and A.V. Sidorov 261 Eur. Phys. J., A 9 2000 Eur. Phys. J. A 9 (2000) 261 hep-ph/0009150 [110] A.C. Benvenuti et al. (BCDMS Collab.) 29 Z. Phys., C 63 1994 Z. Phys. C 63 (1994) 29 [111] M. Vakili et al. (CCFR Collab.) 052003 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 052003 hep-ex/9905052 [112] S.A. Kulagin 435 Nucl. Phys., A 640 1998 Nucl. Phys. A 640 (1998) 435 nucl-th/9801039 [113] I.R. Afnan, F. Bissey, J. Gomez, A.T. Katramatou, W. Melnitchouk, G.G. Petratos and A.W. Thomas nucl-th/0006003 [114] V. Guzey et al hep-ph/0102133 [115] S. Sarantakos, A. Sirlin and W.J. Marciano 84 Nucl. Phys., B 217 1983 Nucl. Phys. B 217 (1983) 84 D.Y. Bardin and V.A. Dokuchaeva 975 Sov. J. Nucl. Phys. 43 1986 Sov. J. Nucl. Phys. 43 (1986) 975 D.Y. Bardin and V.A. Dokuchaeva 839 Nucl. Phys., B 287 1987 Nucl. Phys. B 287 (1987) 839 [116] G. Degrassi et al. Phys. Lett., B350 (95) 75; G. Degrassi and P. Gambino 3 Nucl. Phys., B 567 2000 Nucl. Phys. B 567 (2000) 3 [117] J.N. Bahcall, M. Kamionkowski and A. Sirlin 6146 Phys. Rev., D 51 1995 Phys. Rev. D 51 (1995) 6146 astro-ph/9502003 [118] See F. Jegerlehner hep-ph/9901386 and references therein [119] K.S. McFarland et al. (NuTeV Collab.) hep-ex/9806013 in Proceedings 33rd Rencontres de Moriond on Electroweak Interactions and Unified Theories, Les Arcs, 1998 [120] M. E. Peskin and T. Takeuchi 381 Phys. Rev., D 46 1992 Phys. Rev. D 46 (1992) 381 W. J. Marciano and J. L. Rosner 2963 Phys. Rev. Lett. 65 1990 Phys. Rev. Lett. 65 (1990) 2963 [Erratum 2963 Phys. Rev. Lett. 68 1990 Phys. Rev. Lett. 68 (1990) 2963 ] [121] G. Altarelli and R. Barbieri 161 Phys. Lett., B 253 1991 Phys. Lett. B 253 (1991) 161 D. C. Kennedy and P. Langacker 2967 Phys. Rev. Lett. 65 1990 Phys. Rev. Lett. 65 (1990) 2967 [Erratum 2967 Phys. Rev. Lett. 66 1990 Phys. Rev. Lett. 66 (1990) 2967 ] [122] D.E. Groom et al, Particle Data Group 1 Eur. Phys. J. 15 2000 Eur. Phys. J. 15 (2000) 1 [123] P. Migliozzi et al 217 Phys. Lett., B 462 1999 Phys. Lett. B 462 (1999) 217 [124] J. Finjord and F. Ravndal 61 Phys. Lett., B 58 1975 Phys. Lett. B 58 (1975) 61 [125] R.E. Shrock and B.W. Lee 2539 Phys. Rev., D 13 1976 Phys. Rev. D 13 (1976) 2539 [126] C. Avilez et al 149 Phys. Lett., B 66 1977 Phys. Lett. B 66 (1977) 149 [127] C. Avilez and T. Kobayashi 3448 Phys. Rev., D 19 1979 Phys. Rev. D 19 (1979) 3448 [128] C. Avilez et al 709 Phys. Rev., D 17 1978 Phys. Rev. D 17 (1978) 709 70 [129] A. Amer et al 48 Phys. Lett., B 81 1979 Phys. Lett. B 81 (1979) 48 [130] S.G. Kovalenko 934 Sov. J. Nucl. Phys. 52 1990 Sov. J. Nucl. Phys. 52 (1990) 934 [131] G.T. Jones et al. (WA21 Collab.) 593 Z. Phys., C 36 1987 Z. Phys. C 36 (1987) 593 [132] V.V. Ammosov et al 247 JETP Lett. 58 1993 JETP Lett. 58 (1993) 247 [133] D. Son et al 2129 Phys. Rev., D 28 1983 Phys. Rev. D 28 (1983) 2129 [134] N. Ushida et al. (E531 Collab.) 375 Phys. Lett., B 206 1988 Phys. Lett. B 206 (1988) 375 [135] N. Armenise et al 409 Phys. Lett., B 104 1981 Phys. Lett. B 104 (1981) 409 [136] G. De Lellis, P. Migliozzi and P. Zucchelli 7 Phys. Lett., B 507 2001 Phys. Lett. B 507 (2001) 7 hep-ph/0104066 [137] G. Corcella et al hep-ph/0011363 [138] T. Sjöstrand, report LU-TP-95-20 hep-ph/9508391 [139] G. Ingelman et al 108 Comput. Phys. Commun. 101 1997 Comput. Phys. Commun. 101 (1997) 108 [140] T. Bolton hep-ex/9708014 [141] P. Annis et al. (CHORUS Collab.) 458 Phys. Lett., B 435 1998 Phys. Lett. B 435 (1998) 458 [142] J. Conrad et al 1341 Rev. Mod. Phys. 70 1998 Rev. Mod. Phys. 70 (1998) 1341 [143] T. Adams et al. (NuTeV Collab.) 092001 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 092001 [144] A.E. Asratian et al. (BBCN Collab.) 55 Z. Phys., C 58 1993 Z. Phys. C 58 (1993) 55 [145] J.D. Richman and P.R. Burchat 893 Rev. Mod. Phys. 67 1995 Rev. Mod. Phys. 67 (1995) 893 [146] J. Collins, L. Frankfurt and M. Strikman 2982 Phys. Rev., D 56 1997 Phys. Rev. D 56 (1997) 2982 [147] A.V. Radyushkin 5524 Phys. Rev., D 56 1997 Phys. Rev. D 56 (1997) 5524 [148] S.J. Brodsky, L. Frankfurt, J.F. Gunion, A.H. Mueller and M. Strikman 3134 Phys. Rev., D 50 1994 Phys. Rev. D 50 (1994) 3134 A. V. Radyushkin 333 Phys. Lett., B 385 1996 Phys. Lett. B 385 (1996) 333 L. Mankiewicz, G. Piller and T. Weigl 119 Eur. Phys. J., C 5 1998 Eur. Phys. J. C 5 (1998) 119 and 017501 Phys. Rev., D 59 1999 Phys. Rev. D 59 (1999) 017501 M. Vanderhaeghen, P.A.M. Guichon and M. Guidal 5064 Phys. Rev. Lett. 80 1998 Phys. Rev. Lett. 80 (1998) 5064 [149] B. Lehmann-Dronke, P.V. Pobylitsa, M.V. Polyakov, A. Schäfer and K. Goeke 147 Phys. Lett., B 475 2000 Phys. Lett. B 475 (2000) 147 B. Lehmann-Dronke, M.V. Polyakov, A. Schäfer and K. Goeke 114001 Phys. Rev., D 63 2001 Phys. Rev. D 63 (2001) 114001 hep-ph/0012108 [150] M. Wirbel, B. Stech and M. Bauer 637 Z. Phys., C 29 1985 Z. Phys. C 29 (1985) 637 M. Bauer and M. Wirbel 671 Z. Phys. 42 1989 Z. Phys. 42 (1989) 671 [151] H-n. Li and B. Meli´c 695 Eur. Phys. J., C 11 1999 Eur. Phys. J. C 11 (1999) 695 [152] A. Abada et al 268 Nucl. Phys. B, Proc. Suppl. 83 2000 Nucl. Phys. B, Proc. Suppl. 83 (2000) 268 D. Becirevic et al hep-lat/0002025 A. Ali Khan et al hep-lat/0010009 A. S. Kronfeld hep-ph/0010074 L. Lellouch and C.J.D. Lin (UKQCD Collab.) hep-ph/0011086 71 [153] A.V. Radyushkin 014030 Phys. Rev., D 59 1999 Phys. Rev. D 59 (1999) 014030 [154] A.D. Martin, R.G. Roberts and W.J. Stirling 155 Phys. Lett., B 354 1995 Phys. Lett. B 354 (1995) 155 [155] J.T. Jones et al. (WA21 Collab.) 23 Z. Phys., C 28 1987 Z. Phys. C 28 (1987) 23 [156] S. Willocq et al. (WA59 Collab.) 207 Z. Phys., C 53 1992 Z. Phys. C 53 (1992) 207 [157] D. DeProspo et al. (E632 Collab.) 6691 Phys. Rev., D 50 1994 Phys. Rev. D 50 (1994) 6691 [158] P. Astier et al. (NOMAD Collab.) 3 Nucl. Phys., B 588 2000 Nucl. Phys. B 588 (2000) 3 [159] L. Trentadue and G. Veneziano 201 Phys. Lett., B 323 1994 Phys. Lett. B 323 (1994) 201 [160] M. Anselmino, M. Boglione, J. Hansson, and F. Murgia 828 Phys. Rev., D 54 1996 Phys. Rev. D 54 (1996) 828 [161] R.L. Jaffe 6581 Phys. Rev., D 54 1996 Phys. Rev. D 54 (1996) 6581 [162] J. Ellis, D.E. Kharzeev and A. Kotzinian 467 Z. Phys., C 69 1996 Z. Phys. C 69 (1996) 467 [163] D. de Florian, M. Stratmann, and W. Vogelsang 5811 Phys. Rev., D 57 1998 Phys. Rev. D 57 (1998) 5811 [164] A. Kotzinian, A. Bravar and D. von Harrach 329 Eur. Phys. J., C 2 1998 Eur. Phys. J. C 2 (1998) 329 [165] A. Kotzinian hep-ph/9709259 [166] S.L. Belostotski 526 Nucl. Phys. B, Proc. Suppl. 79 1999 Nucl. Phys. B, Proc. Suppl. 79 (1999) 526 [167] D. Boer, R. Jakob, and P.J. Mulders 471 Nucl. Phys., B 564 2000 Nucl. Phys. B 564 (2000) 471 [168] C. Boros, J.T. Londergan and A.W. Thomas 014007 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 014007 and D : 62 (2000) 014021 [169] D. Ashery and H.J. Lipkin 263 Phys. Lett., B 469 1999 Phys. Lett. B 469 (1999) 263 [170] B-Q. Ma, I. Schmidt, J. Soffer, and J-Y. Yang 657 Eur. Phys. J., C 16 2000 Eur. Phys. J. C 16 (2000) 657 114009 Phys. Rev., D 62 2000 Phys. Rev. D 62 (2000) 114009 [171] M. Anselmino, M. Boglione, and F. Murgia 253 Phys. Lett., B 481 2000 Phys. Lett. B 481 (2000) 253 [172] M. Anselmino, D. Boer, U. D'Alesio, and F. Murgia 054029 Phys. Rev., D 63 2001 Phys. Rev. D 63 (2001) 054029 [173] D. Indumathi, H.S. Mani and A. Rastogi 094014 Phys. Rev., D 58 1998 Phys. Rev. D 58 (1998) 094014 [174] M. Burkardt and R.L. Jaffe 2537 Phys. Rev. Lett. 70 1993 Phys. Rev. Lett. 70 (1993) 2537 [175] I.I. Bigi 43 Nuovo Cimento 41 1977 Nuovo Cimento 41 (1977) 43 and 581 [176] W. Melnitchouk and A.W. Thomas 311 Z. Phys., A 353 1996 Z. Phys. A 353 (1996) 311 [177] J. Ellis, M. Karliner, D.E. Kharzeev and M.G. Sapozhnikov 256 Nucl. Phys., A 673 2000 Nucl. Phys. A 673 (2000) 256 [178] R. Carlitz and M. Kislinger 336 Phys. Rev., D 2 1970 Phys. Rev. D 2 (1970) 336 [179] D. Naumov hep-ph/0101355 [180] P. Migliozzi et al 19 Phys. Lett., B 494 2000 Phys. Lett. B 494 (2000) 19 [181] A. Alton et al hep-ex/0008068 72 [182] Y. Grossman 141 Phys. Lett., B 359 1995 Phys. Lett. B 359 (1995) 141 [183] P. Langacker, M. Luo and A. Mann 87 Rev. Mod. Phys. 64 1992 Rev. Mod. Phys. 64 (1992) 87 [184] F. Cuypers and S. Davidson 503 Eur. Phys. J., C 2 1998 Eur. Phys. J. C 2 (1998) 503 S. Davidson, D. Bailey and B.A. Campbell 613 Z. Phys., C 61 1994 Z. Phys. C 61 (1994) 613 [185] A. Leike 143 Phys. Rep. 317 1999 Phys. Rep. 317 (1999) 143 [186] A. Datta, R. Gandhi, B. Mukhopadhyaya and P. Mehta hep-ph/0011375 [187] G. Giudice et al., Report of the Stopped-Muon Working Group, to appear. 73 eng BNL-40718 FERMILAB-Pub-87-222-T Nason, P Brookhaven Nat. Lab. The total cross section for the production of heavy quarks in hadronic collisions Upton, IL Brookhaven Nat. Lab. 23 Dec 1987 42 p SzGeCERN Particle Physics - Phenomenology Dawson, S Ellis, R K 11 1987 1990-01-29 50 2002-01-04 BATCH SLAC 1773607 h 198804n PREPRINT eng CERN-PRE-82-006 Ellis, J CERN From the standard model to grand unification Geneva CERN 1982 mult. p SzGeCERN General Theoretical Physics 1982 11 TH 1990-01-28 50 2001-09-15 BATCH 820332 oai:cds.cern.ch:CERN-PRE-82-006 cern:theory h 1982n PREPRINT astro-ph/0104076 eng Dev, A Delhi University Cosmic equation of state, Gravitational Lensing Statistics and Merging of Galaxies 4 Apr 2001 28 p In this paper we investigate observational constraints on the cosmic equation of state of dark energy ($p = w \rho$) using gravitational lensing statistics. We carry out likelihood analysis of the lens surveys to constrain thecosmological parameters $\Omega_{m}$ and $w$. We start by constraining $\Omega_{m}$ and $w$ in the no-evolution model of galaxies where the comoving number density of galaxies is constant. We extend our study to evolutionary modelsof galaxies - Volmerange $&$ Guiderdoni Model and Fast-Merging Model (of Broadhurst, Ellis $&$ Glazebrook). For the no-evolution model we get $w \leq -0.24$ and $\Omega_{m}\leq 0.48$ at $1\sigma$ (68% confidence level). For theVolmerange $&$ Guiderdoni Model we have $w \leq -0.2$ and $\Omega_{m} \leq 0.58$ at $1 \sigma$, and for the Fast Merging Model we get $w \leq -0.02$ and $\Omega_{m} \leq 0.93$ at $1\sigma$. For the case of constant $\Lambda$ ($w=-1$), all the models permit $\Omega_{m} = 0.3$ with 68% CL. We observe that the constraints on $w$ and $\Omega_{m}$ (and on $\Omega_{m}$ in the case of $w = -1$) obtained in the case of evolutionary models are weaker than thoseobtained in the case of the no-evolution model. LANL EDS SzGeCERN Astrophysics and Astronomy Jain, D Panchapakesan, N Mahajan, S Bhatia, V B Deepak Jain <deepak@physics.du.ac.in> http://cdsware.cern.ch/download/invenio-demo-site-files/0104076.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0104076.ps.gz 2001 10 Delhi University 2001-04-05 00 2001-04-10 BATCH Dev, Abha Jain, Deepak CER n 200231 PREPRINT [1] S. Perlmutter et al 565 Astrophys. J. 517 1999 Astrophys. J. 517 (1999) 565 [2] S. Perlmutter et al., Phy. Rev. Lett.: 83 (1999) 670 [3] A. G. Riess et al 1009 Astron. J. 116 1998 Astron. J. 116 (1998) 1009 [4] P. de Bernardis et al 955 Nature 404 2000 Nature 404 (2000) 955 [5] P. J. Ostriker & P. J. Steinhardt 600 Nature 377 1995 Nature 377 (1995) 600 [6] V. Sahni & Alexei Starobinsky, IJMP, D : 9 (2000) 373 [7] L. F. Bloomfield Torres & I. Waga 712 Mon. Not. R. Astron. Soc. 279 1996 Mon. Not. R. Astron. Soc. 279 (1996) 712 [8] V. Silveira & I. Waga 4890 Phys. Rev., D 50 1994 Phys. Rev. D 50 (1994) 4890 [9] V.Silveira & I. Waga 4625 Phys. Rev., D 56 1997 Phys. Rev. D 56 (1997) 4625 [10] I. Waga & Ana P. M. R. Miceli, Phy. Rev. D : 59 (1999) 103507 [11] M. S. Turner & M. White, Phy. Rev. D : 56 (1997) 4439 [12] D. Huterer & M. S. Turner, Phy. Rev. D : 60 (1999) 081301 [13] T. Chiba, N. Sugiyama & T. Nakamura, Mon. Not. R. As-tron. Soc.: 289 (1997) L5 [14] T. Chiba, N. Sugiyama & T. Nakamura, Mon. Not. R. As-tron. Soc.: 301 (1998) 72 [15] P. J. E. Peebles 439 Astrophys. J. 284 1984 Astrophys. J. 284 (1984) 439 [16] B. Ratra & P. J. E. Peebles, Phy. Rev. D : 37 (1988) 3406 [17] R. R. Caldwell, R. Dave & P. J. Steinhardt, Phy. Rev. Lett.: 80 (1998) 1582 [18] G. Efstathiou astro-ph/9904356 (1999) [19] J. A. S. Lima & J. S. Alcaniz 893 Mon. Not. R. Astron. Soc. 317 2000 Mon. Not. R. Astron. Soc. 317 (2000) 893 [20] Wang et al 17 Astrophys. J. 530 2000 Astrophys. J. 530 (2000) 17 [21] H. W. Rix, D. Maoz, E. Turner & M. Fukugita 49 Astrophys. J. 435 1994 Astrophys. J. 435 (1994) 49 [22] S. Mao & C. S. Kochanek 569 Mon. Not. R. Astron. Soc. 268 1994 Mon. Not. R. Astron. Soc. 268 (1994) 569 [23] D. Jain, N. Panchapakesan, S. Mahajan & V. B. Bhatia, MPLA : 15 (2000) 41 [24] T. Broadhurst, R. Ellis & K. Glazebrook 55 Nature 355 1992 Nature 355 (1992) 55 [BEG] [25] B. Rocca-Volmerange & B. Guiderdoni, Mon. Not. R. As-tron. Soc.: 247 (1990) 166 [26] A. Toomre, in The Evolution of Galaxies and Stellar Pop-ulations eds: B. M. Tinsley & R. B. Larson ( Yale Univ. Observatory), p-401 (1977) [27] F. Schwezier 109 Astron. J. 111 1996 Astron. J. 111 (1996) 109 [28] O. J. Eggen, D. Lynden-Bell & A. R. Sandage 748 Astrophys. J. 136 1962 Astrophys. J. 136 (1962) 748 [29] R. B. Partridge & P. J. E. Peebles 868 Astrophys. J. 147 1967 Astrophys. J. 147 (1967) 868 [30] S. P. Driver et al L23 Astrophys. J. 449 1995 Astrophys. J. 449 (1995) L23 [31] J. M. Burkey et al L13 Astrophys. J. 429 1994 Astrophys. J. 429 (1994) L13 [32] S. M. Faber et al 668 Astrophys. J. 204 1976 Astrophys. J. 204 (1976) 668 [33] R. G. Carlberg et al 540 Astrophys. J. 435 1994 Astrophys. J. 435 (1994) 540 [34] S. E. Zepf 377 Nature 390 1997 Nature 390 (1997) 377 [35] K. Glazebrook et al 157 Mon. Not. R. Astron. Soc. 273 1995 Mon. Not. R. Astron. Soc. 273 (1995) 157 [36] S. J. Lilly et al 108 Astrophys. J. 455 1995 Astrophys. J. 455 (1995) 108 [37] R. S. Ellis et al 235 Mon. Not. R. Astron. Soc. 280 1996 Mon. Not. R. Astron. Soc. 280 (1996) 235 [38] R. S. Ellis, Ann. Rev 389 Astron. Astrophys. 35 1997 Astron. Astrophys. 35 (1997) 389 [39] B. Guiderdoni & B. Rocca-Volmerange 435 Astron. Astrophys. 252 1991 Astron. Astrophys. 252 (1991) 435 [40] S. E. Zepf, & D. C. Koo 34 Astrophys. J. 337 1989 Astrophys. J. 337 (1989) 34 [41] H. K. C. Yee & E. Ellingson 37 Astrophys. J. 445 1995 Astrophys. J. 445 (1995) 37 [42] S. Cole et al 781 Mon. Not. R. Astron. Soc. 271 1994 Mon. Not. R. Astron. Soc. 271 (1994) 781 [43] C. M. Baugh, S. Cole & C. S. Frenk L27 Mon. Not. R. Astron. Soc. 282 1996 Mon. Not. R. Astron. Soc. 282 (1996) L27 [44] C. M. Baugh, S. Cole & C. S. Frenk 1361 Mon. Not. R. Astron. Soc. 283 1996 Mon. Not. R. Astron. Soc. 283 (1996) 1361 [45] C. M. Baugh et al 504 Astrophys. J. 498 1998 Astrophys. J. 498 (1998) 504 [46] P. Schechter 297 Astrophys. J. 203 1976 Astrophys. J. 203 (1976) 297 [47] W. H. Press & P. Schechter 487 Astrophys. J. 187 1974 Astrophys. J. 187 (1974) 487 [48] J. E. Gunn & J. R. Gott 1 Astrophys. J. 176 1972 Astrophys. J. 176 (1972) 1 [49] J. Loveday, B. A. Peterson, G. Efstathiou & S. J. Maddox 338 Astrophys. J. 390 1994 Astrophys. J. 390 (1994) 338 [50] E. L. Turner, J. P. ostriker & J. R. Gott III 1 Astrophys. J. 284 1984 Astrophys. J. 284 (1984) 1 [51] E. L. Turner L43 Astrophys. J. 365 1990 Astrophys. J. 365 (1990) L43 [52] M. Fukugita & E. L. Turner 99 Mon. Not. R. Astron. Soc. 253 1991 Mon. Not. R. Astron. Soc. 253 (1991) 99 [53] M. Fukugita, T. Futamase, M. Kasai & E. L. Turner, As-trophys. J.: 393 (1992) 3 [54] C. S. Kochanek 12 Astrophys. J. 419 1993 Astrophys. J. 419 (1993) 12 [55] C. S. Kochanek 638 Astrophys. J. 466 1996 Astrophys. J. 466 (1996) 638 [56] F. D. A. Hartwich & D. Schade, Ann. Rev. Astron. Astro-phys.: 28 (1990) 437 [57] Yu-Chung N. Cheng & L. M. Krauss 697 Int. J. Mod. Phys., A 15 2000 Int. J. Mod. Phys. A 15 (2000) 697 [58] J. N. Bahcall et al 56 Astrophys. J. 387 1992 Astrophys. J. 387 (1992) 56 [59] P. C. Hewett et al., Astron. J.109, 1498(LBQS) (1995) [60] D. Maoz et al., Astrophys. J.409, 28(Snapshot) (1993) [61] D. Crampton, R. D. McClure & J. M. Fletcher 23 Astrophys. J. 392 1992 Astrophys. J. 392 (1992) 23 [62] H. K. C. Yee, A. V. Filippenko & D. Tang 7 Astron. J. 105 1993 Astron. J. 105 (1993) 7 [63] J. Surdej et al 2064 Astron. J. 105 1993 Astron. J. 105 (1993) 2064 [64] D. Jain, N. Panchapakesan, S. Mahajan & V. B. Bhatia astro-ph/9807129 (1998) [65] D. Jain, N. Panchapakesan, S. Mahajan & V. B. Bhatia, IJMP, A : 13 (1998) 4227 [66] M. lampton, B. Margon & S. Bowyer 177 Astrophys. J. 208 1976 Astrophys. J. 208 (1976) 177 eng DOE-ER-40048-24-P-4 Abbott, R B Washington U. Seattle Cosmological perturbations in Kaluza-Klein models Washington, DC US. Dept. Energy. Office Adm. Serv. Nov 1985 26 p SzGeCERN General Theoretical Physics Bednarz, B F Ellis, S D 1985 11 1990-01-29 50 2002-01-04 BATCH h 198608n PREPRINT eng CERN-PPE-92-085 HEPHY-PUB-568 Albajar, C CERN Multifractal analysis of minimum bias events in \Sqrt s = 630 GeV $\overline{p}$p collisions Geneva CERN 1 Jun 1992 27 p SzGeCERN Particle Physics - Experimental Results Allkofer, O C Apsimon, R J Bartha, S Bezaguet, A Bohrer, A Buschbeck, B Cennini, P Cittolin, S Clayton, E Coughlan, J A Dau, D Della Negra, M Demoulin, M Dibon, H Dowell, J D Eggert, K Eisenhandler, E F Ellis, N Faissner, H Fensome, I F Ferrando, A Garvey, J Geiser, A Givernaud, A Gonidec, A Jank, W Jorat, G Josa-Mutuberria, I Kalmus, P I P Karimaki, V Kenyon, I R Kinnunen, R Krammer, M Lammel, S Landon, M Levegrun, S Lipa, P Markou, C Markytan, M Maurin, G McMahon, S Meyer, T Moers, T Morsch, A Moulin, A Naumann, L Neumeister, N Norton, A Pancheri, G Pauss, F Pietarinen, E Pimia, M Placci, A Porte, J P Priem, R Prosi, R Radermacher, E Rauschkolb, M Reithler, H Revol, J P Robinson, D Rubbia, C Salicio, J M Samyn, D Schinzel, D Schleichert, R Seez, C Shah, T P Sphicas, P Sumorok, K Szoncso, F Tan, C H Taurok, A Taylor, L Tether, S Teykal, H F Thompson, G Terrente-Lujan, E Tuchscherer, H Tuominiemi, J Virdee, T S von Schlippe, W Vuillemin, V Wacker, K Wagner, H Walzel, G Weselka, D Wulz, C E AACHEN - BIRMINGHAM - CERN - HELSINKI - KIEL - IMP. COLL. LONDON - QUEEN MARY COLL. LONDON - MADRID CIEMAT - MIT - RUTHERFORD APPLETON LAB. - VIENNA Collaboration 1992 13 UA1 PPE P00003707 CERN SPS CERN 1992-06-16 50 2001-04-12 BATCH 37-46 Z. Phys., C 56 1992 SLAC 2576562 oai:cds.cern.ch:CERN-PPE-92-085 cern:experiment n 199226 a1992 ARTICLE eng CERN-TH-4036 Ellis, J CERN Non-compact supergravity solves problems Geneva CERN Oct 1984 15 p SzGeCERN General Theoretical Physics Kahler manifolds gravitinos axions constraints noscale Enqvist, K Nanopoulos, D V 1985 13 TH CERN 1990-01-29 50 2001-09-15 BATCH 357-362 Phys. Lett., B 151 1985 oai:cds.cern.ch:CERN-TH-4036 cern:theory h 198451 a1985 ARTICLE eng STAN-CS-81-898-MF Whang, K Stanford University Separability as a physical database design methodology Stanford, CA Stanford Univ. Comput. Sci. Dept. Oct 1981 60 p Ordered for J Blake/DD SzGeCERN Computing and Computers Wiederhold, G Sagalowicz, D 1981 19 Stanford Univ. 1990-01-28 50 2002-01-04 BATCH n 198238n REPORT eng JYFL-RR-82-7 Arje, J University of Jyvaskyla Charge creation and reset mechanisms in an ion guide isotope separator (IGIS) Jyvaskyla Finland Univ. Dept. Phys. Jul 1982 18 p SzGeCERN Detectors and Experimental Techniques 1982 19 Jyväsklä Univ. 1990-01-28 50 2002-01-04 BATCH n 198238n REPORT 0898710022 eng 519.2 Lindley, Dennis Victor University College London Bayesian statistics a review Philadelphia, PA SIAM 1972 88 p CBMS-NSF Reg. Conf. Ser. Appl. Math. 2 Society for Industrial and Applied Mathematics. Philadelphia 1972 21 1990-01-27 00 2002-04-12 BATCH m 198604 BOOK 0844621951 eng 621.396.615 621.385.3 Hamilton, Donald R MIT Klystrons and microwave triodes New York, NY McGraw-Hill 1948 547 p M.I.T. Radiat. Lab. 7 Knipp, Julian K Kuper, J B Horner 1948 21 1990-01-27 00 2002-04-12 BATCH m 198604 BOOK eng 621.313 621.382.333.33 Draper, Alec Electrical machines 2nd ed London Longmans 1967 404 p Electrical engineering series 1967 21 1990-01-27 00 2002-04-12 BATCH m 198604 BOOK 1563964554 eng 539.1.078 539.143.44 621.384.8 Quadrupole mass spectrometry and its applications Amsterdam North-Holland 1976 ed. Dawson, Peter H 368 p 1976 21 1990-01-27 00 2002-04-12 BATCH m 198604 BOOK 2225350574 fre 518.5:62.01 Dasse, Michel Analyse informatique t.1 Les preliminaires Paris Masson 1972 Informatique 1972 21 1990-01-27 00 2002-04-12 BATCH m 198604 BOOK 2225350574 fre 518.5:62.01 Dasse, Michel Analyse informatique t.2 L'accomplissement Paris Masson 1972 Informatique 1972 21 1990-01-27 00 2002-04-12 BATCH m 198604 BOOK 0023506709 eng 519.2 Harshbarger, Thad R Introductory statistics a decision map 2nd ed New York, NY Macmillan 1977 597 p 1977 21 1990-01-27 00 2002-04-12 BATCH m 198604 BOOK eng 519.2 Fry, Thornton C Bell Teleph Labs Probability and its engineering uses Princeton, NJ Van Nostrand 1928 490 p Bell Teleph Lab. Ser. 1928 21 1990-01-27 00 2002-04-12 BATCH m 198606 BOOK 0720421039 eng 517.11 Kleene, Stephen Cole University of Wisconsin Introduction to metamathematics Amsterdam North-Holland 1952 (repr.1964.) 560 p Bibl. Matematica 1 1952 21 1990-01-27 00 2002-04-12 BATCH m 198606 BOOK eng 621.38 Hughes, Robert James Introduction to electronics London English Univ. Press 1962 432 p 65/0938, Blair, W/PE, pp Pipe, Peter 1962 21 1990-01-27 50 2002-04-12 BATCH m 198606 BOOK eng 519.2 518.5:519.2 Burford, Roger L Indiana University Statistics a computer approach Columbus, OH Merrill 1968 814 p 1968 21 1990-01-27 00 2002-04-12 BATCH m 198606 BOOK 0471155039 eng 539.1.075 Chiang, Hai Hung Basic nuclear electronics New York, NY Wiley 1969 354 p 1969 21 1990-01-27 00 2002-04-12 BATCH m 198606 BOOK eng 621-5 Dransfield, Peter Engineering systems and automatic control Englewood Cliffs, N.J. Prentice-Hall 1968 432 p 1968 21 1990-01-27 00 2002-04-12 BATCH m 198606 BOOK 0387940758 eng 537.52 Electrical breakdown in gases London Macmillan 1973 ed. Rees, J A 303 p 1973 21 1990-01-27 00 2002-04-12 BATCH m 198606 BOOK eng Tavanapong, W University of Central Florida A High-performance Video Browsing System Orlando, FL Central Florida Univ. 1999 dir. Hua, K A 172 p No fulltext Not held by the library Ph.D. : Univ. Central Florida : 1999 Recent advances in multimedia processing technologies, internetworking technologies, and the World Wide Web phenomenon have resulted in a vast creation and use of digital videos in all kinds of applications ranging fromentertainment, business solutions, to education. Designing efficient techniques for searching and retrieving videos over the networks becomes increasingly more important as future applications will include a huge volume of multimediacontent. One practical approach to search for a video segment is as follows. Step 1: Apply an initial search to determine the set of candidate videos. Step 2: Browse the candidates to identify the relevant videos. Step 3: Searchwithin the relevant videos for interesting video segments. In practice, a user might have to iterate through these steps multiple times in order to locate the desired video segments. Independently, database researchers have beeninvestigating techniques for the initial search in Step 1. Multimedia researchers have proposed several techniques for video browsing in Step 2. Computer communications researchers have been investigating video delivery techniques. Iidentify that searching for video data is an interactive process which involves the transmission of video data. Developing techniques for each step independently could result in a system with less performance. In this dissertation, Ipresent a unified approach taking into accounts all fundamental characteristics of multimedia data. I evaluated the proposed techniques through both simulation and system implementation. The resulting system is less expensive andoffers better performance. The simulation results demonstrate that the proposed technique can offer video browsing and search operations with little delays and with minimum storage overhead at the server. Client machines can handletheir search operations without involving the server making the design more scalable, which is vital for large systems deployed over the Internet. The implemented system shows that the visual quality of the browsing and the searchoperations are excellent. PROQUEST200009 SzGeCERN Computing and Computers THESIS notheld 1999 14 2000-09-22 00 2002-02-22 BATCH PROQUEST 9923724 PROQUEST DAI-B60/03p1177Sep1999 n 200034 THESIS eng Teshome, D California State Univ Neural Networks For Speech Recognition Of A Phonetic Language Long Beach, CA Calif. State Univ. 1999 55 p No fulltext Not held by the library Ms : California State Univ. : 1999 The goal of this thesis is to explore a possibility for a viable alternative/replacement to the Amharic typewriter. Amharic is the national language of Ethiopia. It is one of the oldest languages in the world. Actually, the root-language of Amharic, called Geez, is a descendent of Sabean, which is the direct ancestor of all Semitic languages including English. A phonetic language with 276 phonemes/characters, Amharic has posed quite a challenge to those who,like the author of this thesis, have attempted to design an easy-to-use word processor that interfaces with the conventional keyboard. With current Amharic word processing software, each character requires an average of threekeystrokes thus making typing Amharic literature quite a task. This thesis researches the feasibility of developing a PC-based speech recognition system to recognize the spoken phonemes of the Amharic language. Artificial NeuralNetworks are used for the recognition of spoken alphabets that form Amharic words. A neural network with feed-forward architecture is trained with a series of alphabets and is evaluated on its ability to recognize subsequent testdata. The neural network used in this project is a static classification network; that is, it focuses on the frequency domain of speech while making no attempt to process temporal information. The network training procedure uses thegeneralized Delta Rule. The recognition system developed in this project is an Isolated Speech Recognition System. The approach taken is to recognize the spoken word character by character. This approach is expected to work well dueto the phonetic nature of Amharic. PROQUEST200009 SzGeCERN Computing and Computers THESIS notheld 1999 14 2000-09-22 00 2002-02-22 BATCH PROQUEST 1397120 PROQUEST MAI38/02p448Apr2000 n 200034 THESIS eng Topcuoglu, H R Syracuse Univ. Scheduling Task Graphs In Heterogeneous Computing Environments Syracuse, NY Syracuse Univ. 1999 dir. Hariri, S 126 p No fulltext Not held by the library Ph.D. : Syracuse Univ. : 1999 Efficient application scheduling is critical for achieving high performance in heterogeneous computing environments. An application is represented by a directed acyclic graph (DAG) whose nodes represent tasks and whose edgesrepresent communication messages and precedence constraints among the tasks. The general task-scheduling problem maps the tasks of an application on processors and orders their execution so that task precedence requirements aresatisfied and a minimum schedule length is obtained. The task-scheduling problem has been shown to be NP- complete in general cases as well as in several restricted cases. Although a large number of scheduling heuristics arepresented in the literature, most of them target homogeneous processors. Existing algorithms for heterogeneous processors are not generally efficient because of their high complexity and the quality of their results. This thesisstudies the scheduling of DAG-structured application tasks on heterogeneous domains. We develop two novel low-complexity and efficient scheduling algorithms for bounded number of heterogeneous processors, the HeterogeneousEarliest-Finish-Time (HEFT) algorithm and the Critical-Path-on-a-Processor (CPOP) algorithm. The experimental work presented in this thesis shows that these algorithms significantly surpass previous approaches in terms of performance(schedule length ratio, speed-up, and frequency of best results) and cost (running time and time complexity). Our experimental work includes randomly generated graphs and graphs deducted from real applications. As part of thecomparison study, a parametric graph generator is introduced to generate graphs with various characteristics. We also present a further optimization of the HEFT Algorithm by introducing alternative methods for task prioritizing andprocessor selection phases. A novel processor selection policy based on the earliest finish time of the critical child task improves the performance of the HEFT algorithm. Several strategies for selecting the critical child task of agiven task are presented. This thesis addresses embedding the task scheduling algorithms into an application-development environment for distributed resources. An analytical model is introduced for setting the computation costs oftasks and communication costs of edges of a graph. As part of the design framework of our application development environment, a novel, two-phase, distributed scheduling algorithm is presented for scheduling an application overwide-area distributed resources. PROQUEST200009 SzGeCERN Computing and Computers THESIS notheld 1999 14 2000-09-22 00 2002-02-08 BATCH PROQUEST 9946509 PROQUEST DAI-B60/09p4718Mar2000 n 200034 THESIS spa Trespalacios-Mantilla, J H Puerto Rico Univ. Software De Apoyo Educativo Al Concepto De Funcion En Precalculo I (spanish Text) Rio Piedras Puerto Rico Univ. 1999 dir. Monroy, H 64 p No fulltext Not held by the library Ms : Univ. Puerto Rico : 1999 This thesis reports on the evaluation of the use of an educational software, designed to improve student's learning of the concept of mathematical function. The students in the study were registered in Precalculus I at theUniversity of Puerto Rico, Mayaguez Campus. The educational software allows the practice of changing the representation of a function among tabular, analytic, and graphical representations. To carry the evaluation, 59 students wereselected and were divided in two groups: control and experimental. Both groups received the 'traditional' classroom lectures on the topic. The experimental group, in addition, was allowed to practice with the educational software. Tomeasure their performance and the effect of the educational software, two tests were given: a pre-test and a post-test. The results of this study shows that the experimental group improved significantly more than the control group,thus demonstrating the validity of the educational software in the learning of the concept of mathematical function. PROQUEST200009 SzGeCERN Computing and Computers THESIS notheld 1999 14 2000-09-22 00 2002-02-08 BATCH PROQUEST 1395476 PROQUEST MAI37/06p1890Dec1999 n 200034 THESIS 0612382052 fre Troudi, N Laval Univ. Systeme Multiagent Pour Les Environnements Riches En Informations (french Text) Laval Laval Univ. 1999 dir. Chaib-Draa, B 101 p No fulltext Not held by the library Msc : Universite Laval : 1999 La croissance du Web est spectaculaire, puisqu'on estime aujourd'hui a plus de 50 millions, le nombre de pages sur le Web qui ne demandent qu'a etre consultees. Un simple calcul montre qu'en consacrant ne serait-ce qu'une minute parpage, il faudrait environ 95 ans pour consulter toutes ces pages. L'utilisation d'une strategie de recherche est donc vitale. Dans ce cadre, de nombreux outils de recherche ont ete proposes. Ces outils appeles souvent moteurs derecherche se sont averes aujourd'hui incapables de fournir de l'aide aux utilisateurs. Les raisons principales a cela sont les suivantes: (1) La nature ouverte de l'Internet: aucune supervision centrale ne s'applique quant audeveloppement d'Internet, puisque toute personne qui desire l'utiliser et/ou offrir des informations est libre de le faire; (2) La nature dynamique des informations: les informations qui ne sont pas disponibles aujourd'hui peuventl'etre demain et inversement; (3) La nature heterogene de l'information: l'information est offerte sous plusieurs formats et de plusieurs facons, compliquant ainsi la recherche automatique de l'information. Devant ce constat, ilsemble important de chercher de nouvelles solutions pour aider l'utilisateur dans sa recherche d'informations. (Abstract shortened by UMI.) PROQUEST200009 SzGeCERN Computing and Computers THESIS notheld 1999 14 2000-09-22 00 2002-02-08 BATCH PROQUEST MQ38205 PROQUEST MAI37/06p1890Dec1999 n 200034 THESIS eng LBL-22304 Manes, J L Calif. Univ. Berkeley Anomalies in quantum field theory and differential geometry Berkeley, CA Lawrence Berkeley Nat. Lab. Apr 1986 76 p Thesis : Calif. Univ. Berkeley SzGeCERN General Theoretical Physics bibliography REPORT THESIS 1986 14 1990-01-29 50 2002-03-22 BATCH SLAC 1594192 h 198650n THESIS eng LBL-21916 Ingermanson, R Calif. Univ. Berkeley Accelerating the loop expansion Berkeley, CA Lawrence Berkeley Nat. Lab. Jul 1986 96 p Thesis : Calif. Univ. Berkeley SzGeCERN General Theoretical Physics bibliography REPORT THESIS 1986 14 1990-01-29 50 2002-03-22 BATCH SLAC 1594184 h 198650n THESIS eng LBL-28106 Bertsche, K J Calif. Univ. Berkeley A small low energy cyclotron for radioisotope measurements Berkeley, CA Lawrence Berkeley Nat. Lab. Nov 1989 155 p Thesis : Calif. Univ. Berkeley SzGeCERN Accelerators and Storage Rings bibliography REPORT THESIS 14 1989 1990-02-28 50 2002-03-22 BATCH h 199010n THESIS gr-qc/0204045 eng Khalatnikov, I M L D Landau Institute for Theoretical Physics of Russian Academy of Sciences Comment about quasiisotropic solution of Einstein equations near cosmological singularity 12 Apr 2002 7 p We generalize for the case of arbitrary hydrodynamical matter the quasiisotropic solution of Einstein equations near cosmological singularity, found by Lifshitz and Khalatnikov in 1960 for the case of radiation-dominated universe. Itis shown that this solution always exists, but dependence of terms in the quasiisotropic expansion acquires a more complicated form. LANL EDS SzGeCERN General Relativity and Cosmology Kamenshchik, A Y Alexander Kamenshchik <sasha.kamenshchik@centrovolta.it> http://cdsware.cern.ch/download/invenio-demo-site-files/0204045.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204045.ps.gz CER n 200231 2002 11 2002-04-15 00 2002-04-15 BATCH PREPRINT [1] Lifshitz E M and Khalatnikov I M 1960 149 Zh. Eksp. Teor. Fiz. 39 1960 Zh. Eksp. Teor. Fiz. 39 (1960) 149 [2] Lifshitz E M and Khalatnikov I M 1964 Sov. Phys. Uspekhi 6 495 [3] Landau L D and Lifshitz E M 1979 The Classical Theory of Fields (Perg-amon Press) [4] Starobinsky A A 1986 Stochastic De Sitter (inflationary stage) in the early universe in Field Theory, Quantum Gravity and Strings, (Eds. H.J. De Vega and N. Sanchez, Springer-Verlag, Berlin) 107; Linde A D 1990 Particle Physics and Inflationary Cosmology (Harward Academic Publishers, New York) [5] Banks T and Fischler W 2001 M theory observables for cosmolog-ical space-times hep-th/0102077 An Holographic Cosmology hep-th/0111142 [6] Perlmutter S J et al 1999 565 Astrophys. J. 517 1999 Astrophys. J. 517 (1999) 565 Riess A et al 1998 1009 Astron. J. 116 1998 Astron. J. 116 (1998) 1009 [7] Sahni V and Starobinsky A A 2000 373 Int. J. Mod. Phys., D 9 2000 Int. J. Mod. Phys. D 9 (2000) 373 gr-qc/0204046 eng Bento, M C CERN Supergravity Inflation on the Brane 12 Apr 2002 5 p We study N=1 Supergravity inflation in the context of the braneworld scenario. Particular attention is paid to the problem of the onset of inflation at sub-Planckian field values and the ensued inflationary observables. We find thatthe so-called $\eta$-problem encountered in supergravity inspired inflationary models can be solved in the context of the braneworld scenario, for some range of the parameters involved. Furthermore, we obtain an upper bound on thescale of the fifth dimension, $M_5 \lsim 10^{-3} M_P$, in case the inflationary potential is quadratic in the inflaton field, $\phi$. If the inflationary potential is cubic in $\phi$, consistency with observational data requires that$M_5 \simeq 9.2 \times 10^{-4} M_P$. LANL EDS SzGeCERN General Relativity and Cosmology Bertolami, O Sen, A A Maria da Conceicao Bento <bento@sirius.ist.utl.pt> http://cdsware.cern.ch/download/invenio-demo-site-files/0204046.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204046.ps.gz 2002 11 2002-04-15 00 2002-04-15 BATCH n 200216 PREPRINT hep-th/0204098 eng Alhaidari, A D King Fadh University Reply to 'Comment on "Solution of the Relativistic Dirac-Morse Problem"' 11 Apr 2002 This combines a reply to the Comment [hep-th/0203067 v1] by A. N. Vaidya and R. de L. Rodrigues with an erratum to our Letter [Phys. Rev. Lett. 87, 210405 (2001)] LANL EDS SzGeCERN Particle Physics - Theory A. D. Alhaidari <haidari@kfupm.edu.sa> http://cdsware.cern.ch/download/invenio-demo-site-files/0204098.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204098.ps.gz 2002 11 2002-04-15 00 2002-04-15 BATCH n 200216 PREPRINT hep-th/0204099 eng CU-TP-1043 Easther, R Columbia Univ. Cosmological String Gas on Orbifolds Irvington-on-Hudson, NY Columbia Univ. Dept. Phys. 12 Apr 2002 14 p It has long been known that strings wound around incontractible cycles can play a vital role in cosmology. In particular, in a spacetime with toroidal spatial hypersurfaces, the dynamics of the winding modes may help yield threelarge spatial dimensions. However, toroidal compactifications are phenomenologically unrealistic. In this paper we therefore take a first step toward extending these cosmological considerations to $D$-dimensional toroidal orbifolds.We use numerical simulation to study the timescales over which "pseudo-wound" strings unwind on these orbifolds with trivial fundamental group. We show that pseudo-wound strings can persist for many ``Hubble times'' in some of thesespaces, suggesting that they may affect the dynamics in the same way as genuinely wound strings. We also outline some possible extensions that include higher-dimensional wrapped branes. LANL EDS SzGeCERN Particle Physics - Theory Greene, B R Jackson, M G M. G. Jackson <markj@phys.columbia.edu> http://cdsware.cern.ch/download/invenio-demo-site-files/0204099.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204099.ps.gz CER n 200231 2002 11 Easther, Richard Greene, Brian R. Jackson, Mark G. 2002-04-15 00 2002-04-15 BATCH PREPRINT [1] R. Brandenberger and C. Vafa 391 Nucl. Phys., B 316 1989 Nucl. Phys. B 316 (1989) 391 [2] A. A. Tseytlin and C. Vafa 443 Nucl. Phys., B 372 1992 Nucl. Phys. B 372 (1992) 443 hep-th/9109048 [3] M. Sakellariadou 319 Nucl. Phys., B 468 1996 Nucl. Phys. B 468 (1996) 319 hep-th/9511075 [4] A. G. Smith and A. Vilenkin 990 Phys. Rev., D 36 1987 Phys. Rev. D 36 (1987) 990 [5] R. Brandenberger, D. A. Easson and D. Kimberly 421 Nucl. Phys., B 623 2002 Nucl. Phys. B 623 (2002) 421 hep-th/0109165 [6] B. R. Greene, A. D. Shapere, C. Vafa, and S. T. Yau 1 Nucl. Phys., B 337 1990 Nucl. Phys. B 337 (1990) 1 [7] L. Dixon, J. Harvey, C. Vafa and E. Witten 678 Nucl. Phys., B 261 1985 Nucl. Phys. B 261 (1985) 678 L. Dixon, J. Harvey, C. Vafa and E. Witten 285 Nucl. Phys., B 274 1986 Nucl. Phys. B 274 (1986) 285 [8] M. Sakellariadou and A. Vilenkin 885 Phys. Rev., D 37 1988 Phys. Rev. D 37 (1988) 885 [9] J. J. Atick and E. Witten 291 Nucl. Phys., B 310 1988 Nucl. Phys. B 310 (1988) 291 [10] D. Mitchell and N. Turok 1577 Phys. Rev. Lett. 58 1987 Phys. Rev. Lett. 58 (1987) 1577 Imperial College report, 1987 (unpublished) [11] S. Alexander, R. Brandenberger, and D. Easson 103509 Phys. Rev., D 62 2000 Phys. Rev. D 62 (2000) 103509 hep-th/0005212 [12] D. Easson hep-th/0110225 hep-ph/0204132 eng NUC-MINN-02-3-T Shovkovy, I A Minnesota Univ. Thermal conductivity of dense quark matter and cooling of stars Minneapolis, MN Minnesota Univ. 11 Apr 2002 9 p The thermal conductivity of the color-flavor locked phase of dense quark matter is calculated. The dominant contribution to the conductivity comes from photons and Nambu-Goldstone bosons associated with breaking of baryon numberwhich are trapped in the quark core. Because of their very large mean free path the conductivity is also very large. The cooling of the quark core arises mostly from the heat flux across the surface of direct contact with the nuclearmatter. As the thermal conductivity of the neighboring layer is also high, the whole interior of the star should be nearly isothermal. Our results imply that the cooling time of compact stars with color-flavor locked quark cores issimilar to that of ordinary neutron stars. LANL EDS SzGeCERN Particle Physics - Phenomenology Ellis, P J Igor Shovkovy <shovkovy@physics.umn.edu> http://cdsware.cern.ch/download/invenio-demo-site-files/0204132.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204132.ps.gz CER n 200231 2002 11 Shovkovy, Igor A. Ellis, Paul J. 2002-04-15 00 2002-04-15 BATCH PREPRINT [1] J.C. Collins and M.J. Perry 1353 Phys. Rev. Lett. 34 1975 Phys. Rev. Lett. 34 (1975) 1353 [2] B. C. Barrois 390 Nucl. Phys., B 129 1977 Nucl. Phys. B 129 (1977) 390 S. C. Frautschi, in "Hadronic matter at extreme energy density", edited by N. Cabibbo and L. Sertorio (Plenum Press, 1980); D. Bailin and A. Love 325 Phys. Rep. 107 1984 Phys. Rep. 107 (1984) 325 [3] M. G. Alford, K. Rajagopal and F. Wilczek 247 Phys. Lett., B 422 1998 Phys. Lett. B 422 (1998) 247 R. Rapp, T. Schäfer, E. V. Shuryak and M. Velkovsky 53 Phys. Rev. Lett. 81 1998 Phys. Rev. Lett. 81 (1998) 53 [4] D. T. Son 094019 Phys. Rev., D 59 1999 Phys. Rev. D 59 (1999) 094019 R. D. Pisarski and D. H. Rischke 37 Phys. Rev. Lett. 83 1999 Phys. Rev. Lett. 83 (1999) 37 [5] T. Schafer and F. Wilczek 114033 Phys. Rev., D 60 1999 Phys. Rev. D 60 (1999) 114033 D. K. Hong, V. A. Miransky, I. A. Shovkovy and L. C. R. Wijewardhana 056001 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 056001 erratum 059903 Phys. Rev., D 62 2000 Phys. Rev. D 62 (2000) 059903 R. D. Pisarski and D. H. Rischke 051501 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 051501 [6] S. D. Hsu and M. Schwetz 211 Nucl. Phys., B 572 2000 Nucl. Phys. B 572 (2000) 211 W. E. Brown, J. T. Liu and H. C. Ren 114012 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 114012 [7] I. A. Shovkovy and L. C. R. Wijewardhana 189 Phys. Lett., B 470 1999 Phys. Lett. B 470 (1999) 189 T. Schäfer 269 Nucl. Phys., B 575 2000 Nucl. Phys. B 575 (2000) 269 [8] K. Rajagopal and F. Wilczek, arXiv hep-ph/0011333 M. G. Alford 131 Annu. Rev. Nucl. Part. Sci. 51 2001 Annu. Rev. Nucl. Part. Sci. 51 (2001) 131 [9] M. Alford and K. Rajagopal, arXiv hep-ph/0204001 [10] M. Alford, K. Rajagopal and F. Wilczek 443 Nucl. Phys., B 537 1999 Nucl. Phys. B 537 (1999) 443 [11] R. Casalbuoni and R. Gatto 111 Phys. Lett., B 464 1999 Phys. Lett. B 464 (1999) 111 [12] D. T. Son and M. A. Stephanov 074012 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 074012 erratum 059902 Phys. Rev., D 62 2000 Phys. Rev. D 62 (2000) 059902 [13] P. F. Bedaque and T. Schäfer 802 Nucl. Phys., A 697 2002 Nucl. Phys. A 697 (2002) 802 [14] V. A. Miransky and I. A. Shovkovy 111601 Phys. Rev. Lett. 88 2002 Phys. Rev. Lett. 88 (2002) 111601 [arXiv hep-ph/0108178 T. Schafer, D. T. Son, M. A. Stephanov, D. Toublan and J. J. Ver-baarschot 67 Phys. Lett., B 522 2001 Phys. Lett. B 522 (2001) 67 [arXiv hep-ph/0108210 [15] D. T. Son, arXiv hep-ph/0108260 [16] P. Jaikumar, M. Prakash and T. Schäfer, arXiv astro-ph/0203088 [17] E. J. Ferrer, V. P. Gusynin and V. de la Incera, arXiv: cond-matt/0203217 [18] I. S. Gradshteyn and I. M. Ryzhik, Tables of Integrals, Series and Products (Academic, New York, 1965) 3.252.9 [19] J. J. Freeman and A. C. Anderson 5684 Phys. Rev., B 34 1986 Phys. Rev. B 34 (1986) 5684 [20] C. Kittel, Introduction to Solid State Phys.(John Wi-ley & Sons, Inc., 1960) p. 139 [21] V. P. Gusynin and I. A. Shovkovy 577 Nucl. Phys., A 700 2002 Nucl. Phys. A 700 (2002) 577 [22] I. M. Khalatnikov, An introduction to the theory of su-perfluidity, (Addison-Wesley Pub. Co., 1989) [23] P. A. Sturrock, Plasma Physics, (Cambridge University Press, 1994) [24] J. M. Lattimer, K. A. Van Riper, M. Prakash and M. Prakash 802 Astrophys. J. 425 1994 Astrophys. J. 425 (1994) 802 [25] M. G. Alford, K. Rajagopal, S. Reddy and F. Wilczek 074017 Phys. Rev., D 64 2001 Phys. Rev. D 64 (2001) 074017 [26] G. W. Carter and S. Reddy 103002 Phys. Rev., D 62 2000 Phys. Rev. D 62 (2000) 103002 [27] A. W. Steiner, M. Prakash and J. M. Lattimer 10 Phys. Lett., B 509 2001 Phys. Lett. B 509 (2001) 10 [arXiv astro-ph/0101566 [28] S. Reddy, M. Sadzikowski and M. Tachibana, arXiv nucl-th/0203011 [29] M. Prakash, J. M. Lattimer, J. A. Pons, A. W. Steiner and S. Reddy 364 Lect. Notes Phys. 578 2001 Lect. Notes Phys. 578 (2001) 364 [30] S. L. Shapiro and S. A. Teukolsky, Black holes, white dwarfs, and neutron stars: the physics of compact ob-jects, (John Wiley & Sons, 1983) [31] D. Blaschke, H. Grigorian and D. N. Voskresensky, As-tron. Astrophys. : 368 (2001) 561 [32] D. Page, M. Prakash, J. M. Lattimer and A. W. Steiner 2048 Phys. Rev. Lett. 85 2000 Phys. Rev. Lett. 85 (2000) 2048 [33] K. Rajagopal and F. Wilczek 3492 Phys. Rev. Lett. 86 2001 Phys. Rev. Lett. 86 (2001) 3492 [34] J. I. Kapusta, Finite-temperature field theory, (Cam-bridge University Press, 1989) [35] S. M. Johns, P. J. Ellis and J. M. Lattimer 1020 Astrophys. J. 473 1996 Astrophys. J. 473 (1996) 1020 hep-ph/0204133 eng Gomez, M E CFIF Lepton-Flavour Violation in SUSY with and without R-parity 12 Apr 2002 11 p We study whether the individual violation of the lepton numbers L_{e,mu,tau} in the charged sector can lead to measurable rates for BR(mu->e gamma) and BR(tau->mu gamma). We consider three different scenarios, the fist onecorresponds to the Minimal Supersymmetric Standard Model with non-universal soft terms. In the other two cases the violation of flavor in the leptonic charged sector is associated to the neutrino problem in models with a see-sawmechanism and with R-parity violation respectively. LANL EDS SzGeCERN Particle Physics - Phenomenology Carvalho, D F Mario E. Gomez <mgomez@gtae3.ist.utl.pt> http://cdsware.cern.ch/download/invenio-demo-site-files/0204133.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204133.ps.gz CER n 200231 2002 11 2002-04-15 00 2002-04-15 BATCH TALK GIVEN BY M E G AT THE CORFU SUMMER INSTITUTE ON ELEMENTARY PARTICLE PHYSICS CORFU 2001 11 PAGES 5 FIGURES PREPRINT [1] Y. Fukuda et al., Super-Kamiokande collaboration 9 Phys. Lett., B 433 1998 Phys. Lett. B 433 (1998) 9 33 Phys. Lett., B 436 1998 Phys. Lett. B 436 (1998) 33 1562 Phys. Rev. Lett. 81 1998 Phys. Rev. Lett. 81 (1998) 1562 [2] M. Apollonio et al., Chooz collaboration 397 Phys. Lett. B 420 1998 Phys. Lett. B 420 (1998) 397 [3] H. N. Brown et al. [Muon g-2 Collaboration] 2227 Phys. Rev. Lett. 86 2001 Phys. Rev. Lett. 86 (2001) 2227 hep-ex/0102017 [4] Review of Particle Physics, D. E. Groom et al 1 Eur. Phys. J., C 15 2000 Eur. Phys. J. C 15 (2000) 1 [5] D. F. Carvalho, M. E. Gomez and S. Khalil 001 J. High Energy Phys. 0107 2001 J. High Energy Phys. 0107 (2001) 001 hep-ph/0104292 [6] D. F. Carvalho, J. R. Ellis, M. Gomez and S. Lola 323 Phys. Lett., B 515 2001 Phys. Lett. B 515 (2001) 323 [7] D. F. Carvalho, M. E. Gomez and J. C. Romao hep-ph/0202054 (to appear in Phys. Rev., D [8] J. R. Ellis, M. E. Gomez, G. K. Leontaris, S. Lola and D. V. Nanopoulos 319 Eur. Phys. J., C 14 2000 Eur. Phys. J. C 14 (2000) 319 [9] A. Belyaev et al 715 Eur. Phys. J., C 22 2002 Eur. Phys. J. C 22 (2002) 715 A. Belyaev et al. [Kaon Physics Working Group Collaboration] hep-ph/0107046 [10] J. Hisano, T. Moroi, K. Tobe and M. Yamaguchi 2442 Phys. Rev., D 53 1996 Phys. Rev. D 53 (1996) 2442 J. Hisano and D. Nomura 116005 Phys. Rev., D 59 1999 Phys. Rev. D 59 (1999) 116005 [11] R. Barbieri and L.J. Hall 212 Phys. Lett., B 338 1994 Phys. Lett. B 338 (1994) 212 R. Barbieri et al 219 Nucl. Phys., B 445 1995 Nucl. Phys. B 445 (1995) 219 Nima Arkani-Hamed, Hsin-Chia Cheng and L.J. Hall 413 Phys. Rev., D 53 1996 Phys. Rev. D 53 (1996) 413 P. Ciafaloni, A. Romanino and A. Strumia 3 Nucl. Phys., B 458 1996 Nucl. Phys. B 458 (1996) 3 M. E. Gomez and H. Goldberg 5244 Phys. Rev., D 53 1996 Phys. Rev. D 53 (1996) 5244 J. Hisano, D. Nomura, Y. Okada, Y. Shimizu and M. Tanaka 116010 Phys. Rev., D 58 1998 Phys. Rev. D 58 (1998) 116010 [12] M. E. Gomez, G. K. Leontaris, S. Lola and J. D. Vergados 116009 Phys. Rev., D 59 1999 Phys. Rev. D 59 (1999) 116009 G.K. Leontaris and N.D. Tracas 90 Phys. Lett., B 431 1998 Phys. Lett. B 431 (1998) 90 W. Buchmuller, D. Delepine and F. Vissani 171 Phys. Lett., B 459 1999 Phys. Lett. B 459 (1999) 171 W. Buchmuller, D. Delepine and L. T. Handoko 445 Nucl. Phys., B 576 2000 Nucl. Phys. B 576 (2000) 445 Q. Shafi and Z. Tavartkiladze 145 Phys. Lett., B 473 2000 Phys. Lett. B 473 (2000) 145 J. L. Feng, Y. Nir and Y. Shadmi 113005 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 113005 [13] A. Brignole, L. E. Iba nez and C. Mu noz 125 Nucl. Phys., B 422 1994 Nucl. Phys. B 422 (1994) 125 [Erratum 747 Nucl. Phys., B 436 1994 Nucl. Phys. B 436 (1994) 747 ] [14] L. Iba nez and G.G. Ross 100 Phys. Lett., B 332 1994 Phys. Lett. B 332 (1994) 100 G.K. Leontaris, S. Lola and G.G. Ross 25 Nucl. Phys., B 454 1995 Nucl. Phys. B 454 (1995) 25 S. Lola and G.G. Ross 81 Nucl. Phys., B 553 1999 Nucl. Phys. B 553 (1999) 81 [15] M. Gell-Mann, P. Ramond and R. Slansky, Proceedings of the Stony Brook Super-gravity Workshop, New York, 1979, eds. P. Van Nieuwenhuizen and D. Freedman (North-Holland, Amsterdam) [16] J. A. Casas and A. Ibarra 171 Nucl. Phys., B 618 2001 Nucl. Phys. B 618 (2001) 171 S. Lavignac, I. Masina and C. A. Savoy 269 Phys. Lett., B 520 2001 Phys. Lett. B 520 (2001) 269 and hep-ph/0202086 [17] J. R. Ellis, D. V. Nanopoulos and K. A. Olive 65 Phys. Lett., B 508 2001 Phys. Lett. B 508 (2001) 65 [18] J. C. Romao, M. A. Diaz, M. Hirsch, W. Porod and J. W. Valle 071703 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 071703 113008 Phys. Rev., D 62 2000 Phys. Rev. D 62 (2000) 113008 [19] M. E. Gomez and K. Tamvakis 057701 Phys. Rev., D 58 1998 Phys. Rev. D 58 (1998) 057701 [20] M. Hirsch, W. Porod, J. W. F. Valle and J. C. Rom ao hep-ph/0202149 [21] L. M. Barkov et al., Research Proposal to PSI, 1999 http://www.icepp.s.u-tokyo.ac.jp/meg http://www.icepp.s.u-tokyo.ac.jp/meg [22] The homepage of the PRISM project http://www-prism.kek.jp/ http://www-prism.kek.jp/ Y. Kuno, Lep-ton Flavor Violation Experiments at KEK/JAERI Joint Project of High Intensity Proton Machine, in Proceedings of Workshop of "LOWNU/NOON 2000", Tokyo, December 4-8, 2000 [23] W. Porod, M. Hirsch, J. Rom ao and J. W. Valle 115004 Phys. Rev., D 63 2001 Phys. Rev. D 63 (2001) 115004 hep-ph/0204134 eng Dzuba, V A University of New South Wales Precise calculation of parity nonconservation in cesium and test of the standard model 12 Apr 2002 24 p We have calculated the 6s-7s parity nonconserving (PNC) E1 transition amplitude, E_{PNC}, in cesium. We have used an improved all-order technique in the calculation of the correlations and have included all significant contributionsto E_{PNC}. Our final value E_{PNC} = 0.904 (1 +/- 0.5 %) \times 10^{-11}iea_{B}(-Q_{W}/N) has half the uncertainty claimed in old calculations used for the interpretation of Cs PNC experiments. The resulting nuclear weak chargeQ_{W} for Cs deviates by about 2 standard deviations from the value predicted by the standard model. LANL EDS SzGeCERN Particle Physics - Phenomenology Flambaum, V V Ginges, J S M "Jacinda S.M. GINGES" <ginges@phys.unsw.edu.au> http://cdsware.cern.ch/download/invenio-demo-site-files/0204134.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204134.ps.gz CER n 200231 2002 11 2002-04-15 00 2002-04-15 BATCH PREPRINT [1] I.B. Khriplovich, Parity Nonconservation in Atomic Phenomena (Gordon and Breach, Philadelphia, 1991) [2] M.-A. Bouchiat and C. Bouchiat 1351 Rep. Prog. Phys. 60 1997 Rep. Prog. Phys. 60 (1997) 1351 [3] C.S. Wood et al 1759 Science 275 1997 Science 275 (1997) 1759 [4] V.A. Dzuba, V.V. Flambaum, and O.P. Sushkov 147 Phys. Lett., A 141 1989 Phys. Lett. A 141 (1989) 147 [5] S.A. Blundell, W.R. Johnson, and J. Sapirstein 1411 Phys. Rev. Lett. 65 1990 Phys. Rev. Lett. 65 (1990) 1411 S.A. Blundell, J. Sapirstein, and W.R. Johnson 1602 Phys. Rev., D 45 1992 Phys. Rev. D 45 (1992) 1602 [6] R.J. Rafac, and C.E. Tanner, Phys. Rev., A58 1087 (1998); R.J. Rafac, C.E. Tanner, A.E. Livingston, and H.G. Berry, Phys. Rev., A60 3648 (1999) [7] S.C. Bennett, J.L. Roberts, and C.E. Wieman R16 Phys. Rev., A 59 1999 Phys. Rev. A 59 (1999) R16 [8] S.C. Bennett and C.E. Wieman 2484 Phys. Rev. Lett. 82 1999 Phys. Rev. Lett. 82 (1999) 2484 82, 4153(E) (1999); 83, 889(E) (1999) [9] R. Casalbuoni, S. De Curtis, D. Dominici, and R. Gatto 135 Phys. Lett., B 460 1999 Phys. Lett. B 460 (1999) 135 [10] J. L. Rosner 016006 Phys. Rev., D 61 1999 Phys. Rev. D 61 (1999) 016006 [11] J. Erler and P. Langacker 212 Phys. Rev. Lett. 84 2000 Phys. Rev. Lett. 84 (2000) 212 [12] A. Derevianko 1618 Phys. Rev. Lett. 85 2000 Phys. Rev. Lett. 85 (2000) 1618 [13] V.A. Dzuba, C. Harabati, W.R. Johnson, and M.S. Safronova 044103 Phys. Rev., A 63 2001 Phys. Rev. A 63 (2001) 044103 [14] M.G. Kozlov, S.G. Porsev, and I.I. Tupitsyn 3260 Phys. Rev. Lett. 86 2001 Phys. Rev. Lett. 86 (2001) 3260 [15] W.J. Marciano and A. Sirlin 552 Phys. Rev., D 27 1983 Phys. Rev. D 27 (1983) 552 W.J. Marciano and J.L. Rosner 2963 Phys. Rev. Lett. 65 1990 Phys. Rev. Lett. 65 (1990) 2963 [16] B.W. Lynn and P.G.H. Sandars 1469 J. Phys., B 27 1994 J. Phys. B 27 (1994) 1469 I. Bednyakov et al 012103 Phys. Rev., A 61 1999 Phys. Rev. A 61 (1999) 012103 [17] A.I. Milstein and O.P. Sushkov, e-print hep-ph/0109257 [18] W.R. Johnson, I. Bednyakov, and G. Soff 233001 Phys. Rev. Lett. 87 2001 Phys. Rev. Lett. 87 (2001) 233001 [19] A. Derevianko 012106 Phys. Rev., A 65 2002 Phys. Rev. A 65 (2002) 012106 [20] V.A. Dzuba and V.V. Flambaum 052101 Phys. Rev., A 62 2000 Phys. Rev. A 62 (2000) 052101 [21] V.A. Dzuba, V.V. Flambaum, and O.P. Sushkov R4357 Phys. Rev., A 56 1997 Phys. Rev. A 56 (1997) R4357 [22] D.E. Groom et al., Euro. Phys. J. C : 15 (2000) 1 [23] V.A. Dzuba, V.V. Flambaum, P.G. Silvestrov, and O.P. Sushkov 1399 J. Phys., B 20 1987 J. Phys. B 20 (1987) 1399 [24] V.A. Dzuba, V.V. Flambaum, and O.P. Sushkov 493 Phys. Lett., A 140 1989 Phys. Lett. A 140 (1989) 493 [25] V.A. Dzuba, V.V. Flambaum, A.Ya. Kraftmakher, and O.P. Sushkov 373 Phys. Lett., A 142 1989 Phys. Lett. A 142 (1989) 373 [26] G. Fricke et al 177 At. Data Nucl. Data Tables 60 1995 At. Data Nucl. Data Tables 60 (1995) 177 [27] A. Trzci´nska et al 082501 Phys. Rev. Lett. 87 2001 Phys. Rev. Lett. 87 (2001) 082501 [28] V.B. Berestetskii, E.M. Lifshitz, and L.P. Pitaevskii, Relativistic Quantum Theory (Pergamon Press, Oxford, 1982) [29] P.J. Mohr and Y.-K. Kim 2727 Phys. Rev., A 45 1992 Phys. Rev. A 45 (1992) 2727 P.J. Mohr 4421 Phys. Rev., A 46 1992 Phys. Rev. A 46 (1992) 4421 [30] L.W. Fullerton and G.A. Rinker, Jr 1283 Phys. Rev., A 13 1976 Phys. Rev. A 13 (1976) 1283 [31] E.H. Wichmann and N.M. Kroll 343 Phys. Rev. 101 1956 Phys. Rev. 101 (1956) 343 [32] A.I. Milstein and V.M. Strakhovenko 1247 Zh. Eksp. Teor. Fiz. 84 1983 Zh. Eksp. Teor. Fiz. 84 (1983) 1247 [33] V.V. Flambaum and V.G. Zelevinsky 3108 Phys. Rev. Lett. 83 1999 Phys. Rev. Lett. 83 (1999) 3108 [34] C.E. Moore, Natl. Stand. Ref. Data Ser. (U.S., Natl. Bur. Stand.), 3 (1971) [35] R.J. Rafac, C.E. Tanner, A.E. Livingston, and H.G. Berry 3648 Phys. Rev., A 60 1999 Phys. Rev. A 60 (1999) 3648 [36] M.-A. Bouchiat, J. Gu´ena, and L. Pottier, J. Phys.(France) Lett. : 45 (1984) L523 [37] E. Arimondo, M. Inguscio, and P. Violino 31 Rev. Mod. Phys. 49 1977 Rev. Mod. Phys. 49 (1977) 31 [38] S.L. Gilbert, R.N. Watts, and C.E. Wieman 581 Phys. Rev., A 27 1983 Phys. Rev. A 27 (1983) 581 [39] R.J. Rafac and C.E. Tanner 1027 Phys. Rev., A 56 1997 Phys. Rev. A 56 (1997) 1027 [40] M.-A. Bouchiat and J. Gu´ena, J. Phys.(France) : 49 (1988) 2037 [41] D. Cho et al 1007 Phys. Rev., A 55 1997 Phys. Rev. A 55 (1997) 1007 [42] A.A. Vasilyev, I.M. Savukov, M.S. Safronova, and H.G. Berry, e-print physics/0112071 hep-ph/0204135 eng Bertin, V Universite Blaise Pascal Neutrino Indirect Detection of Neutralino Dark Matter in the CMSSM 12 Apr 2002 16 p We study potential signals of neutralino dark matter indirect detection by neutrino telescopes in a wide range of CMSSM parameters. We also compare with direct detection potential signals taking into account in both cases present andfuture experiment sensitivities. Only models with neutralino annihilation into gauge bosons can satisfy cosmological constraints and current neutrino indirect detection sensitivities. For both direct and indirect detection, only nextgeneration experiments will be able to really test this kind of models. LANL EDS SzGeCERN Particle Physics - Phenomenology Nezri, E Orloff, J Jean Orloff <orloff@in2p3.fr> http://cdsware.cern.ch/download/invenio-demo-site-files/0204135.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204135.ps.gz 2002 11 2002-04-15 00 2002-04-15 BATCH n 200216 PREPRINT hep-ph/0204136 eng FISIST-14-2001-CFIF IPPP-01-58 DCPT-01-114 Branco, G C FCIF Supersymmetry and a rationale for small CP violating phases 12 Apr 2002 28 p We analyse the CP problem in the context of a supersymmetric extension of the standard model with universal strength of Yukawa couplings. A salient feature of these models is that the CP phases are constrained to be very small by thehierarchy of the quark masses, and the pattern of CKM mixing angles. This leads to a small amount of CP violation from the usual KM mechanism and a significant contribution from supersymmetry is required. Due to the large generationmixing in some of the supersymmetric interactions, the electric dipole moments impose severe constraints on the parameter space, forcing the trilinear couplings to be factorizable in matrix form. We find that the LL mass insertionsgive the dominant gluino contribution to saturate epsilon_K. The chargino contributions to epsilon'/epsilon are significant and can accommodate the experimental results. In this framework, the standard model gives a negligiblecontribution to the CP asymmetry in B-meson decay, a_{J/\psi K_s}. However, due to supersymmetric contributions to B_d-\bar{B}_d mixing, the recent large value of a_{J/\psi K_s} can be accommodated. LANL EDS SzGeCERN Particle Physics - Phenomenology Gomez, M E Khalil, S Teixeira, A M Shaaban Khalil <shaaban.khalil@durham.ac.uk> http://cdsware.cern.ch/download/invenio-demo-site-files/0204136.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204136.ps.gz CER n 200231 2002 11 2002-04-15 00 2002-04-15 BATCH PREPRINT [1] A.G. Cohen, D.B. Kaplan and A.E. Nelson 27 Annu. Rev. Nucl. Part. Sci. 43 1993 Annu. Rev. Nucl. Part. Sci. 43 (1993) 27 M.B. Gavela, P. Hernandez, J. Orloff, O. P ene and C. Quimbay 345 Nucl. Phys., B 430 1994 Nucl. Phys. B 430 (1994) 345 382 Nucl. Phys., B 430 1994 Nucl. Phys. B 430 (1994) 382 A.D. Dolgov hep-ph/9707419 V.A. Rubakov and M.E. Shaposhnikov, Usp. Fiz. Nauk : 166 (1996) 493[ 461 Phys. Usp. 39 1996 Phys. Usp. 39 (1996) 461 ] [2] S. Abel, S. Khalil and O. Lebedev 151 Nucl. Phys., B 606 2001 Nucl. Phys. B 606 (2001) 151 [3] S. Pokorski, J. Rosiek and C. A. Savoy 81 Nucl. Phys., B 570 2000 Nucl. Phys. B 570 (2000) 81 [4] Recent Developments in Gauge Theories, Proceedings of Nato Advanced Study Insti-tute (Carg ese, 1979), edited by G. 't Hooft et al., Plenum, New York (1980) [5] G. C. Branco, J. I. Silva-Marcos and M. N. Rebelo 446 Phys. Lett., B 237 1990 Phys. Lett. B 237 (1990) 446 G. C. Branco, D. Emmanuel­Costa and J. I. Silva-Marcos 107 Phys. Rev., D 56 1997 Phys. Rev. D 56 (1997) 107 [6] P. M. Fishbane and P. Q. Hung 2743 Phys. Rev., D 57 1998 Phys. Rev. D 57 (1998) 2743 [7] P. Q. Hung and M. Seco hep-ph/0111013 [8] G. C. Branco and J. I. Silva-Marcos 166 Phys. Lett., B 359 1995 Phys. Lett. B 359 (1995) 166 [9] M. V. Romalis, W. C. Griffith and E. N. Fortson 2505 Phys. Rev. Lett. 86 2001 Phys. Rev. Lett. 86 (2001) 2505 J. P. Jacobs et al 3782 Phys. Rev. Lett. 71 1993 Phys. Rev. Lett. 71 (1993) 3782 [10] BABAR Collaboration, B. Aubert et al 091801 Phys. Rev. Lett. 87 2001 Phys. Rev. Lett. 87 (2001) 091801 [11] BELLE Collaboration, K. Abe et al 091802 Phys. Rev. Lett. 87 2001 Phys. Rev. Lett. 87 (2001) 091802 [12] G. Eyal and Y. Nir 21 Nucl. Phys., B 528 1998 Nucl. Phys. B 528 (1998) 21 and references therein [13] G. C. Branco, F. Cagarrinho and F. Krüger 224 Phys. Lett., B 459 1999 Phys. Lett. B 459 (1999) 224 [14] H. Fritzsch and J. Plankl 584 Phys. Rev., D 49 1994 Phys. Rev. D 49 (1994) 584 H. Fritzsch and P. Minkowski 393 Nuovo Cimento 30 1975 Nuovo Cimento 30 (1975) 393 H. Fritzsch and D. Jackson 365 Phys. Lett., B 66 1977 Phys. Lett. B 66 (1977) 365 P. Kaus and S. Meshkov 1863 Phys. Rev., D 42 1990 Phys. Rev. D 42 (1990) 1863 [15] H. Fusaoka and Y. Koide 3986 Phys. Rev., D 57 1998 Phys. Rev. D 57 (1998) 3986 [16] See for example, V. Barger, M. S. Berger and P. Ohmann 1093 Phys. Rev., D 47 1993 Phys. Rev. D 47 (1993) 1093 4908 Phys. Rev., D 49 1994 Phys. Rev. D 49 (1994) 4908 [17] G. C. Branco and J. I. Silva-Marcos 390 Phys. Lett., B 331 1994 Phys. Lett. B 331 (1994) 390 [18] Particle Data Group 1 Eur. Phys. J., C 15 2000 Eur. Phys. J. C 15 (2000) 1 [19] C. Jarlskog 1039 Phys. Rev. Lett. 55 1985 Phys. Rev. Lett. 55 (1985) 1039 491 Z. Phys., C 29 1985 Z. Phys. C 29 (1985) 491 [20] M. Dugan, B. Grinstein and L. J. Hall 413 Nucl. Phys., B 255 1985 Nucl. Phys. B 255 (1985) 413 [21] D. A. Demir, A. Masiero and O. Vives 230 Phys. Lett., B 479 2000 Phys. Lett. B 479 (2000) 230 S. M. Barr and S. Khalil 035005 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 035005 [22] S. A. Abel and J. M. Fr ere 1632 Phys. Rev., D 55 1997 Phys. Rev. D 55 (1997) 1632 S. Khalil, T. Kobayashi and A. Masiero 075003 Phys. Rev., D 60 1999 Phys. Rev. D 60 (1999) 075003 S. Khalil and T. Kobayashi 341 Phys. Lett., B 460 1999 Phys. Lett. B 460 (1999) 341 [23] S. Khalil, T. Kobayashi and O. Vives 275 Nucl. Phys., B 580 2000 Nucl. Phys. B 580 (2000) 275 T. Kobayashi and O. Vives 323 Phys. Lett., B 406 2001 Phys. Lett. B 406 (2001) 323 [24] S. Abel, D. Bailin, S. Khalil and O. Lebedev 241 Phys. Lett., B 504 2001 Phys. Lett. B 504 (2001) 241 [25] A. Masiero, M. Piai, A. Romanino and L. Silvestrini 075005 Phys. Rev., D 64 2001 Phys. Rev. D 64 (2001) 075005 and references therein [26] P. G. Harris et al 904 Phys. Rev. Lett. 82 1999 Phys. Rev. Lett. 82 (1999) 904 [27] M. Ciuchini et al 008 J. High Energy Phys. 10 1998 J. High Energy Phys. 10 (1998) 008 [28] S. Khalil and O. Lebedev 387 Phys. Lett., B 515 2001 Phys. Lett. B 515 (2001) 387 [29] A. J. Buras hep-ph/0101336 [30] See, for example, G. C. Branco, L. Lavoura and J. P. Silva, CP Violation, Interna-tional Series of Monographs on Physics (103), Oxford University Press, Clarendon (1999) [31] F. Gabbiani, E. Gabrielli, A. Masiero and L. Silverstrini 321 Nucl. Phys., B 477 1996 Nucl. Phys. B 477 (1996) 321 [32] V. Fanti et al 335 Phys. Lett., B 465 1999 Phys. Lett. B 465 (1999) 335 [33] T. Gershon (NA48) hep-ex/0101034 [34] A. J. Buras, M. Jamin and M. E. Lautenbacher 209 Nucl. Phys., B 408 1993 Nucl. Phys. B 408 (1993) 209 [35] S. Bertolini, M. Fabbrichesi and E. Gabrielli 136 Phys. Lett., B 327 1994 Phys. Lett. B 327 (1994) 136 [36] G. Colangelo and G. Isidori 009 J. High Energy Phys. 09 1998 J. High Energy Phys. 09 (1998) 009 A. Buras, G. Colan-gelo, G. Isidori, A. Romanino and L. Silvestrini 3 Nucl. Phys., B 566 2000 Nucl. Phys. B 566 (2000) 3 [37] OPAL Collaboration, K. Ackerstaff et al 379 Eur. Phys. J., C 5 1998 Eur. Phys. J. C 5 (1998) 379 CDF Collaboration, T. Affolder et al 072005 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 072005 CDF Collaboration, C. A. Blocker, Proceedings of 3rd Workshop on Physics and Detectors for DAPHNE (DAPHNE 99), Frascati, Italy, 16-19 Nov 1999; ALEPH Collaboration, R. Barate et al 259 Phys. Lett., B 492 2000 Phys. Lett. B 492 (2000) 259 [38] S. Bertolini, F. Borzumati, A. Masiero and G. Ridolfi 591 Nucl. Phys., B 353 1991 Nucl. Phys. B 353 (1991) 591 [39] CLEO Collaboration, S. Ahmed et al, CLEO-CONF-99-10 hep-ex/9908022 [40] E. Gabrielli, S. Khalil and E. Torrente­Lujan 3 Nucl. Phys., B 594 2001 Nucl. Phys. B 594 (2001) 3 hep-ph/0204137 eng DO-TH-02-05 Paschos, E A Univ. Dortmund Leptogenesis with Majorana neutrinos Dortmund Dortmund Univ. Inst. Phys. 12 Apr 2002 6 p I review the origin of the lepton asymmetry which is converted to a baryon excess at the electroweak scale. This scenario becomes more attractive if we can relate it to other physical phenomena. For this reason I elaborate on theconditions of the early universe which lead to a sizable lepton asymmetry. Then I describe methods and models which relate the low energy parameters of neutrinos to the high energy (cosmological) CP-violation and to neutrinolessdouble beta-decay. LANL EDS SzGeCERN Particle Physics - Phenomenology Emmanuel A. Paschos <paschos@hal1.physik.uni-dortmund.de> http://cdsware.cern.ch/download/invenio-demo-site-files/0204137.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204137.ps.gz CER n 200231 11 2002 2002-04-15 00 2002-04-15 BATCH CONTRIBUTED TO 1ST WORKSHOP ON NEUTRINO - NUCLEUS INTERACTIONS IN THE FEW GEV REGION (NUINT01) TSUKUBA JAPAN 13-16 DEC 2001 6 PAGES 6 FIGURES PREPRINT 1. Fukugida and Yanagida 45 Phys. Lett., B 174 1986 Phys. Lett. B 174 (1986) 45 2. M. Flanz, E.A. Paschos and U. Sarkar 248 Phys. Lett., B 345 1995 Phys. Lett. B 345 (1995) 248 3. M. Luty 445 Phys. Rev., D 45 1992 Phys. Rev. D 45 (1992) 445 4. M. Flanz, E.A. Paschos, U. Sarkar and J. Weiss 693 Phys. Lett., B 389 1996 Phys. Lett. B 389 (1996) 693 M. Flanz and E.A. Paschos 113009 Phys. Rev., D 58 1998 Phys. Rev. D 58 (1998) 113009 5. A. Pilaftsis 5431 Phys. Rev., D 56 1997 Phys. Rev. D 56 (1997) 5431 6. W. Buchmüller and M. Plümacher 354 Phys. Lett., B 431 1998 Phys. Lett. B 431 (1998) 354 7. L. Covi, E. Roulet and F. Vissani 169 Phys. Lett., B 384 1996 Phys. Lett. B 384 (1996) 169 8. E.K. Akhmedov, V.A. Rubakov and A.Y. Smirnov 1359 Phys. Rev. Lett. 81 1998 Phys. Rev. Lett. 81 (1998) 1359 9. S.Y. Khlepnikov and M.E. Shaposhnikov 885 Nucl. Phys., B 308 1988 Nucl. Phys. B 308 (1988) 885 and references therein 10. J. Ellis, S. Lola and D.V. Nanopoulos 87 Phys. Lett., B 452 1999 Phys. Lett. B 452 (1999) 87 11. G. Lazarides and N. Vlachos 482 Phys. Lett., B 459 1999 Phys. Lett. B 459 (1999) 482 12. M.S. Berger and B. Brahmachari 073009 Phys. Rev., D 60 1999 Phys. Rev. D 60 (1999) 073009 13. K. Kang, S.K. Kang and U. Sarkar 391 Phys. Lett., B 486 2000 Phys. Lett. B 486 (2000) 391 14. H. Goldberg 389 Phys. Lett., B 474 2000 Phys. Lett. B 474 (2000) 389 15. M. Hirsch and S.F. King 113005 Phys. Rev., D 64 2001 Phys. Rev. D 64 (2001) 113005 16. H. Nielsen and Y. Takanishi 241 Phys. Lett., B 507 2001 Phys. Lett. B 507 (2001) 241 17. W. Buchmüller and D. Wyler 291 Phys. Lett., B 521 2001 Phys. Lett. B 521 (2001) 291 18. Falcone and Tramontano 1 Phys. Lett., B 506 2001 Phys. Lett. B 506 (2001) 1 F. Buccella et al 241 Phys. Lett., B 524 2002 Phys. Lett. B 524 (2002) 241 19. G.C. Branco et al., Nucl. Phys., B617 (2001) 475 20. A.S. Joshipura, E.A. Paschos and W. Rodejo-hann 227 Nucl. Phys., B 611 2001 Nucl. Phys. B 611 (2001) 227 and 29 J. High Energy Phys. 0108 2001 J. High Energy Phys. 0108 (2001) 29 21. mentioned by H.V. Klapdor­Kleingrothaus, in hep-ph/0103062 hep-ph/0204138 eng DO-TH-02-06 Paschos, E A Univ. Dortmund Neutrino Interactions at Low and Medium Energies Dortmund Dortmund Univ. Inst. Phys. 12 Apr 2002 9 p We discuss the calculations for several neutrino induced reactions from low energies to the GeV region. Special attention is paid to nuclear corrections when the targets are medium or heavy nuclei. Finally, we present several ratiosof neutral to charged current reactions whose values on isoscalar targets can be estimated accurately. The ratios are useful for investigating neutrino oscillations in Long Baseline experiments. LANL EDS SzGeCERN Particle Physics - Phenomenology Emmanuel A. Paschos <paschos@hal1.physik.uni-dortmund.de> http://cdsware.cern.ch/download/invenio-demo-site-files/0204138.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204138.ps.gz CER n 200231 11 2002 2002-04-15 00 2002-04-15 BATCH CONTRIBUTED TO 1ST WORKSHOP ON NEUTRINO - NUCLEUS INTERACTIONS IN THE FEW GEV REGION (NUINT01) TSUKUBA JAPAN 13-16 DEC 2001 9 PAGES 15 FIGURES PREPRINT 1. E. A. Paschos, L. Pasquali and J. Y. Yu 263 Nucl. Phys., B 588 2000 Nucl. Phys. B 588 (2000) 263 2. E. A. Paschos and J. Y. Yu 033002 Phys. Rev., D 65 2002 Phys. Rev. D 65 (2002) 033002 3. C. Albright and C. Jarlskog 467 Nucl. Phys., B 84 1975 Nucl. Phys. B 84 (1975) 467 4. N. J. Baker et al 617 Phys. Rev., D 25 1982 Phys. Rev. D 25 (1982) 617 5. M. Hirai, S. Kumano and M. Miyama 034003 Phys. Rev., D 64 2001 Phys. Rev. D 64 (2001) 034003 6. K. J. Eskola, V. J. Kolhinen and P. V. Ru-uskanen 351 Nucl. Phys., B 535 1998 Nucl. Phys. B 535 (1998) 351 K. J. Eskola, V. J. Kolhinen, P. V. Ruuskanen and C. A. Salgado 645 Nucl. Phys., A 661 1999 Nucl. Phys. A 661 (1999) 645 7. See Figure 1 in Ref. [2] 8. P. A. Schreiner and F. V. von Hippel 333 Nucl. Phys., B 58 1973 Nucl. Phys. B 58 (1973) 333 9. S. L. Adler, S. Nussinov. and E. A. Paschos 2125 Phys. Rev., D 9 1974 Phys. Rev. D 9 (1974) 2125 10. S. L. Adler 2644 Phys. Rev., D 12 1975 Phys. Rev. D 12 (1975) 2644 11. P. Musset and J. P. Vialle 1 Phys. Rep. 39 1978 Phys. Rep. 39 (1978) 1 12. H. Kluttig, J. G. Morfin and W. Van Do-minick 446 Phys. Lett., B 71 1977 Phys. Lett. B 71 (1977) 446 13. R. Merenyi et al 743 Phys. Rev., D 45 1982 Phys. Rev. D 45 (1982) 743 14. S. K. Singh, M. T. Vicente-Vacas and E. Oset 23 Phys. Lett., B 416 1998 Phys. Lett. B 416 (1998) 23 15. E. A. Paschos and L. Wolfenstein 91 Phys. Rev., D 7 1973 Phys. Rev. D 7 (1973) 91 see equation (15) 16. E. A. Paschos, Precise Ratios for Neutrino-Nucleon and Neutrino-Nucleus Interactions, Dortmund preprint­DO­TH 02/02; hep-ph 0204090 17. G. Gounaris, E. A. Paschos and P. Porfyri-adis 63 Phys. Lett., B 525 2002 Phys. Lett. B 525 (2002) 63 18. J. Bouchez and I. Giomataris, CEA/Saclay internal note, DAPNIA/01-07, June 2001 hep-ph/0204139 eng Van Beveren, E University of Coimbra Remarks on the f_0(400-1200) scalar meson as the dynamically generated chiral partner of the pion 12 Apr 2002 15 p The quark-level linear sigma model is revisited, in particular concerning the identification of the f_0(400-1200) (or \sigma(600)) scalar meson as the chiral partner of the pion. We demonstrate the predictive power of the linearsigma model through the pi-pi and pi-N s-wave scattering lengths, as well as several electromagnetic, weak, and strong decays of pseudoscalar and vector mesons. The ease with which the data for these observables are reproduced in thelinear sigma model lends credit to the necessity to include the sigma as a fundamental q\bar{q} degree of freedom, to be contrasted with approaches like chiral perturbation theory or the confining NJL model of Shakin and Wang. LANL EDS SzGeCERN Particle Physics - Phenomenology Kleefeld, F Rupp, G Scadron, M D George Rupp <george@ajax.ist.utl.pt> http://cdsware.cern.ch/download/invenio-demo-site-files/0204139.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204139.ps.gz CER n 200231 2002 11 Beveren, Eef van Kleefeld, Frieder Rupp, George Scadron, Michael D. 2002-04-15 00 2002-04-15 BATCH PREPRINT [1] D. E. Groom et al. [Particle Data Group Collaboration] 1 Eur. Phys. J., C 15 2000 Eur. Phys. J. C 15 (2000) 1 [2] N. Isgur and J. Speth 2332 Phys. Rev. Lett. 77 1996 Phys. Rev. Lett. 77 (1996) 2332 [3] N. A. Törnqvist and M. Roos 1575 Phys. Rev. Lett. 76 1996 Phys. Rev. Lett. 76 (1996) 1575 hep-ph/9511210 [4] M. Harada, F. Sannino, and J. Schechter 1603 Phys. Rev. Lett. 78 1997 Phys. Rev. Lett. 78 (1997) 1603 hep-ph/9609428 [5] E. van Beveren, T. A. Rijken, K. Metzger, C. Dullemond, G. Rupp, and J. E. Ribeiro 615 Z. Phys., C 30 1986 Z. Phys. C 30 (1986) 615 Eef van Beveren and George Rupp 469 Eur. Phys. J., C 10 1999 Eur. Phys. J. C 10 (1999) 469 hep-ph/9806246 [6] M. Boglione and M. R. Pennington hep-ph/0203149 [7] M. Gell-Mann and M. L´evy 705 Nuovo Cimento 16 1960 Nuovo Cimento 16 (1960) 705 also see V. de Alfaro, S. Fubini, G. Furlan, and C. Rossetti, in Currents in Hadron Physics, North-Holland Publ., Amsterdam, Chap. 5 (1973) [8] R. Delbourgo and M. D. Scadron 251 Mod. Phys. Lett., A 10 1995 Mod. Phys. Lett. A 10 (1995) 251 hep-ph/9910242 657 Int. J. Mod. Phys., A 13 1998 Int. J. Mod. Phys. A 13 (1998) 657 hep-ph/9807504 [9] Y. Nambu and G. Jona-Lasinio 345 Phys. Rev. 122 1961 Phys. Rev. 122 (1961) 345 [10] C. M. Shakin and Huangsheng Wang 094020 Phys. Rev., D 64 2001 Phys. Rev. D 64 (2001) 094020 [11] C. M. Shakin and Huangsheng Wang 014019 Phys. Rev., D 63 2000 Phys. Rev. D 63 (2000) 014019 [12] G. Rupp, E. van Beveren, and M. D. Scadron 078501 Phys. Rev., D 65 2002 Phys. Rev. D 65 (2002) 078501 hep-ph/0104087 [13] Eef van Beveren, George Rupp, and Michael D. Scadron 300 Phys. Lett., B 495 2000 Phys. Lett. B 495 (2000) 300 [Erratum 365 Phys. Lett., B 509 2000 Phys. Lett. B 509 (2000) 365 ] hep-ph/0009265 Frieder Kleefeld, Eef van Beveren, George Rupp, and Michael D. Scadron hep-ph/0109158 [14] M. D. Scadron 239 Phys. Rev., D 26 1982 Phys. Rev. D 26 (1982) 239 2076 Phys. Rev., D 29 1984 Phys. Rev. D 29 (1984) 2076 669 Mod. Phys. Lett., A 7 1992 Mod. Phys. Lett. A 7 (1992) 669 [15] M. L´evy 23 Nuovo Cimento, A 52 1967 Nuovo Cimento, A 52 (1967) 23 S. Gasiorowicz and D. A. Geffen 531 Rev. Mod. Phys. 41 1969 Rev. Mod. Phys. 41 (1969) 531 J. Schechter and Y. Ueda 2874 Phys. Rev., D 3 1971 Phys. Rev. D 3 (1971) 2874 [Erratum 987 Phys. Rev., D 8 1973 Phys. Rev. D 8 (1973) 987 ] [16] T. Eguchi 2755 Phys. Rev., D 14 1976 Phys. Rev. D 14 (1976) 2755 T. Eguchi 611 Phys. Rev., D 17 1978 Phys. Rev. D 17 (1978) 611 [17] The once-subtracted dispersion-relation result hep-ph/0204140 eng CERN-TH-2002-069 RM3-TH-02-4 Aglietti, U CERN A new model-independent way of extracting |V_ub/V_cb| Geneva CERN 12 Apr 2002 20 p The ratio between the photon spectrum in B -> X_s gamma and the differential semileptonic rate wrt the hadronic variable M_X/E_X is a short-distance quantity calculable in perturbation theory and independent of the Fermi motion ofthe b quark in the B meson. We present a NLO analysis of this ratio and show how it can be used to determine |V_ub/V_cb| independently of any model for the shape function. We also discuss how this relation can be used to test thevalidity of the shape-function theory on the data. LANL EDS SzGeCERN Particle Physics - Phenomenology Ciuchini, M Gambino, P Paolo Gambino <paolo.gambino@cern.ch> http://cdsware.cern.ch/download/invenio-demo-site-files/0204140.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204140.ps.gz CER n 200231 2002 11 TH CERN 2002-04-15 00 2002-04-15 BATCH Aglietti, Ugo Ciuchini, Marco Gambino, Paolo PREPRINT [1] I. I. Bigi, M. A. Shifman, N. G. Uraltsev and A. I. Vainshtein 496 Phys. Rev. Lett. 71 1993 Phys. Rev. Lett. 71 (1993) 496 [arXiv hep-ph/9304225 and 2467 Int. J. Mod. Phys., A 9 1994 Int. J. Mod. Phys. A 9 (1994) 2467 [arXiv hep-ph/9312359 [2] M. Neubert 4623 Phys. Rev., D 49 1994 Phys. Rev. D 49 (1994) 4623 [arXiv hep-ph/9312311 [3] R. Akhoury and I. Z. Rothstein 2349 Phys. Rev., D 54 1996 Phys. Rev. D 54 (1996) 2349 [arXiv hep-ph/9512303 A. K. Leibovich and I. Z. Rothstein 074006 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 074006 [arXiv hep-ph/9907391 A. K. Leibovich, I. Low and I. Z. Rothstein 053006 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 053006 [arXiv hep-ph/9909404 A. K. Leibovich, I. Low and I. Z. Rothstein 86 Phys. Lett., B 486 2000 Phys. Lett. B 486 (2000) 86 [arXiv hep-ph/0005124 M. Neubert 88 Phys. Lett., B 513 2001 Phys. Lett. B 513 (2001) 88 [arXiv hep-ph/0104280 A. K. Leibovich, I. Low and I. Z. Rothstein 83 Phys. Lett., B 513 2001 Phys. Lett. B 513 (2001) 83 [arXiv hep-ph/0105066 [4] V. D. Barger, C. S. Kim and R. J. Phillips 629 Phys. Lett., B 251 1990 Phys. Lett. B 251 (1990) 629 A. F. Falk, Z. Ligeti and M. B. Wise 225 Phys. Lett., B 406 1997 Phys. Lett. B 406 (1997) 225 [arXiv hep-ph/9705235 I. I. Bigi, R. D. Dikeman and N. Uraltsev 453 Eur. Phys. J., C 4 1998 Eur. Phys. J. C 4 (1998) 453 [arXiv hep-ph/9706520 [5] R. Barate et al. (ALEPH Coll.) 555 Eur. Phys. J., C 6 1999 Eur. Phys. J. C 6 (1999) 555 M. Acciarri et al. (L3 Coll.), Phys. Lett., B436 (1998); P. Abreu et al. (DELPHI Coll.) 14 Phys. Lett., B 478 2000 Phys. Lett. B 478 (2000) 14 G. Abbiendi et al. (OPAL Coll.) 399 Eur. Phys. J., C 21 2001 Eur. Phys. J. C 21 (2001) 399 [6] A. Bornheim [CLEO Coll.], arXiv hep-ex/0202019 [7] C. W. Bauer, Z. Ligeti and M. E. Luke 395 Phys. Lett., B 479 2000 Phys. Lett. B 479 (2000) 395 [arXiv hep-ph/0002161 [8] C. W. Bauer, Z. Ligeti and M. E. Luke 113004 Phys. Rev., D 64 2001 Phys. Rev. D 64 (2001) 113004 [arXiv hep-ph/0107074 [9] U. Aglietti, arXiv hep-ph/0010251 [10] U. Aglietti 308 Phys. Lett., B 515 2001 Phys. Lett. B 515 (2001) 308 [arXiv hep-ph/0103002 [11] U. Aglietti 293 Nucl. Phys., B 610 2001 Nucl. Phys. B 610 (2001) 293 [arXiv hep-ph/0104020 [12] A. Ali and E. Pietarinen 519 Nucl. Phys., B 154 1979 Nucl. Phys. B 154 (1979) 519 [13] G. Altarelli, N. Cabibbo, G. Corb o, L. Maiani and G. Martinelli 365 Nucl. Phys., B 208 1982 Nucl. Phys. B 208 (1982) 365 [14] R. L. Jaffe and L. Randall 79 Nucl. Phys., B 412 1994 Nucl. Phys. B 412 (1994) 79 [arXiv hep-ph/9306201 [15] M. Neubert 3392 Phys. Rev., D 49 1994 Phys. Rev. D 49 (1994) 3392 [arXiv hep-ph/9311325 [16] U. Aglietti, M. Ciuchini, G. Corb o, E. Franco, G. Martinelli and L. Silvestrini 411 Phys. Lett., B 432 1998 Phys. Lett. B 432 (1998) 411 [arXiv hep-ph/9804416 [17] S. Catani, L. Trentadue, G. Turnock and B. R. Webber 3 Nucl. Phys., B 407 1993 Nucl. Phys. B 407 (1993) 3 [18] V. Lubicz 116 Nucl. Phys. B, Proc. Suppl. 94 2001 Nucl. Phys. B, Proc. Suppl. 94 (2001) 116 [arXiv hep-lat/0012003 [19] A. J. Buras, M. Jamin, M. E. Lautenbacher and P. H. Weisz 37 Nucl. Phys., B 400 1993 Nucl. Phys. B 400 (1993) 37 [arXiv hep-ph/9211304 M. Ciuchini, E. Franco, G. Martinelli and L. Reina 403 Nucl. Phys., B 415 1994 Nucl. Phys. B 415 (1994) 403 [arXiv hep-ph/9304257 [20] K. Chetyrkin, M. Misiak and M. Munz 206 Phys. Lett., B 400 1997 Phys. Lett. B 400 (1997) 206 [Erratum 414 Phys. Lett., B 425 1997 Phys. Lett. B 425 (1997) 414 ] [arXiv hep-ph/9612313 and refs. therein [21] P. Gambino and M. Misiak 338 Nucl. Phys., B 611 2001 Nucl. Phys. B 611 (2001) 338 [arXiv hep-ph/0104034 [22] M.B. Voloshin 275 Phys. Lett., B 397 1997 Phys. Lett. B 397 (1997) 275 A. Khodjamirian et al 167 Phys. Lett., B 402 1997 Phys. Lett. B 402 (1997) 167 Z. Ligeti, L. Randall and M.B. Wise 178 Phys. Lett., B 402 1997 Phys. Lett. B 402 (1997) 178 A.K. Grant, A.G. Morgan, S. Nussinov and R.D. Peccei 3151 Phys. Rev., D 56 1997 Phys. Rev. D 56 (1997) 3151 G. Buchalla, G. Isidori and S.J. Rey 594 Nucl. Phys., B 511 1998 Nucl. Phys. B 511 (1998) 594 [23] P. Gambino and U. Haisch 020 J. High Energy Phys. 0110 2001 J. High Energy Phys. 0110 (2001) 020 [arXiv hep-ph/0109058 and 001 J. High Energy Phys. 0009 2000 J. High Energy Phys. 0009 (2000) 001 [arXiv hep-ph/0007259 [24] F. De Fazio and M. Neubert 017 J. High Energy Phys. 9906 1999 J. High Energy Phys. 9906 (1999) 017 [arXiv hep-ph/9905351 [25] U. Aglietti, arXiv hep-ph/0105168 to appear in the Proceedings of "XIII Convegno sulla Fisica al LEP (LEPTRE 2001)", Rome (Italy), 18-20 April 2001 [26] T. van Ritbergen 353 Phys. Lett., B 454 1999 Phys. Lett. B 454 (1999) 353 [27] C. W. Bauer, M. E. Luke and T. Mannel, arXiv hep-ph/0102089 [28] The Particle Data Group 1 Eur. Phys. J., C 15 2000 Eur. Phys. J. C 15 (2000) 1 [29] M. Ciuchini et al 013 J. High Energy Phys. 0107 2001 J. High Energy Phys. 0107 (2001) 013 [arXiv hep-ph/0012308 [30] S. Chen et al., CLEO Coll 251807 Phys. Rev. Lett. 87 2001 Phys. Rev. Lett. 87 (2001) 251807 [31] N. Pott 938 Phys. Rev. D 54 1996 Phys. Rev., D 54 (1996) 938 [arXiv hep-ph/9512252 [32] C. Greub, T. Hurth and D. Wyler 3350 Phys. Rev. D 54 1996 Phys. Rev., D 54 (1996) 3350 [arXiv hep-ph/9603404 A. J. Buras, A. Czarnecki, M. Misiak and J. Urban 488 Nucl. Phys. B 611 2001 Nucl. Phys., B 611 (2001) 488 [arXiv hep-ph/0105160 [33] A. J. Buras, A. Czarnecki, M. Misiak and J. Urban, arXiv hep-ph/0203135 hep-ph/0204141 eng Appelquist, T Yale University Neutrino Masses in Theories with Dynamical Electroweak Symmetry Breaking 12 Apr 2002 4 p We address the problem of accounting for light neutrino masses in theories with dynamical electroweak symmetry breaking. As a possible solution, we embed (extended) technicolor in a theory in which a $|\Delta L|=2$ neutrinocondensate forms at a scale $\Lambda_N \gsim 10^{11}$ GeV, and produces acceptably small (Majorana) neutrino masses. We present an explicit model illustrating this mechanism. LANL EDS SzGeCERN Particle Physics - Phenomenology Shrock, R Robert Shrock <shrock@insti.physics.sunysb.edu> http://cdsware.cern.ch/download/invenio-demo-site-files/0204141.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204141.ps.gz CER n 200231 2002 11 Appelquist, Thomas Shrock, Robert 2002-04-15 00 2002-04-15 BATCH PREPRINT [1] S. Fukuda, et al 5651 Phys. Rev. Lett. 86 2001 Phys. Rev. Lett. 86 (2001) 5651 S. Fukuda et al. ibid, 5656 (2001) (SuperK) and Q.R. Ahmad et al 071301 Phys. Rev. Lett. 87 2001 Phys. Rev. Lett. 87 (2001) 071301 (SNO). Other data is from the Homestake, Kamiokande, GALLEX, and SAGE experiments [2] Y. Fukuda et al 9 Phys. Lett., B 433 1998 Phys. Lett. B 433 (1998) 9 1562 Phys. Rev. Lett. 81 1998 Phys. Rev. Lett. 81 (1998) 1562 2644 Phys. Rev. Lett. 82 1999 Phys. Rev. Lett. 82 (1999) 2644 185 Phys. Lett., B 467 1999 Phys. Lett. B 467 (1999) 185 (SuperK) and data from Kamiokande, IMB, Soudan-2, and MACRO experiments. The data, which is consistent with results from K2K, indicates that |m( 3)2 - m( 2)2| |m( 3)2 - m( 1)2| 2.5 × 10-3 eV2. With a hierarchical mass assumption, one infers m( 3) m232 0.05 eV [3] S. Weinberg 1277 Phys. Rev., D 19 1979 Phys. Rev. D 19 (1979) 1277 L. Susskind 2619 Phys. Rev., D 20 1979 Phys. Rev. D 20 (1979) 2619 E. Eichten and K. Lane 125 Phys. Lett., B 90 1980 Phys. Lett. B 90 (1980) 125 [4] P. Sikivie, L. Susskind, M. Voloshin, and V. Zakharov 189 Nucl. Phys., B 173 1980 Nucl. Phys. B 173 (1980) 189 [5] B. Holdom 301 Phys. Lett., B 150 1985 Phys. Lett. B 150 (1985) 301 K Yamawaki, M. Bando, and K. Matumoto 1335 Phys. Rev. Lett. 56 1986 Phys. Rev. Lett. 56 (1986) 1335 T. Appelquist, D. Karabali, and L. Wijeward-hana 957 Phys. Rev. Lett. 57 1986 Phys. Rev. Lett. 57 (1986) 957 T. Appelquist and L.C.R. Wijewardhana 774 Phys. Rev., D 35 1987 Phys. Rev. D 35 (1987) 774 568 Phys. Rev., D 36 1987 Phys. Rev. D 36 (1987) 568 [6] B. Holdom 1637 Phys. Rev., D 23 1981 Phys. Rev. D 23 (1981) 1637 169 Phys. Lett., B 246 1990 Phys. Lett. B 246 (1990) 169 [7] T. Appelquist and J. Terning 139 Phys. Lett., B 315 1993 Phys. Lett. B 315 (1993) 139 T. Appelquist, J. Terning, and L. Wijewardhana 1214 Phys. Rev. Lett. 77 1996 Phys. Rev. Lett. 77 (1996) 1214 2767 Phys. Rev. Lett. 79 1997 Phys. Rev. Lett. 79 (1997) 2767 T. Appelquist, N. Evans, S. Selipsky 145 Phys. Lett., B 374 1996 Phys. Lett. B 374 (1996) 145 T. Appelquist and S. Selipsky 364 Phys. Lett., B 400 1997 Phys. Lett. B 400 (1997) 364 [8] T. Appelquist, J. Terning 2116 Phys. Rev., D 50 1994 Phys. Rev. D 50 (1994) 2116 [9] Recent reviews include R. Chivukula hep-ph/0011264 K. Lane hep-ph/0202255 C. Hill E. Simmons hep-ph/0203079 [10] M. Gell-Mann, P. Ramond, R. Slansky, in Supergrav-ity (North Holland, Amsterdam, 1979), p. 315; T. Yanagida in proceedings of Workshop on Unified Theory and Baryon Number in the Universe, KEK, 1979 [11] Although we require our model to yield a small S, a re-analysis of precision electroweak data is called for in view of the value of sin2 W reported in G. Zeller et al 091802 Phys. Rev. Lett. 88 2002 Phys. Rev. Lett. 88 (2002) 091802 [12] For a vectorial SU(N) theory with Nf fermions in the fundamental representation, an IRFP occurs if Nf > Nf,min,IR, where, perturbatively, Nf,min,IR 34N3/(13N2 -3). At this IRFP, using the criticality con-dition [13], the theory is expected to exist in a confining phase with S SB if Nf,min,IR < Nf < Nf,con, where Nf,con (2/5)N(50N2 - 33)/(5N2 - 3) and in a confor-mal phase if Nf,con < Nf < 11N/2. For N = 2 we have Nf,min,IR 5 and Nf,con 8, respectively. For attempts at lattice measurements, see R. Mawhinney 57 Nucl. Phys. B, Proc. Suppl. 83 2000 Nucl. Phys. B, Proc. Suppl. 83 (2000) 57 [13] In the approximation of a single-gauge-boson exchange, the critical coupling for the condensation of fermion rep-resentations R1 × R2 Rc is 3 2 C2 = 1, where C2 = [C2(R1) + C2(R2) - C2(Rc)], and C2(R) is the quadratic Casimir invariant. Instanton contributions are also important [7] [14] J. Gasser, H. Leutwyler 77 Phys. Rep. 87 1982 Phys. Rep. 87 (1982) 77 H. Leutwyler, in 108 Nucl. Phys. B, Proc. Suppl. 94 2001 Nucl. Phys. B, Proc. Suppl. 94 (2001) 108 [15] A. Ali Khan et al 4674 Phys. Rev. Lett. 85 2000 Phys. Rev. Lett. 85 (2000) 4674 M. Wingate et al., Int. J. Mod. Phys., A16 S B1 (2001) 585 [16] Here a = exp[ETC,a fF (dµ/µ) ( (µ))], and in walking TC theories the anomalous dimension 1 so a ETC,a/fF [17] By convention, we write SM-singlet neutrinos as right-handed fields j,R. These are assigned lepton number 1. Thus, in writing SU(4)PS SU(3)c × U(1), the U(1) is not U(1)B-L since some neutrinos in the model are SU(4)PS-singlet states [18] Z. Maki, M. Nakagawa, S. Sakata 870 Prog. Theor. Phys. 28 1962 Prog. Theor. Phys. 28 (1962) 870 (2 × 2 matrix); B. W. Lee, S. Pakvasa, R. Shrock, and H. Sugawara 937 Phys. Rev. Lett. 38 1977 Phys. Rev. Lett. 38 (1977) 937 (3 × 3 matrix) [19] T. Appelquist and R. Shrock, to appear [20] K. Dienes, E. Dudas, T. Gherghetta 25 Nucl. Phys., B 557 1999 Nucl. Phys. B 557 (1999) 25 N. Arkani-Hamed, S. Dimopoulos, G. Dvali, and J. March-Russell hep-ph/9811448 T. Appelquist, B. Dobrescu, E. Ponton, and H.-U. Yee hep-ph/0201131 hep-th/0204100 eng LBNL-50097 UCB-PTH-02-14 Gaillard, M K University of California, Berkeley Modular Invariant Anomalous U(1) Breaking Berkeley, CA Lawrence Berkeley Nat. Lab. 11 Apr 2002 19 p We describe the effective supergravity theory present below the scale of spontaneous gauge symmetry breaking due to an anomalous U(1), obtained by integrating out tree-level interactions of massive modes. A simple case is examined insome detail. We find that the effective theory can be expressed in the linear multiplet formulation, with some interesting consequences. Among them, the modified linearity conditions lead to new interactions not present in the theorywithout an anomalous U(1). These additional interactions are compactly expressed through a superfield functional. LANL EDS SzGeCERN Particle Physics - Theory Giedt, J Mary K Gaillard <gaillard@thsrv.lbl.gov> http://cdsware.cern.ch/download/invenio-demo-site-files/0204100.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204100.ps.gz CER n 200231 2002 11 Gaillard, Mary K. Giedt, Joel 2002-04-15 00 2002-04-15 BATCH PREPRINT [1] J. Giedt 1 Ann. Phys. (N.Y.) 297 2002 Ann. Phys. (N.Y.) 297 (2002) 1 hep-th/0108244 [2] M. Dine, N. Seiberg and E. Witten 585 Nucl. Phys., B 289 1987 Nucl. Phys. B 289 (1987) 585 J. J. Atick, L. Dixon and A. Sen 109 Nucl. Phys., B 292 1987 Nucl. Phys. B 292 (1987) 109 M. Dine, I. Ichinose and N. Seiberg 253 Nucl. Phys., B 293 1987 Nucl. Phys. B 293 (1987) 253 [3] M. B. Green and J. H. Schwarz 117 Phys. Lett., B 149 1984 Phys. Lett. B 149 (1984) 117 [4] P. Bin´etruy, G. Girardi and R. Grimm 111 Phys. Lett., B 265 1991 Phys. Lett. B 265 (1991) 111 [5] M. Müller 292 Nucl. Phys., B 264 1986 Nucl. Phys. B 264 (1986) 292 P. Bin´etruy, G. Girardi, R. Grimm and M. Müller 389 Phys. Lett., B 189 1987 Phys. Lett. B 189 (1987) 389 [6] P. Bin´etruy, G. Girardi and R. Grimm 255 Phys. Rep. 343 2001 Phys. Rep. 343 (2001) 255 [7] G. Girardi and R. Grimm 49 Ann. Phys. (N.Y.) 272 1999 Ann. Phys. (N.Y.) 272 (1999) 49 [8] P. Bin´etruy, M. K. Gaillard and Y.-Y. Wu 109 Nucl. Phys., B 481 1996 Nucl. Phys. B 481 (1996) 109 [9] P. Bin´etruy, M. K. Gaillard and Y.-Y. Wu 27 Nucl. Phys., B 493 1997 Nucl. Phys. B 493 (1997) 27 P. Bin´etruy, M. K. Gaillard and Y.-Y. Wu 288 Phys. Lett., B 412 1997 Phys. Lett. B 412 (1997) 288 [10] M. K. Gaillard, B. Nelson and Y.-Y. Wu 549 Phys. Lett., B 459 1999 Phys. Lett. B 459 (1999) 549 [11] M. K. Gaillard and B. Nelson 3 Nucl. Phys., B 571 2000 Nucl. Phys. B 571 (2000) 3 [12] S. Ferrara, C. Kounnas and M. Porrati 263 Phys. Lett., B 181 1986 Phys. Lett. B 181 (1986) 263 [13] M. Cveti c, J. Louis and B. A. Ovrut 227 Phys. Lett., B 206 1988 Phys. Lett. B 206 (1988) 227 L. E. Iba nez and D. Lüst 305 Nucl. Phys., B 382 1992 Nucl. Phys. B 382 (1992) 305 [14] M. K. Gaillard 125 Phys. Lett., B 342 1995 Phys. Lett. B 342 (1995) 125 105027 Phys. Rev., D 58 1998 Phys. Rev. D 58 (1998) 105027 D : 61 (2000) 084028 [15] E. Witten 151 Phys. Lett., B 155 1985 Phys. Lett. B 155 (1985) 151 [16] L. J. Dixon, V. S. Kaplunovsky and J. Louis 27 Nucl. Phys., B 329 1990 Nucl. Phys. B 329 (1990) 27 [17] S.J. Gates, M. Grisaru, M. Ro cek and W. Siegel, Superspace (Benjamin/Cummings, 1983) [18] M.K. Gaillard and T.R. Taylor 577 Nucl. Phys., B 381 1992 Nucl. Phys. B 381 (1992) 577 [19] J. Wess and J. Bagger, Supersymmetry and supergravity (Princeton, 1992) [20] P. Bin´etruy, C. Deffayet and P. Peter 163 Phys. Lett., B 441 1998 Phys. Lett. B 441 (1998) 163 [21] M. K. Gaillard and J. Giedt, in progress hep-ph/0204142 eng Chacko, Z University of California, Berkeley Fine Structure Constant Variation from a Late Phase Transition Berkeley, CA Lawrence Berkeley Nat. Lab. 12 Apr 2002 9 p Recent experimental data indicates that the fine structure constant alpha may be varying on cosmological time scales. We consider the possibility that such a variation could be induced by a second order phase transition which occursat late times (z ~ 1 - 3) and involves a change in the vacuum expectation value (vev) of a scalar with milli-eV mass. Such light scalars are natural in supersymmetric theories with low SUSY breaking scale. If the vev of this scalarcontributes to masses of electrically charged fields, the low-energy value of alpha changes during the phase transition. The observational predictions of this scenario include isotope-dependent deviations from Newtonian gravity atsub-millimeter distances, and (if the phase transition is a sharp event on cosmological time scales) the presence of a well-defined step-like feature in the alpha(z) plot. The relation between the fractional changes in alpha and theQCD confinement scale is highly model dependent, and even in grand unified theories the change in alpha does not need to be accompanied by a large shift in nucleon masses. LANL EDS SzGeCERN Particle Physics - Phenomenology Grojean, C Perelstein, M Maxim Perelstein <meperelstein@lbl.gov> http://cdsware.cern.ch/download/invenio-demo-site-files/0204142.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204142.ps.gz CER n 200231 2002 11 2002-04-15 00 2002-04-15 BATCH PREPRINT [1] J. K. Webb, M. T. Murphy, V. V. Flambaum, V. A. Dzuba, J. D. Barrow, C. W. Churchill, J. X. Prochaska and A. M. Wolfe 091301 Phys. Rev. Lett. 87 2001 Phys. Rev. Lett. 87 (2001) 091301 astro-ph/0012539 see also J. K. Webb, V. V. Flambaum, C. W. Churchill, M. J. Drinkwater and J. D. Barrow 884 Phys. Rev. Lett. 82 1999 Phys. Rev. Lett. 82 (1999) 884 astro-ph/9803165 V. A. Dzuba, V. V. Flambaum, and J. K. Webb 888 Phys. Rev. Lett. 82 1999 Phys. Rev. Lett. 82 (1999) 888 [2] P. A. Dirac 323 Nature 139 1937 Nature 139 (1937) 323 for an historial perspective, see F. Dyson, "The fundamental constants and their time variation", in Aspects of Quantum Theory, eds A. Salam and E. Wigner [3] T. Damour gr-qc/0109063 [4] J. D. Bekenstein 1527 Phys. Rev., D 25 1982 Phys. Rev. D 25 (1982) 1527 [5] G. R. Dvali and M. Zaldarriaga 091303 Phys. Rev. Lett. 88 2002 Phys. Rev. Lett. 88 (2002) 091303 hep-ph/0108217 [6] K. A. Olive and M. Pospelov 085044 Phys. Rev., D 65 2002 Phys. Rev. D 65 (2002) 085044 hep-ph/0110377 [7] T. Banks, M. Dine and M. R. Douglas 131301 Phys. Rev. Lett. 88 2002 Phys. Rev. Lett. 88 (2002) 131301 hep-ph/0112059 [8] P. Langacker, G. Segr e and M. J. Strassler 121 Phys. Lett., B 528 2002 Phys. Lett. B 528 (2002) 121 hep-ph/0112233 [9] A. Y. Potekhin, A. V. Ivanchik, D. A. Varshalovich, K. M. Lanzetta, J. A. Bald-win, G. M. Williger and R. F. Carswell 523 Astrophys. J. 505 1998 Astrophys. J. 505 (1998) 523 astro-ph/9804116 [10] S. Weinberg 3357 Phys. Rev., D 9 1974 Phys. Rev. D 9 (1974) 3357 L. Dolan and R. Jackiw 3320 Phys. Rev., D 9 1974 Phys. Rev. D 9 (1974) 3320 [11] N. Arkani-Hamed, L. J. Hall, C. Kolda and H. Murayama 4434 Phys. Rev. Lett. 85 2000 Phys. Rev. Lett. 85 (2000) 4434 astro-ph/0005111 [12] M. Dine, W. Fischler and M. Srednicki 575 Nucl. Phys., B 189 1981 Nucl. Phys. B 189 (1981) 575 S. Dimopou-los and S. Raby 353 Nucl. Phys., B 192 1981 Nucl. Phys. B 192 (1981) 353 L. Alvarez-Gaum´e, M. Claudson and M. B. Wise 96 Nucl. Phys., B 207 1982 Nucl. Phys. B 207 (1982) 96 M. Dine and A. E. Nelson 1277 Phys. Rev., D 48 1993 Phys. Rev. D 48 (1993) 1277 hep-ph/9303230 M. Dine, A. E. Nelson and Y. Shirman 1362 Phys. Rev., D 51 1995 Phys. Rev. D 51 (1995) 1362 hep-ph/9408384 M. Dine, A. E. Nelson, Y. Nir and Y. Shirman 2658 Phys. Rev., D 53 1996 Phys. Rev. D 53 (1996) 2658 hep-ph/9507378 [13] N. Arkani-Hamed, S. Dimopoulos, N. Kaloper and R. Sundrum 193 Phys. Lett., B 480 2000 Phys. Lett. B 480 (2000) 193 hep-th/0001197 S. Kachru, M. Schulz and E. Silverstein 045021 Phys. Rev., D 62 2000 Phys. Rev. D 62 (2000) 045021 hep-th/0001206 C. Cs´aki, J. Erlich and C. Grojean 312 Nucl. Phys., B 604 2001 Nucl. Phys. B 604 (2001) 312 hep-th/0012143 [14] X. Calmet and H. Fritzsch hep-ph/0112110 H. Fritzsch hep-ph/0201198 [15] G. R. Dvali and S. Pokorski 126 Phys. Lett., B 379 1996 Phys. Lett. B 379 (1996) 126 hep-ph/9601358 [16] Z. Chacko and R. N. Mohapatra 2836 Phys. Rev. Lett. 82 1999 Phys. Rev. Lett. 82 (1999) 2836 hep-ph/9810315 [17] J. P. Turneaure, C. M. Will, B. F. Farrell, E. M. Mattison and R. F. C. Vessot 1705 Phys. Rev., D 27 1983 Phys. Rev. D 27 (1983) 1705 J. D. Prestage, R. L. Tjoelker and L. Maleki 3511 Phys. Rev. Lett. 74 1995 Phys. Rev. Lett. 74 (1995) 3511 [18] A. I. Shlyakhter 340 Nature 264 1976 Nature 264 (1976) 340 T. Damour and F. Dyson 37 Nucl. Phys., B 480 1996 Nucl. Phys. B 480 (1996) 37 hep-ph/9606486 Y. Fujii, A. Iwamoto, T. Fukahori, T. Ohnuki, M. Nakagawa, H. Hidaka, Y. Oura, P. Möller 377 Nucl. Phys., B 573 2000 Nucl. Phys. B 573 (2000) 377 hep-ph/9809549 [19] E. W. Kolb, M. J. Perry and T. P. Walker 869 Phys. Rev., D 33 1986 Phys. Rev. D 33 (1986) 869 B. A. Camp-bell and K. A. Olive 429 Phys. Lett., B 345 1995 Phys. Lett. B 345 (1995) 429 hep-ph/9411272 L. Bergström, S. Iguri and H. Rubinstein 045005 Phys. Rev., D 60 1999 Phys. Rev. D 60 (1999) 045005 astro-ph/9902157 P. P. Avelino et al 103505 Phys. Rev., D 64 2001 Phys. Rev. D 64 (2001) 103505 astro-ph/0102144 [20] S. Hannestad 023515 Phys. Rev., D 60 1999 Phys. Rev. D 60 (1999) 023515 astro-ph/9810102 M. Kaplinghat, R. J. Scherrer and M. S. Turner 023516 Phys. Rev., D 60 1999 Phys. Rev. D 60 (1999) 023516 astro-ph/9810133 P. P. Avelino, C. J. Martins, G. Rocha and P. Viana 123508 Phys. Rev., D 62 2000 Phys. Rev. D 62 (2000) 123508 astro-ph/0008446 [21] C. D. Hoyle, U. Schmidt, B. R. Heckel, E. G. Adelberger, J. H. Gundlach, D. J. Kap-ner and H. E. Swanson 1418 Phys. Rev. Lett. 86 2001 Phys. Rev. Lett. 86 (2001) 1418 hep-ph/0011014 E. G. Adelberger [EOT-WASH Group Collaboration] hep-ex/0202008 [22] S. Coleman, Aspects of symmetry. (Cambridge Univ. Press, 1985.) hep-ph/0204143 eng Domin, P Comenius University Phenomenological Study of Solar-Neutrino Induced Double Beta Decay of Mo100 12 Apr 2002 8 p The detection of solar-neutrinos of different origin via induced beta beta process of Mo100 is investigated. The particular counting rates and energy distributions of emitted electrons are presented. A discussion in respect tosolar-neutrino detector consisting of 10 tones of Mo100 is included. Both the cases of the standard solar model and neutrino oscillation scenarios are analyzed. Moreover, new beta^- beta^+ and beta^-/EC channels of the double-betaprocess are introduced and possibilities of their experimental observation are addressed. LANL EDS SzGeCERN Particle Physics - Phenomenology Simkovic, F Semenov, S V Gaponov, Y V Pavol Domin <domin@chavena.dnp.fmph.uniba.sk> http://cdsware.cern.ch/download/invenio-demo-site-files/0204143.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204143.ps.gz CER n 200231 2002 11 Gaponov, Yu. V. 2002-04-15 00 2002-04-15 BATCH 8 PAGES LATEX 2 POSTSCRIPT FIGURES TALK PRESENTED BY P DOMIN ON THE WORKSHOP MEDEX'01 (PRAGUE JUNE 2001) TO APPEAR IN CZECH J PHYS 52 (2002) PREPRINT [1] S. M. Bilenky, C. Giunti and W. Grimus 1 Prog. Part. Nucl. Phys. 45 1999 Prog. Part. Nucl. Phys. 45 (1999) 1 [2] J. N. Bahcall, S. Basu and M. H. Pinsonneault 1 Phys. Lett., B 433 1998 Phys. Lett. B 433 (1998) 1 [3] R. Davis Jr 13 Prog. Part. Nucl. Phys. 32 1994 Prog. Part. Nucl. Phys. 32 (1994) 13 [4] Kamiokande Collaboration, Y Fukuda et al 1683 Phys. Rev. Lett. 77 1996 Phys. Rev. Lett. 77 (1996) 1683 [5] SAGE collaboration, A. I. Abazov et al 3332 Phys. Rev. Lett. 67 1991 Phys. Rev. Lett. 67 (1991) 3332 D. N. Abdurashitov et al 4708 Phys. Rev. Lett. 77 1996 Phys. Rev. Lett. 77 (1996) 4708 [6] GALLEX collaboration, P. Anselmann et al 376 Phys. Lett., B 285 1992 Phys. Lett. B 285 (1992) 376 W. Hampel et al 384 Phys. Lett., B 388 1996 Phys. Lett. B 388 (1996) 384 [7] Super-Kamiokande Coll., S. Fukuda et al 5651 Phys. Rev. Lett. 86 2001 Phys. Rev. Lett. 86 (2001) 5651 [8] SNO Collaboration, Q.R. Ahmad et. al 071301 Phys. Rev. Lett. 87 2001 Phys. Rev. Lett. 87 (2001) 071301 [9] H. Ejiri et al., Phys. Rev. Lett.85 2917 (2000); H. Ejiri 265 Phys. Rep. 338 2000 Phys. Rep. 338 (2000) 265 [10] S. V. Semenov, Yu. V. Gaponov and R. U. Khafizov 1379 Yad. Fiz. 61 1998 Yad. Fiz. 61 (1998) 1379 [11] L. V. Inzhechik, Yu. V. Gaponov and S. V. Semenov 1384 Yad. Fiz. 61 1998 Yad. Fiz. 61 (1998) 1384 [12] http://www.sns.ias.edu/~jnb. http://www.sns.ias.edu/~jnb [13] B. Singh et al 478 Nucl. Data Sheets 84 1998 Nucl. Data Sheets 84 (1998) 478 [14] H. Akimune et al 23 Phys. Lett., B 394 1997 Phys. Lett. B 394 (1997) 23 [15] J. N. Bahcall, P. I. Krastev, and A. Yu. Smirnov 096016 Phys. Rev., D 58 1998 Phys. Rev. D 58 (1998) 096016 hep-th/0204101 eng CSULB-PA-02-2 Nishino, H California State University Axisymmetric Gravitational Solutions as Possible Classical Backgrounds around Closed String Mass Distributions 12 Apr 2002 15 p By studying singularities in stationary axisymmetric Kerr and Tomimatsu-Sato solutions with distortion parameter \d = 2, 3, ... in general relativity, we conclude that these singularities can be regarded as nothing other than closedstring-like circular mass distributions. We use two different regularizations to identify \d-function type singularities in the energy-momentum tensor for these solutions, realizing a regulator independent result. This result givessupporting evidence that these axisymmetric exact solutions may well be the classical solutions around closed string-like mass distributions, just like Schwarzschild solution corresponding to a point mass distribution. In otherwords, these axisymmetric exact solutions may well provide the classical backgrounds around closed strings. LANL EDS SzGeCERN Particle Physics - Theory Rajpoot, S Hitoshi Nishino <hnishino@csulb.edu> http://cdsware.cern.ch/download/invenio-demo-site-files/0204101.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204101.ps.gz CER n 200231 2002 11 Nishino, Hitoshi Rajpoot, Subhash 2002-04-15 00 2002-04-15 BATCH PREPRINT [1] K. Schwarzschild, Sitzungsberichte Preuss. Akad. Wiss., 424 (1916) [2] M. Green, J.H. Schwarz and E. Witten, `Superstring Theory', Vols. I and II, Cambridge University Press (1987) [3] J. Chazy, Bull. Soc. Math. France: 52 (1924) 17H.E.J. Curzon, Proc. London Math. Soc. : 23 (1924) 477 [4] P. Ho rava and E. Witten 506 Nucl. Phys., B 460 1996 Nucl. Phys. B 460 (1996) 506 94 Nucl. Phys., B 475 1996 Nucl. Phys. B 475 (1996) 94 [5] N. Arkani-Hamed, S. Dimopoulos and G. Dvali 263 Phys. Lett. 429 1998 Phys. Lett. 429 (1998) 263 I. Anto-niadis, N. Arkani-Hamed, S. Dimopoulos and G. Dvali 257 Phys. Lett. 436 1998 Phys. Lett. 436 (1998) 257 [6] L. Randall and R. Sundrum 3370 Phys. Rev. Lett. 83 1999 Phys. Rev. Lett. 83 (1999) 3370 4690 Phys. Rev. Lett. 83 1999 Phys. Rev. Lett. 83 (1999) 4690 [7] R.P. Kerr 237 Phys. Rev. Lett. 11 1963 Phys. Rev. Lett. 11 (1963) 237 [8] A. Ya Burinskii 441 Phys. Lett., A 185 1994 Phys. Lett. A 185 (1994) 441 `Complex String as Source of Kerr Ge-ometry' hep-th/9503094 2392 Phys. Rev., D 57 1998 Phys. Rev. D 57 (1998) 2392 `Structure of Spinning Parti-cle Suggested by Gravity, Supergravity & Low-Energy String Theory' hep-th/9910045 Czech. J. Phys.50S : 1 (2000) 201 [9] See, e.g., A. Sen 2081 Mod. Phys. Lett., A 10 1995 Mod. Phys. Lett. A 10 (1995) 2081 P.H. Frampton and T.W. Kephart 2571 Mod. Phys. Lett., A 10 1995 Mod. Phys. Lett. A 10 (1995) 2571 A. Strominger and C. Vafa 99 Phys. Lett. 379 1996 Phys. Lett. 379 (1996) 99 K. Behrndt 188 Nucl. Phys., B 455 1995 Nucl. Phys. B 455 (1995) 188 J.C. Breckenridge, D.A. Lowe, R.C. Myers, A.W. Peet, A. Strominger and C. Vafa 423 Phys. Lett., B 381 1996 Phys. Lett. B 381 (1996) 423 C. Callan and J. Maldacena 591 Nucl. Phys., B 472 1996 Nucl. Phys. B 472 (1996) 591 G. Horowitz and A. Stro-minger 2368 Phys. Rev. Lett. 77 1996 Phys. Rev. Lett. 77 (1996) 2368 J.M. Maldacena, `Black Holes in String Theory', Ph.D. Thesis hep-th/9607235 A. Dabholkar and J.A. Harvey 478 Phys. Rev. Lett. 63 1989 Phys. Rev. Lett. 63 (1989) 478 A. Dabholkar, G.W. Gibbons, J.A. Harvey and F. Ruiz Ruiz 33 Nucl. Phys., B 340 1990 Nucl. Phys. B 340 (1990) 33 C.G. Callan, Jr., J.M. Maldacena, A.W. Peet 645 Nucl. Phys. B 475 1996 Nucl. Phys. B 475 (1996) 645 [10] A. Tomimatu and H. Sato 95 Prog. Theor. Phys. 50 1973 Prog. Theor. Phys. 50 (1973) 95 [11] M. Yamazaki and S. Hori 696 Prog. Theor. Phys. 57 1977 Prog. Theor. Phys. 57 (1977) 696 erratum 1248 Prog. Theor. Phys. 60 1978 Prog. Theor. Phys. 60 (1978) 1248 S. Hori 1870 Prog. Theor. Phys. 59 1978 Prog. Theor. Phys. 59 (1978) 1870 erratum 365 Prog. Theor. Phys. 61 1979 Prog. Theor. Phys. 61 (1979) 365 [12] H. Nishino 77 Phys. Lett. 359 1995 Phys. Lett. 359 (1995) 77 [13] H. Weyl, Ann. de Phys. : 54 (1917) 117 [14] J.M. Bardeen, Astrophys. Jour. : 162 (1970) 71 [15] D. Kramer, H. Stephani, E. Herlt and M. MacCallum, `Exact Solutions of Einstein's Field Equations', Cambridge University Press (1980) [16] R. Arnowitt, S. Deser and C. Misner, in `Gravitation': `An Introduction to Current Re-search', ed. L. Witten (New York, Wiley, 1962) hep-th/0204102 eng Bo-Yu, H Northwest University, China Soliton on Noncommutative Orbifold $ T^2/Z_k $ 12 Apr 2002 13 p Following the construction of the projection operators on $ T^2 $ presented by Gopakumar, Headrick and Spradin, we construct the projection operators on the integral noncommutative orbifold $ T^2/G (G=Z_k,k=2, 3, 4, 6)$. Suchoperators are expressed by a function on this orbifold. So it provides a complete set of projection operators upon the moduli space $T^2 \times K/Z_k$. All these operators has the same trace 1/A ($A$ is an integer). Since theprojection operators correspond to solitons in noncommutative string field theory, we obtained the explicit expression of all the soliton solutions on $ T^2/Z_k $. LANL EDS SzGeCERN Particle Physics - Theory Kangjie, S Zhan-ying, Y Zhanying Yang <yzy@phy.nwu.edu.cn> http://cdsware.cern.ch/download/invenio-demo-site-files/0204102.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204102.ps.gz CER n 200231 2002 11 Bo-yu, Hou Kangjie, Shi Zhan-ying, Yang 2002-04-15 00 2002-04-15 BATCH PREPRINT [1] A. Connes, Non-commutative Geometry, Academic Press, 1994 [2] G. Landi," An introduction to non-commutative space and their geometry" hep-th/9701078 J. Varilly, "An introduction to non-commutative Geometry" physics/9709045 [3] J. Madore, "An introduction to non-commutative Differential Geometry and its physical Applications", Cambridge University press 2nd edition, 1999 [4] A. Connes, M. Douglas, A. Schwartz, Matrix theory compactification on Tori 003 J. High Energy Phys. 9802 1998 J. High Energy Phys. 9802 (1998) 003 hep-th/9711162 M. dougals, C. Hull 008 J. High Energy Phys. 9802 1998 J. High Energy Phys. 9802 (1998) 008 hep-th/9711165 [5] Nathan. Seiberg and Edward. Witten," String theory and non-commutative geometry" 032 J. High Energy Phys. 9909 1999 J. High Energy Phys. 9909 (1999) 032 hep-th/9908142 V. Schomerus," D-branes and Deformation Quan-tization" 030 J. High Energy Phys. 9906 1999 J. High Energy Phys. 9906 (1999) 030 [6] E. Witten, "Noncommutative Geometry and String Field Theory" 253 Nucl. Phys., B 268 1986 Nucl. Phys. B 268 (1986) 253 [7] R. B. Laughlin, "The quantum Hall Effect", edited by R. Prange and S. Girvin, p233 [8] L. Susskind hep-th/0101029 J. P. Hu and S. C. Zhang cond-mat/0112432 [9] R. Gopakumar, M. Headrick, M. Spradin, "on Noncommutative Multi-solitons" hep-th/0103256 [10] E. J. Martinec and G. Moore, "Noncommutative Solitons on Orbifolds" hep-th/0101199 [11] D. J. Gross and N. A. Nekrasov, " Solitons in noncommutative Gauge Theory" hep-th/0010090 M. R. Douglas and N. A. Nekrasov, "Noncommutative Field Theory" hep-th/0106048 [12] R. Gopakumar, S. Minwalla and A. Strominger, " Noncommutative Soliton" 048 J. High Energy Phys. 005 2000 J. High Energy Phys. 005 (2000) 048 hep-th/0003160 [13] J. Harvey, " Komaba Lectures on Noncommutative Solitons and D-branes hep-th/0102076 J. A. Harvey, P. Kraus and F.Larsen, J. High Energy Phys.0012 (200) 024 hep-th/0010060 [14] A. Konechny and A. Schwarz, "Compactification of M(atrix) theory on noncommutative toroidal orbifolds" 667 Nucl. Phys., B 591 2000 Nucl. Phys. B 591 (2000) 667 hep-th/9912185 " Moduli spaces of max-imally supersymmetric solutions on noncommutative tori and noncommutative orbifolds", J. High Energy Phys.0009, (2000) 005 hep-th/0005167 [15] S. Walters, "Projective modules over noncommutative sphere", J. London Math. Soc. : 51 (1995) 589"Chern characters of Fourier modules", Can. J. Math. : 52 (2000) 633 [16] M. Rieffel, Pacific J. Math. : 93 (1981) 415 [17] F. P. Boca 325 Commun. Math. Phys. 202 1999 Commun. Math. Phys. 202 (1999) 325 [18] H. Bacry, A. Grossman and J. Zak 1118 Phys. Rev., B 12 1975 Phys. Rev. B 12 (1975) 1118 [19] J. Zak, In Solid State Phys.edited by H. Ehrenreich, F. Seitz and D. Turnbull (Aca-demic,new York,1972), Vol. 27 nucl-th/0204031 eng LA-UR-02-2040 Page, P R Los Alamos Sci. Lab. Hybrid Baryons Los Alamos, NM Los Alamos Sci. Lab. 11 Apr 2002 12 p We review the status of hybrid baryons. The only known way to study hybrids rigorously is via excited adiabatic potentials. Hybrids can be modelled by both the bag and flux-tube models. The low-lying hybrid baryon is N 1/2^+ with amass of 1.5-1.8 GeV. Hybrid baryons can be produced in the glue-rich processes of diffractive gamma N and pi N production, Psi decays and p pbar annihilation. LANL EDS SzGeCERN Nuclear Physics "Philip R. page" <prp@t16prp.lanl.gov> http://cdsware.cern.ch/download/invenio-demo-site-files/0204031.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204031.ps.gz 11 2002 Page, Philip R. 2002-04-15 00 2002-04-15 BATCH INVITED PLENARY TALK PRESENTED AT THE ``9TH INTERNATIONAL CONFERENCE ON THE STRUCTURE OF BARYONS'' (BARYONS 2002) 3-8 MARCH NEWPORT NEWS VA USA 12 PAGES 7 ENCAPSULATED POSTSCRIPT FIGURES LATEX n 200216 PREPRINT nucl-th/0204032 eng Amos, K The University of Melbourne A simple functional form for proton-nucleus total reaction cross sections 12 Apr 2002 13 p A simple functional form has been found that gives a good representation of the total reaction cross sections for the scattering of protons from (15) nuclei spanning the mass range ${}^{9}$Be to ${}^{238}$U and for proton energiesranging from 20 to 300 MeV. LANL EDS SzGeCERN Nuclear Physics Deb, P K Ken Amos <amos@physics.unimelb.edu.au> http://cdsware.cern.ch/download/invenio-demo-site-files/0204032.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204032.ps.gz 2002 11 2002-04-15 00 2002-04-15 BATCH n 200216 PREPRINT nucl-th/0204033 eng Oyamatsu, K Aichi Shukutoku Univ Saturation of nuclear matter and radii of unstable nuclei 12 Apr 2002 26 p We examine relations among the parameters characterizing the phenomenological equation of state (EOS) of nearly symmetric, uniform nuclear matter near the saturation density by comparing macroscopic calculations of radii and massesof stable nuclei with the experimental data. The EOS parameters of interest here are the symmetry energy S_0, the symmetry energy density-derivative coefficient L and the incompressibility K_0 at the normal nuclear density. We find aconstraint on the relation between K_0 and L from the empirically allowed values of the slope of the saturation line (the line joining the saturation points of nuclear matter at finite neutron excess), together with a strongcorrelation between S_0 and L. In the light of the uncertainties in the values of K_0 and L, we macroscopically calculate radii of unstable nuclei as expected to be produced in future facilities. We find that the matter radii dependstrongly on L while being almost independent of K_0, a feature that will help to determine the L value via systematic measurements of nuclear size. LANL EDS SzGeCERN Nuclear Physics Iida, K Kei Iida <keiiida@postman.riken.go.jp> http://cdsware.cern.ch/download/invenio-demo-site-files/0204033.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204033.ps.gz CER n 200231 2002 11 Oyamatsu, Kazuhiro Iida, Kei 2002-04-15 00 2002-04-15 BATCH PREPRINT [1] J.M. Blatt and V.F. Weisskopf, Theoretical Nuclear Physics, Wiley, New York, 1952 [2] H. Heiselberg, V.R. Pandharipande 481 Annu. Rev. Nucl. Part. Sci. 50 2000 Annu. Rev. Nucl. Part. Sci. 50 (2000) 481 [3] K. Oyamatsu, I. Tanihata, Y. Sugahara, K. Sumiyoshi, H. Toki 3 Nucl. Phys., A 634 1998 Nucl. Phys. A 634 (1998) 3 [4] B.A. Brown 5296 Phys. Rev. Lett. 85 2000 Phys. Rev. Lett. 85 (2000) 5296 [5] K.C. Chung, C.S. Wang, A.J. Santiago nucl-th/0102017 [6] B.A. Li 4221 Phys. Rev. Lett. 85 2000 Phys. Rev. Lett. 85 (2000) 4221 [7] C. Sturm et al 39 Phys. Rev. Lett. 86 2001 Phys. Rev. Lett. 86 (2001) 39 [8] C. Fuchs, A. Faessler, E. Zabrodin, Y.M. Zheng 1974 Phys. Rev. Lett. 86 2001 Phys. Rev. Lett. 86 (2001) 1974 [9] P. Danielewicz, in: Proc. Int. Symp. on Non-Equilibrium and Nonlinear Dynamics in Nuclear and Other Finite Systems, Beijing, 2001 nucl-th/0112006 [10] D.H. Youngblood, H.L. Clark, Y.-W. Lui 691 Phys. Rev. Lett. 82 1999 Phys. Rev. Lett. 82 (1999) 691 [11] J.A. Pons, F.M. Walter, J.M. Lattimer, M. Prakash, R. Neuhaeuser, P. An 981 Astrophys. J. 564 2002 Astrophys. J. 564 (2002) 981 [12] J.M. Lattimer 337 Annu. Rev. Nucl. Part. Sci. 31 1981 Annu. Rev. Nucl. Part. Sci. 31 (1981) 337 [13] K. Oyamatsu 431 Nucl. Phys., A 561 1993 Nucl. Phys. A 561 (1993) 431 [14] L.R.B. Elton, A. Swift 52 Nucl. Phys., A 94 1967 Nucl. Phys. A 94 (1967) 52 [15] M. Yamada 512 Prog. Theor. Phys. 32 1964 Prog. Theor. Phys. 32 (1964) 512 [16] H. de Vries, C.W. de Jager, C. de Vries 495 At. Data Nucl. Data Tables 36 1987 At. Data Nucl. Data Tables 36 (1987) 495 [17] G. Audi, A.H. Wapstra 409 Nucl. Phys., A 595 1995 Nucl. Phys. A 595 (1995) 409 [18] S. Goriely, F. Tondeur, J.M. Pearson 311 At. Data Nucl. Data Tables 77 2001 At. Data Nucl. Data Tables 77 (2001) 311 [19] M. Samyn, S. Goriely, P.-H. Heenen, J.M. Pearson, F. Tondeur 142 Nucl. Phys., A 700 2002 Nucl. Phys. A 700 (2002) 142 [20] E. Chabanat, P. Bonche, P. Haensel, J. Meyer, R. Schaeffer 231 Nucl. Phys., A 635 1998 Nucl. Phys. A 635 (1998) 231 [21] Y. Sugahara, H. Toki 557 Nucl. Phys., A 579 1994 Nucl. Phys. A 579 (1994) 557 [22] A. Ozawa, T. Suzuki, I. Tanihata 32 Nucl. Phys., A 693 2001 Nucl. Phys. A 693 (2001) 32 [23] C.J. Batty, E. Friedman, H.J. Gils, H. Rebel 1 Adv. Nucl. Phys. 19 1989 Adv. Nucl. Phys. 19 (1989) 1 [24] G. Fricke, C. Bernhardt, K. Heilig, L.A. Schaller, L. Schellenberg, E.B. Shera, C.W. de Jager 177 At. Data Nucl. Data Tables 60 1995 At. Data Nucl. Data Tables 60 (1995) 177 [25] G. Huber et al 2342 Phys. Rev., C 18 1978 Phys. Rev. C 18 (1978) 2342 [26] L. Ray, G.W. Hoffmann, W.R. Coker 223 Phys. Rep. 212 1992 Phys. Rep. 212 (1992) 223 [27] S. Yoshida, H. Sagawa, N. Takigawa 2796 Phys. Rev., C 58 1998 Phys. Rev. C 58 (1998) 2796 [28] C.J. Pethick, D.G. Ravenhall 173 Nucl. Phys., A 606 1996 Nucl. Phys. A 606 (1996) 173 [29] K. Iida, K. Oyamatsu, unpublished [30] J.P. Blaizot, J.F. Berger, J. Decharg´e, M. Girod 435 Nucl. Phys., A 591 1995 Nucl. Phys. A 591 (1995) 435 nucl-th/0204034 eng Bozek, P Institute of Nuclear Physics, Cracow, Poland Nuclear matter with off-shell propagation 12 Apr 2002 Symmetric nuclear matter is studied within the conserving, self-consistent T-matrix approximation. This approach involves off-shell propagation of nucleons in the ladder diagrams. The binding energy receives contributions from thebackground part of the spectral function, away form the quasiparticle peak. The Fermi energy at the saturation point fulfills the Hugenholz-Van Hove relation. In comparison to the Brueckner-Hartree-Fock approach, the binding energyis reduced and the equation of state is harder LANL EDS SzGeCERN Nuclear Physics Bozek <bozek@sothis.ifj.edu.pl> http://cdsware.cern.ch/download/invenio-demo-site-files/0204034.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0204034.ps.gz 2002 11 2002-04-15 00 2002-04-15 BATCH n 200216 PREPRINT SCAN-9605068 eng McGILL-96-15 Contogouris, A P University of Athens One loop corrections for certain reactions initiated by 5-parton subprocesses via helicity amplitudes Montreal McGill Univ. Phys. Dept. Apr 1996? 28 p UNC9808 SzGeCERN Particle Physics - Phenomenology Merebashvili, Z V Lebessis, F Veropoulos, G http://cdsware.cern.ch/download/invenio-demo-site-files/convert_SCAN-9605068.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/SCAN-9605068.tif 13 1996 1996-05-08 50 2001-12-14 BATCH 4234-4243 7 Phys. Rev., D 54 1996 h 199620 ARTICLE eng TRI-PP-86-73 Bryman, D A University of British Columbia Exotic muon decay mu --> e + x Burnaby, BC TRIUMF Aug 1986 8 p jv200203 SzGeCERN Particle Physics - Experimental Results Clifford, E T H 13 1986 1990-01-29 50 2002-03-26 BATCH 2787-88 22 Phys. Rev. Lett. 57 1986 SLAC 1594699 h 198648n ARTICLE hep-th/0003289 eng PUPT-1926 Costa, M S Princeton University A Test of the AdS/CFT Duality on the Coulomb Branch Princeton, NJ Princeton Univ. Joseph-Henry Lab. Phys. 31 Mar 2000 11 p We consider the N=4 SU(N) Super Yang Mills theory on the Coulomb branch with gauge symmetry broken to S(U(N_1)*U(N_2)). By integrating the W particles, the effective action near the IR SU(N_i) conformal fixed points is seen to be adeformation of the Super Yang Mills theory by a non-renormalized, irrelevant, dimension 8 operator. The correction to the two-point function of the dilaton field dual operator near the IR is related to a three-point function ofchiral primary operators at the conformal fixed points and agrees with the classical gravity prediction, including the numerical factor. LANL EDS LANLPUBL200104 SzGeCERN Particle Physics - Theory Miguel S Costa <miguel@feynman.princeton.edu> http://cdsware.cern.ch/download/invenio-demo-site-files/0003289.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0003289.ps.gz 2000 13 Princeton University 2000-04-03 50 2001-11-09 BATCH Costa, Miguel S. 287-292 Phys. Lett., B 482 2000 SLAC 4356110 n 200014 ARTICLE [1] J.M. Maldacena, The Large N Limit of Superconformal Field Theories and Supergrav-ity 231 Adv. Theor. Math. Phys. 2 1998 Adv. Theor. Math. Phys. 2 (1998) 231 hep-th/9711200 [2] S.S. Gubser, I.R. Klebanov and A.M. Polyakov, Gauge Theory Correlators from Non-Critical String Theory 105 Phys. Lett., B 428 1998 Phys. Lett. B 428 (1998) 105 hep-th/9802109 [3] E. Witten, Anti De Sitter Space And Holography 253 Adv. Theor. Math. Phys. 2 1998 Adv. Theor. Math. Phys. 2 (1998) 253 hep-th/9802150 [4] O. Aharony, S.S. Gubser, J. Maldacena, H. Ooguri and Y. Oz, Large N Field Theories, String Theory and Gravity 183 Phys. Rep. 323 2000 Phys. Rep. 323 (2000) 183 hep-th/9905111 [5] J.A. Minahan and N.P. Warner, Quark Potentials in the Higgs Phase of Large N Supersymmetric Yang-Mills Theories 005 J. High Energy Phys. 06 1998 J. High Energy Phys. 06 (1998) 005 hep-th/9805104 [6] M.R. Douglas and W. Taylor, Branes in the bulk of Anti-de Sitter space hep-th/9807225 [7] A.A. Tseytlin and S. Yankielowicz, Free energy of N=4 super Yang-Mills in Higgs phase and non-extremal D3-brane interactions 145 Nucl. Phys., B 541 1999 Nucl. Phys. B 541 (1999) 145 hep-th/9809032 [8] Y. Wu, A Note on AdS/SYM Correspondence on the Coulomb Branch hep-th/9809055 [9] P. Kraus, F. Larsen, S. Trivedi, The Coulomb Branch of Gauge Theory from Rotating Branes 003 J. High Energy Phys. 03 1999 J. High Energy Phys. 03 (1999) 003 hep-th/9811120 [10] I.R. Klebanov and E. Witten, AdS/CFT Correspondence and Symmetry Breaking 89 Nucl. Phys., B 556 1999 Nucl. Phys. B 556 (1999) 89 hep-th/9905104 [11] D.Z. Freedman, S.S. Gubser, K. Pilch and N.P. Warner, Continuous distributions of D3-branes and gauged supergravity hep-th/9906194 [12] A. Brandhuber and K. Sfetsos, Wilson loops from multicentre and rotating branes, mass gaps and phase structure in gauge theories hep-th/9906201 [13] I. Chepelev and R. Roiban, A note on correlation functions in AdS5/SY M4 corre-spondence on the Coulomb branch 74 Phys. Lett., B 462 1999 Phys. Lett. B 462 (1999) 74 hep-th/9906224 [14] S.B. Giddings and S.F. Ross, D3-brane shells to black branes on the Coulomb branch 024036 Phys. Rev., D 61 2000 Phys. Rev. D 61 (2000) 024036 hep-th/9907204 [15] M. Cvetic, S.S. Gubser, H. Lu and C.N. Pope, Symmetric Potentials of Gauged Su-pergravities in Diverse Dimensions and Coulomb Branch of Gauge Theories hep-th/9909121 [16] R.C.Rashkov and K.S.Viswanathan, Correlation functions in the Coulomb branch of N=4 SYM from AdS/CFT correspondence hep-th/9911160 [17] M.S. Costa, Absorption by Double-Centered D3-Branes and the Coulomb Branch of N = 4 SYM Theory hep-th/9912073 [18] Y.S. Myung, G. Kang and H.W. Lee, Greybody factor for D3-branes in B field hep-th/9911193 S-wave absorption of scalars by noncommutative D3-branes hep-th/9912288 [19] R. Manvelyan, H.J.W. Mueller-Kirsten, J.-Q. Liang, Y. Zhang, Absorption Cross Sec-tion of Scalar Field in Supergravity Background hep-th/0001179 [20] S.S. Gubser and I.R. Klebanov, Absorption by Branes and Schwinger Terms in the World Volume Theory 41 Phys. Lett., B 413 1997 Phys. Lett. B 413 (1997) 41 hep-th/9708005 [21] K. Intriligator, Maximally Supersymmetric RG Flows and AdS Duality hep-th/9909082 [22] S.S. Gubser, A. Hashimoto, I.R. Klebanov and M. Krasnitz, Scalar Absorption and the Breaking of the World Volume Conformal Invariance 393 Nucl. Phys., B 526 1998 Nucl. Phys. B 526 (1998) 393 hep-th/9803023 [23] S. Lee, S. Minwalla, M. Rangamani and N. Seiberg, Three-Point Functions of Chiral Operators in D=4, N = 4 SYM at Large N 697 Adv. Theor. Math. Phys. 2 1998 Adv. Theor. Math. Phys. 2 (1998) 697 hep-th/9806074 [24] E. D'Hoker, D.Z. Freedman and W. Skiba, Field Theory Tests for Correlators in the AdS/CFT Correspondence 045008 Phys. Rev., D 59 1999 Phys. Rev. D 59 (1999) 045008 hep-th/9807098 [25] F. Gonzalez-Rey, B. Kulik and I.Y. Park, Non-renormalization of two and three Point Correlators of N=4 SYM in N=1 Superspace 164 Phys. Lett., B 455 1999 Phys. Lett. B 455 (1999) 164 hep-th/9903094 [26] K. Intriligator, Bonus Symmetries of N=4 Super-Yang-Mills Correlation Functions via AdS Duality 575 Nucl. Phys., B 551 1999 Nucl. Phys. B 551 (1999) 575 hep-th/9811047 K. Intriligator and W. Skiba, Bonus Symmetry and the Operator Product Expansion of N=4 Super-Yang-Mills 165 Nucl. Phys., B 559 1999 Nucl. Phys. B 559 (1999) 165 hep-th/9905020 [27] B. Eden, P.S. Howe and P.C. West, Nilpotent invariants in N=4 SYM 19 Phys. Lett., B 463 1999 Phys. Lett. B 463 (1999) 19 hep-th/9905085 P.S. Howe, C. Schubert, E. Sokatchev and P.C. West, Explicit construction of nilpotent covariants in N=4 SYM hep-th/9910011 [28] A. Petkou and K. Skenderis, A non-renormalization theorem for conformal anomalies 100 Nucl. Phys., B 561 1999 Nucl. Phys. B 561 (1999) 100 hep-th/9906030 [29] M.R. Douglas, D. Kabat, P. Pouliot and S.H. Shenker, D-branes and Short Distances in String Theory 85 Nucl. Phys., B 485 1997 Nucl. Phys. B 485 (1997) 85 hep-th/9608024 [30] G. Lifschytz and S.D. Mathur, Supersymmetry and Membrane Interactions in M(atrix) Theory 621 Nucl. Phys., B 507 1997 Nucl. Phys. B 507 (1997) 621 hep-th/9612087 [31] J. Maldacena, Probing Near Extremal Black Holes with D-branes 3736 Phys. Rev., D 57 1998 Phys. Rev. D 57 (1998) 3736 hep-th/9705053 Branes probing black holes 17 Nucl. Phys. B, Proc. Suppl. 68 1998 Nucl. Phys. B, Proc. Suppl. 68 (1998) 17 hep-th/9709099 [32] I. Chepelev and A.A. Tseytlin, Interactions of type IIB D-branes from D-instanton ma-trix model 629 Nucl. Phys., B 511 1998 Nucl. Phys. B 511 (1998) 629 hep-th/9705120 Long-distance interactions of branes: correspondence between supergravity and super Yang-Mills descriptions 73 Nucl. Phys., B 515 1998 Nucl. Phys. B 515 (1998) 73 hep-th/9709087 A.A. Tseytlin, Interactions Between Branes and Matrix Theories 99 Nucl. Phys. B, Proc. Suppl. 68 1998 Nucl. Phys. B, Proc. Suppl. 68 (1998) 99 hep-th/9709123 [33] M. Dine and N. Seiberg, Comments on Higher Derivative Operators in Some SUSY Field Theories 239 Phys. Lett., B 409 1997 Phys. Lett. B 409 (1997) 239 hep-th/9705057 [34] A.A. Tseytlin, On non-abelian generalisation of Born-Infeld action in string theory 41 Nucl. Phys., B 501 1997 Nucl. Phys. B 501 (1997) 41 hep-th/9701125 [35] S.S. Gubser and A. Hashimoto, Exact absorption probabilities for the D3-brane, Com-mun. Math. Phys. : 203 (1999) 325 hep-th/9805140 [36] S.S. Gubser, Non-conformal examples of AdS/CFT 1081 Class. Quantum Gravity 17 2000 Class. Quantum Gravity 17 (2000) 1081 hep-th/9910117 eng Bollen, G Institut fur Physic, Universitat Mainz ISOLTRAP : a tandem penning trap system for accurate on-line mass determination of short-lived isotopes SzGeCERN Detectors and Experimental Techniques Becker, S Kluge, H J Konig, M Moore, M Otto, T Raimbault-Hartmann, H Savard, G Schweikhard, L Stolzenberg, H ISOLDE Collaboration 1996 13 IS302 ISOLDE PPE CERN PS 1996-05-08 50 2001-12-14 BATCH 675-697 Nucl. Instrum. Methods Phys. Res., A 368 1996 n 199600 a1996 ARTICLE hep-th/0003291 eng McInnes, B National University of Singapore AdS/CFT For Non-Boundary Manifolds In its Euclidean formulation, the AdS/CFT correspondence begins as a study of Yang-Mills conformal field theories on the sphere, S^4. It has been successfully extended, however, to S^1 X S^3 and to the torus T^4. It is natural tohope that it can be made to work for any manifold on which it is possible to define a stable Yang-Mills conformal field theory. We consider a possible classification of such manifolds, and show how to deal with the most obviousobjection : the existence of manifolds which cannot be represented as boundaries. We confirm Witten's suggestion that this can be done with the help of a brane in the bulk. LANL EDS SzGeCERN Particle Physics - Theory Brett McInnes <matmcinn@nus.edu.sg> http://cdsware.cern.ch/download/invenio-demo-site-files/0003291.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0003291.ps.gz 2000 13 Innes, Brett Mc 2000-04-03 50 2001-11-09 BATCH 025 J. High Energy Phys. 05 2000 SLAC 4356136 n 200014 ARTICLE SCAN-9605071 eng KEK-Preprint-95-196 TUAT-HEP-96-1 DPNU-96-04 Emi, K KEK Study of a dE/dx measurement and the gas-gain saturation by a prototype drift chamber for the BELLE-CDC Tsukuba KEK Jan 1996 20 p UNC9806 SzGeCERN Detectors and Experimental Techniques Tsukamoto, T Hirano, H Mamada, H Sakai, Y Uno, S Itami, S Kajikawa, R Nitoh, O Ohishi, N Sugiyama, A Suzuki, S Takahashi, T Tamagawa, Y Tomoto, M Yamaki, T library@kekvax.kek.jp http://cdsware.cern.ch/download/invenio-demo-site-files/convert_SCAN-9605071.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/SCAN-9605071.tif 1996 13 1996-05-08 50 2001-12-14 BATCH 225 2 Nucl. Instrum. Methods Phys. Res., A 379 1996 SLAC 3328660 h 199620 ARTICLE hep-th/0003293 eng Smailagic, A University of Osijek Higher Dimensional Schwinger-like Anomalous Effective Action We construct explicit form of the anomalous effective action, in arbitrary even dimension, for Abelian vector and axial gauge fields coupled to Dirac fermions. It turns out to be a surprisingly simple extension of 2D Schwinger modeleffective action. LANL EDS LANLPUBL200104 SzGeCERN Particle Physics - Theory Spallucci, E spallucci@ts.infn.it http://cdsware.cern.ch/download/invenio-demo-site-files/0003293.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0003293.ps.gz CER n 200231 2000 13 2000-04-03 50 2001-11-09 BATCH 045010 Phys. Rev., D 62 2000 SLAC 4356152 ARTICLE [1] S.L. Adler 2426 Phys. Rev. 177 1969 Phys. Rev. 177 (1969) 2426 [2] S.E.Treiman, R. Jackiw, D.J.Gross " Lectures on Current Algebra and its Applications ", Princeton UP, Princeton NJ, (1972) [3] T.Berger " Fermions in two (1+1)-dimensional anomalous gauge theories: the chiral Schwinger model and the chiral quantum gravity " Hamburg U DESY-90-084 July 1990 [4] L.Rosenberg, Phys. Rev.129, (1963) 2786 [5] R.Jackiw " Topological Investigations of Quantized Gauge Theories " in Relativity, Groups and Topology eds. B.deWitt and R.Stora (Elsevier, Amsterdam 1984) [6] M.T.Grisaru, N.K.Nielsen, W.Siegel, D.Zanon 157 Nucl. Phys., B 247 1984 Nucl. Phys. B 247 (1984) 157 [7] A.M. Polyakov 207 Phys. Lett., B 103 1981 Phys. Lett. B 103 (1981) 207 A.M. Polyakov 893 Mod. Phys. Lett., A 2 1987 Mod. Phys. Lett. A 2 (1987) 893 [8] R.J. Riegert 56 Phys. Lett. 134 1984 Phys. Lett. 134 (1984) 56 [9] K.Fujikawa 1195 Phys. Rev. Lett. 42 1979 Phys. Rev. Lett. 42 (1979) 1195 [10] B.deWitt, Relativity, Groups and Topology, Paris (1963); A.O.Barvinsky, G.A.Vilkovisky 1 Phys. Rep. 119 1985 Phys. Rep. 119 (1985) 1 [11] P.H.Frampton, T.W.Kephart 1343 Phys. Rev. Lett. 50 1983 Phys. Rev. Lett. 50 (1983) 1343 L. Alvarez-Gaume, E.Witten 269 Nucl. Phys. 234 1983 Nucl. Phys. 234 (1983) 269 [12] A.Smailagic, R.E.Gamboa-Saravi 145 Phys. Lett. 192 1987 Phys. Lett. 192 (1987) 145 A.Smailagic, E.Spallucci 17 Phys. Lett. 284 1992 Phys. Lett. 284 (1992) 17 hep-th/0003294 eng Matsubara, K Uppsala University Restrictions on Gauge Groups in Noncommutative Gauge Theory We show that the gauge groups SU(N), SO(N) and Sp(N) cannot be realized on a flat noncommutative manifold, while it is possible for U(N). LANL EDS LANLPUBL200104 SzGeCERN Particle Physics - Theory Keizo Matsubara <keizo.matsubara@teorfys.uu.se> http://cdsware.cern.ch/download/invenio-demo-site-files/0003294.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0003294.ps.gz CER n 200231 2000 13 Matsubara, Keizo 2000-04-03 50 2001-11-09 BATCH 417-419 Phys. Lett., B 482 2000 SLAC 4356160 ARTICLE [1] J.Polchinski, TASI Lectures on D-branes hep-th/9611050 [2] M.R.Douglas and C.Hull, D-branes and the Noncommuta-tive torus 8 J. High Energy Phys. 2 1998 J. High Energy Phys. 2 (1998) 8 hep-th/9711165 [3] V.Schomerus, D-branes and Deformation Quantization hep-th/9903205 [4] N.Seiberg and E.Witten, String Theory and Noncommu-tative Geometry hep-th/9908142 2 hep-th/0003295 eng Wang, B Fudan University Quasinormal modes of Reissner-Nordstrom Anti-de Sitter Black Holes Complex frequencies associated with quasinormal modes for large Reissner-Nordstr$\ddot{o}$m Anti-de Sitter black holes have been computed. These frequencies have close relation to the black hole charge and do not linearly scale withthe black hole temperature as in Schwarzschild Anti-de Sitter case. In terms of AdS/CFT correspondence, we found that the bigger the black hole charge is, the quicker for the approach to thermal equilibrium in the CFT. The propertiesof quasinormal modes for $l>0$ have also been studied. LANL EDS LANLPUBL200104 SzGeCERN Particle Physics - Theory Lin, C Y Abdalla, E Elcio Abdalla <eabdalla@fma.if.usp.br> http://cdsware.cern.ch/download/invenio-demo-site-files/0003295.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0003295.ps.gz http://cdsware.cern.ch/download/invenio-demo-site-files/0003295.fig1.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0003295.fig2.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0003295.fig3.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0003295.fig4.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0003295.fig5.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0003295.fig6a.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0003295.fig6b.ps.gz Additional http://cdsware.cern.ch/download/invenio-demo-site-files/0003295.fig7.ps.gz Additional CER n 200231 2000 13 Wang, Bin Lin, Chi-Yong Abdalla, Elcio 2000-04-03 50 2001-11-09 BATCH 79-88 Phys. Lett., B 481 2000 SLAC 4356179 ARTICLE [1] K. D. Kokkotas, B. G. Schmidt gr-qc/9909058 and references therein [2] W. Krivan 101501 Phys. Rev., D 60 1999 Phys. Rev. D 60 (1999) 101501 [3] S. Hod gr-qc/9902072 [4] P. R. Brady, C. M. Chambers, W. G. Laarakkers and E. Poisson 064003 Phys. Rev., D 60 1999 Phys. Rev. D 60 (1999) 064003 [5] P. R. Brady, C. M. Chambers, W. Krivan and P. Laguna 7538 Phys. Rev., D 55 1997 Phys. Rev. D 55 (1997) 7538 [6] G. T. Horowitz and V. E. Hubeny hep-th/9909056 G. T. Horowitz hep-th/9910082 [7] E. S. C. Ching, P. T. Leung, W. M. Suen and K. Young 2118 Phys. Rev., D 52 1995 Phys. Rev. D 52 (1995) 2118 [8] J. M. Maldacena 231 Adv. Theor. Math. Phys. 2 1998 Adv. Theor. Math. Phys. 2 (1998) 231 [9] E. Witten 253 Adv. Theor. Math. Phys. 2 1998 Adv. Theor. Math. Phys. 2 (1998) 253 [10] S. S. Gubser, I. R. Klebanov and A. M. Polyakov 105 Phys. Lett., B 428 1998 Phys. Lett. B 428 (1998) 105 [11] A. Chamblin, R. Emparan, C. V. Johnson and R. C. Myers 064018 Phys. Rev., D 60 1999 Phys. Rev. D 60 (1999) 064018 [12] E. W. Leaver 1238 J. Math. Phys. 27 1986 J. Math. Phys. 27 (1986) 1238 [13] E. W. Leaver 2986 Phys. Rev., D 41 1990 Phys. Rev. D 41 (1990) 2986 [14] C. O. Lousto 1733 Phys. Rev., D 51 1995 Phys. Rev. D 51 (1995) 1733 [15] O. Kaburaki 316 Phys. Lett., A 217 1996 Phys. Lett. A 217 (1996) 316 [16] R. K. Su, R. G. Cai and P. K. N. Yu 2932 Phys. Rev., D 50 1994 Phys. Rev. D 50 (1994) 2932 3473 Phys. Rev., D 48 1993 Phys. Rev. D 48 (1993) 3473 6186 Phys. Rev., D 52 1995 Phys. Rev. D 52 (1995) 6186 B. Wang, J. M. Zhu 1269 Mod. Phys. Lett., A 10 1995 Mod. Phys. Lett. A 10 (1995) 1269 [17] A. Chamblin, R. Emparan, C. V. Johnson and R. C. Myers, Phys. Rev., D60: 104026 (1999) 5070 90 110 130 150 r+ 130 230 330 50 70 90 110 130 150 r+ rus Пушкин, А С Медный всадник <!--HTML-->На берегу пустынных волн, <br /> Стоял он, дум великих полн, <br /> И вдаль глядел. Пред ним широко<br /> Река неслася; бедный чёлн<br /> По ней стремился одиноко. <br /> По мшистым, топким берегам<br /> Чернели избы здесь и там, <br /> Приют убогого чухонца; <br /> И лес, неведомый лучам<br /> В тумане спрятанного солнца, <br /> Кругом шумел. 1833 1990-01-27 00 2002-04-12 BATCH POETRY gre Καβάφης, Κ Π Ιθάκη <!--HTML-->Σα βγεις στον πηγαιμό για την Ιθάκη, <br /> να εύχεσαι νάναι μακρύς ο δρόμος, <br /> γεμάτος περιπέτειες, γεμάτος γνώσεις. <br/> Τους Λαιστρυγόνας και τους Κύκλωπας, <br /> τον θυμωμένο Ποσειδώνα μη φοβάσαι, <br /> τέτοια στον δρόμο σου ποτέ σου δεν θα βρείς, <br /> αν μέν' η σκέψις σου υψηλή, αν εκλεκτή<br /> συγκίνησις το πνεύμα και το σώμα σου αγγίζει. <br /> Τους Λαιστρυγόνας και τους Κύκλωπας, <br /> τον άγριο Ποσειδώνα δεν θα συναντήσεις, <br /> αν δεν τους κουβανείς μες στην ψυχή σου, <br /> αν η ψυχή σου δεν τους στήνει εμπρός σου. <br /> <br> Να εύχεσαι νάναι μακρύς ο δρόμος. <br /> Πολλά τα καλοκαιρινά πρωϊά να είναι<br /> που με τι ευχαρίστησι, με τι χαρά<br /> θα μπαίνεις σε λιμένας πρωτοειδωμένους· <br /> να σταματήσεις σ' εμπορεία Φοινικικά, <br /> και τες καλές πραγμάτειες ν' αποκτήσεις, <br /> σεντέφια και κοράλλια, κεχριμπάρια κ' έβενους, <br /> και ηδονικά μυρωδικά κάθε λογής, <br /> όσο μπορείς πιο άφθονα ηδονικά μυρωδικά· <br /> σε πόλεις Αιγυπτιακές πολλές να πας, <br /> να μάθεις και να μάθεις απ' τους σπουδασμένους. <br /> <br /> Πάντα στον νου σου νάχεις την Ιθάκη. <br/> Το φθάσιμον εκεί είν' ο προορισμός σου. <br /> Αλλά μη βιάζεις το ταξίδι διόλου. <br /> Καλλίτερα χρόνια πολλά να διαρκέσει· <br /> και γέρος πια ν' αράξεις στο νησί, <br /> πλούσιος με όσα κέρδισες στον δρόμο, <br /> μη προσδοκώντας πλούτη να σε δώσει η Ιθάκη. <br /> <br /> Η Ιθάκη σ' έδωσε το ωραίο ταξίδι. <br /> Χωρίς αυτήν δεν θάβγαινες στον δρόμο. <br /> Αλλο δεν έχει να σε δώσει πια. <br /> <br /> Κι αν πτωχική την βρεις, η Ιθάκη δεν σε γέλασε. <br /> Ετσι σοφός που έγινες, με τόση πείρα, <br /> ήδη θα το κατάλαβες η Ιθάκες τι σημαίνουν. 1911 2005-03-02 00 2005-03-02 BATCH POETRY SzGeCERN 2345180CERCER SLAC 5278333 hep-th/0210114 eng Klebanov, Igor R Princeton University AdS Dual of the Critical O(N) Vector Model 2002 11 Oct 2002 11 p We suggest a general relation between theories of infinite number of higher-spin massless gauge fields in $AdS_{d+1}$ and large $N$ conformal theories in $d$ dimensions containing $N$-component vector fields. In particular, we propose that the singlet sector of the well-known critical 3-d O(N) model with the $(\phi^a \phi^a)^2$ interaction is dual, in the large $N$ limit, to the minimal bosonic theory in $AdS_4$ containing massless gauge fields of even spin. LANL EDS SIS LANLPUBL2003 SIS:2003 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE LANL EDS High Energy Physics - Theory Polyakov, A M 213-219 Phys. Lett. B 550 2002 http://cdsware.cern.ch/download/invenio-demo-site-files/0210114.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0210114.ps.gz klebanov@feynman.princeton.edu n 200242 13 20060826 0012 CER01 20021014 PUBLIC 002345180CER ARTICLE [1] G.’t Hooft, "A planar diagram theory for strong interactions," Nucl. Phys. B 72 (1974) 461 [2] A.M. Polyakov, "String theory and quark confinement," Nucl. Phys. B, Proc. Suppl. 68 (1998) 1 hep-th/9711002 [2] "The wall of the cave," hep-th/9809057 [3] J. Maldacena, "The large N limit of superconformal field theories and supergravity," Adv. Theor. Math. Phys. 2 (1998) 231 hep-th/9711200 [4] S. S. Gubser, I. R. Klebanov, and A. M. Polyakov, "Gauge theory correlators from non-critical string theory," Phys. Lett. B 428 (1998) 105 hep-th/9802109 [5] E. Witten, "Anti-de Sitter space and holography," Adv. Theor. Math. Phys. 2 (1998) 253 hep-th/9802150 [6] E. Brezin, D.J. Wallace, Phys. Rev. B 7 (1973) 1976 [7] K.G. Wilson and J. Kogut, "The Renormalization Group and the Epsilon Expansion," Phys. Rep. 12 (1974) 75 [8] C. Fronsdal, Phys. Rev. D 18 (1978) 3624 [9] E. Fradkin and M. Vasiliev, Phys. Lett. B 189 (1987) 89 [9] Nucl. Phys. B 291 (1987) 141 [10] M.A. Vasiliev, "Higher Spin Gauge Theories Star Product and AdS Space," hep-th/9910096 [11] A. M. Polyakov, "Gauge fields and space-time," hep-th/0110196 [12] P. Haggi-Mani and B. Sundborg, "Free Large N Supersymmetric Yang-Mills Theory Ann. Sci. a String Theory," hep-th/0002189 [12] B. Sundborg, "Stringy Gravity, Interacting Tensionless Strings and Massless Higher Spins," hep-th/0103247 [13] E. Witten, Talk at the John Schwarz 60-th Birthday Symposium, http://theory.caltech.edu/jhs60/witten/1.html http://theory.caltech.edu/jhs60/witten/1.html [14] E. Sezgin and P. Sundell, "Doubletons and 5D Higher Spin Gauge Theory," hep-th/0105001 [15] A. Mikhailov, "Notes On Higher Spin Symmetries," hep-th/0201019 [16] E. Sezgin and P. Sundell, "Analysis of Higher Spin Field Equations in Four Dimensions," hep-th/0205132 [16] J. Engquist, E. Sezgin, P. Sundell, "On N=1,2,4 Higher Spin Gauge Theories in Four Dimensions," hep-th/0207101 [17] M. Vasiliev, "Higher Spin Gauge Theories in Four, Three and Two Dimensions," Int. J. Mod. Phys. D 5 (1996) 763 hep-th/9611024 [18] I.R. Klebanov and E. Witten, "AdS/CFT correspondence and Symmetry Breaking," Nucl. Phys. B 556 (1999) 89 hep-th/9905104 [19] O. Aharony, M. Berkooz, E. Silverstein, "Multiple Trace Operators and Nonlocal String Theories," J. High Energy Phys. 0108 (2001) 006 hep-th-0105309 [20] E. Witten, "Multi-Trace Operators, Boundary Conditions, And AdS/CFT Correspondence," hep-th/0112258 [21] M. Berkooz, A. Sever and A. Shomer, "Double Trace Deformations, Boundary Conditions and Space-time Singularities," J. High Energy Phys. 0205 (2002) 034 hep-th-0112264 [22] S.S. Gubser and I. Mitra, "Double-Trace Operators and One-Loop Vacuum Energy in AdS/CFT," hep-th/0210093 [23] I.R. Klebanov, "Touching Random Surfaces and Liouville Gravity," Phys. Rev. D 51 (1995) 1836 hep-th/9407167 [23] I.R. Klebanov and A. Hashimoto, "Non-Perturbative Solution of Matrix Models Modified by Trace-Squared Terms," Nucl. Phys. B 434 (1995) 264 hep-th/9409064 [24] A.M. Polyakov, "Non-Hamiltonian Approach to Quantum Field Theory at Small Distances," Zh. Eksp. Teor. Fiz. 66 (1974) 23 [25] E. D’Hoker, D. Z. Freedman, S. Mathur, A. Matusis and L. Rastelli, "Graviton exchange and complete 4-point functions in the AdS/CFT correspondence, " hep-th/9903196 [26] For a review with a comprehensive set of references, see E. d‘Hoker and D.Z. Freedman, "Supersymmetric Gauge Theories and the AdS/CFT Correspondence," hep-th/0201253 CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181365824-0-23-17-1-0 2292727CERCER SLAC 4828445 UNCOVER 1021768628 hep-th/0201100 eng DSF-2002-2 Mück, W INFN Universita di Napoli An improved correspondence formula for AdS/CFT with multi-trace operators 2002 Napoli Napoli Univ. 15 Jan 2002 6 p An improved correspondence formula is proposed for the calculation of correlation functions of a conformal field theory perturbed by multi-trace operators from the analysis of the dynamics of the dual field theory in Anti-de Sitter space. The formula reduces to the usual AdS/CFT correspondence formula in the case of single-trace perturbations. LANL EDS SIS ING2002 SIS:2002 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE LANL EDS High Energy Physics - Theory 301-304 3-4 Phys. Lett. B 531 2002 http://cdsware.cern.ch/download/invenio-demo-site-files/0201100.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0201100.ps.gz wolfgang.mueck@na.infn.it n 200204 13 20060826 0008 CER01 20020128 PUBLIC 002292727CER ARTICLE [1] E. Witten, hep-th/0112258 [2] S. S. Gubser, I. R. Klebanov and A. M. Polyakov, Phys. Lett. B 428 (1998) 105 hep-th/9802109 [3] E. Witten, Adv. Theor. Math. Phys. 2 (1998) 253 hep-th/9802150 [4] P. Breitenlohner and D. Z. Freedman, Ann. Phys. (San Diego) 144 (1982) 249 [5] I. R. Klebanov and E. Witten, Nucl. Phys. B 556 (1999) 89 hep-th/9905104 [6] W. Mück and K. S. Viswanathan, Phys. Rev. D 60 (1999) 081901 hep-th/9906155 [7] W. Mück, Nucl. Phys. B 620 (2002) 477 hep-th/0105270 [8] M. Bianchi, D. Z. Freedman and K. Skenderis, J. High Energy Phys. 08 (2001) 041 hep-th/0105276 CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181358050-0-7-7-0-0 SzGeCERN 2307939CERCER SLAC 4923022 hep-th/0205061 eng DSF-2002-11 QMUL-PH-2002-11 Martelli, D University of London Holographic Renormalization and Ward Identities with the Hamilton-Jacobi Method 2003 Napoli Napoli Univ. 7 May 2002 31 p A systematic procedure for performing holographic renormalization, which makes use of the Hamilton-Jacobi method, is proposed and applied to a bulk theory of gravity interacting with a scalar field and a U(1) gauge field in the Stueckelberg formalism. We describe how the power divergences are obtained as solutions of a set of "descent equations" stemming from the radial Hamiltonian constraint of the theory. In addition, we isolate the logarithmic divergences, which are closely related to anomalies. The method allows to determine also the exact one-point functions of the dual field theory. Using the other Hamiltonian constraints of the bulk theory, we derive the Ward identities for diffeomorphisms and gauge invariance. In particular, we demonstrate the breaking of U(1)_R current conservation, recovering the holographic chiral anomaly recently discussed in hep-th/0112119 and hep-th/0202056. LANL EDS SIS LANLPUBL2004 SIS:2004 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE LANL EDS High Energy Physics - Theory Mück, W Martelli, Dario Mueck, Wolfgang 248-276 Nucl. Phys. B 654 2003 http://cdsware.cern.ch/download/invenio-demo-site-files/0205061.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0205061.ps.gz d.martelli@qmul.ac.uk n 200219 13 20060823 0005 CER01 20020508 PUBLIC 002307939CER ARTICLE [1] J. M. Maldacena, Adv. Theor. Math. Phys. 2 (1998) 231 hep-th/9711200 [2] S. S. Gubser, I. R. Klebanov and A. M. Polyakov, Phys. Lett. B 428 (1998) 105 hep-th/9802109 [3] E. Witten, Adv. Theor. Math. Phys. 2 (1998) 253 hep-th/9802150 [4] E. D’Hoker and D. Z. Freedman, hep-th/0201253 [5] W. Mück and K. S. Viswanathan, Phys. Rev. D 58 (1998) 041901 hep-th/9804035 [6] D. Z. Freedman, S. D. Mathur, A. Matusis and L. Rastelli, Nucl. Phys. B 546 (1998) 96 hep-th/9812032 [7] H. Liu and Astron. Astrophys. Tseytlin, Nucl. Phys. B 533 (1998) 88 hep-th/9804083 [8] M. Henningson and K. Skenderis, J. High Energy Phys. 07 (1998) 023 hep-th/9806087 [9] J. D. Brown and J. W. York, Phys. Rev. D 47 (1993) 1407 [10] B. Balasubramanian and P. Kraus, Commun. Math. Phys. 208 (1999) 413 hep-th/9902121 [11] R. C. Myers, Phys. Rev. D 60 (1999) 046002 hep-th/9903203 [12] R. Emparan, C. V. Johnson and R. C. Myers, Phys. Rev. D p. 104001 (1999), hep-th/9903238 [13] S. de Haro, K. Skenderis and S. N. Solodukhin, Commun. Math. Phys. 217 (2000) 595 hep-th/0002230 [14] M. Bianchi, D. Z. Freedman and K. Skenderis, hep-th/0112119 [15] M. Bianchi, D. Z. Freedman and K. Skenderis, J. High Energy Phys. 08 (2001) 041 hep-th/0105276 [16] J. de Boer, E. Verlinde and H. Verlinde, J. High Energy Phys. 08 (2000) 003 hep-th/9912012 [17] J. Kalkkinen, D. Martelli and W. Mück, J. High Energy Phys. 04 (2001) 036 hep-th/0103111 [18] S. Corley, Phys. Lett. B 484 (2000) 141 hep-th/0004030 [19] J. Kalkkinen and D. Martelli, Nucl. Phys. B 596 (2001) 415 hep-th/0007234 [20] M. Bianchi, O. DeWolfe, D. Z. Freedman and K. Pilch, J. High Energy Phys. 01 (2001) 021 hep-th/0009156 [21] I. R. Klebanov, P. Ouyang and E. Witten, Phys. Rev. D 65 (2002) 105007 hep-th/0202056 [22] C. Fefferman and C. R. Graham, in Elie Cartan et les Mathématiques d’aujour d’hui, Astérique, p. 95 (1985). [23] D. Martelli and A. Miemic, J. High Energy Phys. 04 (2002) 027 hep-th/0112150 [24] S. Ferrara and A. Zaffaroni, hep-th/9908163 [25] J. Parry, D. S. Salopek and J. M. Stewart, Phys. Rev. D 49 (1994) 2872 gr-qc/9310020 [26] B. Darian, Class. Quantum Gravity 15 (1998) 143 gr-qc/9707046 [27] V. L. Campos, G. Ferretti, H. Larsson, D. Martelli and B. E. W. Nilsson, J. High Energy Phys. 0006 (2000) 023 hep-th/0003151 [28] L. Girardello, M. Petrini, M. Porrati and A. Zaffaroni, Nucl. Phys. B 569 (2000) 451 hep-th/9909047 [29] W. Mück, hep-th/0201100 [30] W. Mück and K. S. Viswanathan, Phys. Rev. D 58 (1998) 106006 hep-th/9805145 [31] M. M. Taylor-Robinson, hep-th/0002125 [32] C. W. Misner, K. S. Thorne and J. A. Wheeler, Gravitation, Freeman, San Francisco (1973). CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181361227-0-29-24-0-2 SzGeCERN 2327507CERCER SLAC 5004500 hep-th/0207111 eng BROWN-HEP-1309 Ramgoolam, S Brown University Higher dimensional geometries related to fuzzy odd-dimensional spheres 2002 Providence, RI Brown Univ. 11 Jul 2002 32 p We study $SO(m)$ covariant Matrix realizations of $ \sum_{i=1}^{m} X_i^2 = 1 $ for even $m$ as candidate fuzzy odd spheres following hep-th/0101001. As for the fuzzy four sphere, these Matrix algebras contain more degrees of freedom than the sphere itself and the full set of variables has a geometrical description in terms of a higher dimensional coset. The fuzzy $S^{2k-1} $ is related to a higher dimensional coset $ {SO(2k) \over U(1) \times U(k-1)}$. These cosets are bundles where base and fibre are hermitian symmetric spaces. The detailed form of the generators and relations for the Matrix algebras related to the fuzzy three-spheres suggests Matrix actions which admit the fuzzy spheres as solutions. These Matrix actions are compared with the BFSS, IKKT and BMN Matrix models as well as some others. The geometry and combinatorics of fuzzy odd spheres lead to some remarks on the transverse five-brane problem of Matrix theories and the exotic scaling of the entropy of 5-branes with the brane number. LANL EDS SIS:2003 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE LANL EDS High Energy Physics - Theory Ramgoolam, Sanjaye 064 J. High Energy Phys. 10 2002 http://cdsware.cern.ch/download/invenio-demo-site-files/0207111.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0207111.ps.gz ramgosk@het.brown.edu n 200228 13 20070205 2036 CER01 20020712 PUBLIC 002327507CER ARTICLE [1] D. Kabat and W. Taylor, "Spherical membranes in Matrix theory," Adv. Theor. Math. Phys. 2 (1998) 181 hep-th/9711078 [2] J.Castelino, S. Lee and W. Taylor IV, "Longitudinal Five-Branes Ann. Sci. Four Spheres in Matrix Theory," Nucl. Phys. B 526 (1998) 334 hep-th/9712105 [3] R. Myers, "Dielectric-Branes," hep-th/9910053 [4] N. Constable, R. Myers, O. Tafjord, "Non-abelian Brane intersections, " J. High Energy Phys. 0106 (2001) 023 hep-th/0102080 [5] D. Berenstein, J. Maldacena, H. Nastase "Strings in flat space and pp waves from N = 4 Super Yang Mills," J. High Energy Phys. 0204 (2002) 013 hep-th/0202021 [6] J. Maldacena, A. Strominger, "AdS3 Black Holes and a Stringy Exclusion Principle," hep-th/980408, J. High Energy Phys. 9812 (1998) 005 [7] A. Jevicki, S. Ramgoolam, "Non commutative gravity from the ADS/CFT correspon-dence," J. High Energy Phys. 9904 (1999) 032 hep-th/9902059 [8] P.M. Ho, M. Li, "Fuzzy Spheres in AdS/CFT Correspondence and Holography from Noncommutativity," Nucl. Phys. B 596 (2001) 259 hep-th/0004072 [9] M. Berkooz, H. Verlinde "Matrix Theory, AdS/CFT and Higgs-Coulomb Equiva-lence," J. High Energy Phys. 9911 (1999) 037 hep-th/9907100 [10] Z. Guralnik, S. Ramgoolam "On the Polarization of Unstable D0-Branes into Non-Commutative Odd Spheres," J. High Energy Phys. 0102 (2001) 032 hep-th/0101001 [11] S. Ramgoolam, " On spherical harmonics for fuzzy spheres in diverse dimensions, " Nucl. Phys. B 610 (2001) 461 hep-th/0105006 [12] P.M. Ho, S. Ramgoolam, "Higher dimensional geometries from matrix brane construc-tions," Nucl. Phys. B 627 (2002) 266 hep-th/0111278 [13] Y. Kimura "Noncommutative Gauge Theory on Fuzzy Four-Sphere and Matrix Model," hep-th/0204256 [14] S.C Zhang, J. Hu "A Four Dimensional Generalization of the Quantum Hall Effect," Science 294 (2001) 823 cond-mat/0110572 [15] M. Fabinger, "Higher-Dimensional Quantum Hall Effect in String Theory," J. High Energy Phys. 0205 (2002) 037 hep-th/0201016 [16] A.P. Balachandran "Quantum Spacetimes in the Year 1," hep-th/0203259 [17] A. Salam, J. Strathdee, "On Kaluza-Klein Theory," Ann. Phys. 141, 1982, 216 [18] N.L. Wallach, "Harmonic Analysis on homogeneous spaces," M. Drekker Inc. NY 1973 [19] Y. Kazama, H. Suzuki, "New N = 2 superconformal field theories and superstring compactification" Nucl. Phys. B 321 (1989) 232 [20] M. Kramer, " Some remarks suggesting an interesting theory of harmonic functions on SU(2n + 1)/Sp(n) and SO(2n + 1)/U(n)," Arch. Math. 33 ( 1979/80), 76-79. [21] P.M. Ho, "Fuzzy sphere from Matrix model," J. High Energy Phys. 0012 (2000) 015 hep-th/0110165 [22] T. Banks, W. Fischler, S. Shenker, L. Susskind, "M-Theory Ann. Sci. a Matrix model A conjecture," Phys. Rev. D 55 (1997) 5112 hep-th/9610043 [23] N. Ishibashi, H. Kawai, Y. Kitazawa, A. Tsuchiya, " A large-N reduced model Ann. Sci. Superstring, " Nucl. Phys. B 498 (1997) 467 [24] V. Periwal, "Matrices on a point Ann. Sci. the theory of everything," Phys. Rev. D 55 (1997) 1711 [25] S. Chaudhuri, "Bosonic Matrix Theory and D-branes," hep-th/0205306 [26] M. Bagnoud, L. Carlevaro, A. Bilal, "Supermatrix models for M-theory based on osp(1—32,R)," hep-th/0201183 [27] L. Smolin, "M theory Ann. Sci. a matrix extension of Chern Simons theory," Nucl. Phys. B 591 (2000) 227 hep-th/0002009 [28] I. Bandos, J. Lukierski, "New superparticle models outside the HLS suersymmetry scheme," hep-th/9812074 [29] S.Iso, Y.Kimura, K.Tanaka, K. Wakatsuki, "Noncommutative Gauge Theory on Fuzzy Sphere from Matrix Model," hep-th/0101102 [30] W. Fulton and G. Harris, "Representation theory," Springer Verlag 1991. [31] M. Atiyah and E. Witten, "M-Theory Dynamics On A Manifold Of G2 Holonomy," hep-th/0107177 [32] S. Ramgoolam, D. Waldram, "Zero branes on a compact orbifold," J. High Energy Phys. 9807 (1998) 009 hep-th/9805191 [33] Brian R. Greene, C.I. Lazaroiu, Piljin Yi " D Particles on T4 /Z(N) Orbifolds and their resolutions," Nucl. Phys. B 539 (1999) 135 hep-th/9807040 [34] I. Klebanov, A. Tseytlin, "Entropy of Near-Extremal Black p-branes," Nucl. Phys. B 475 (1996) 164 hep-th/9604089 CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181363461-0-26-22-0-4 SzGeCERN 2341644CERCER SLAC 5208424 hep-th/0209226 eng PUTP-2002-48 SLAC-PUB-9504 SU-ITP-2002-36 Adams, A Stanford University Decapitating Tadpoles 2002 Beijing Beijing Univ. Dept. Phys. 26 Sep 2002 31 p We argue that perturbative quantum field theory and string theory can be consistently modified in the infrared to eliminate, in a radiatively stable manner, tadpole instabilities that arise after supersymmetry breaking. This is achieved by deforming the propagators of classically massless scalar fields and the graviton so as to cancel the contribution of their zero modes. In string theory, this modification of propagators is accomplished by perturbatively deforming the world-sheet action with bi-local operators similar to those that arise in double-trace deformations of AdS/CFT. This results in a perturbatively finite and unitary S-matrix (in the case of string theory, this claim depends on standard assumptions about unitarity in covariant string diagrammatics). The S-matrix is parameterized by arbitrary scalar VEVs, which exacerbates the vacuum degeneracy problem. However, for generic values of these parameters, quantum effects produce masses for the nonzero modes of the scalars, lifting the fluctuating components of the moduli. LANL EDS SzGeCERN Particle Physics - Theory PREPRINT LANL EDS High Energy Physics - Theory McGreevy, J Silverstein, E Adams, Allan Greevy, John Mc Silverstein, Eva http://cdsware.cern.ch/download/invenio-demo-site-files/0209226.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0209226.ps.gz evas@slac.stanford.edu n 200239 11 20060218 0013 CER01 20020927 PUBLIC 002341644CER PREPRINT [1] W. Fischler and L. Susskind, "Dilaton Tadpoles, String Condensates And Scale In-variance," Phys. Lett. B 171 (1986) 383 [2] W. Fischler and L. Susskind, "Dilaton Tadpoles, String Condensates And Scale In-variance. 2," Phys. Lett. B 173 (1986) 262 [3] C. G. Callan, C. Lovelace, C. R. Nappi and S. A. Yost, "Loop Corrections To Super-string Equations Of Motion," Nucl. Phys. B 308 (1988) 221 [4] H. Ooguri and N. Sakai, "String Multiloop Corrections To Equations Of Motion," Nucl. Phys. B 312 (1989) 435 [5] J. Polchinski, "Factorization Of Bosonic String Amplitudes," Nucl. Phys. B 307 (1988) 61 [6] H. La and P. Nelson, "Effective Field Equations For Fermionic Strings," Nucl. Phys. B 332 (1990) 83 [7] O. Aharony, M. Berkooz and E. Silverstein, "Multiple-trace operators and non-local string theories," J. High Energy Phys. 0108 (2001) 006 hep-th/0105309 [8] O. Aharony, M. Berkooz and E. Silverstein, "Non-local string theories on AdS3 × S3 and stable non-supersymmetric backgrounds," Phys. Rev. D 65 (2002) 106007 hep-th/0112178 [9] N. Arkani-Hamed, S. Dimopoulos, G. Dvali, G. Gabadadze, to appear. [10] E. Witten, "Strong Coupling Expansion Of Calabi-Yau Compactification," Nucl. Phys. B 471 (1996) 135 hep-th/9602070 [11] O. Aharony and T. Banks, "Note on the Quantum Mech. of M theory," J. High Energy Phys. 9903 (1999) 016 hep-th/9812237 [12] T. Banks, "On isolated vacua and background independence," arXiv hep-th/0011255 [13] R. Bousso and J. Polchinski, "Quantization of four-form fluxes and dynamical neutral-ization of the cosmological constant," J. High Energy Phys. 0006 (2000) 006 hep-th/0004134 [14] S. B. Giddings, S. Kachru and J. Polchinski, "Hierarchies from fluxes in string com-pactifications," arXiv hep-th/0105097 [15] A. Maloney, E. Silverstein and A. Strominger, "De Sitter space in noncritical string theory," arXiv hep-th/0205316 [16] S. Kachru and E. Silverstein, "4d conformal theories and strings on orbifolds," Phys. Rev. Lett. 80 (1998) 4855 hep-th/9802183 [17] A. E. Lawrence, N. Nekrasov and C. Vafa, "On conformal field theories in four di-mensions," Nucl. Phys. B 533 (1998) 199 hep-th/9803015 [18] M. Bershadsky, Z. Kakushadze and C. Vafa, "String expansion Ann. Sci. large N expansion of gauge theories," Nucl. Phys. B 523 (1998) 59 hep-th/9803076 [19] I. R. Klebanov and Astron. Astrophys. Tseytlin, "A non-supersymmetric large N CFT from type 0 string theory," J. High Energy Phys. 9903 (1999) 015 hep-th/9901101 [20] E. Witten, "Multi-trace operators, boundary conditions, and AdS/CFT correspon-dence," arXiv hep-th/0112258 [21] M. Berkooz, A. Sever and A. Shomer, "Double-trace deformations, boundary condi-tions and spacetime singularities," J. High Energy Phys. 0205 (2002) 034 hep-th/0112264 [22] A. Adams and E. Silverstein, "Closed string tachyons, AdS/CFT, and large N QCD," Phys. Rev. D 64 (2001) 086001 hep-th/0103220 [23] Astron. Astrophys. Tseytlin and K. Zarembo, "Effective potential in non-supersymmetric SU(N) x SU(N) gauge theory and interactions of type 0 D3-branes," Phys. Lett. B 457 (1999) 77 hep-th/9902095 [24] M. Strassler, to appear [25] V. Balasubramanian and P. Kraus, "A stress tensor for anti-de Sitter gravity," Commun. Math. Phys. 208 (1999) 413 hep-th/9902121 [26] S. Thomas, in progress. [27] O. Aharony, M. Fabinger, G. T. Horowitz and E. Silverstein, "Clean time-dependent string backgrounds from bubble baths," J. High Energy Phys. 0207 (2002) 007 hep-th/0204158 [28] G. Dvali, G. Gabadadze and M. Shifman, "Diluting cosmological constant in infinite volume extra dimensions," arXiv hep-th/0202174 [29] D. Friedan, "A tentative theory of large distance Physics," arXiv hep-th/0204131 [30] G. Dvali, G. Gabadadze and M. Shifman, "Diluting cosmological constant via large distance modification of gravity," arXiv hep-th/0208096 [31] J. W. Moffat, arXiv hep-th/0207198 [32] Astron. Astrophys. Tseytlin, "On ’Macroscopic String’ Approximation In String Theory," Phys. Lett. B 251 (1990) 530 [33] B. Zwiebach, "Closed string field theory Quantum action and the B-V master equa-tion," Nucl. Phys. B 390 (1993) 33 hep-th/9206084 [34] J. Polchinski, "String Theory. Vol. 1 An Introduction To The Bosonic String," Cam-bridge, UK Univ. Phys. Rev. (1998) 402 p. [35] S. Kachru, X. Liu, M. B. Schulz and S. P. Trivedi, "Supersymmetry changing bubbles in string theory," arXiv hep-th/0205108 [36] A. R. Frey and J. Polchinski, "N = 3 warped compactifications," Phys. Rev. D 65 (2002) 126009 hep-th/0201029 [37] A. Adams, O. Aharony, J. McGreevy, E. Silverstein,..., work in progress CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181365384-0-25-23-0-5 SzGeCERN 2342206CERCER SLAC 5224543 hep-th/0209257 eng Berkooz, M The Weizmann Inst. of Science Double Trace Deformations, Infinite Extra Dimensions and Supersymmetry Breaking 2002 29 Sep 2002 22 p It was recently shown how to break supersymmetry in certain $AdS_3$ spaces, without destabilizing the background, by using a ``double trace'' deformation which localizes on the boundary of space-time. By viewing spatial sections of $AdS_3$ as a compactification space, one can convert this into a SUSY breaking mechanism which exists uniformly throughout a large 3+1 dimensional space-time, without generating any dangerous tadpoles. This is a generalization of a Visser type infinite extra dimensions compactification. Although the model is not Lorentz invariant, the dispersion relation is relativistic at high enough momenta, and it can be arranged such that at the same kinematical regime the energy difference between between former members of a SUSY multiplet is large. LANL EDS SzGeCERN Particle Physics - Theory PREPRINT LANL EDS High Energy Physics - Theory Berkooz, Micha http://cdsware.cern.ch/download/invenio-demo-site-files/0209257.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0209257.ps.gz berkooz@wisemail.weizmann.ac.il n 200240 11 20060603 0013 CER01 20021001 PUBLIC 002342206CER PREPRINT [1] T. Banks, "Cosmological Breaking of Supersymmetry ? Or Little Lambda Goes Back to the Future 2.", hep-th/0007146 [2] J. Brown and C. Teitelboim, Phys. Lett. B 195 (1987) 177 [2] Nucl. Phys. B 297 (1988) 787 [2] R. Bousso and J. Polchinski, "Quantization of Four-form Fluxes and Dynami-cal Neutralization of the Cosmological Constant", J. High Energy Phys. 0006 (2000) 006 hep-th/0004134 [2] J.L. Feng, J. March-Russell, S. Sethi and F. Wilczek, "Saltatory Relaxation of the Cosmological Constant", Nucl. Phys. B 602 (2001) 307 hep-th/0005276 [3] E. Witten, "Strong Coupling and the Cosmological Constant", Mod. Phys. Lett. A 10 (1995) 2153 hep-th/9506101 [4] A. Maloney, E. Silverstein and A. Strominger "de Sitter Space in Non-Critical String Theory", hep-th/0205316 [4] , Hawking Festschrift. [5] S. Kachru and E. Silverstein, "On Vanishing Two Loop Cosmological Constant in Nonsupersymmetric Strings", J. High Energy Phys. 9901 (1999) 004 hep-th/9810129 [6] S. Kachru, M. Schulz and E. Silverstein, "Self-tuning flat domain walls in 5d gravity and string theory", Phys. Rev. D 62 (2000) 045021 hep-th/0001206 [7] V.A. Rubakov and M.E. Shaposhnikov, "Extra Space-time Dimensions Towards a Solution to the Cosmological Constant Problem", Phys. Lett. B 125 (1983) 139 [8] G. Dvali, G. Gabadadze and M. Shifman, "Diluting Cosmological Constant In Infinite Volume Extra", hep-th/0202174 [9] G.W. Moore, "Atkin-Lehner Symmetry", Nucl. Phys. B 293 (1987) 139 [9] Erratum- Nucl. Phys. B 299 (1988) 847 [10] By K. Akama, "Pregeometry", Lect. Notes Phys. 176 (1982) 267 hep-th/0001113 [10] Also in *Nara 1982, Proceedings, Gauge Theory and Gravitation*, 267-271. [11] M. Visser, "An Exotic Class of Kaluza-Klein Models", Phys. Lett. B 159 (1985) 22 hep-th/9910093 [12] L. Randall and R. Sundrum, "An Alternative to Compactification", Phys. Rev. Lett. 83 (1999) 4690 hep-th/9906064 [13] A. Adams and E. Silverstein, "Closed String Tachyons, AdS/CFT and Large N QCD", Phys. Rev. D 64 (2001) 086001 hep-th/0103220 [14] O. Aharony, M. Berkooz and E. Silverstein, "Multiple-Trace Operators and Non-Local String Theories", J. High Energy Phys. 0108 (2001) 006 hep-th/0105309 [15] O. Aharony, M. Berkooz and E. Silverstein, "Non-local String Theories on AdS3 × S3 and non-supersymmetric backgrounds", Phys. Rev. D 65 (2002) 106007 hep-th/0112178 [16] M. Berkooz, A. Sever and A. Shomer, "Double-trace Deformations, Boundary Condi-tions and Space-time Singularities", J. High Energy Phys. 0205 (2002) 034 hep-th/0112264 [17] E. Witten, "Multi-Trace Operators, Boundary Conditions, And AdS/CFT Correspon-dence", hep-th/0112258 [18] A. Sever and A. Shomer, "A Note on Multi-trace Deformations and AdS/CFT", J. High Energy Phys. 0207 (2002) 027 hep-th/0203168 [19] J. Maldacena, "The large N limit of superconformal field theories and supergravity," Adv. Theor. Math. Phys. 2 (1998) 231 hep-th/9711200 [19] Int. J. Theor. Phys. 38 (1998) 1113 [20] E. Witten, "Anti-de Sitter space and holography," Adv. Theor. Math. Phys. 2 (1998) 253 hep-th/9802150 [21] S. S. Gubser, I. R. Klebanov and A. M. Polyakov, "Gauge theory correlators from non-critical string theory," hep-th/980210, Phys. Lett. B 428 (1998) 105 [22] O. Aharony, S.S. Gubser, J. Maldacena, H. Ooguri and Y. Oz, "Large N Field Theories, String Theory and Gravity", Phys. Rep. 323 (2000) 183 hep-th/9905111 [23] A. Giveon, D. Kutasov and N. Seiberg, "Comments on string theory on AdS3," he-th/9806194, Adv. Theor. Math. Phys. 2 (1998) 733 [24] J. Maldacena, J. Michelson and A. Strominger, "Anti-de Sitter Fragmentation", J. High Energy Phys. 9902 (1999) 011 hep-th/9812073 [25] N. Seiberg and E. Witten, "The D1/D5 System And Singular CFT", J. High Energy Phys. 9904 (1999) 017 hep-th/9903224 [26] J. Maldacena and H. Ooguri, "Strings in AdS3 and the SL(2, R) WZW Model. Part 1 The Spectrum", J. Math. Phys. 42 (2001) 2929 hep-th/0001053 [27] I. R. Klebanov and E. Witten, "AdS/CFT correspondence and Symmetry breaking," Nucl. Phys. B 556 (1999) 89 hep-th/9905104 [28] R. Kallosh, A.D. Linde, S. Prokushkin and M. Shmakova, "Gauged Supergravities, de Sitter space and Cosmology", Phys. Rev. D 65 (2002) 105016 hep-th/0110089 [29] R. Kallosh, "Supergravity, M-Theory and Cosmology", hep-th/0205315 [30] R. Kallosh, A.D. Linde, S. Prokushkin and M. Shmakova, "Supergravity, Dark Energy and the Fate of the Universe", hep-th/0208156 [31] C.M. Hull and N.P. Warner, "Non-compact Gauging from Higher Dimensions", Class. Quantum Gravity 5 (1988) 1517 [32] P. Kraus and E.T. Tomboulis "Title Photons and Gravitons Ann. Sci. Goldstone Bosons, and the Cosmological Constant", Phys. Rev. D 66 (2002) 045015 hep-th/0203221 [33] M. Berkooz and S.-J. Rey, "Non-Supersymmetric Stable Vacua of M-Theory", J. High Energy Phys. 9901 (1999) 014 hep-th/9807200 [34] A. Adams, J. McGreevy and E. Silverstein, "Decapitating Tadpoles", hep-th/0209226 [35] N. Arkani-Hamed, S. Dimopoulos, G. Dvali and G. Gabadadze, "Non-Local Modifi-cation of Gravity and the Cosmological Constant Problem", hep-th/0209227 [36] V. Balasubramanian, P. Kraus and A. Lawrence "Bulk vs. Boundary Dynamics in Anti-de Sitter Space-time" Phys. Rev. D 59 (1999) 046003 hep-th/9805171 [37] H. Verlinde, "Holography and Compactification", Nucl. Phys. B 580 (2000) 264 hep-th/9906182 [38] S.B. Giddings, S. Kachru and J. Polchinski, "Hierarchies from Fluxes in String Com-pactifications", hep-th/0105097 [39] G. Dvali, G. Gabadadze and M. Shifman, "Diluting Cosmological Constant via Large Distance Modification of Gravity" hep-th/0208096 [40] D. Gepner, "Lectures on N=2 String Theory", In Superstrings 89, The Trieste Spring School, 1989. [41] R.G. Leigh, "Dirac-Born-Infeld Action from Dirichlet SIGMA, Symmetry Integrability Geom. Methods Appl. Model", Mod. Phys. Lett. A 4 (1989) 2767 [42] J. Bagger and A. Galperin "Linear and Non-linear Supersymmetries", hep-th/9810109 [42] , *Dubna 1997, Supersymmetries and quantum symmetries* 3-20. [43] A, Giveon and M. Rocek, "Supersymmetric String Vacua on AdS3 × N ", hep-th/9904024 [44] E.J. Martinec and W. McElgin, "String Theory on AdS Orbifolds" J. High Energy Phys. 0204 (2002) 029 hep-th/0106171 [45] E.J. Martinec and W. McElgin, "Exciting AdS Orbifolds", hep-th/0206175 [46] V. Balasubramanian, J. de Boer, E. Keski-Vakkuri and S.F. Ross, "Supersymmetric Conical Defects", Phys. Rev. D 64 (2001) 064011 hep-th/0011217 CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181365450-0-40-37-0-4 SzGeCERN CERCER 2344398 SLAC 5256739 hep-th/0210075 eng SISSA-2002-64-EP Borunda, M INFN On the quantum stability of IIB orbifolds and orientifolds with Scherk-Schwarz SUSY breaking 2003 Trieste Scuola Int. Sup. Studi Avan. 8 Oct 2002 26 p We study the quantum stability of Type IIB orbifold and orientifold string models in various dimensions, including Melvin backgrounds, where supersymmetry (SUSY) is broken {\it \`a la} Scherk-Schwarz (SS) by twisting periodicity conditions along a circle of radius R. In particular, we compute the R-dependence of the one-loop induced vacuum energy density $\rho(R)$, or cosmological constant. For SS twists different from Z2 we always find, for both orbifolds and orientifolds, a monotonic $\rho(R)<0$, eventually driving the system to a tachyonic instability. For Z2 twists, orientifold models can have a different behavior, leading either to a runaway decompactification limit or to a negative minimum at a finite value R_0. The last possibility is obtained for a 4D chiral orientifold model where a more accurate but yet preliminary analysis seems to indicate that $R_0\to \infty$ or towards the tachyonic instability, as the dependence on the other geometric moduli is included. LANL EDS SIS LANLPUBL2003 SIS:2003 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE LANL EDS High Energy Physics - Theory Serone, M Trapletti, M 85-108 Nucl. Phys. B 653 2003 http://cdsware.cern.ch/download/invenio-demo-site-files/0210075.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0210075.ps.gz serone@he.sissa.it n 200241 13 20060823 0006 CER01 20021009 PUBLIC 002344398CER ARTICLE [1] J. Scherk and J. H. Schwarz, Phys. Lett. B 82 (1979) 60 [1] Nucl. Phys. B 153 (1979) 61 [2] R. Rohm, Nucl. Phys. B 237 (1984) 553 [3] H. Itoyama and T.R. Taylor, Phys. Lett. B 186 (1987) 129 [4] C. Kounnas and M. Porrati, Nucl. Phys. B 310 (1988) 355 [4] S. Ferrara, C. Kounnas, M. Porrati and F. Zwirner, Nucl. Phys. B 318 (1989) 75 [4] C. Kounnas and B. Rostand, Nucl. Phys. B 341 (1990) 641 [4] I. Antoniadis and C. Kounnas, Phys. Lett. B 261 (1991) 369 [4] E. Kiritsis and C. Kounnas, Nucl. Phys. B 503 (1997) 117 hep-th/9703059 [5] I. Antoniadis, Phys. Lett. B 246 (1990) 377 [6] C. A. Scrucca and M. Serone, J. High Energy Phys. 0110 (2001) 017 hep-th/0107159 [7] I. Antoniadis, E. Dudas and A. Sagnotti, Nucl. Phys. B 544 (1999) 469 hep-th/9807011 [8] I. Antoniadis, G. D’Appollonio, E. Dudas and A. Sagnotti, Nucl. Phys. B 553 (1999) 133 hep-th/9812118 [8] Nucl. Phys. B 565 (2000) 123 hep-th/9907184 [8] I. Antoniadis, K. Benakli and A. Laugier, hep-th/0111209 [9] C. A. Scrucca, M. Serone and M. Trapletti, Nucl. Phys. B 635 (2002) 33 hep-th/0203190 [10] J. D. Blum and K. R. Dienes, Nucl. Phys. B 516 (1998) 83 hep-th/9707160 [11] M. Fabinger and P. Horava, Nucl. Phys. B 580 (2000) 243 hep-th/0002073 [12] P. Ginsparg and C. Vafa, Nucl. Phys. B 289 (1987) 414 [13] M. A. Melvin, Phys. Lett. 8 (1964) 65 [13] G. W. Gibbons and K. i. Maeda, Nucl. Phys. B 298 (1988) 741 [13] F. Dowker, J. P. Gauntlett, D. A. Kastor and J. Traschen, Phys. Rev. D 49 (1994) 2909 hep-th/9309075 [14] A. Adams, J. Polchinski and E. Silverstein, J. High Energy Phys. 0110 (2001) 029 hep-th/0108075 [15] J. R. David, M. Gutperle, M. Headrick and S. Minwalla, J. High Energy Phys. 0202 (2002) 041 hep-th/0111212 [16] T. Suyama, J. High Energy Phys. 0207 (2002) 015 hep-th/0110077 [17] C. Vafa, arXiv hep-th/0111051 [18] G. Aldazabal, A. Font, L. E. Ibanez and G. Violero, Nucl. Phys. B 536 (1998) 29 hep-th/9804026 [19] K. H. O’Brien and C. I. Tan, Phys. Rev. D 36 (1987) 1184 [20] J. Polchinski, Commun. Math. Phys. 104 (1986) 37 [21] D. M. Ghilencea, H. P. Nilles and S. Stieberger, arXiv hep-th/0108183 [22] P. Mayr and S. Stieberger, Nucl. Phys. B 407 (1993) 725 hep-th/9303017 [23] E. Alvarez, Nucl. Phys. B 269 (1986) 596 [24] J. G. Russo and Astron. Astrophys. Tseytlin, J. High Energy Phys. 0111 (2001) 065 hep-th/0110107 [24] Nucl. Phys. B 611 (2001) 93 hep-th/0104238 [24] A. Dabholkar, Nucl. Phys. B 639 (2002) 331 hep-th/0109019 [24] M. Gutperle and A. Strominger, J. High Energy Phys. 0106 (2001) 035 hep-th/0104136 [24] M. S. Costa and M. Gutperle, J. High Energy Phys. 0103 (2001) 027 hep-th/0012072 [25] E. Dudas and J. Mourad, Nucl. Phys. B 622 (2002) 46 hep-th/0110186 [25] T. Takayanagi and T. Uesugi, J. High Energy Phys. 0111 (2001) 036 hep-th/0110200 [25] Phys. Lett. B 528 (2002) 156 hep-th/0112199 [25] C. Angelantonj, E. Dudas and J. Mourad, Nucl. Phys. B 637 (2002) 59 hep-th/0205096 [26] M. Trapletti, in preparation. [27] A. Adams, J. McGreevy and E. Silverstein, arXiv hep-th/0209226 [28] E. Witten, Nucl. Phys. B 195 (1982) 481 CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181365734-0-27-39-0-1 SzGeCERN 2355566CERCER SLAC 5419166 hep-th/0212138 eng PUPT-2069 Gubser, S S Princeton University A universal result on central charges in the presence of double-trace deformations 2003 Princeton, NJ Princeton Univ. Joseph-Henry Lab. Phys. 12 Dec 2002 15 p We study large N conformal field theories perturbed by relevant double-trace deformations. Using the auxiliary field trick, or Hubbard-Stratonovich transformation, we show that in the infrared the theory flows to another CFT. The generating functionals of planar correlators in the ultraviolet and infrared CFT's are shown to be related by a Legendre transform. Our main result is a universal expression for the difference of the scale anomalies between the ultraviolet and infrared fixed points, which is of order 1 in the large N expansion. Our computations are entirely field theoretic, and the results are shown to agree with predictions from AdS/CFT. We also remark that a certain two-point function can be computed for all energy scales on both sides of the duality, with full agreement between the two and no scheme dependence. LANL EDS SIS LANLPUBL2004 SIS:2004 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE LANL EDS High Energy Physics - Theory Klebanov, Igor R Gubser, Steven S. Klebanov, Igor R. 23-36 Nucl. Phys. B 656 2003 http://cdsware.cern.ch/download/invenio-demo-site-files/0212138.ps.gz http://cdsware.cern.ch/download/invenio-demo-site-files/0212138.pdf ssgubser@Princeton.EDU n 200250 13 20060823 0007 CER01 20021213 PUBLIC 002355566CER ARTICLE CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181367639-4-0-0-0-0 SzGeCERN 2356302CERCER SLAC 5423422 hep-th/0212181 eng Girardello, L INFN Universita di Milano-Bicocca 3-D Interacting CFTs and Generalized Higgs Phenomenon in Higher Spin Theories on AdS 2003 16 Dec 2002 8 p We study a duality, recently conjectured by Klebanov and Polyakov, between higher-spin theories on AdS_4 and O(N) vector models in 3-d. These theories are free in the UV and interacting in the IR. At the UV fixed point, the O(N) model has an infinite number of higher-spin conserved currents. In the IR, these currents are no longer conserved for spin s>2. In this paper, we show that the dual interpretation of this fact is that all fields of spin s>2 in AdS_4 become massive by a Higgs mechanism, that leaves the spin-2 field massless. We identify the Higgs field and show how it relates to the RG flow connecting the two CFTs, which is induced by a double trace deformation. LANL EDS SIS LANLPUBL2004 SIS:2004 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE LANL EDS High Energy Physics - Theory Porrati, Massimo Zaffaroni, A 289-293 Phys. Lett. B 561 2003 http://cdsware.cern.ch/download/invenio-demo-site-files/0212181.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0212181.ps.gz alberto.zaffaroni@mib.infn.it n 200251 13 20060823 0007 CER01 20021217 PUBLIC 002356302CER ARTICLE [1] D. Francia and A. Sagnotti, Phys. Lett. B 543 (2002) 303 hep-th/0207002 [1] P. Haggi-Mani and B. Sundborg, J. High Energy Phys. 0004 (2000) 031 hep-th/0002189 [1] B. Sundborg, Nucl. Phys. B, Proc. Suppl. 102 (2001) 113 hep-th/0103247 [1] E. Sezgin and P. Sundell, J. High Energy Phys. 0109 (2001) 036 hep-th/0105001 [1] A. Mikhailov, hep-th/0201019 [1] E. Sezgin and P. Sundell, Nucl. Phys. B 644 (2002) 303 hep-th/0205131 [1] E. Sezgin and P. Sundell, J. High Energy Phys. 0207 (2002) 055 hep-th/0205132 [1] J. Engquist, E. Sezgin and P. Sundell, Class. Quantum Gravity 19 (2002) 6175 hep-th/0207101 [1] M. A. Vasiliev, Int. J. Mod. Phys. D 5 (1996) 763 hep-th/9611024 [1] D. Anselmi, Nucl. Phys. B 541 (1999) 323 hep-th/9808004 [1] D. Anselmi, Class. Quantum Gravity 17 (2000) 1383 hep-th/9906167 [2] E. S. Fradkin and M. A. Vasiliev, Nucl. Phys. B 291 (1987) 141 [2] E. S. Fradkin and M. A. Vasiliev, Phys. Lett. B 189 (1987) 89 [3] I. R. Klebanov and A. M. Polyakov, Phys. Lett. B 550 (2002) 213 hep-th/0210114 [4] M. A. Vasiliev, hep-th/9910096 [5] T. Leonhardt, A. Meziane and W. Ruhl, hep-th/0211092 [6] O. Aharony, M. Berkooz and E. Silverstein, J. High Energy Phys. 0108 (2001) 006 hep-th/0105309 [7] E. Witten, hep-th/0112258 [8] M. Berkooz, A. Sever and A. Shomer J. High Energy Phys. 0205 (2002) 034 hep-th/0112264 [9] S. S. Gubser and I. Mitra, hep-th/0210093 [10] S. S. Gubser and I. R. Klebanov, hep-th/0212138 [11] M. Porrati, J. High Energy Phys. 0204 (2002) 058 hep-th/0112166 [12] K. G. Wilson and J. B. Kogut, Phys. Rep. 12 (1974) 75 [13] I. R. Klebanov and E. Witten, Nucl. Phys. B 556 (1999) 89 hep-th/9905104 [14] W. Heidenreich, J. Math. Phys. 22 (1981) 1566 [15] D. Anselmi, hep-th/0210123 CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181367768-0-22-19-0-0 SzGeCERN 20041129103619.0 2357700CERCER SLAC 5435544 hep-th/0212314 eng KUNS-1817 YITP-2002-73 TAUP-2719 Fukuma, M Kyoto University Holographic Renormalization Group 2003 Kyoto Kyoto Univ. 26 Dec 2002 90 p The holographic renormalization group (RG) is reviewed in a self-contained manner. The holographic RG is based on the idea that the radial coordinate of a space-time with asymptotically AdS geometry can be identified with the RG flow parameter of the boundary field theory. After briefly discussing basic aspects of the AdS/CFT correspondence, we explain how the notion of the holographic RG comes out in the AdS/CFT correspondence. We formulate the holographic RG based on the Hamilton-Jacobi equations for bulk systems of gravity and scalar fields, as was introduced by de Boer, Verlinde and Verlinde. We then show that the equations can be solved with a derivative expansion by carefully extracting local counterterms from the generating functional of the boundary field theory. The calculational methods to obtain the Weyl anomaly and scaling dimensions are presented and applied to the RG flow from the N=4 SYM to an N=1 superconformal fixed point discovered by Leigh and Strassler. We further discuss a relation between the holographic RG and the noncritical string theory, and show that the structure of the holographic RG should persist beyond the supergravity approximation as a consequence of the renormalizability of the nonlinear sigma model action of noncritical strings. As a check, we investigate the holographic RG structure of higher-derivative gravity systems, and show that such systems can also be analyzed based on the Hamilton-Jacobi equations, and that the behaviour of bulk fields are determined solely by their boundary values. We also point out that higher-derivative gravity systems give rise to new multicritical points in the parameter space of the boundary field theories. LANL EDS SIS INIS2004 SIS LANLPUBL2004 SIS:2004 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE LANL EDS High Energy Physics - Theory Matsuura, S Sakai, T Fukuma, Masafumi Matsuura, So Sakai, Tadakatsu 489-562 Prog. Theor. Phys. 109 2003 http://cdsware.cern.ch/download/invenio-demo-site-files/0212314.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0212314.ps.gz matsu@yukawa.kyoto-u.ac.jp n 200201 13 20051024 1938 CER01 20021230 PUBLIC 002357700CER ARTICLE [1] Y. Nambu, in Symmetries and quark models, ed. R. Chand (Tordon and Breach 1970), p 269; H. Nielsen, in the 15th International Conference on High Energy Physics (Kiev 1970); L. Susskind, Nuovo Cimento A 69 (1970) 457 [2] G. ’t Hooft, "A Planar Diagram Theory For Strong Interactions," Nucl. Phys. B 72 (1974) 461 [3] K. G. Wilson, ‘Confinement of Quarks," Phys. Rev. D 10 (1974) 2445 [4] R. Gopakumar and C. Vafa, "On the gauge theory/geometry correspondence," Adv. Theor. Math. Phys. 3 (1999) 1415 hep-th/9811131 [5] J. Maldacena, "The large N limit of superconformal field theories and supergravity," Adv. Theor. Math. Phys. 2 (1998) 231 hep-th/9711200 [6] S. S. Gubser, I. R. Klebanov and A. M. Polyakov, "Gauge Theory Correlators from Non-Critical String Theory," Phys. Lett. B 428 (1998) 105 hep-th/9802109 [7] E. Witten, "Anti De Sitter Space And Holography," Adv. Theor. Math. Phys. 2 (1998) 253 hep-th/9802150 [8] O. Aharony, S. S. Gubser, J. Maldacena, H. Ooguri and Y. Oz, "Large N Field Theories, String Theory and Gravity," hep-th/9905111 [8] , and references therein. [9] G. T. Horowitz and A. Strominger, "Black Strings And P-Branes," Nucl. Phys. B 360 (1991) 197 [10] L. Susskind and E. Witten, "The holographic bound in anti-de Sitter space," hep-th/9805114 [11] E. T. Akhmedov, "A remark on the AdS/CFT correspondence and the renormaliza-tion group flow," Phys. Lett. B 442 (1998) 152 hep-th/9806217 [12] E. Alvarez and C. Gomez, "Geometric Holography, the Renormalization Group and the c-Theorem," Nucl. Phys. B 541 (1999) 441 hep-th/9807226 [13] L. Girardello, M. Petrini, M. Porrati and A. Zaffaroni, "Novel Local CFT and Exact Results on Perturbations of N=4 Super Yang Mills from AdS Dynamics," J. High Energy Phys. 12 (1998) 022 hep-th/9810126 [14] M. Porrati and A. Starinets, "RG Fixed Points in Supergravity Duals of 4-d Field Theory and Asymptotically AdS Spaces," Phys. Lett. B 454 (1999) 77 hep-th/9903085 [15] V. Balasubramanian and P. Kraus, "Spacetime and the Holographic Renormalization Group," Phys. Rev. Lett. 83 (1999) 3605 hep-th/9903190 [16] D. Z. Freedman, S. S. Gubser, K. Pilch and N. P. Warner, "Renormalization group flows from holography supersymmetry and a c-theorem," Adv. Theor. Math. Phys. 3 (1999) 363 hep-th/9904017 [17] L. Girardello, M. Petrini, M. Porrati and A. Zaffaroni "The Supergravity Dual of N=1 Super Yang-Mills Theory," Nucl. Phys. B 569 (2000) 451 hep-th/9909047 [18] K. Skenderis and P. K. Townsend, "Gravitational Stability and Renormalization-Group Flow," Phys. Lett. B 468 (1999) 46 hep-th/9909070 [19] O. DeWolfe, D. Z. Freedman, S. S. Gubser and A. Karch, "Modeling the fifth dimen-sion with scalars and gravity," Phys. Rev. D 62 (2000) 046008 hep-th/9909134 [20] V. Sahakian, "Holography, a covariant c-function and the geometry of the renormal-ization group," Phys. Rev. D 62 (2000) 126011 hep-th/9910099 [21] E. Alvarez and C. Gomez, "A comment on the holographic renormalization group and the soft dilaton theorem," Phys. Lett. B 476 (2000) 411 hep-th/0001016 [22] S. Nojiri, S. D. Odintsov and S. Zerbini, "Quantum (in)stability of dilatonic AdS backgrounds and holographic renormalization group with gravity," Phys. Rev. D 62 (2000) 064006 hep-th/0001192 [23] M. Li, "A note on relation between holographic RG equation and Polchinski’s RG equation," Nucl. Phys. B 579 (2000) 525 hep-th/0001193 [24] V. Sahakian, "Comments on D branes and the renormalization group," J. High Energy Phys. 0005 (2000) 011 hep-th/0002126 [25] O. DeWolfe and D. Z. Freedman, "Notes on fluctuations and correlation functions in holographic renormalization group flows," hep-th/0002226 [26] V. Balasubramanian, E. G. Gimon and D. Minic, "Consistency conditions for holo-graphic duality," J. High Energy Phys. 0005 (2000) 014 hep-th/0003147 [27] C. V. Johnson, K. J. Lovis and D. C. Page, "Probing some N = 1 AdS/CFT RG flows," J. High Energy Phys. 0105 (2001) 036 hep-th/0011166 [28] J. Erdmenger, "A field-theoretical interpretation of the holographic renormalization group," Phys. Rev. D 64 (2001) 085012 hep-th/0103219 [29] S. Yamaguchi, "Holographic RG flow on the defect and g-theorem," J. High Energy Phys. 0210 (2002) 002 hep-th/0207171 [30] J. de Boer, E. Verlinde and H. Verlinde, "On the Holographic Renormalization Group," hep-th/9912012 [31] M. Henningson and K. Skenderis, "The Holographic Weyl anomaly," J. High Energy Phys. 07 (1998) 023 hep-th/9806087 [32] V. Balasubramanian and P. Kraus, "A stress tensor for anti-de Sitter gravity," Commun. Math. Phys. 208 (1999) 413 hep-th/9902121 [33] S. de Haro, K. Skenderis and S. Solodukhin, "Holographic Reconstruction of Space-time and Renormalization in the AdS/CFT Correspondence," hep-th/0002230 [34] M. J. Duff, "Twenty Years of the Weyl Anomaly," Class. Quantum Gravity 11 (1994) 1387 hep-th/9308075 [35] M. Fukuma, S. Matsuura and T. Sakai, "A note on the Weyl anomaly in the holographic renormalization group," Prog. Theor. Phys. 104 (2000) 1089 hep-th/0007062 [36] M. Fukuma and T. Sakai, "Comment on ambiguities in the holographic Weyl anomaly," Mod. Phys. Lett. A 15 (2000) 1703 hep-th/0007200 [37] M. Fukuma, S. Matsuura and T. Sakai, "Higher-Derivative Gravity and the AdS/CFT Correspondence," Prog. Theor. Phys. 105 (2001) 1017 hep-th/0103187 [38] M. Fukuma and S. Matsuura, "Holographic renormalization group structure in higher-derivative gravity," Prog. Theor. Phys. 107 (2002) 1085 hep-th/0112037 [39] A. Fayyazuddin and M. Spalinski "Large N Superconformal Gauge Theories and Supergravity Orientifolds," Nucl. Phys. B 535 (1998) 219 hep-th/9805096 [39] O. Aharony, A. Fayyazuddin and J. Maldacena, "The Large N Limit of N = 1, 2 Field Theories from Three Branes in F-theory," J. High Energy Phys. 9807 (1998) 013 hep-th/9806159 [40] M. Blau, K. S. Narain and E. Gava "On Subleading Contributions to the AdS/CFT Trace Anomaly," J. High Energy Phys. 9909 (1999) 018 hep-th/9904179 [41] O. Aharony, J. Pawelczyk, S. Theisen and S. Yankielowicz, "A Note on Anomalies in the AdS/CFT correspondence," Phys. Rev. D 60 (1999) 066001 hep-th/9901134 [42] S. Corley, "A Note on Holographic Ward Identities," Phys. Lett. B 484 (2000) 141 hep-th/0004030 [43] J. Kalkkinen and D. Martelli, "Holographic renormalization group with fermions and form fields," Nucl. Phys. B 596 (2001) 415 hep-th/0007234 [44] S. Nojiri, S. D. Odintsov and S. Ogushi, "Scheme-dependence of holographic confor-mal anomaly in d5 gauged supergravity with non-trivial bulk potential," Phys. Lett. B 494 (2000) 318 hep-th/0009015 [45] N. Hambli, "On the holographic RG-flow and the low-Energy, strong coupling, large N limit," Phys. Rev. D 64 (2001) 024001 hep-th/0010054 [46] S. Nojiri, S. D. Odintsov and S. Ogushi, "Holographic renormalization group and conformal anomaly for AdS(9)/CFT(8) correspondence," Phys. Lett. B 500 (2001) 199 hep-th/0011182 [47] J. de Boer, "The holographic renormalization group," Fortschr. Phys. 49 (2001) 339 hep-th/0101026 [48] J. Kalkkinen, D. Martelli and W. Muck, "Holographic renormalisation and anoma-lies," J. High Energy Phys. 0104 (2001) 036 hep-th/0103111 [49] S. Nojiri and S. D. Odintsov, "Conformal anomaly from dS/CFT correspondence," Phys. Lett. B 519 (2001) 145 hep-th/0106191 [50] S. Nojiri and S. D. Odintsov, "Asymptotically de Sitter dilatonic space-time, holo-graphic RG flow and conformal anomaly from (dilatonic) dS/CFT correspondence," Phys. Lett. B 531 (2002) 143 hep-th/0201210 [51] R. G. Leigh and M. J. Strassler, "Exactly marginal operators and duality in four-dimensional N=1 supersymmetric gauge theory," Nucl. Phys. B 447 (1995) 95 hep-th/9503121 [52] S. Ferrara, C. Fronsdal and A. Zaffaroni, "On N = 8 supergravity on AdS(5) and N = 4 superconformal Yang-Mills theory," Nucl. Phys. B 532 (1998) 153 hep-th/9802203 [53] L. Andrianopoli and S. Ferrara, "K-K excitations on AdS(5) x S(5) Ann. Sci. N = 4 *pri-mary* superfields," Phys. Lett. B 430 (1998) 248 hep-th/9803171 [54] S. Ferrara, M. A. Lledo and A. Zaffaroni, "Born-Infeld corrections to D3 brane action in AdS(5) x S(5) and N = 4, d = 4 primary superfields," Phys. Rev. D 58 (1998) 105029 hep-th/9805082 [55] M. F. Sohnius, "Introducing Supersymmetry," Phys. Rep. 128 (1985) 39 [56] O. Aharony, M. Berkooz and E. Silverstein, "Multiple-trace operators and non-local string theories," J. High Energy Phys. 0108 (2001) 006 hep-th/0105309 [57] E. Witten, "Multi-trace operators, boundary conditions, and AdS/CFT correspon-dence," hep-th/0112258 [58] M. Berkooz, A. Sever and A. Shomer, "Double-trace deformations, boundary condi-tions and spacetime singularities," J. High Energy Phys. 0205 (2002) 034 hep-th/0112264 [59] S. Minwalla, "Restrictions imposed by superconformal invariance on quantum field theories," Adv. Theor. Math. Phys. 2 (1998) 781 hep-th/9712074 [60] M. Gunaydin, D. Minic, and M. Zagermann, "Novel supermultiplets of SU(2, 2|4) and the AdS5 / CFT4 duality," hep-th/9810226 [61] L. Andrianopoli and S. Ferrara, "K-K Excitations on AdS5 ×S5 Ann. Sci. N = 4 ‘Primary’ Superfields," Phys. Lett. B 430 (1998) 248 hep-th/9803171 [62] L. Andrianopoli and S. Ferrara, "Nonchiral’ Primary Superfields in the AdSd+1 / CFTd Correspondence," Lett. Math. Phys. 46 (1998) 265 hep-th/9807150 [63] S. Ferrara and A. Zaffaroni, "Bulk gauge fields in AdS supergravity and supersingle-tons," hep-th/9807090 [64] M. Gunaydin, D. Minic, and M. Zagermann, "4-D doubleton conformal theories, CPT and II B string on AdS5 × S5," Nucl. Phys. B 534 (1998) 96 hep-th/9806042 [65] L. Andrianopoli and S. Ferrara, "On Short and Long SU(2, 2/4) Multiplets in the AdS/CFT Correspondence," hep-th/9812067 [66] P. S. Howe, K. S. Stelle and P. K. Townsend, "Supercurrents," Nucl. Phys. B 192 (1981) 332 [67] P. S. Howe and P. C. West, "Operator product expansions in four-dimensional super-conformal field theories," Phys. Lett. B 389 (1996) 273 hep-th/9607060 [67] "Is N = 4 Yang-Mills theory soluble?," hep-th/9611074 [67] "Superconformal invariants and extended supersymmetry," Phys. Lett. B 400 (1997) 307 hep-th/9611075 [68] H. J. Kim, L. J. Romans and P. van Nieuwenhuizen, "The Mass Spectrum Of Chiral N=2 D = 10 Supergravity On S**5," Phys. Rev. D 32 (1985) 389 [69] M. Günaydin and N. Marcus, "The Spectrum Of The S**5 Compactification Of The Chiral N=2, D=10 Supergravity And The Unitary Supermultiplets Of U(2, 2/4)," Class. Quantum Gravity 2 (1985) L11 [70] V. A. Novikov, M. A. Shifman, A. I. Vainshtein and V. I. Zakharov, "Exact Gell-Mann-Low Function Of Supersymmetric Yang-Mills Theories From Instanton Cal-culus," Nucl. Phys. B 229 (1983) 381 [71] D. Anselmi, D. Z. Freedman, M. T. Grisaru and Astron. Astrophys. Johansen, "Nonperturbative formulas for central functions of supersymmetric gauge theories," Nucl. Phys. B 526 (1998) 543 hep-th/9708042 [72] A. Khavaev, K. Pilch and N. P. Warner, "New vacua of gauged N = 8 supergravity in five dimensions," Phys. Lett. B 487 (2000) 14 hep-th/9812035 [73] K. Pilch and N. P. Warner, "N = 1 supersymmetric renormalization group flows from ICFA Instrum. Bull. supergravity," Adv. Theor. Math. Phys. 4 (2002) 627 hep-th/0006066 [74] D. Berenstein, J. M. Maldacena and H. Nastase, "Strings in flat space and pp waves from N = 4 super Yang Mills," J. High Energy Phys. 0204 (2002) 013 hep-th/0202021 [75] M. Blau, J. Figueroa-O’Farrill, C. Hull and G. Papadopoulos, "A new maximally supersymmetric background of ICFA Instrum. Bull. superstring theory," J. High Energy Phys. 0201 (2002) 047 hep-th/0110242 [75] M. Blau, J. Figueroa-O’Farrill, C. Hull and G. Papadopoulos, "Pen-rose limits and maximal supersymmetry," Class. Quantum Gravity 19 (2002) L87 hep-th/0201081 [75] M. Blau, J. Figueroa-O’Farrill and G. Papadopoulos, "Penrose lim-its, supergravity and brane dynamics," Class. Quantum Gravity 19 (2002) 4753 hep-th/0202111 [76] R. R. Metsaev, "Type ICFA Instrum. Bull. Green-Schwarz superstring in plane wave Ramond-Ramond background," Nucl. Phys. B 625 (2002) 70 hep-th/0112044 [77] R. Corrado, N. Halmagyi, K. D. Kennaway and N. P. Warner, "Penrose limits of RG fixed points and pp-waves with background fluxes," hep-th/0205314 [77] E. G. Gi-mon, L. A. Pando Zayas and J. Sonnenschein, "Penrose limits and RG flows," hep-th/0206033 [77] D. Brecher, C. V. Johnson, K. J. Lovis and R. C. Myers, "Penrose limits, deformed pp-waves and the string duals of N = 1 large N gauge theory," J. High Energy Phys. 0210 (2002) 008 hep-th/0206045 [78] Y. Oz and T. Sakai, "Penrose limit and six-dimensional gauge theories," Phys. Lett. B 544 (2002) 321 hep-th/0207223 [78] ; etc. [79] A. B. Zamolodchikov, "Irreversibility’ Of The Flux Of The Renormalization Group In A 2-D Field Theory," JETP Lett. 43 (1986) 730 [79] [ Pis'ma Zh. Eksp. Teor. Fiz. 43 (1986) 565 [79] ]. [80] D. Anselmi, "Anomalies, unitarity, and quantum irreversibility," Ann. Phys. 276 (1999) 361 hep-th/9903059 [81] G. W. Gibbons and S. W. Hawking, "Action Integrals and Partition Functions in Quantum Gravity," Phys. Rev. D 15 (1977) 2752 [82] C. R. Graham and J. M. Lee, "Einstein Metrics with Prescribed Conformal Infinity on the Ball," Adv. Math. 87 (1991) 186 [83] M. Green, J. Schwarz and E. Witten, "Superstring Theory," Cambridge University Press, New York, 1987. [84] S. Nojiri and S. Odintsov, "Conformal Anomaly for Dilaton Coupled Theories from AdS/CFT Correspondence," Phys. Lett. B 444 (1998) 92 hep-th/9810008 [84] S. Nojiri, S. Odintsov and S. Ogushi, "Conformal Anomaly from d5 Gauged Super-gravity and c-function Away from Conformity," hep-th/9912191 [84] "Finite Action in d5 Gauged Supergravity and Dilatonic Conformal Anomaly for Dual Quantum Field Theory," hep-th/0001122 [85] A. Polyakov, Phys. Lett. B 103 (1981) 207 [85] 211; V. Knizhnik, A. Polyakov and A. Zamolodchikov, Mod. Phys. Lett. A 3 (1988) 819 [86] F. David, Mod. Phys. Lett. A 3 (1988) 1651 [86] J. Distler and H. Kawai, Nucl. Phys. B 321 (1989) 509 [87] N. Seiberg, "Notes on quantum Liouville theory and quantum gravity," Prog. Theor. Phys. Suppl. 102 (1990) 319 [88] R. Myer, Phys. Lett. B 199 (1987) 371 [89] A. Dhar and S. Wadia, "Noncritical strings, RG flows and holography," Nucl. Phys. B 590 (2000) 261 hep-th/0006043 [90] S. Nojiri and S. D. Odintsov, "Brane World Inflation Induced by Quantum Effects," Phys. Lett. B 484 (2000) 119 hep-th/0004097 [91] R. C. Myers, "Higher-derivative gravity, surface terms, and string theory," Phys. Rev. D 36 (1987) 392 [92] S. Nojiri and S. D. Odintsov, "Brane-World Cosmology in Higher Derivative Gravity or Warped Compactification in the Next-to-leading Order of AdS/CFT Correspon-dence," J. High Energy Phys. 0007 (2000) 049 hep-th/0006232 [92] S. Nojiri, S. D. Odintsov and S. Ogushi, "Dynamical Branes from Gravitational Dual of N = 2 Sp(N) Superconformal Field Theory," hep-th/0010004 [92] "Holographic Europhys. Newstropy and brane FRW-dynamics from AdS black hole in d5 higher derivative gravity," hep-th/0105117 [93] S. Nojiri and S. D. Odintsov, "On the conformal anomaly from higher derivative grav-ity in AdS/CFT correspondence," Int. J. Mod. Phys. A 15 (2000) 413 hep-th/9903033 [93] S. Nojiri and S. D. Odintsov, "Finite gravitational action for higher derivative and stringy gravity," Phys. Rev. D 62 (2000) 064018 hep-th/9911152 [94] J. Polchinski, "String Theory," Vol. II, Cambridge University Press, 1998. [95] S. Kamefuchi, L. O’Raifeartaigh and A. Salam, "Change Of Variables And Equiva-lence Theorems In Quantum Field Theories," Nucl. Phys. 28 (1961) 529 [96] D. J. Gross and E. Witten, "Superstring Modifications Of Einstein’s Equations," Nucl. Phys. B 277 (1986) 1 [97] J. I. Latorre and T. R. Morris, "Exact scheme independence," J. High Energy Phys. 0011 (2000) 004 hep-th/0008123 [98] M. Fukuma and S. Matsuura, "Comment on field redefinitions in the AdS/CFT cor-respondence," Prog. Theor. Phys. 108 (2002) 375 hep-th/0204257 [99] I. R. Klebanov and A. M. Polyakov, "AdS dual of the critical O(N) vector model," Phys. Lett. B 550 (2002) 213 hep-th/0210114 [100] A. M. Polyakov, "Gauge Fields Ann. Sci. Rings Of Glue," Nucl. Phys. B 164 (1980) 171 [101] Y. Makeenko and Astron. Astrophys. Migdal, "Quantum Chromodynamics Ann. Sci. Dynamics Of Loops," Nucl. Phys. B 188 (1981) 269 [102] A. M. Polyakov, "Confining strings," Nucl. Phys. B 486 (1997) 23 hep-th/9607049 [103] A. M. Polyakov, "String theory and quark confinement," Nucl. Phys. B, Proc. Suppl. 68 (1998) 1 hep-th/9711002 [104] A. M. Polyakov, "The wall of the cave," Int. J. Mod. Phys. A 14 (1999) 645 hep-th/9809057 [105] A. M. Polyakov and V. S. Rychkov, "Gauge fields - strings duality and the loop equation," Nucl. Phys. B 581 (2000) 116 hep-th/0002106 [106] A. M. Polyakov and V. S. Rychkov, "Loop dynamics and AdS/CFT correspondence," Nucl. Phys. B 594 (2001) 272 hep-th/0005173 [107] A. M. Polyakov, "String theory Ann. Sci. a universal language," Phys. At. Nucl. 64 (2001) 540 hep-th/0006132 [108] A. M. Polyakov, "Gauge fields and space-time," Int. J. Mod. Phys. A 17S : 1 (2002) 119, hep-th/0110196 [109] J. B. Kogut and L. Susskind, "Hamiltonian Formulation Of Wilson’s Lattice Gauge Theories," Phys. Rev. D 11 (1975) 395 [110] A. Santambrogio and D. Zanon, "Exact anomalous dimensions of N = 4 Yang-Mills operators with large R charge," Phys. Lett. B 545 (2002) 425 hep-th/0206079 [111] Y. Oz and T. Sakai, "Exact anomalous dimensions for N = 2 ADE SCFTs," hep-th/0208078 [112] S. R. Das, C. Gomez and S. J. Rey, "Penrose limit, spontaneous Symmetry break-ing and holography in pp-wave background," Phys. Rev. D 66 (2002) 046002 hep-th/0203164 [113] R. G. Leigh, K. Okuyama and M. Rozali, "PP-waves and holography," Phys. Rev. D 66 (2002) 046004 hep-th/0204026 [114] D. Berenstein and H. Nastase, "On lightcone string field theory from super Yang-Mills and holography," hep-th/0205048 CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181368247-0-102-108-0-5 SzGeCERN 2373792CERCER hep-th/0304229 eng Barvinsky, A O Lebedev Physics Institute Nonlocal action for long-distance modifications of gravity theory 2003 28 Apr 2003 9 p We construct the covariant nonlocal action for recently suggested long-distance modifications of gravity theory motivated by the cosmological constant and cosmological acceleration problems. This construction is based on the special nonlocal form of the Einstein-Hilbert action explicitly revealing the fact that this action within the covariant curvature expansion begins with curvature-squared terms. LANL EDS SIS LANLPUBL2004 SIS:2004 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE LANL EDS High Energy Physics - Theory 109-116 Phys. Lett. B 572 2003 http://cdsware.cern.ch/download/invenio-demo-site-files/0304229.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0304229.ps.gz barvin@lpi.ru n 200318 13 20060826 0015 CER01 20030429 PUBLIC 002373792CER ARTICLE [1] N.Arkani-Hamed, S.Dimopoulos, G.Dvali and G.Gabadadze, Nonlocal modifica-tion of gravity and the cosmological constant problem, hep-th/0209227 [2] S.Weinberg, Rev. Mod. Phys. 61 (1989) 1 [3] M.K.Parikh and S.N.Solodukhin, Phys. Lett. B 503 (2001) 384 hep-th/0012231 [4] A.O.Barvinsky and G.A.Vilkovisky, Nucl. Phys. B 282 (1987) 163 [5] A.O.Barvinsky and G.A.Vilkovisky, Nucl. Phys. B 333 (1990) 471 [6] A.O.Barvinsky, Yu.V.Gusev, G.A.Vilkovisky and V.V.Zhytnikov, J. Math. Phys. 35 (1994) 3525 [6] J. Math. Phys. 35 (1994) 3543 [7] A.Adams, J.McGreevy and E.Silverstein, hep-th/0209226 [8] R.Gregory, V.A.Rubakov and S.M.Sibiryakov, Phys. Rev. Lett. 84 (2000) 5928 hep-th/0002072 [9] G.Dvali, G.Gabadadze and M.Porrati, Phys. Rev. Lett. B : 485 (2000) 208, hep-th/0005016 [10] S.L.Dubovsky and V.A.Rubakov, Phys. Rev. D 67 (2003) 104014 hep-th/0212222 [11] A.O.Barvinsky, Phys. Rev. D 65 (2002) 062003 hep-th/0107244 [12] A.O.Barvinsky, A.Yu.Kamenshchik, A.Rathke and C.Kiefer, Phys. Rev. D 67 (2003) 023513 hep-th/0206188 [13] E.S. Fradkin and Astron. Astrophys. Tseytlin, Phys. Lett. B 104 (1981) 377 [13] A.O.Barvinsky and I.G.Avramidi, Phys. Lett. B 159 (1985) 269 [14] A.O.Barvinsky, A.Yu.Kamenshchik and I.P.Karmazin, Phys. Rev. D 48 (1993) 3677 gr-qc/9302007 [15] E.V.Gorbar and I.L.Shapiro, J. High Energy Phys. 0302 (2003) 021 [16] M.Porrati, Phys. Lett. B 534 (2002) 209 hep-th/0203014 [17] H. van Damm and M.J.Veltman, Nucl. Phys. D : 22 (1970) 397; V.I.Zakharov, JETP Lett. 12 (1970) 312 [17] M.Porrati, Phys. Lett. B 498 (2001) 92 hep-th/0011152 [18] A.O.Barvinsky, Yu.V.Gusev, V.F.Mukhanov and D.V.Nesterov, Nonperturbative late time asymptotics for heat kernel in gravity theory, hep-th/0306052 [19] A.Strominger, J. High Energy Phys. 0110 (2001) 034 hep-th/0106113 [19] J. High Energy Phys. 0111 (2001) 049 hep-th/0110087 [20] J.Schwinger, J. Math. Phys. 2 (1961) 407 [20] J.L.Buchbinder, E.S.Fradkin and D.M.Gitman, Fortschr. Phys. 29 (1981) 187 [20] R.D.Jordan, Phys. Rev. D 33 (1986) 444 [21] C.Deffayet, G.Dvali and G.Gabadadze, Phys. Rev. D 65 (2002) 044023 astro-ph/0105068 [22] G.Dvali, A.Gruzinov and M.Zaldarriaga, The accelerated Universe and the Moon, hep-ph/0212069 [23] M.E.Soussa and R.P.Woodard, A nonlocal metric formulation of MOND, astro-ph/0302030 [24] M.Milgrom, Astrophys. J. 270 (1983) 365 [24] Astrophys. J. 270 (1983) 371 [24] J.Bekenstein and M.Milgrom, Astrophys. J. 286 (1984) 7 [25] L.R.Abramo and R.P.Woodard, Phys. Rev. D 65 (2002) 063516 [25] V.K.Onemli and R.P.Woodard, Class. Quantum Gravity 19 (2002) 4607 gr-qc/0204065 CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181372109-0-18-28-0-0 SzGeCERN hep-th/0307041 eng Witten, Edward Princeton University SL(2,Z) Action On Three-Dimensional Conformal Field Theories With Abelian Symmetry 2003 3 Jul 2003 24 p On the space of three-dimensional conformal field theories with U(1) symmetry and a chosen coupling to a background gauge field, there is a natural action of the group SL(2,Z). The generator S of SL(2,Z) acts by letting the background gauge field become dynamical, an operation considered recently by Kapustin and Strassler. The other generator T acts by shifting the Chern-Simons coupling of the background field. This SL(2,Z) action in three dimensions is related by the AdS/CFT correspondence to SL(2,Z) duality of low energy U(1) gauge fields in four dimensions. LANL EDS SzGeCERN Particle Physics - Theory PREPRINT LANL EDS High Energy Physics - Theory Witten, Edward http://cdsware.cern.ch/download/invenio-demo-site-files/0307041.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0307041.ps.gz witten@ias.edu n 200327 11 20061123 0917 CER01 20030704 PUBLIC 002385282CER PREPRINT [1] C. Burgess and B. P. Dolan, "Particle Vortex Duality And The Modular Group Applications To The Quantum Hall Effect And Other 2-D Systems," hep-th/0010246 [2] A. Shapere and F. Wilczek, "Self-Dual Models With Theta Terms," Nucl. Phys. B 320 (1989) 669 [3] S. J. Rey and A. Zee, "Self-Duality Of Three-Dimensional Chern-Simons Theory," Nucl. Phys. B 352 (1991) 897 [4] C. A. Lutken and G. G. Ross, "Duality In The Quantum Hall System," Phys. Rev. B 45 (1992) 11837 [4] Phys. Rev. B 48 (1993) 2500 [5] D.-H. Lee, S. Kivelson, and S.-C. Zhang, Phys. Lett. 68 (1992) 2386 [5] Phys. Rev. B 46 (1992) 2223 [6] C. A. Lutken, "Geometry Of Renormalization Group Flows Constrained By Discrete Global Symmetries," Nucl. Phys. B 396 (1993) 670 [7] B. P. Dolan, "Duality And The Modular Group In The Quantum Hall Effect," J. Phys. A 32 (1999) L243 cond-mat/9805171 [8] C. P. Burgess, R. Dib, and B. P. Dolan, Phys. Rev. B 62 (2000) 15359 cond-mat/9911476 [9] A. Zee, "Quantum Hall Fluids," cond-mat/9501022 [10] A. Kapustin and M. Strassler, "On Mirror Symmetry In Three Dimensional Abelian Gauge Theories," hep-th/9902033 [11] K. Intriligator and N. Seiberg, "Mirror Symmetry In Three-Dimensional Gauge The-ories," Phys. Lett. B 387 (1996) 512 hep-th/9607207 [12] J. Cardy and E. Rabinovici, "Phase Structure Of Z. Phys. Models In The Presence Of A Theta Parameter," Nucl. Phys. B 205 (1982) 1 [12] J. Cardy, "Duality And The Theta Parameter In Abelian Lattice Models," Nucl. Phys. B 205 (1982) 17 [13] C. Vafa and E. Witten, "A Strong Coupling Test Of S-Duality," Nucl. Phys. B 431 (1994) 3 hep-th/9408074 [14] E. Witten, "On S Duality In Abelian Gauge Theory," Selecta Mathematica : 1 (1995) 383, hep-th/9505186 [15] S. Deser, R. Jackiw, and S. Templeton, "Topologically Massive Gauge Theories," Ann. Phys. 140 (1982) 372 [16] E. Guadagnini, M. Martinelli, and M. Mintchev, "Scale-Invariant SIGMA, Symmetry Integrability Geom. Methods Appl. Models On Homogeneous Spaces," Phys. Lett. B 194 (1987) 69 [17] K. Bardacki, E. Rabinovici, and B. Saring, Nucl. Phys. B 299 (1988) 157 [18] D. Karabali, Q.-H. Park, H. J. Schnitzer, and Z. Yang, Phys. Lett. B 216 (1989) 307 [18] H. J. Schnitzer, Nucl. Phys. B 324 (1989) 412 [18] D. Karabali and H. J. Schnitzer, Nucl. Phys. B 329 (1990) 649 [19] T. Appelquist and R. D. Pisarski, "Hot Yang-Mills Theories And Three-Dimensional QCD," Phys. Rev. D 23 (1981) 2305 [20] R. Jackiw and S. Templeton, "How Superrenormalizable Interactions Cure Their In-frared Divergences," Phys. Rev. D 23 (1981) 2291 [21] S. Templeton, "Summation Of Dominant Coupling Constant Logarithms In QED In Three Dimensions," Phys. Lett. B 103 (1981) 134 [21] "Summation Of Coupling Constant Logarithms In QED In Three Dimensions," Phys. Rev. D 24 (1981) 3134 [22] T. Appelquist and U. W. Heinz,"Three-Dimensional O(N) Theories At Large Dis-tances," Phys. Rev. D 24 (1981) 2169 [23] D. Anselmi, "Large N Expansion, Conformal Field Theory, And Renormalization Group Flows In Three Dimensions," J. High Energy Phys. 0006 (2000) 042 hep-th/0005261 [24] V. Borokhov, A. Kapustin, and X. Wu, "Topological Disorder Operators In Three-Dimensional Conformal Field Theory," hep-th/0206054 [25] V. Borokhov, A. Kapustin, and X. Wu, "Monopole Operators And Mirror Symmetry In Three Dimensions," J. High Energy Phys. 0212 (2002) 044 hep-th/0207074 [26] P. Breitenlohner and D. Z. Freedman, "Stability In Gauged Extended Supergravity," Ann. Phys. 144 (1982) 249 [27] I. R. Klebanov and E. Witten, "AdS/CFT Correspondence And Symmetry Breaking," Nucl. Phys. B 536 (1998) 199 hep-th/9905104 [28] R. Jackiw, "Topological Investigations Of Quantized Gauge Theories," in Current Algebra And Anomalies, ed. S. B. Treiman et. al. (World-Scientific, 1985). [29] A. Schwarz, "The Partition Function Of A Degenerate Functional," Commun. Math. Phys. 67 (1979) 1 [30] M. Rocek and E. Verlinde, "Duality, Quotients, and Currents," Nucl. Phys. B 373 (1992) 630 hep-th/9110053 [31] S. Elitzur, G. Moore, A. Schwimmer, and N. Seiberg, "Remarks On The Canonical Quantization Of The Chern-Simons-Witten Theory," Nucl. Phys. B 326 (1989) 108 [32] E. Witten, "Quantum Field Theory And The Jones Polynomial," Commun. Math. Phys. 121 (1989) 351 [33] N. Redlich, "Parity Violation And Gauge Non-Invariance Of The Effective Gauge Field Action In Three Dimensions," Phys. Rev. D 29 (1984) 2366 [34] E. Witten, "Multi-Trace Operators, Boundary Conditions, and AdS/CFT Correspon-dence," hep-th/0112258 [35] M. Berkooz, A. Sever, and A. Shomer, "Double-trace Deformations, Boundary Con-ditions, and Spacetime Singularities," J. High Energy Phys. 05 (2002) 034 hep-th/0112264 [36] P. Minces, "Multi-trace Operators And The Generalized AdS/CFT Prescription," hep-th/0201172 [37] O. Aharony, M. Berkooz, and E. Silverstein, "Multiple Trace Operators And Non-Local String Theories," J. High Energy Phys. 08 (2001) 006 [38] V. K. Dobrev, "Intertwining Operator Realization Of The AdS/CFT Correspon-dence," Nucl. Phys. B 553 (1999) 559 hep-th/9812194 [39] I. R. Klebanov, "Touching Random Surfaces And Liouville Theory," Phys. Rev. D 51 (1995) 1836 hep-th/9407167 [39] I. R. Klebanov and A. Hashimoto, "Non-perturbative Solution Of Matrix Models Modified By Trace Squared Terms," Nucl. Phys. B 434 (1995) 264 hep-th/9409064 [40] S. Gubser and I. Mitra, "Double-trace Operators And One-Loop Vacuum Energy In AdS/CFT," hep-th/0210093 Phys.Rev. D67 (2003) 064018 [41] S. Gubser and I. R. Klebanov, "A Universal Result On Central Charges In The Presence Of Double-Trace Deformations," Nucl.Phys. B656 (2003) 23 hep-th/0212138 CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181375069-0-21-38-0-1 SzGeCERN 20070403111954.0 hep-th/0402130 eng NYU-TH-2004-02-17 Dvali, G New York University Filtering Gravity: Modification at Large Distances? Infrared Modification of Gravity Preprint title 2005 New York, NY New York Univ. Dept. Phys. 17 Feb 2004 18 p In this lecture I address the issue of possible large distance modification of gravity and its observational consequences. Although, for the illustrative purposes we focus on a particular simple generally-covariant example, our conclusions are rather general and apply to large class of theories in which, already at the Newtonian level, gravity changes the regime at a certain very large crossover distance $r_c$. In such theories the cosmological evolution gets dramatically modified at the crossover scale, usually exhibiting a "self-accelerated" expansion, which can be differentiated from more conventional "dark energy" scenarios by precision cosmology. However, unlike the latter scenarios, theories of modified-gravity are extremely constrained (and potentially testable) by the precision gravitational measurements at much shorter scales. Despite the presence of extra polarizations of graviton, the theory is compatible with observations, since the naive perturbative expansion in Newton's constant breaks down at a certain intermediate scale. This happens because the extra polarizations have couplings singular in $1/r_c$. However, the correctly resummed non-linear solutions are regular and exhibit continuous Einsteinian limit. Contrary to the naive expectation, explicit examples indicate that the resummed solutions remain valid after the ultraviolet completion of the theory, with the loop corrections taken into account. LANL EDS SIS:200704 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE LANL EDS High Energy Physics - Theory Dvali, Gia 92-98 Phys. Scr. Top. Issues T117 2005 http://cdsware.cern.ch/download/invenio-demo-site-files/0402130.pdf n 200408 13 20070425 1019 CER01 20040218 002414101 92-98 sigtuna20030814 PUBLIC 002426503CER ARTICLE [1] G. Dvali, G. Gabadadze and M. Porrati, Phys. Lett. B 485 (2000) 208 hep-th/0005016 [1] G. R. Dvali and G. Gabadadze, Phys. Rev. D 63 (2001) 065007 hep-th/0008054 [2] G. Dvali, G. Gabadadze, M. Kolanovic and F. Nitti, Phys. Rev. D 65 (2002) 024031 hep-ph/0106058 [3] G. Dvali, G. Gabadadze, M. Kolanovic and F. Nitti, Phys. Rev. D 64 (2001) 084004 hep-ph/0102216 [4] C. Deffayet, G. Dvali and G. Gabadadze, Phys. Rev. D 65 (2002) 044023 astro-ph/0105068 [5] C. Deffayet, Phys. Lett. B 502 (2001) 199 hep-th/0010186 [6] A. G. Riess et al. [Supernova Search Team Collaboration], Astron. J. 116 (1998) 1009 astro-ph/9805201 [6] S. Perlmutter et al. [Supernova Cosmology Project Collaboration], Astrophys. J. 517 (1999) 565 astro-ph/9812133 [7] G. Dvali and M. Turner, astro-ph/0301510 [8] H. van Dam and M. Veltman, Nucl. Phys. B 22 (1970) 397 [9] V. I. Zakharov, JETP Lett. 12 (1970) 312 [10] A. I. Vainshtein, Phys. Lett. B 39 (1972) 393 [11] C. Deffayet, G. Dvali, G. Gabadadze and A. I. Vainshtein, Phys. Rev. D 65 (2002) 044026 hep-th/0106001 [12] N. Arkani-Hamed, H. Georgi and M.D. Schwartz, Ann. Phys. 305 (2003) 96 hep-th/0210184 [13] D. G..Boulware and S. Deser., Phys. Rev. D 6 (1972) 3368 [14] G. Gabadadze and A. Gruzinov, Phys.Rev. D72 (2005) 124007 hep-th/0312074 [15] M. A. Luty, M. Porrati and R. Rattazzi, J. High Energy Phys. 0309 (2003) 029 hep-th/0303116 [16] A. Lue, Phys. Rev. D 66 (2002) 043509 hep-th/0111168 [17] A. Gruzinov, astro-ph/0112246 New Astron. 10 (2005) 311 [18] S. Corley, D.A.Lowe and S. Ramgoolam, J. High Energy Phys. 0107 (2001) 030 hep-th/0106067 [19] I. Antoniadis, R. Minasian and P. Vanhove, Nucl. Phys. B 648 (2003) 69 hep-th/0209030 [20] R. L. Davis, Phys. Rev. D 35 (1987) 3705 [21] G. Dvali, A. Gruzinov and M. Zaldarriaga, Phys. Rev. D 68 (2003) 024012 hep-ph/0212069 [22] A. Lue and G. Starkman, Phys. Rev. D 67 (2003) 064002 astro-ph/0212083 [23] E. Adelberger (2002). Private communication. [24] T. Damour, I. I. Kogan, A. Papazoglou, Phys. Rev. D 66 (2002) 104025 hep-th/0206044 [25] G. Dvali, G. Gabadadze and M. Shifman, Phys. Rev. D 67 (2003) 044020 hep-th/0202174 [26] A. Adams, J. McGreevy and E. Silverstein, hep-th/0209226 [27] N. Arkani-Hamed, S. Dimopoulos, G. Dvali and G. Gabadadze, hep-th/0209227 [28] S.M. Carrol, V. Duvvuri, M. Trodden and M.S. Turner, astro-ph/0306438 Phys.Rev. D70 (2004) 043528 [29] G.Gabadadze and M. Shifman, hep-th/0312289 Phys.Rev. D69 (2004) 124032 [30] M.Porrati and G. W. Rombouts, hep-th/0401211 Phys.Rev. D69 (2004) 122003 CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181382391-0-26-23-0-2 SzGeCERN 20060124104603.0 hep-th/0501145 eng Durin, B LPTHE Closed strings in Misner space: a toy model for a Big Bounce ? 2005 19 Jan 2005 Misner space, also known as the Lorentzian orbifold $R^{1,1}/boost$, is one of the simplest examples of a cosmological singularity in string theory. In this lecture, we review the semi-classical propagation of closed strings in this background, with a particular emphasis on the twisted sectors of the orbifold. Tree-level scattering amplitudes and the one-loop vacuum amplitude are also discussed. LANL EDS SIS LANLPUBL2006 SIS:2006 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE LANL EDS High Energy Physics - Theory Pioline, B Durin, Bruno Pioline, Boris http://cdsware.cern.ch/download/invenio-demo-site-files/0501145.pdf LPTHE LPTHE, Lptens n 200503 13 20061202 0008 CER01 20050120 002424942 177 cargese20040607 PUBLIC 002503681CER ARTICLE [1] S. Lem, "The Seventh Voyage", in The Star Diaries, Varsaw 1971, english translation New York, 1976. [2] A. Borde and A. Vilenkin, "Eternal inflation and the initial singu-larity," Phys. Rev. Lett. 72 (1994) 3305 gr-qc/9312022 [3] C. W. Misner, in Relativity Theory and Astrophysics I Relativity and Cosmology, edited by J. Ehlers, Lectures in Applied Mathe-matics, Vol. 8 (American Electron. Res. Announc. Am. Math. Soc., Providence, 1967), p. 160. [4] M. Berkooz, and B. Pioline, "Strings in an electric field, and the Milne universe," J. Cosmol. Astropart. Phys. 0311 (2003) 007 hep-th/0307280 [5] M. Berkooz, B. Pioline and M. Rozali, "Closed strings in Mis-ner space Cosmological production of winding strings," J. Cosmol. Astropart. Phys. 07 (2004) 003 hep-th/0405126 [6] JCAP 0410 (2004) 002 M. Berkooz, B. Durin, B. Pioline and D. Reichmann, "Closed strings in Misner space Stringy fuzziness with a twist," arXiv hep-th/0407216 [7] G. T. Horowitz and A. R. Steif, "Singular String Solutions With Nonsingular Initial Data," Phys. Lett. B 258 (1991) 91 [8] J. Khoury, B. A. Ovrut, N. Seiberg, P. J. Steinhardt and N. Turok, "From big crunch to big bang," Phys. Rev. D 65 (2002) 086007 hep-th/0108187 [9] Surveys High Energ.Phys. 17 (2002) 115 N. A. Nekrasov, "Milne universe, tachyons, and quantum group," arXiv hep-th/0203112 [10] V. Balasubramanian, S. F. Hassan, E. Keski-Vakkuri and A. Naqvi, "A space-time orbifold A toy model for a cosmological singu-larity," Phys. Rev. D 67 (2003) 026003 hep-th/0202187 [10] R. Biswas, E. Keski-Vakkuri, R. G. Leigh, S. Nowling and E. Sharpe, "The taming of closed time-like curves," J. High Energy Phys. 0401 (2004) 064 hep-th/0304241 [11] I. Antoniadis, C. Bachas, J. R. Ellis and D. V. Nanopoulos, "Cosmo-logical String Theories And Discrete Inflation," Phys. Lett. B 211 (1988) 393 [11] I. Antoniadis, C. Bachas, J. R. Ellis and D. V. Nanopou-los, "An Expanding Universe In String Theory," Nucl. Phys. B 328 (1989) 117 [11] I. Antoniadis, C. Bachas, J. R. Ellis and D. V. Nanopou-los, "Comments On Cosmological String Solutions," Phys. Lett. B 257 (1991) 278 [12] C. R. Nappi and E. Witten, "A Closed, expanding universe in string theory," Phys. Lett. B 293 (1992) 309 hep-th/9206078 [13] C. Kounnas and D. Lust, "Cosmological string backgrounds from gauged WZW models," Phys. Lett. B 289 (1992) 56 hep-th/9205046 [14] E. Kiritsis and C. Kounnas, "Dynamical Topology change in string theory," Phys. Lett. B 331 (1994) 51 hep-th/9404092 [15] S. Elitzur, A. Giveon, D. Kutasov and E. Rabinovici, "From big bang to big crunch and beyond," J. High Energy Phys. 0206 (2002) 017 hep-th/0204189 [15] S. Elitzur, A. Giveon and E. Rabinovici, "Removing singularities," J. High Energy Phys. 0301 (2003) 017 hep-th/0212242 [16] L. Cornalba and M. S. Costa, "A New Cosmological Scenario in String Theory," Phys. Rev. D 66 (2002) 066001 hep-th/0203031 [16] L. Cornalba, M. S. Costa and C. Kounnas, "A res-olution of the cosmological singularity with orientifolds," Nucl. Phys. B 637 (2002) 378 hep-th/0204261 [16] L. Cornalba and M. S. Costa, "On the classical stability of orientifold cosmologies," Class. Quantum Gravity 20 (2003) 3969 hep-th/0302137 [17] B. Craps, D. Kutasov and G. Rajesh, "String propagation in the presence of cosmological singularities," J. High Energy Phys. 0206 (2002) 053 hep-th/0205101 [17] B. Craps and B. A. Ovrut, "Global fluc-tuation spectra in big crunch / big bang string vacua," Phys. Rev. D 69 (2004) 066001 hep-th/0308057 [18] E. Dudas, J. Mourad and C. Timirgaziu, "Time and space depen-dent backgrounds from nonsupersymmetric strings," Nucl. Phys. B 660 (2003) 3 hep-th/0209176 [19] L. Cornalba and M. S. Costa, "Time-dependent orbifolds and string cosmology," Fortschr. Phys. 52 (2004) 145 hep-th/0310099 [20] Phys.Rev. D70 (2004) 126011 C. V. Johnson and H. G. Svendsen, "An exact string theory model of closed time-like curves and cosmological singularities," arXiv hep-th/0405141 [21] N. Toumbas and J. Troost, "A time-dependent brane in a cosmolog-ical background," J. High Energy Phys. 0411 (2004) 032 hep-th/0410007 [22] W. A. Hiscock and D. A. Konkowski, "Quantum Vacuum Energy In Taub - Nut (Newman-Unti-Tamburino) Type Cosmologies," Phys. Rev. D 26 (1982) 1225 [23] A. H. Taub, "Empty Space-Times Admitting A Three Parameter Group Of Motions," Ann. Math. 53 (1951) 472 [23] E. Newman, L. Tamburino and T. Unti, "Empty Space Generalization Of The Schwarzschild Metric," J. Math. Phys. 4 (1963) 915 [24] J. G. Russo, "Cosmological string models from Milne spaces and SL(2,Z) orbifold," arXiv hep-th/0305032 [25] Mod.Phys.Lett. A19 (2004) 421 J. R. I. Gott, "Closed Timelike Curves Produced By Pairs Of Mov-ing Cosmic Strings Exact Solutions," Phys. Rev. Lett. 66 (1991) 1126 [25] J. D. Grant, "Cosmic strings and chronology protection," Phys. Rev. D 47 (1993) 2388 hep-th/9209102 [26] S. W. Hawking, "The Chronology protection conjecture," Phys. Rev. D 46 (1992) 603 [27] Commun.Math.Phys. 256 (2005) 491 D. Kutasov, J. Marklof and G. W. Moore, "Melvin Models and Diophantine Approximation," arXiv hep-th/0407150 [28] C. Gabriel and P. Spindel, "Quantum charged fields in Rindler space," Ann. Phys. 284 (2000) 263 gr-qc/9912016 [29] N. Turok, M. Perry and P. J. Steinhardt, "M theory model of a big crunch / big bang transition," Phys. Rev. D 70 (2004) 106004 hep-th/0408083 [30] C. Bachas and M. Porrati, "Pair Creation Of Open Strings In An Electric Field," Phys. Lett. B 296 (1992) 77 hep-th/9209032 [31] J. M. Maldacena, H. Ooguri and J. Son, "Strings in AdS(3) and the SL(2,R) WZW model. II Euclidean black hole," J. Math. Phys. 42 (2001) 2961 hep-th/0005183 [32] M. Berkooz, B. Craps, D. Kutasov and G. Rajesh, "Comments on cosmological singularities in string theory," arXiv hep-th/0212215 [33] D. J. Gross and P. F. Mende, "The High-Energy Behavior Of String Scattering Amplitudes," Phys. Lett. B 197 (1987) 129 [34] H. Liu, G. Moore and N. Seiberg, "Strings in a time-dependent orbifold," J. High Energy Phys. 0206 (2002) 045 hep-th/0204168 [34] H. Liu, G. Moore and N. Seiberg, "Strings in time-dependent orbifolds," J. High Energy Phys. 0210 (2002) 031 hep-th/0206182 [35] D. Amati, M. Ciafaloni and G. Veneziano, "Class. Quantum Gravity Effects From Planckian Energy Superstring Collisions," Int. J. Mod. Phys. A 3 (1988) 1615 [36] G. T. Horowitz and J. Polchinski, "Instability of spacelike and null orbifold singularities," Phys. Rev. D 66 (2002) 103512 hep-th/0206228 [37] C. R. Nappi and E. Witten, "A WZW model based on a non-semisimple group," Phys. Rev. Lett. 71 (1993) 3751 hep-th/9310112 [38] D. I. Olive, E. Rabinovici and A. Schwimmer, "A Class of string backgrounds Ann. Sci. a semiclassical limit of WZW models," Phys. Lett. B 321 (1994) 361 hep-th/9311081 [39] E. Kiritsis and C. Kounnas, "String Propagation In Gravitational Wave Backgrounds," Phys. Lett. B 320 (1994) 264 [39] [Addendum- Phys. Lett. B 325 (1994) 536 hep-th/9310202 [39] E. Kiritsis, C. Koun-nas and D. Lust, "Superstring gravitational wave backgrounds with space-time supersymmetry," Phys. Lett. B 331 (1994) 321 hep-th/9404114 [40] E. Kiritsis and B. Pioline, "Strings in homogeneous gravitational waves and null holography," J. High Energy Phys. 0208 (2002) 048 hep-th/0204004 [41] Nucl.Phys. B674 (2003) 80 G. D’Appollonio and E. Kiritsis, "String interactions in gravita-tional wave backgrounds," arXiv hep-th/0305081 [42] Y. K. Cheung, L. Freidel and K. Savvidy, "Strings in gravimagnetic fields," J. High Energy Phys. 0402 (2004) 054 hep-th/0309005 [43] O. Aharony, M. Berkooz and E. Silverstein, "Multiple-trace op-erators and non-local string theories," J. High Energy Phys. 0108 (2001) 006 hep-th/0105309 [43] M. Berkooz, A. Sever and A. Shomer, "Double-trace deformations, boundary conditions and spacetime singularities," J. High Energy Phys. 0205 (2002) 034 hep-th/0112264 [43] E. Witten, "Multi-trace operators, boundary conditions, and AdS/CFT correspondence," arXiv hep-th/0112258 [44] T. Damour, M. Henneaux and H. Nicolai, "Cosmological billiards," Class. Quantum Gravity 20 (2003) R145 hep-th/0212256 CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181394655-0-44-48-0-2 SzGeCERN 20060713170102.0 hep-th/0606038 eng DESY-06-083 DESY-2006-083 Papadimitriou, I DESY Non-Supersymmetric Membrane Flows from Fake Supergravity and Multi-Trace Deformations 2007 Hamburg DESY 5 Jun 2006 45 p We use fake supergravity as a solution generating technique to obtain a continuum of non-supersymmetric asymptotically $AdS_4\times S^7$ domain wall solutions of eleven-dimensional supergravity with non-trivial scalars in the $SL(8,\mathbb{R})/SO(8)$ coset. These solutions are continuously connected to the supersymmetric domain walls describing a uniform sector of the Coulomb branch of the $M2$-brane theory. We also provide a general argument that identifies the fake superpotential with the exact large-N quantum effective potential of the dual theory, thus arriving at a very general description of multi-trace deformations in the AdS/CFT correspondence, which strongly motivates further study of fake supergravity as a solution generating method. This identification allows us to interpret our non-supersymmetric solutions as a family of marginal triple-trace deformations of the Coulomb branch that completely break supersymmetry and to calculate the exact large-N anomalous dimensions of the operators involved. The holographic one- and two-point functions for these solutions are also computed. LANL EDS SIS JHEP2007 SIS:200703 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE LANL EDS High Energy Physics - Theory Papadimitriou, Ioannis 008 J. High Energy Phys. 02 2007 http://cdsware.cern.ch/download/invenio-demo-site-files/0606038.pdf n 200623 13 20070307 2032 CER01 20060607 PUBLIC 002623855CER ARTICLE [1] M. Cvetic and H. H. Soleng, "Supergravity domain walls," Phys. Rep. 282 (1997) 159 hep-th/9604090 [2] D. Z. Freedman, C. Nunez, M. Schnabl and K. Skenderis, "Fake supergravity and domain wall stability," Phys. Rev. D 69 (2004) 104027 hep-th/0312055 [3] A. Celi, A. Ceresole, G. Dall’Agata, A. Van Proeyen and M. Zagermann, "On the fakeness of fake supergravity," Phys. Rev. D 71 (2005) 045009 hep-th/0410126 [4] K. Skenderis and P. K. Townsend, "Gravitational stability and renormalization-group flow," Phys. Lett. B 468 (1999) 46 hep-th/9909070 [5] I. Bakas, A. Brandhuber and K. Sfetsos, "Domain walls of gauged supergravity, M-branes, and algebraic curves," Adv. Theor. Math. Phys. 3 (1999) 1657 hep-th/9912132 [6] M. Zagermann, "N = 4 fake supergravity," Phys. Rev. D 71 (2005) 125007 hep-th/0412081 [7] K. Skenderis and P. K. Townsend, "Hidden supersymmetry of domain walls and cosmologies," arXiv hep-th/0602260 [8] K. Skenderis, private communication. [9] P. K. Townsend, "Positive Energy And The Scalar Potential In Higher Dimensional (Super)Gravity Theories," Phys. Lett. B 148 (1984) 55 [10] O. DeWolfe, D. Z. Freedman, S. S. Gubser and A. Karch, "Modeling the fifth dimension with scalars and gravity," Phys. Rev. D 62 (2000) 046008 hep-th/9909134 [11] S. S. Gubser, "Curvature singularities The good, the bad, and the naked," Adv. Theor. Math. Phys. 4 (2002) 679 hep-th/0002160 [12] I. Papadimitriou and K. Skenderis, "AdS / CFT correspondence and geometry," arXiv hep-th/0404176 [13] V. L. Campos, G. Ferretti, H. Larsson, D. Martelli and B. E. W. Nilsson, "A study of holographic renormalization group flows in d = 6 and d = 3," J. High Energy Phys. 0006 (2000) 023 hep-th/0003151 [14] M. Cvetic, S. S. Gubser, H. Lu and C. N. Pope, "Symmetric potentials of gauged supergravities in diverse dimensions and Coulomb branch of gauge theories," Phys. Rev. D 62 (2000) 086003 hep-th/9909121 [15] M. Cvetic, H. Lu, C. N. Pope and A. Sadrzadeh, "Consistency of Kaluza-Klein sphere reductions of symmetric potentials," Phys. Rev. D 62 (2000) 046005 hep-th/0002056 [16] P. Kraus, F. Larsen and S. P. Trivedi, "The Coulomb branch of gauge theory from rotating branes," J. High Energy Phys. 9903 (1999) 003 hep-th/9811120 [17] D. Z. Freedman, S. S. Gubser, K. Pilch and N. P. Warner, "Continuous distributions of D3-branes and gauged supergravity," J. High Energy Phys. 0007 (2000) 038 hep-th/9906194 [18] I. Bakas and K. Sfetsos, "States and curves of five-dimensional gauged supergravity," Nucl. Phys. B 573 (2000) 768 hep-th/9909041 [19] C. Martinez, R. Troncoso and J. Zanelli, "Exact black hole solution with a minimally coupled scalar field," Phys. Rev. D 70 (2004) 084035 hep-th/0406111 [20] B. de Wit and H. Nicolai, "The Consistency Of The S7 Truncation In D = 11 Supergravity," Nucl. Phys. B 281 (1987) 211 [21] H. Nastase, D. Vaman and P. van Nieuwenhuizen, "Consistent Nonlinearity K K reduction of 11d supergravity on AdS7 × S4 and self-duality in odd dimensions," Phys. Lett. B 469 (1999) 96 hep-th/9905075 [22] H. Nastase, D. Vaman and P. van Nieuwenhuizen, "Consistency of the AdS7 × S4 reduction and the origin of self-duality in odd dimensions," Nucl. Phys. B 581 (2000) 179 hep-th/9911238 [23] P. Breitenlohner and D. Z. Freedman, "Stability In Gauged Extended Supergravity," Ann. Phys. 144 (1982) 249 [24] I. R. Klebanov and E. Witten, "AdS/CFT correspondence and Symmetry breaking," Nucl. Phys. B 556 (1999) 89 hep-th/9905104 [25] Dr. E. Kamke, Differentialgleichungen Lösungsmethoden und Lösungen, Chelsea Publishing Company, 1971. [26] E. S. Cheb-Terrab and A. D. Roche, "Abel ODEs Equivalence and Integrable Classes," Comput. Phys. Commun. 130, Issues 1- : 2 (2000) 204 [arXiv math-ph/0001037 [26] E. S. Cheb-Terrab and A. D. Roche, "An Abel ordinary differential equation class generalizing known integrable classes," European J. Appl. Math. 14 (2003) 217 math.GM/0002059 [26] V. M. Boyko, "Symmetry, Equivalence and Integrable Classes of Abel’s Equations," Proceedings of the Institute of Mathematics of the NAS of Ukraine 50, Part : 1 (2004) 47 [arXiv nlin.SI/0404020 [27] M. J. Duff and J. T. Liu, "Anti-de Sitter black holes in gauged N = 8 supergravity," Nucl. Phys. B 554 (1999) 237 hep-th/9901149 [28] M. Cvetic et al., "Embedding AdS black holes in ten and eleven dimensions," Nucl. Phys. B 558 (1999) 96 hep-th/9903214 [29] J. de Boer, E. P. Verlinde and H. L. Verlinde, "On the holographic renormalization group," J. High Energy Phys. 0008 (2000) 003 hep-th/9912012 [30] M. Bianchi, D. Z. Freedman and K. Skenderis, "How to go with an RG flow," J. High Energy Phys. 0108 (2001) 041 hep-th/0105276 [31] I. Papadimitriou and K. Skenderis, "Correlation functions in holographic RG flows," J. High Energy Phys. 0410 (2004) 075 hep-th/0407071 [32] M. Henningson and K. Skenderis, "The holographic Weyl anomaly," J. High Energy Phys. 9807 (1998) 023 hep-th/9806087 [33] V. Balasubramanian and P. Kraus, "A stress tensor for anti-de Sitter gravity," Commun. Math. Phys. 208 (1999) 413 hep-th/9902121 [34] P. Kraus, F. Larsen and R. Siebelink, "The gravitational action in asymptotically AdS and flat spacetimes," Nucl. Phys. B 563 (1999) 259 hep-th/9906127 [35] S. de Haro, S. N. Solodukhin and K. Skenderis, "Holographic reconstruction of spacetime and renormalization in the AdS/CFT correspondence," Commun. Math. Phys. 217 (2001) 595 hep-th/0002230 [36] M. Bianchi, D. Z. Freedman and K. Skenderis, "Holographic renormalization," Nucl. Phys. B 631 (2002) 159 hep-th/0112119 [37] D. Martelli and W. Muck, "Holographic renormalization and Ward identities with the Hamilton-Jacobi method," Nucl. Phys. B 654 (2003) 248 hep-th/0205061 [38] K. Skenderis, "Lecture notes on holographic renormalization," Class. Quantum Gravity 19 (2002) 5849 hep-th/0209067 [39] D. Z. Freedman, S. D. Mathur, A. Matusis and L. Rastelli, "Correlation functions in the CFT(d)/AdS(d + 1) correspondence," Nucl. Phys. B 546 (1999) 96 hep-th/9804058 [40] O. DeWolfe and D. Z. Freedman, "Notes on fluctuations and correlation functions in holographic renormalization group flows," arXiv hep-th/0002226 [41] W. Muck, "Correlation functions in holographic renormalization group flows," Nucl. Phys. B 620 (2002) 477 hep-th/0105270 [42] M. Bianchi, M. Prisco and W. Muck, "New results on holographic three-point functions," J. High Energy Phys. 0311 (2003) 052 hep-th/0310129 [43] E. Witten, "Multi-trace operators, boundary conditions, and AdS/CFT correspondence," arXiv hep-th/0112258 [44] M. Berkooz, A. Sever and A. Shomer, "Double-trace deformations, boundary conditions and spacetime singularities," J. High Energy Phys. 0205 (2002) 034 hep-th/0112264 [45] W. Muck, "An improved correspondence formula for AdS/CFT with multi-trace operators," Phys. Lett. B 531 (2002) 301 hep-th/0201100 [46] P. Minces, "Multi-trace operators and the generalized AdS/CFT prescription," Phys. Rev. D 68 (2003) 024027 hep-th/0201172 [47] A. Sever and A. Shomer, "A note on multi-trace deformations and AdS/CFT," J. High Energy Phys. 0207 (2002) 027 hep-th/0203168 [48] S. S. Gubser and I. R. Klebanov, "A universal result on central charges in the presence of double-trace deformations," Nucl. Phys. B 656 (2003) 23 hep-th/0212138 [49] O. Aharony, M. Berkooz and B. Katz, "Non-local effects of multi-trace deformations in the AdS/CFT correspondence," J. High Energy Phys. 0510 (2005) 097 hep-th/0504177 [50] S. Elitzur, A. Giveon, M. Porrati and E. Rabinovici, "Multitrace deformations of vector and adjoint theories and their holographic duals," J. High Energy Phys. 0602 (2006) 006 hep-th/0511061 [51] R. Corrado, K. Pilch and N. P. Warner, "An N = 2 supersymmetric membrane flow," Nucl. Phys. B 629 (2002) 74 hep-th/0107220 [52] T. Hertog and K. Maeda, "Black holes with scalar hair and asymptotics in N = 8 supergravity," J. High Energy Phys. 0407 (2004) 051 hep-th/0404261 [53] T. Hertog and G. T. Horowitz, "Towards a big crunch dual," J. High Energy Phys. 0407 (2004) 073 hep-th/0406134 [54] T. Hertog and G. T. Horowitz, "Designer gravity and field theory effective potentials," Phys. Rev. Lett. 94 (2005) 221301 hep-th/0412169 [55] T. Hertog and G. T. Horowitz, "Holographic description of AdS cosmologies," J. High Energy Phys. 0504 (2005) 005 hep-th/0503071 [56] S. de Haro, I. Papadimitriou and A. C. Petkou, "Conformally coupled scalars, instantons and Vacuum instability in AdS(4)," [arXiv hep-th/0611315 CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181414470-0-53-49-0-2 SzGeCERN 20060616163757.0 hep-th/0606096 eng UTHET-2006-05-01 Koutsoumbas, G National Technical University of Athens Quasi-normal Modes of Electromagnetic Perturbations of Four-Dimensional Topological Black Holes with Scalar Hair 2006 10 Jun 2006 17 p We study the perturbative behaviour of topological black holes with scalar hair. We calculate both analytically and numerically the quasi-normal modes of the electromagnetic perturbations. In the case of small black holes we find clear evidence of a second-order phase transition of a topological black hole to a hairy configuration. We also find evidence of a second-order phase transition of the AdS vacuum solution to a topological black hole. LANL EDS SIS JHEP2007 SIS:200702 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE LANL EDS High Energy Physics - Theory Musiri, S Papantonopoulos, E Siopsis, G Koutsoumbas, George Musiri, Suphot Papantonopoulos, Eleftherios Siopsis, George 006 J. High Energy Phys. 10 2006 http://cdsware.cern.ch/download/invenio-demo-site-files/0606096.pdf n 200624 13 20070425 1021 CER01 20060613 PUBLIC 002628325CER ARTICLE [1] K. D. Kokkotas and B. G. Schmidt, Living Rev. Relativ. 2 (1999) 2 gr-qc/9909058 [2] H.-P. Nollert, Class. Quantum Gravity 16 (1999) R159 [3] J. S. F. Chan and R. B. Mann, Phys. Rev. D 55 (1997) 7546 gr-qc/9612026 [3] Phys. Rev. D 59 (1999) 064025 [4] G. T. Horowitz and V. E. Hubeny, Phys. Rev. D 62 (2000) 024027 hep-th/9909056 [5] V. Cardoso and J. P. S. Lemos, Phys. Rev. D 64 (2001) 084017 gr-qc/0105103 [6] B. Wang, C. Y. Lin and E. Abdalla, Phys. Lett. B 481 (2000) 79 hep-th/0003295 [7] E. Berti and K. D. Kokkotas, Phys. Rev. D 67 (2003) 064020 gr-qc/0301052 [8] F. Mellor and I. Moss, Phys. Rev. D 41 (1990) 403 [9] C. Martinez and J. Zanelli, Phys. Rev. D 54 (1996) 3830 gr-qc/9604021 [10] M. Henneaux, C. Martinez, R. Troncoso and J. Zanelli, Phys. Rev. D 65 (2002) 104007 hep-th/0201170 [11] C. Martinez, R. Troncoso and J. Zanelli, Phys. Rev. D 67 (2003) 024008 hep-th/0205319 [12] N. Bocharova, K. Bronnikov and V. Melnikov, Vestn. Mosk. Univ. Fizika Astronomy 6 (1970) 706 [12] J. D. Bekenstein, Ann. Phys. 82 (1974) 535 [12] Ann. Phys. 91 (1975) 75 [13] T. Torii, K. Maeda and M. Narita, Phys. Rev. D 64 (2001) 044007 [14] E. Winstanley, Found. Phys. 33 (2003) 111 gr-qc/0205092 [15] T. Hertog and K. Maeda, J. High Energy Phys. 0407 (2004) 051 hep-th/0404261 [16] J. P. S. Lemos, Phys. Lett. B 353 (1995) 46 gr-qc/9404041 [17] R. B. Mann, Class. Quantum Gravity 14 (1997) L109 gr-qc/9607071 [17] R. B. Mann, Nucl. Phys. B 516 (1998) 357 hep-th/9705223 [18] L. Vanzo, Phys. Rev. D 56 (1997) 6475 gr-qc/9705004 [19] D. R. Brill, J. Louko and P. Peldan, Phys. Rev. D 56 (1997) 3600 gr-qc/9705012 [20] D. Birmingham, Class. Quantum Gravity 16 (1999) 1197 hep-th/9808032 [21] R. G. Cai and K. S. Soh, Phys. Rev. D 59 (1999) 044013 gr-qc/9808067 [22] Phys.Rev. D65 (2002) 084006 B. Wang, E. Abdalla and R. B. Mann, [arXiv hep-th/0107243 [23] Phys.Rev. D65 (2002) 084006 R. B. Mann, [arXiv gr-qc/9709039 [24] J. Crisostomo, R. Troncoso and J. Zanelli, Phys. Rev. D 62 (2000) 084013 hep-th/0003271 [25] R. Aros, R. Troncoso and J. Zanelli, Phys. Rev. D 63 (2001) 084015 hep-th/0011097 [26] R. G. Cai, Y. S. Myung and Y. Z. Zhang, Phys. Rev. D 65 (2002) 084019 hep-th/0110234 [27] M. H. Dehghani, Phys. Rev. D 70 (2004) 064019 hep-th/0405206 [28] C. Martinez, R. Troncoso and J. Zanelli, Phys. Rev. D 70 (2004) 084035 hep-th/0406111 [29] Phys.Rev. D74 (2006) 044028 C. Martinez, J. P. Staforelli and R. Troncoso, [arXiv hep-th/0512022 [29] C. Martinez and R. Troncoso, [arXiv Phys.Rev. D74 (2006) 064007 hep-th/0606130 [30] E. Winstanley, Class. Quantum Gravity 22 (2005) 2233 gr-qc/0501096 [30] E. Radu and E. Win-stanley, Phys. Rev. D 72 (2005) 024017 gr-qc/0503095 [30] A. M. Barlow, D. Doherty and E. Winstanley, Phys. Rev. D 72 (2005) 024008 gr-qc/0504087 [31] I. Papadimitriou, [arXiv JHEP 0702 (2007) 008 hep-th/0606038 [32] P. Breitenlohner and D. Z. Freedman, Phys. Lett. B 115 (1982) 197 [32] Ann. Phys. 144 (1982) 249 [33] L. Mezincescu and P. K. Townsend, Ann. Phys. 160 (1985) 406 [34] V. Cardoso, J. Natario and R. Schiappa, J. Math. Phys. 45 (2004) 4698 hep-th/0403132 [35] J. Natario and R. Schiappa, Adv. Theor. Math. Phys. 8 (2004) 1001 hep-th/0411267 [36] S. Musiri, S. Ness and G. Siopsis, Phys. Rev. D 73 (2006) 064001 hep-th/0511113 [37] L. Motl and A. Neitzke, Adv. Theor. Math. Phys. 7 (2003) 307 hep-th/0301173 [38] Astron. J. M. Medved, D. Martin and M. Visser, Class. Quantum Gravity 21 (2004) 2393 gr-qc/0310097 [39] W.-H. Press, S. A. Teukolsky, W. T. Vetterling and B. P. Flannery in Numerical Recipies (Cambridge University Press, Cambridge, England, 1992). [40] G. Koutsoumbas, S. Musiri, E. Papantonopoulos and G. Siopsis, in preparation. CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181414732-0-36-41-0-2 SzGeCERN hep-th/0703265 eng IGPG-07-3-4 Alexander, S The Pennsylvania State University A new PPN parameter to test Chern-Simons gravity 2007 28 Mar 2007 4 p We study Chern-Simons (CS) gravity in the parameterized post-Newtonian (PPN) framework through weak-field solutions of the modified field equations for a perfect fluid source. We discover that CS gravity possesses the same PPN parameters as general relativity, except for the inclusion of a new term, proportional both to the CS coupling parameter and the curl of the PPN vector potentials. This new term encodes the key physical effect of CS gravity in the weak-field limit, leading to a modification of frame dragging and, thus, the Lense-Thirring contribution to gyroscopic precession. We provide a physical interpretation for the new term, as well as an estimate of the size of this effect relative to the general relativistic Lense-Thirring prediction. This correction to frame dragging might be used in experiments, such as Gravity Probe B and lunar ranging, to place bounds on the CS coupling parameter, as well as other intrinsic parameters of string theory. LANL EDS SzGeCERN Particle Physics - Theory PREPRINT LANL EDS High Energy Physics - Theory Yunes, N Alexander, Stephon Yunes, Nicolas Phys. Rev. Lett. http://cdsware.cern.ch/download/invenio-demo-site-files/0703265.pdf yunes@gravity.psu.edu> Uploader Engine <uploader@sundh99.cern.ch n 200713 11 20070417 2012 CER01 20070330 PUBLIC 002685163CER PREPRINT [1] J. Polchinski, String theory. Vol. 2 Superstring theory and beyond (Cambridge University Press, Cambridge, UK, 1998). [2] S. H. S. Alexander, M. E. Peskin, and M. M. Sheik-Jabbari, Phys. Rev. Lett. 96 (2006) 081301 [3] A. Lue, L.-M. Wang, and M. Kamionkowski, Phys. Rev. Lett. 83 (1999) 1506 astro-ph/9812088 [4] C. M. Will, Theory and experiment in gravitational Physics (Cambridge Univ. Press, Cambridge, UK, 1993). [5] C. M. Will, Phys. Rev. D 57 (1998) 2061 gr-qc/9709011 [6] C. M. Will and N. Yunes, Class. Quantum Gravity 21 (2004) 4367 [7] E. Berti, A. Buonanno, and C. M. Will, Phys. Rev. D 71 (2005) 084025 [8] A discussion of the history, technology and Physics of Gravity Probe B can be found at http://einstein.standfod.edu http://einstein.standfod.edu [9] J. Murphy, T. W., K. Nordtvedt, and S. G. Turyshev, Phys. Rev. Lett. 98 (2007) 071102 gr-qc/0702028 [10] R. Jackiw and S. Y. Pi, Phys. Rev. D 68 (2003) 104012 [11] D. Guarrera and Astron. J. Hariton (2007), Phys. Rev. D 76 (2007) 044011 gr-qc/0702029 [12] S. Alexander and J. Martin, Phys. Rev. D 71 (2005) 063526 hep-th/0410230 [13] R. J. Gleiser and C. N. Kozameh, Phys. Rev. D 64 (2001) 083007 gr-qc/0102093 [14] R. H. Brandenberger and C. Vafa, Nucl. Phys. B 316 (1989) 391 [15] L. Randall and R. Sundrum, Phys. Rev. Lett. 83 (1999) 4690 hep-th/9906064 [16] S. Alexander and N. Yunes (2007), in progress. [17] L. Blanchet, Living Rev. Relativ. 9 (2006) 4 [17] and references therein, gr-qc/0202016 [18] S. Alexander, L. S. Finn, and N. Yunes, in progress (2007). CDS Invenio/0.92.0.20070116 refextract/0.92.0.20070116-1181427282-0-8-12-1-4 SzGeCERN 0237765CERCER SLAC 3455840 hep-th/9611103 eng PUPT-1665 Periwal, V Princeton University Matrices on a point as the theory of everything 1997 Princeton, NJ Princeton Univ. Joseph-Henry Lab. Phys. 14 Nov 1996 5 p It is shown that the world-line can be eliminated in the matrix quantum mechanics conjectured by Banks, Fischler, Shenker and Susskind to describe the light-cone physics of M theory. The resulting matrix model has a form that suggests origins in the reduction to a point of a Yang-Mills theory. The reduction of the Nishino-Sezgin $10+2$ dimensional supersymmetric Yang-Mills theory to a point gives a matrix model with the appropriate features: Lorentz invariance in $9+1$ dimensions, supersymmetry, and the correct number of physical degrees of freedom. SIS UNC98 LANL EDS SzGeCERN Particle Physics - Theory ARTICLE Periwal, Vipul 1711 4 Phys. Rev. D 55 1997 http://cdsware.cern.ch/download/invenio-demo-site-files/9611103.pdf vipul@viper.princeton.edu n 199648 13 20070310 0012 CER01 19961115 PUBLIC 000237765CER ARTICLE 0289446CERCER SLAC 3838510 hep-th/9809057 eng Polyakov, A M Princeton University The wall of the cave 1999 In this article old and new relations between gauge fields and strings are discussed. We add new arguments that the Yang Mills theories must be described by the non-critical strings in the five dimensional curved space. The physical meaning of the fifth dimension is that of the renormalization scale represented by the Liouville field. We analyze the meaning of the zigzag symmetry and show that it is likely to be present if there is a minimal supersymmetry on the world sheet. We also present the new string backgrounds which may be relevant for the description of the ordinary bosonic Yang-Mills theories. The article is written on the occasion of the 40-th anniversary of the IHES. SIS LANLPUBL2001 LANL EDS SIS:2001 PR/LKR added SzGeCERN Particle Physics - Theory ARTICLE 645-658 Int. J. Mod. Phys. A 14 1999 polyakov@puhep1.princeton.edu n 199837 13 20060916 0007 CER01 19980910 PUBLIC 000289446CER ARTICLE http://cdsware.cern.ch/download/invenio-demo-site-files/9809057.pdf SzGeCERN 2174811CERCER SLAC 4308492 hep-ph/0002060 eng ACT-2000-1 CTP-TAMU-2000-2 OUTP-2000-03-P TPI-MINN-2000-6 Cleaver, G B Non-Abelian Flat Directions in a Minimal Superstring Standard Model 2000 Houston, TX Houston Univ. Adv. Res. Cent. The Woodlands 4 Feb 2000 14 p Recently, by studying exact flat directions of non-Abelian singlet fields, wedemonstrated the existence of free fermionic heterotic-string models in whichthe SU(3)_C x SU(2)_L x U(1)_Y-charged matter spectrum, just below the stringscale, consists solely of the MSSM spectrum. In this paper we generalize theanalysis to include VEVs of non-Abelian fields. We find several,MSSM-producing, exact non-Abelian flat directions, which are the first suchexamples in the literature. We examine the possibility that hidden sectorcondensates lift the flat directions. LANL EDS SIS LANLPUBL2001 SIS:2001 PR/LKR added SzGeCERN Particle Physics - Phenomenology ARTICLE Faraggi, A E Nanopoulos, Dimitri V Walker, J W Walker, Joel W. 1191-1202 Mod. Phys. Lett. A 15 2000 gcleaver@rainbow.physics.tamu.edu n 200006 13 20070425 1017 CER01 20000207 PUBLIC 002174811CER ARTICLE [1] A.E. Faraggi and D.V. Nanopoulos and L. Yuan Nucl. Phys. B 335 (1990) 347 [2] I. Antoniadis and J. Ellis and J. Hagelin and D.V. Nanopoulos Phys. Lett. B 213 (1989) 65 [3] I. Antoniadis and C. Bachas and C. Kounnas Nucl. Phys. B 289 (1987) 87 [4] A.E. Faraggi and D.V. Nanopoulos Phys. Rev. D 48 (1993) 3288 [5] G.B. Cleaver and A.E. Faraggi and D.V. Nanopoulos and L. Yuan Phys. Lett. B 455 (1999) 135 [6] hep-ph/9904301 [7] hep-ph/9910230 [8] Phys. Lett. B 256 (1991) 150 [10] hep-ph/9511426 [12] J. Ellis, K. Enqvist, D.V. Nanopoulos Phys. Lett., B 151 (1985) 357 [13] P. Horava Phys. Rev. D 54 (1996) 7561 http://cdsware.cern.ch/download/invenio-demo-site-files/0002060.pdf http://cdsware.cern.ch/download/invenio-demo-site-files/0002060.ps.gz SzGeCERN 20060914104330.0 INIS 34038281 UNCOVER 251,129,189,013 eng SCAN-0005061 TESLA-FEL-99-07 Treusch, R Development of photon beam diagnostics for VUV radiation from a SASE FEL 2000 Hamburg DESY Dec 1999 For the proof-of-principle experiment of self-amplified spontaneous emission (SASE) at short wavelengths on the VUV FEL at DESY a multi-facetted photon beam diagnostics experiment has been developed employing new detection concepts to measure all SASE specific properties on a single pulse basis. The present setup includes instrumentation for the measurement of the energy and the angular and spectral distribution of individual photon pulses. Different types of photon detectors such as PtSi-photodiodes and fast thermoelectric detectors based on YBaCuO-films are used to cover some five orders of magnitude of intensity from the level of spontaneous emission to FEL radiation at saturation. A 1 m normal incidence monochromator in combination with a fast intensified CCD camera allows to select single photon pulses and to record the full spectrum at high resolution to resolve the fine structure due to the start-up from noise. SIS INIS2004 SIS UNC2002 Development of photon beam diagnostics for VUV radiation from a SASE FEL SzGeCERN Accelerators and Storage Rings ARTICLE INIS Particle accelerators INIS ceramics- INIS desy- INIS far-ultraviolet-radiation INIS free-electron-lasers INIS photodiodes- INIS photon-beams INIS superradiance- INIS thin-films INIS x-ray-detection INIS x-ray-sources INIS accelerators- INIS beams- INIS cyclic-accelerators INIS detection- INIS electromagnetic-radiation INIS emission- INIS energy-level-transitions INIS films- INIS lasers- INIS photon-emission INIS radiation-detection INIS radiation-sources INIS radiations- INIS semiconductor-devices INIS semiconductor-diodes INIS stimulated-emission INIS synchrotrons- INIS ultraviolet-radiation Lokajczyk, T Xu, W Jastrow, U Hahn, U Bittner, L Feldhaus, J 456-462 1-3 Nucl. Instrum. Methods Phys. Res., A 445 2000 n 200430 13 20061230 0016 CER01 20040727 000289917 456-462 hamburg990823 PUBLIC 002471378CER ARTICLE http://cdsware.cern.ch/download/invenio-demo-site-files/convert_SCAN-0005061.pdf SzGeCERN 20070110102840.0 oai:cds.cern.ch:SCAN-9709037 cerncds:SCAN cerncds:FULLTEXT 0008580CERCER eng SCAN-9709037 UCRL-8417 Orear, J Notes on statistics for physicists Statistics for physicists 1958 Berkeley, CA Lawrence Berkeley Nat. Lab. 13 Aug 1958 34 p SzGeCERN Mathematical Physics and Mathematics PREPRINT h 199700 11 20070110 1028 CER01 19900127 PUBLIC PREPRINT 0001 000008580CER http://cdsware.cern.ch/download/invenio-demo-site-files/9709037.pdf BUL-NEWS-2009-001 eng Charles Darwin A naturalist's voyage around the world <!--HTML--><p class="articleHeader">After having been twice driven back by heavy south-western gales, Her Majesty's ship Beagle" a ten-gun brig, under the command of Captain Fitz Roy, R.N., sailed from Devonport on the 27th of December, 1831. The object of the expedition was to complete the survey of Patagonia and Tierra del Fuego, commenced under Captain King in 1826 to 1830--to survey the shores of Chile, Peru, and of some islands in the Pacific--and to carry a chain of chronometrical measurements round the World.</p> <div class="phwithcaption"> <div class="imageScale"><img alt="" src="http://cdsware.cern.ch/download/invenio-demo-site-files/icon-journal_hms_beagle_image.gif" /></div> <p>H.M.S. Beagle</p> </div> <p>On the 6th of January we reached Teneriffe, but were prevented landing, by fears of our bringing the cholera: the next morning we saw the sun rise behind the rugged outline of the Grand Canary Island, and suddenly illumine the Peak of Teneriffe, whilst the lower parts were veiled in fleecy clouds. This was the first of many delightful days never to be forgotten. On the 16th of January 1832 we anchored at Porto Praya, in St. Jago, the chief island of the Cape de Verd archipelago.</p> <p>The neighbourhood of Porto Praya, viewed from the sea, wears a desolate aspect. The volcanic fires of a past age, and the scorching heat of a tropical sun, have in most places rendered the soil unfit for vegetation. The country rises in successive steps of table-land, interspersed with some truncate conical hills, and the horizon is bounded by an irregular chain of more lofty mountains. The scene, as beheld through the hazy atmosphere of this climate, is one of great interest; if, indeed, a person, fresh from sea, and who has just walked, for the first time, in a grove of cocoa-nut trees, can be a judge of anything but his own happiness. The island would generally be considered as very uninteresting, but to any one accustomed only to an English landscape, the novel aspect of an utterly sterile land possesses a grandeur which more vegetation might spoil. A single green leaf can scarcely be discovered over wide tracts of the lava plains; yet flocks of goats, together with a few cows, contrive to exist. It rains very seldom, but during a short portion of the year heavy torrents fall, and immediately afterwards a light vegetation springs out of every crevice. This soon withers; and upon such naturally formed hay the animals live. It had not now rained for an entire year. When the island was discovered, the immediate neighbourhood of Porto Praya was clothed with trees,1 the reckless destruction of which has caused here, as at St. Helena, and at some of the Canary islands, almost entire sterility. The broad, flat-bottomed valleys, many of which serve during a few days only in the season as watercourses, are clothed with thickets of leafless bushes. Few living creatures inhabit these valleys. The commonest bird is a kingfisher (Dacelo Iagoensis), which tamely sits on the branches of the castor-oil plant, and thence darts on grasshoppers and lizards. It is brightly coloured, but not so beautiful as the European species: in its flight, manners, and place of habitation, which is generally in the driest valley, there is also a wide difference. One day, two of the officers and myself rode to Ribeira Grande, a village a few miles eastward of Porto Praya. Until we reached the valley of St. Martin, the country presented its usual dull brown appearance; but here, a very small rill of water produces a most refreshing margin of luxuriant vegetation. In the course of an hour we arrived at Ribeira Grande, and were surprised at the sight of a large ruined fort and cathedral. This little town, before its harbour was filled up, was the principal place in the island: it now presents a melancholy, but very picturesque appearance. Having procured a black Padre for a guide, and a Spaniard who had served in the Peninsular war as an interpreter, we visited a collection of buildings, of which an ancient church formed the principal part. It is here the governors and captain-generals of the islands have been buried. Some of the tombstones recorded dates of the sixteenth century.1 The heraldic ornaments were the only things in this retired place that reminded us of Europe. The church or chapel formed one side of a quadrangle, in the middle of which a large clump of bananas were growing. On another side was a hospital, containing about a ozen miserable-looking inmates.</p> <p>We returned to the Vênda to eat our dinners. A considerable number of men, women, and children, all as black as jet, collected to watch us. Our companions were extremely merry; and everything we said or did was followed by their hearty laughter. Before leaving the town we visited the cathedral. It does not appear so rich as the smaller church, but boasts of a little organ, which sent forth singularly inharmonious cries. We presented the black priest with a few shillings, and the Spaniard, patting him on the head, said, with much candour, he thought his colour made no great difference. We then returned, as fast as the ponies would go, to Porto Praya.</p> (Excerpt from A NATURALIST'S VOYAGE ROUND THE WORLD Chapter 1, By Charles Darwin) <!--HTML--><br /> 3 02/2009 Atlantis Times 3 03/2009 Atlantis Times ATLANTISTIMESNEWS http://cdsware.cern.ch/download/invenio-demo-site-files/journal_hms_beagle_image.gif http://cdsware.cern.ch/download/invenio-demo-site-files/icon-journal_hms_beagle_image.gif BUL-NEWS-2009-002 eng Plato Atlantis (Critias) <!--HTML--><p class="articleHeader">I have before remarked in speaking of the allotments of the gods, that they distributed the whole earth into portions differing in extent, and made for themselves temples and instituted sacrifices. And Poseidon, receiving for his lot the island of Atlantis, begat children by a mortal woman, and settled them in a part of the island, which I will describe.</p> <p>Looking towards the sea, but in the centre of the whole island, there was a plain which is said to have been the fairest of all plains and very fertile. Near the plain again, and also in the centre of the island at a distance of about fifty stadia, there was a mountain not very high on any side. In this mountain there dwelt one of the earth-born primeval men of that country, whose name was Evenor, and he had a wife named Leucippe, and they had an only daughter who was called Cleito. The maiden had already reached womanhood, when her father and mother died; Poseidon fell in love with her and had intercourse with her, and breaking the ground, inclosed the hill in which she dwelt all round, making alternate zones of sea and land larger and smaller, encircling one another; there were two of land and three of water, which he turned as with a lathe, each having its circumference equidistant every way from the centre, so that no man could get to the island, for ships and voyages were not as yet. He himself, being a god, found no difficulty in making special arrangements for the centre island, bringing up two springs of water from beneath the earth, one of warm water and the other of cold, and making every variety of food to spring up abundantly from the soil. He also begat and brought up five pairs of twin male children; and dividing the island of Atlantis into ten portions, he gave to the first-born of the eldest pair his mother's dwelling and the surrounding allotment, which was the largest and best, and made him king over the rest; the others he made princes, and gave them rule over many men, and a large territory. And he named them all; the eldest, who was the first king, he named Atlas, and after him the whole island and the ocean were called Atlantic. To his twin brother, who was born after him, and obtained as his lot the extremity of the island towards the pillars of Heracles, facing the country which is now called the region of Gades in that part of the world, he gave the name which in the Hellenic language is Eumelus, in the language of the country which is named after him, Gadeirus. Of the second pair of twins he called one Ampheres, and the other Evaemon. To the elder of the third pair of twins he gave the name Mneseus, and Autochthon to the one who followed him. Of the fourth pair of twins he called the elder Elasippus, and the younger Mestor. And of the fifth pair he gave to the elder the name of Azaes, and to the younger that of Diaprepes. All these and their descendants for many generations were the inhabitants and rulers of divers islands in the open sea; and also, as has been already said, they held sway in our direction over the country within the pillars as far as Egypt and Tyrrhenia. Now Atlas had a numerous and honourable family, and they retained the kingdom, the eldest son handing it on to his eldest for many generations; and they had such an amount of wealth as was never before possessed by kings and potentates, and is not likely ever to be again, and they were furnished with everything which they needed, both in the city and country. For because of the greatness of their empire many things were brought to them from foreign countries, and the island itself provided most of what was required by them for the uses of life. In the first place, they dug out of the earth whatever was to be found there, solid as well as fusile, and that which is now only a name and was then something more than a name, orichalcum, was dug out of the earth in many parts of the island, being more precious in those days than anything except gold. There was an abundance of wood for carpenter's work, and sufficient maintenance for tame and wild animals. Moreover, there were a great number of elephants in the island; for as there was provision for all other sorts of animals, both for those which live in lakes and marshes and rivers, and also for those which live in mountains and on plains, so there was for the animal which is the largest and most voracious of all. Also whatever fragrant things there now are in the earth, whether roots, or herbage, or woods, or essences which distil from fruit and flower, grew and thrived in that land; also the fruit which admits of cultivation, both the dry sort, which is given us for nourishment and any other which we use for food&mdash;we call them all by the common name of pulse, and the fruits having a hard rind, affording drinks and meats and ointments, and good store of chestnuts and the like, which furnish pleasure and amusement, and are fruits which spoil with keeping, and the pleasant kinds of dessert, with which we console ourselves after dinner, when we are tired of eating&mdash;all these that sacred island which then beheld the light of the sun, brought forth fair and wondrous and in infinite abundance. With such blessings the earth freely furnished them; meanwhile they went on constructing their temples and palaces and harbours and docks.</p> (Excerpt from CRITIAS, By Plato, translated By Jowett, Benjamin) <!--HTML--><br /> 2 02/2009 Atlantis Times 2 03/2009 Atlantis Times ATLANTISTIMESNEWS BUL-NEWS-2009-003 eng Plato Atlantis (Timaeus) <!--HTML--><p class="articleHeader">This great island lay over against the Pillars of Heracles, in extent greater than Libya and Asia put together, and was the passage to other islands and to a great ocean of which the Mediterranean sea was only the harbour; and within the Pillars the empire of Atlantis reached in Europe to Tyrrhenia and in Libya to Egypt.</p> <p>This mighty power was arrayed against Egypt and Hellas and all the countries</p> <div class="phrwithcaption"> <div class="imageScale"><img src="http://cdsware.cern.ch/download/invenio-demo-site-files/icon-journal_Athanasius_Kircher_Atlantis_image.gif" alt="" /></div> <p>Representation of Atlantis by Athanasius Kircher (1669)</p> </div> bordering on the Mediterranean. Then your city did bravely, and won renown over the whole earth. For at the peril of her own existence, and when the other Hellenes had deserted her, she repelled the invader, and of her own accord gave liberty to all the nations within the Pillars. A little while afterwards there were great earthquakes and floods, and your warrior race all sank into the earth; and the great island of Atlantis also disappeared in the sea. This is the explanation of the shallows which are found in that part of the Atlantic ocean. <p> </p> (Excerpt from TIMAEUS, By Plato, translated By Jowett, Benjamin)<br /> <!--HTML--><br /> 1 02/2009 Atlantis Times 1 03/2009 Atlantis Times 1 04/2009 Atlantis Times ATLANTISTIMESNEWS http://cdsware.cern.ch/download/invenio-demo-site-files/journal_Athanasius_Kircher_Atlantis_image.gif http://cdsware.cern.ch/download/invenio-demo-site-files/icon-journal_Athanasius_Kircher_Atlantis_image.gif BUL-SCIENCE-2009-001 eng Charles Darwin The order Rodentia in South America <!--HTML--><p>The order Rodentia is here very numerous in species: of mice alone I obtained no less than eight kinds. <sup><a name="note1" href="#footnote1">1</a></sup>The largest gnawing animal in the world, the Hydrochærus capybara (the water-hog), is here also common. One which I shot at Monte Video weighed ninety-eight pounds: its length, from the end of the snout to the stump-like tail, was three feet two inches; and its girth three feet eight. These great Rodents occasionally frequent the islands in the mouth of the Plata, where the water is quite salt, but are far more abundant on the borders of fresh-water lakes and rivers. Near Maldonado three or four generally live together. In the daytime they either lie among the aquatic plants, or openly feed on the turf plain.<sup><a name="note2" href="#footnote2">2</a></sup></p> <p> <div class="phlwithcaption"> <div class="imageScale"><img src="http://cdsware.cern.ch/download/invenio-demo-site-files/icon-journal_water_dog_image.gif" alt="" /></div> <p>Hydrochærus capybara or Water-hog</p> </div> When viewed at a distance, from their manner of walking and colour they resemble pigs: but when seated on their haunches, and attentively watching any object with one eye, they reassume the appearance of their congeners, cavies and rabbits. Both the front and side view of their head has quite a ludicrous aspect, from the great depth of their jaw. These animals, at Maldonado, were very tame; by cautiously walking, I approached within three yards of four old ones. This tameness may probably be accounted for, by the Jaguar having been banished for some years, and by the Gaucho not thinking it worth his while to hunt them. As I approached nearer and nearer they frequently made their peculiar noise, which is a low abrupt grunt, not having much actual sound, but rather arising from the sudden expulsion of air: the only noise I know at all like it, is the first hoarse bark of a large dog. Having watched the four from almost within arm's length (and they me) for several minutes, they rushed into the water at full gallop with the greatest impetuosity, and emitted at the same time their bark. After diving a short distance they came again to the surface, but only just showed the upper part of their heads. When the female is swimming in the water, and has young ones, they are said to sit on her back. These animals are easily killed in numbers; but their skins are of trifling value, and the meat is very indifferent. On the islands in the Rio Parana they are exceedingly abundant, and afford the ordinary prey to the Jaguar.</p> <p><small><sup><a name="footnote1" href="#note1">1</a></sup>. In South America I collected altogether twenty-seven species of mice, and thirteen more are known from the works of Azara and other authors. Those collected by myself have been named and described by Mr. Waterhouse at the meetings of the Zoological Society. I must be allowed to take this opportunity of returning my cordial thanks to Mr. Waterhouse, and to the other gentleman attached to that Society, for their kind and most liberal assistance on all occasions.</small></p> <p><small><sup><a name="footnote2" href="#note2">2</a></sup>. In the stomach and duodenum of a capybara which I opened, I found a very large quantity of a thin yellowish fluid, in which scarcely a fibre could be distinguished. Mr. Owen informs me that a part of the oesophagus is so constructed that nothing much larger than a crowquill can be passed down. Certainly the broad teeth and strong jaws of this animal are well fitted to grind into pulp the aquatic plants on which it feeds.</small></p> (Excerpt from A NATURALIST'S VOYAGE ROUND THE WORLD Chapter 3, By Charles Darwin) <!--HTML--><br />test fr 1 02/2009 Atlantis Times 1 03/2009 Atlantis Times ATLANTISTIMESSCIENCE http://cdsware.cern.ch/download/invenio-demo-site-files/journal_water_dog_image.gif http://cdsware.cern.ch/download/invenio-demo-site-files/icon-journal_water_dog_image.gif BUL-NEWS-2009-004 eng Charles Darwin Rio Macâe <!--HTML--><p class="articleHeader">April 14th, 1832.—Leaving Socêgo, we rode to another estate on the Rio Macâe, which was the last patch of cultivated ground in that direction. The estate was two and a half miles long, and the owner had forgotten how many broad.</p> <p> <div class="phlwithcaption"> <div class="imageScale"><img src="http://cdsware.cern.ch/download/invenio-demo-site-files/icon-journal_virgin_forest_image.gif" alt="" /></div> <p>Virgin Forest</p> </div> Only a very small piece had been cleared, yet almost every acre was capable of yielding all the various rich productions of a tropical land. Considering the enormous area of Brazil, the proportion of cultivated ground can scarcely be considered as anything compared to that which is left in the state of nature: at some future age, how vast a population it will support! During the second day's journey we found the road so shut up that it was necessary that a man should go ahead with a sword to cut away the creepers. The forest abounded with beautiful objects; among which the tree ferns, though not large, were, from their bright green foliage, and the elegant curvature of their fronds, most worthy of admiration. In the evening it rained very heavily, and although the thermometer stood at 65°, I felt very cold. As soon as the rain ceased, it was curious to observe the extraordinary evaporation which commenced over the whole extent of the forest. At the height of a hundred feet the hills were buried in a dense white vapour, which rose like columns of smoke from the most thickly-wooded parts, and especially from the valleys. I observed this phenomenon on several occasions: I suppose it is owing to the large surface of foliage, previously heated by the sun's rays.</p> <p>While staying at this estate, I was very nearly being an eye-witness to one of those atrocious acts which can only take place in a slave country. Owing to a quarrel and a lawsuit, the owner was on the point of taking all the women and children from the male slaves, and selling them separately at the public auction at Rio. Interest, and not any feeling of compassion, prevented this act. Indeed, I do not believe the inhumanity of separating thirty families, who had lived together for many years, even occurred to the owner. Yet I will pledge myself, that in humanity and good feeling he was superior to the common run of men. It may be said there exists no limit to the blindness of interest and selfish habit. I may mention one very trifling anecdote, which at the time struck me more forcibly than any story of cruelty. I was crossing a ferry with a negro who was uncommonly stupid. In endeavouring to make him understand, I talked loud, and made signs, in doing which I passed my hand near his face. He, I suppose, thought I was in a passion, and was going to strike him; for instantly, with a frightened look and half-shut eyes, he dropped his hands. I shall never forget my feelings of surprise, disgust, and shame, at seeing a great powerful man afraid even to ward off a blow, directed, as he thought, at his face. This man had been trained to a degradation lower than the slavery of the most helpless animal.</p> (Excerpt from A NATURALIST'S VOYAGE ROUND THE WORLD Chapter 2, By Charles Darwin) 1 03/2009 Atlantis Times ATLANTISTIMESNEWS Atlantis Times http://cdsware.cern.ch/download/invenio-demo-site-files/journal_virgin_forest_image.gif http://cdsware.cern.ch/download/invenio-demo-site-files/icon-journal_virgin_forest_image.gif zho 李白 Li Bai Alone Looking at the Mountain eng 敬亭獨坐 <!--HTML-->眾鳥高飛盡<br /> 孤雲去獨閒<br /> 相看兩不厭<br /> 唯有敬亭山 <!--HTML-->All the birds have flown up and gone;<br /> A lonely cloud floats leisurely by.<br /> We never tire of looking at each other -<br /> Only the mountain and I. 701-762 2009-09-16 00 2009-09-16 BATCH POETRY diff --git a/modules/miscutil/lib/textutils.py b/modules/miscutil/lib/textutils.py index 60c80f171..4569b0a80 100644 --- a/modules/miscutil/lib/textutils.py +++ b/modules/miscutil/lib/textutils.py @@ -1,319 +1,341 @@ # -*- coding: utf-8 -*- ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """ Functions useful for text wrapping (in a box) and indenting. """ __revision__ = "$Id$" import sys import re import textwrap +import invenio.template CFG_WRAP_TEXT_IN_A_BOX_STYLES = { '__DEFAULT' : { 'horiz_sep' : '*', 'max_col' : 72, 'min_col' : 40, 'tab_str' : ' ', 'tab_num' : 0, 'border' : ('**', '*', '**', '** ', ' **', '**', '*', '**'), 'prefix' : '\n', 'suffix' : '\n', 'break_long' : False, 'force_horiz' : False, }, 'squared' : { 'horiz_sep' : '-', 'border' : ('+', '-', '+', '| ', ' |', '+', '-', '+') }, 'double_sharp' : { 'horiz_sep' : '#', 'border' : ('##', '#', '##', '## ', ' ##', '##', '#', '##') }, 'single_sharp' : { 'horiz_sep' : '#', 'border' : ('#', '#', '#', '# ', ' #', '#', '#', '#') }, 'single_star' : { 'border' : ('*', '*', '*', '* ', ' *', '*', '*', '*',) }, 'double_star' : { }, 'no_border' : { 'horiz_sep' : '', 'border' : ('', '', '', '', '', '', '', ''), 'prefix' : '', 'suffix' : '' }, 'conclusion' : { 'border' : ('', '', '', '', '', '', '', ''), 'prefix' : '', 'horiz_sep' : '-', 'force_horiz' : True, }, 'important' : { 'tab_num' : 1, }, } def indent_text(text, nb_tabs=0, tab_str=" ", linebreak_input="\n", linebreak_output="\n", wrap=False): """ add tabs to each line of text @param text: the text to indent @param nb_tabs: number of tabs to add @param tab_str: type of tab (could be, for example "\t", default: 2 spaces @param linebreak_input: linebreak on input @param linebreak_output: linebreak on output @param wrap: wethever to apply smart text wrapping. (by means of wrap_text_in_a_box) @return: indented text as string """ if not wrap: lines = text.split(linebreak_input) tabs = nb_tabs*tab_str output = "" for line in lines: output += tabs + line + linebreak_output return output else: return wrap_text_in_a_box(body=text, style='no_border', tab_str=tab_str, tab_num=nb_tabs) _RE_BEGINNING_SPACES = re.compile(r'^\s*') _RE_NEWLINES_CLEANER = re.compile(r'\n+') _RE_LONELY_NEWLINES = re.compile(r'\b\n\b') def wrap_text_in_a_box(body='', title='', style='double_star', **args): """Return a nicely formatted text box: e.g. ****************** ** title ** **--------------** ** body ** ****************** Indentation and newline are respected. @param body: the main text @param title: an optional title @param style: the name of one of the style in CFG_WRAP_STYLES. By default the double_star style is used. You can further tune the desired style by setting various optional parameters: @param horiz_sep: a string that is repeated in order to produce a separator row between the title and the body (if needed) @param max_col: the maximum number of coulmns used by the box (including indentation) @param min_col: the symmetrical minimum number of columns @param tab_str: a string to represent indentation @param tab_num: the number of leveles of indentations @param border: a tuple of 8 element in the form (tl, t, tr, l, r, bl, b, br) of strings that represent the different corners and sides of the box @param prefix: a prefix string added before the box @param suffix: a suffix string added after the box @param break_long: wethever to break long words in order to respect max_col @param force_horiz: True in order to print the horizontal line even when there is no title e.g.: print wrap_text_in_a_box(title='prova', body=' 123 prova.\n Vediamo come si indenta', horiz_sep='-', style='no_border', max_col=20, tab_num=1) prova ---------------- 123 prova. Vediamo come si indenta """ def _wrap_row(row, max_col, break_long): """Wrap a single row""" spaces = _RE_BEGINNING_SPACES.match(row).group() row = row[len(spaces):] spaces = spaces.expandtabs() return textwrap.wrap(row, initial_indent=spaces, subsequent_indent=spaces, width=max_col, break_long_words=break_long) def _clean_newlines(text): text = _RE_LONELY_NEWLINES.sub(' \n', text) return _RE_NEWLINES_CLEANER.sub(lambda x: x.group()[:-1], text) body = unicode(body, 'utf-8') title = unicode(title, 'utf-8') astyle = dict(CFG_WRAP_TEXT_IN_A_BOX_STYLES['__DEFAULT']) if CFG_WRAP_TEXT_IN_A_BOX_STYLES.has_key(style): astyle.update(CFG_WRAP_TEXT_IN_A_BOX_STYLES[style]) astyle.update(args) horiz_sep = astyle['horiz_sep'] border = astyle['border'] tab_str = astyle['tab_str'] * astyle['tab_num'] max_col = max(astyle['max_col'] \ - len(border[3]) - len(border[4]) - len(tab_str), 1) min_col = astyle['min_col'] prefix = astyle['prefix'] suffix = astyle['suffix'] force_horiz = astyle['force_horiz'] break_long = astyle['break_long'] body = _clean_newlines(body) tmp_rows = [_wrap_row(row, max_col, break_long) for row in body.split('\n')] body_rows = [] for rows in tmp_rows: if rows: body_rows += rows else: body_rows.append('') if not ''.join(body_rows).strip(): # Concrete empty body body_rows = [] title = _clean_newlines(title) tmp_rows = [_wrap_row(row, max_col, break_long) for row in title.split('\n')] title_rows = [] for rows in tmp_rows: if rows: title_rows += rows else: title_rows.append('') if not ''.join(title_rows).strip(): # Concrete empty title title_rows = [] max_col = max([len(row) for row in body_rows + title_rows] + [min_col]) mid_top_border_len = max_col \ + len(border[3]) + len(border[4]) - len(border[0]) - len(border[2]) mid_bottom_border_len = max_col \ + len(border[3]) + len(border[4]) - len(border[5]) - len(border[7]) top_border = border[0] \ + (border[1] * mid_top_border_len)[:mid_top_border_len] + border[2] bottom_border = border[5] \ + (border[6] * mid_bottom_border_len)[:mid_bottom_border_len] \ + border[7] horiz_line = border[3] + (horiz_sep * max_col)[:max_col] + border[4] title_rows = [tab_str + border[3] + row + ' ' * (max_col - len(row)) + border[4] for row in title_rows] body_rows = [tab_str + border[3] + row + ' ' * (max_col - len(row)) + border[4] for row in body_rows] ret = [] if top_border: ret += [tab_str + top_border] ret += title_rows if title_rows or force_horiz: ret += [tab_str + horiz_line] ret += body_rows if bottom_border: ret += [tab_str + bottom_border] return (prefix + '\n'.join(ret) + suffix).encode('utf-8') def wait_for_user(msg=""): """ Print MSG and a confirmation prompt, waiting for user's confirmation, unless silent '--yes-i-know' command line option was used, in which case the function returns immediately without printing anything. """ if '--yes-i-know' in sys.argv: return print msg try: answer = raw_input("Please confirm by typing 'Yes, I know!': ") except KeyboardInterrupt: print answer = '' if answer != 'Yes, I know!': sys.stderr.write("ERROR: Aborted.\n") sys.exit(1) return def guess_minimum_encoding(text, charsets=('ascii', 'latin1', 'utf8')): """Try to guess the minimum charset that is able to represent the given text using the provided charsets. text is supposed to be encoded in utf8. Returns (encoded_text, charset) where charset is the first charset in the sequence being able to encode text. Returns (text_in_utf8, 'utf8') in case no charset is able to encode text. @note: If the input text is not in strict UTF-8, then replace any non-UTF-8 chars inside it. """ text_in_unicode = text.decode('utf8', 'replace') for charset in charsets: try: return (text_in_unicode.encode(charset), charset) except (UnicodeEncodeError, UnicodeDecodeError): pass return (text_in_unicode.encode('utf8'), 'utf8') def encode_for_xml(text, wash=False, xml_version='1.0'): """Encodes special characters in a text so that it would be XML-compliant. @param text: text to encode @return: an encoded text""" text = text.replace('&', '&') text = text.replace('<', '<') if wash: text = wash_for_xml(text, xml_version='1.0') return text try: unichr(0x100000) RE_ALLOWED_XML_1_0_CHARS = re.compile(u'[^\U00000009\U0000000A\U0000000D\U00000020-\U0000D7FF\U0000E000-\U0000FFFD\U00010000-\U0010FFFF]') RE_ALLOWED_XML_1_1_CHARS = re.compile(u'[^\U00000001-\U0000D7FF\U0000E000-\U0000FFFD\U00010000-\U0010FFFF]') except ValueError: # oops, we are running on a narrow UTF/UCS Python build, # so we have to limit the UTF/UCS char range: RE_ALLOWED_XML_1_0_CHARS = re.compile(u'[^\U00000009\U0000000A\U0000000D\U00000020-\U0000D7FF\U0000E000-\U0000FFFD]') RE_ALLOWED_XML_1_1_CHARS = re.compile(u'[^\U00000001-\U0000D7FF\U0000E000-\U0000FFFD]') def wash_for_xml(text, xml_version='1.0'): """ Removes any character which is not in the range of allowed characters for XML. The allowed characters depends on the version of XML. - XML 1.0: - XML 1.1: @param text: input string to wash. @param xml_version: version of the XML for which we wash the input. Value for this parameter can be '1.0' or '1.1' """ if xml_version == '1.0': return RE_ALLOWED_XML_1_0_CHARS.sub('', unicode(text, 'utf-8')).encode('utf-8') else: return RE_ALLOWED_XML_1_1_CHARS.sub('', unicode(text, 'utf-8')).encode('utf-8') + +def nice_size(size): + """ + @param size: the size. + @type size: int + @return: a nicely printed size. + @rtype: string + """ + websearch_templates = invenio.template.load('websearch') + unit = 'B' + if size > 1024: + size /= 1024.0 + unit = 'KB' + if size > 1024: + size /= 1024.0 + unit = 'MB' + if size > 1024: + size /= 1024.0 + unit = 'GB' + return '%s %s' % (websearch_templates.tmpl_nice_number(size, max_ndigits_after_dot=2), unit) + diff --git a/modules/miscutil/sql/tabfill.sql b/modules/miscutil/sql/tabfill.sql index d132ba4a9..ec6791786 100644 --- a/modules/miscutil/sql/tabfill.sql +++ b/modules/miscutil/sql/tabfill.sql @@ -1,580 +1,580 @@ -- $Id$ -- This file is part of CDS Invenio. -- Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. -- -- CDS Invenio is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License as -- published by the Free Software Foundation; either version 2 of the -- License, or (at your option) any later version. -- -- CDS Invenio is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with CDS Invenio; if not, write to the Free Software Foundation, Inc., -- 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -- Fill Invenio configuration tables with defaults suitable for any site. INSERT INTO rnkMETHOD (id,name,last_updated) VALUES (1,'wrd','0000-00-00 00:00:00'); INSERT INTO collection_rnkMETHOD (id_collection,id_rnkMETHOD,score) VALUES (1,1,100); INSERT INTO rnkCITATIONDATA VALUES (1,'citationdict',NULL,'0000-00-00'); INSERT INTO rnkCITATIONDATA VALUES (2,'reversedict',NULL,'0000-00-00'); INSERT INTO rnkCITATIONDATA VALUES (3,'selfcitdict',NULL,'0000-00-00'); INSERT INTO rnkCITATIONDATA VALUES (4,'selfcitedbydict',NULL,'0000-00-00'); INSERT INTO field VALUES (1,'any field','anyfield'); INSERT INTO field VALUES (2,'title','title'); INSERT INTO field VALUES (3,'author','author'); INSERT INTO field VALUES (4,'abstract','abstract'); INSERT INTO field VALUES (5,'keyword','keyword'); INSERT INTO field VALUES (6,'report number','reportnumber'); INSERT INTO field VALUES (7,'subject','subject'); INSERT INTO field VALUES (8,'reference','reference'); INSERT INTO field VALUES (9,'fulltext','fulltext'); INSERT INTO field VALUES (10,'collection','collection'); INSERT INTO field VALUES (11,'division','division'); INSERT INTO field VALUES (12,'year','year'); INSERT INTO field VALUES (13,'experiment','experiment'); INSERT INTO field VALUES (14,'record ID','recid'); INSERT INTO field VALUES (15,'isbn','isbn'); INSERT INTO field VALUES (16,'issn','issn'); INSERT INTO field VALUES (17,'coden','coden'); -- INSERT INTO field VALUES (18,'doi','doi'); INSERT INTO field VALUES (19,'journal','journal'); INSERT INTO field VALUES (20,'collaboration','collaboration'); INSERT INTO field VALUES (21,'affiliation','affiliation'); INSERT INTO field VALUES (22,'exact author','exactauthor'); INSERT INTO field VALUES (23,'date created','datecreated'); INSERT INTO field VALUES (24,'date modified','datemodified'); INSERT INTO field_tag VALUES (1,100,10); INSERT INTO field_tag VALUES (1,102,10); INSERT INTO field_tag VALUES (1,103,10); INSERT INTO field_tag VALUES (1,104,10); INSERT INTO field_tag VALUES (1,105,10); INSERT INTO field_tag VALUES (1,106,10); INSERT INTO field_tag VALUES (1,107,10); INSERT INTO field_tag VALUES (1,108,10); INSERT INTO field_tag VALUES (1,109,10); INSERT INTO field_tag VALUES (1,110,10); INSERT INTO field_tag VALUES (1,111,10); INSERT INTO field_tag VALUES (1,112,10); INSERT INTO field_tag VALUES (1,113,10); INSERT INTO field_tag VALUES (1,114,10); INSERT INTO field_tag VALUES (1,16,10); INSERT INTO field_tag VALUES (1,17,10); INSERT INTO field_tag VALUES (1,18,10); INSERT INTO field_tag VALUES (1,19,10); INSERT INTO field_tag VALUES (1,20,10); INSERT INTO field_tag VALUES (1,21,10); INSERT INTO field_tag VALUES (1,22,10); INSERT INTO field_tag VALUES (1,23,10); INSERT INTO field_tag VALUES (1,24,10); INSERT INTO field_tag VALUES (1,25,10); INSERT INTO field_tag VALUES (1,26,10); INSERT INTO field_tag VALUES (1,27,10); INSERT INTO field_tag VALUES (1,28,10); INSERT INTO field_tag VALUES (1,29,10); INSERT INTO field_tag VALUES (1,30,10); INSERT INTO field_tag VALUES (1,31,10); INSERT INTO field_tag VALUES (1,32,10); INSERT INTO field_tag VALUES (1,33,10); INSERT INTO field_tag VALUES (1,34,10); INSERT INTO field_tag VALUES (1,35,10); INSERT INTO field_tag VALUES (1,36,10); INSERT INTO field_tag VALUES (1,37,10); INSERT INTO field_tag VALUES (1,38,10); INSERT INTO field_tag VALUES (1,39,10); INSERT INTO field_tag VALUES (1,40,10); INSERT INTO field_tag VALUES (1,41,10); INSERT INTO field_tag VALUES (1,42,10); INSERT INTO field_tag VALUES (1,43,10); INSERT INTO field_tag VALUES (1,44,10); INSERT INTO field_tag VALUES (1,45,10); INSERT INTO field_tag VALUES (1,46,10); INSERT INTO field_tag VALUES (1,47,10); INSERT INTO field_tag VALUES (1,48,10); INSERT INTO field_tag VALUES (1,49,10); INSERT INTO field_tag VALUES (1,50,10); INSERT INTO field_tag VALUES (1,51,10); INSERT INTO field_tag VALUES (1,52,10); INSERT INTO field_tag VALUES (1,53,10); INSERT INTO field_tag VALUES (1,54,10); INSERT INTO field_tag VALUES (1,55,10); INSERT INTO field_tag VALUES (1,56,10); INSERT INTO field_tag VALUES (1,57,10); INSERT INTO field_tag VALUES (1,58,10); INSERT INTO field_tag VALUES (1,59,10); INSERT INTO field_tag VALUES (1,60,10); INSERT INTO field_tag VALUES (1,61,10); INSERT INTO field_tag VALUES (1,62,10); INSERT INTO field_tag VALUES (1,63,10); INSERT INTO field_tag VALUES (1,64,10); INSERT INTO field_tag VALUES (1,65,10); INSERT INTO field_tag VALUES (1,66,10); INSERT INTO field_tag VALUES (1,67,10); INSERT INTO field_tag VALUES (1,68,10); INSERT INTO field_tag VALUES (1,69,10); INSERT INTO field_tag VALUES (1,70,10); INSERT INTO field_tag VALUES (1,71,10); INSERT INTO field_tag VALUES (1,72,10); INSERT INTO field_tag VALUES (1,73,10); INSERT INTO field_tag VALUES (1,74,10); INSERT INTO field_tag VALUES (1,75,10); INSERT INTO field_tag VALUES (1,76,10); INSERT INTO field_tag VALUES (1,77,10); INSERT INTO field_tag VALUES (1,78,10); INSERT INTO field_tag VALUES (1,79,10); INSERT INTO field_tag VALUES (1,80,10); INSERT INTO field_tag VALUES (1,81,10); INSERT INTO field_tag VALUES (1,82,10); INSERT INTO field_tag VALUES (1,83,10); INSERT INTO field_tag VALUES (1,84,10); INSERT INTO field_tag VALUES (1,85,10); INSERT INTO field_tag VALUES (1,86,10); INSERT INTO field_tag VALUES (1,87,10); INSERT INTO field_tag VALUES (1,88,10); INSERT INTO field_tag VALUES (1,89,10); INSERT INTO field_tag VALUES (1,90,10); INSERT INTO field_tag VALUES (1,91,10); INSERT INTO field_tag VALUES (1,92,10); INSERT INTO field_tag VALUES (1,93,10); INSERT INTO field_tag VALUES (1,94,10); INSERT INTO field_tag VALUES (1,95,10); INSERT INTO field_tag VALUES (1,96,10); INSERT INTO field_tag VALUES (1,97,10); INSERT INTO field_tag VALUES (1,98,10); INSERT INTO field_tag VALUES (1,99,10); INSERT INTO field_tag VALUES (1,122,10); INSERT INTO field_tag VALUES (1,123,10); INSERT INTO field_tag VALUES (1,124,10); INSERT INTO field_tag VALUES (1,125,10); INSERT INTO field_tag VALUES (1,126,10); INSERT INTO field_tag VALUES (1,127,10); INSERT INTO field_tag VALUES (1,128,10); INSERT INTO field_tag VALUES (1,129,10); INSERT INTO field_tag VALUES (1,130,10); INSERT INTO field_tag VALUES (10,11,100); INSERT INTO field_tag VALUES (11,14,100); INSERT INTO field_tag VALUES (12,15,10); INSERT INTO field_tag VALUES (13,116,10); INSERT INTO field_tag VALUES (2,3,100); INSERT INTO field_tag VALUES (2,4,90); INSERT INTO field_tag VALUES (3,1,100); INSERT INTO field_tag VALUES (3,2,90); INSERT INTO field_tag VALUES (4,5,100); INSERT INTO field_tag VALUES (5,6,100); INSERT INTO field_tag VALUES (6,7,30); INSERT INTO field_tag VALUES (6,8,10); INSERT INTO field_tag VALUES (6,9,20); INSERT INTO field_tag VALUES (7,12,100); INSERT INTO field_tag VALUES (7,13,90); INSERT INTO field_tag VALUES (8,10,100); INSERT INTO field_tag VALUES (9,115,100); INSERT INTO field_tag VALUES (14,117,100); INSERT INTO field_tag VALUES (15,118,100); INSERT INTO field_tag VALUES (16,119,100); INSERT INTO field_tag VALUES (17,120,100); -- INSERT INTO field_tag VALUES (18,121,100); INSERT INTO field_tag VALUES (19,131,100); INSERT INTO field_tag VALUES (20,132,100); INSERT INTO field_tag VALUES (21,133,100); INSERT INTO field_tag VALUES (21,134,90); INSERT INTO field_tag VALUES (22,1,100); INSERT INTO field_tag VALUES (22,2,90); INSERT INTO format VALUES (1,'HTML brief','hb', 'HTML brief output format, used for search results pages.', 'text/html', 1); INSERT INTO format VALUES (2,'HTML detailed','hd', 'HTML detailed output format, used for Detailed record pages.', 'text/html', 1); INSERT INTO format VALUES (3,'MARC','hm', 'HTML MARC.', 'text/html', 1); INSERT INTO format VALUES (4,'Dublin Core','xd', 'XML Dublin Core.', 'text/xml', 1); INSERT INTO format VALUES (5,'MARCXML','xm', 'XML MARC.', 'text/xml', 1); INSERT INTO format VALUES (6,'portfolio','hp', 'HTML portfolio-style output format for photos.', 'text/html', 1); INSERT INTO format VALUES (7,'photo captions only','hc', 'HTML caption-only output format for photos.', 'text/html', 1); INSERT INTO format VALUES (8,'BibTeX','hx', 'BibTeX.', 'text/html', 1); INSERT INTO format VALUES (9,'EndNote','xe', 'XML EndNote.', 'text/xml', 1); INSERT INTO format VALUES (10,'NLM','xn', 'XML NLM.', 'text/xml', 1); INSERT INTO format VALUES (11,'Excel','excel', 'Excel csv output', 'application/ms-excel', 0); INSERT INTO format VALUES (12,'HTML similarity','hs', 'Very short HTML output for similarity box (people also viewed..).', 'text/html', 0); INSERT INTO format VALUES (13,'RSS','xr', 'RSS.', 'text/xml', 0); INSERT INTO format VALUES (14,'OAI DC','xoaidc', 'OAI DC.', 'text/xml', 0); INSERT INTO format VALUES (15,'File mini-panel', 'hdfile', 'Used to show fulltext files in mini-panel of detailed record pages.', 'text/html', 0); INSERT INTO format VALUES (16,'Actions mini-panel', 'hdact', 'Used to display actions in mini-panel of detailed record pages.', 'text/html', 0); INSERT INTO format VALUES (17,'References tab', 'hdref', 'Display record references in References tab.', 'text/html', 0); INSERT INTO format VALUES (18,'HTML citesummary','hcs', 'HTML cite summary format, used for search results pages.', 'text/html', 1); INSERT INTO format VALUES (19,'RefWorks','xw', 'RefWorks.', 'text/xml', 1); INSERT INTO format VALUES (20,'MODS', 'xo', 'Metadata Object Description Schema', 'application/xml', 1); INSERT INTO tag VALUES (1,'first author name','100__a'); INSERT INTO tag VALUES (2,'additional author name','700__a'); INSERT INTO tag VALUES (3,'main title','245__%'); INSERT INTO tag VALUES (4,'additional title','246__%'); INSERT INTO tag VALUES (5,'abstract','520__%'); INSERT INTO tag VALUES (6,'keyword','6531_a'); INSERT INTO tag VALUES (7,'primary report number','037__a'); INSERT INTO tag VALUES (8,'additional report number','088__a'); INSERT INTO tag VALUES (9,'added report number','909C0r'); INSERT INTO tag VALUES (10,'reference','999C5%'); INSERT INTO tag VALUES (11,'collection identifier','980__%'); INSERT INTO tag VALUES (12,'main subject','65017a'); INSERT INTO tag VALUES (13,'additional subject','65027a'); INSERT INTO tag VALUES (14,'division','909C0p'); INSERT INTO tag VALUES (15,'year','909C0y'); INSERT INTO tag VALUES (16,'00x','00%'); INSERT INTO tag VALUES (17,'01x','01%'); INSERT INTO tag VALUES (18,'02x','02%'); INSERT INTO tag VALUES (19,'03x','03%'); INSERT INTO tag VALUES (20,'lang','04%'); INSERT INTO tag VALUES (21,'05x','05%'); INSERT INTO tag VALUES (22,'06x','06%'); INSERT INTO tag VALUES (23,'07x','07%'); INSERT INTO tag VALUES (24,'08x','08%'); INSERT INTO tag VALUES (25,'09x','09%'); INSERT INTO tag VALUES (26,'10x','10%'); INSERT INTO tag VALUES (27,'11x','11%'); INSERT INTO tag VALUES (28,'12x','12%'); INSERT INTO tag VALUES (29,'13x','13%'); INSERT INTO tag VALUES (30,'14x','14%'); INSERT INTO tag VALUES (31,'15x','15%'); INSERT INTO tag VALUES (32,'16x','16%'); INSERT INTO tag VALUES (33,'17x','17%'); INSERT INTO tag VALUES (34,'18x','18%'); INSERT INTO tag VALUES (35,'19x','19%'); INSERT INTO tag VALUES (36,'20x','20%'); INSERT INTO tag VALUES (37,'21x','21%'); INSERT INTO tag VALUES (38,'22x','22%'); INSERT INTO tag VALUES (39,'23x','23%'); INSERT INTO tag VALUES (40,'24x','24%'); INSERT INTO tag VALUES (41,'25x','25%'); INSERT INTO tag VALUES (42,'internal','26%'); INSERT INTO tag VALUES (43,'27x','27%'); INSERT INTO tag VALUES (44,'28x','28%'); INSERT INTO tag VALUES (45,'29x','29%'); INSERT INTO tag VALUES (46,'pages','30%'); INSERT INTO tag VALUES (47,'31x','31%'); INSERT INTO tag VALUES (48,'32x','32%'); INSERT INTO tag VALUES (49,'33x','33%'); INSERT INTO tag VALUES (50,'34x','34%'); INSERT INTO tag VALUES (51,'35x','35%'); INSERT INTO tag VALUES (52,'36x','36%'); INSERT INTO tag VALUES (53,'37x','37%'); INSERT INTO tag VALUES (54,'38x','38%'); INSERT INTO tag VALUES (55,'39x','39%'); INSERT INTO tag VALUES (56,'40x','40%'); INSERT INTO tag VALUES (57,'41x','41%'); INSERT INTO tag VALUES (58,'42x','42%'); INSERT INTO tag VALUES (59,'43x','43%'); INSERT INTO tag VALUES (60,'44x','44%'); INSERT INTO tag VALUES (61,'45x','45%'); INSERT INTO tag VALUES (62,'46x','46%'); INSERT INTO tag VALUES (63,'47x','47%'); INSERT INTO tag VALUES (64,'48x','48%'); INSERT INTO tag VALUES (65,'series','49%'); INSERT INTO tag VALUES (66,'50x','50%'); INSERT INTO tag VALUES (67,'51x','51%'); INSERT INTO tag VALUES (68,'52x','52%'); INSERT INTO tag VALUES (69,'53x','53%'); INSERT INTO tag VALUES (70,'54x','54%'); INSERT INTO tag VALUES (71,'55x','55%'); INSERT INTO tag VALUES (72,'56x','56%'); INSERT INTO tag VALUES (73,'57x','57%'); INSERT INTO tag VALUES (74,'58x','58%'); INSERT INTO tag VALUES (75,'summary','59%'); INSERT INTO tag VALUES (76,'60x','60%'); INSERT INTO tag VALUES (77,'61x','61%'); INSERT INTO tag VALUES (78,'62x','62%'); INSERT INTO tag VALUES (79,'63x','63%'); INSERT INTO tag VALUES (80,'64x','64%'); INSERT INTO tag VALUES (81,'65x','65%'); INSERT INTO tag VALUES (82,'66x','66%'); INSERT INTO tag VALUES (83,'67x','67%'); INSERT INTO tag VALUES (84,'68x','68%'); INSERT INTO tag VALUES (85,'subject','69%'); INSERT INTO tag VALUES (86,'70x','70%'); INSERT INTO tag VALUES (87,'71x','71%'); INSERT INTO tag VALUES (88,'author-ad','72%'); INSERT INTO tag VALUES (89,'73x','73%'); INSERT INTO tag VALUES (90,'74x','74%'); INSERT INTO tag VALUES (91,'75x','75%'); INSERT INTO tag VALUES (92,'76x','76%'); INSERT INTO tag VALUES (93,'77x','77%'); INSERT INTO tag VALUES (94,'78x','78%'); INSERT INTO tag VALUES (95,'79x','79%'); INSERT INTO tag VALUES (96,'80x','80%'); INSERT INTO tag VALUES (97,'81x','81%'); INSERT INTO tag VALUES (98,'82x','82%'); INSERT INTO tag VALUES (99,'83x','83%'); INSERT INTO tag VALUES (100,'84x','84%'); INSERT INTO tag VALUES (101,'electr','85%'); INSERT INTO tag VALUES (102,'86x','86%'); INSERT INTO tag VALUES (103,'87x','87%'); INSERT INTO tag VALUES (104,'88x','88%'); INSERT INTO tag VALUES (105,'89x','89%'); INSERT INTO tag VALUES (106,'publication','90%'); INSERT INTO tag VALUES (107,'pub-conf-cit','91%'); INSERT INTO tag VALUES (108,'92x','92%'); INSERT INTO tag VALUES (109,'93x','93%'); INSERT INTO tag VALUES (110,'94x','94%'); INSERT INTO tag VALUES (111,'95x','95%'); INSERT INTO tag VALUES (112,'catinfo','96%'); INSERT INTO tag VALUES (113,'97x','97%'); INSERT INTO tag VALUES (114,'98x','98%'); INSERT INTO tag VALUES (115,'url','8564_u'); INSERT INTO tag VALUES (116,'experiment','909C0e'); INSERT INTO tag VALUES (117,'record ID','001'); INSERT INTO tag VALUES (118,'isbn','020__a'); INSERT INTO tag VALUES (119,'issn','022__a'); INSERT INTO tag VALUES (120,'coden','030__a'); -- INSERT INTO tag VALUES (121,'doi','773__a'); INSERT INTO tag VALUES (122,'850x','850%'); INSERT INTO tag VALUES (123,'851x','851%'); INSERT INTO tag VALUES (124,'852x','852%'); INSERT INTO tag VALUES (125,'853x','853%'); INSERT INTO tag VALUES (126,'854x','854%'); INSERT INTO tag VALUES (127,'855x','855%'); INSERT INTO tag VALUES (128,'857x','857%'); INSERT INTO tag VALUES (129,'858x','858%'); INSERT INTO tag VALUES (130,'859x','859%'); INSERT INTO tag VALUES (131,'journal','909C4%'); INSERT INTO tag VALUES (132,'collaboration','710__g'); INSERT INTO tag VALUES (133,'first author affiliation','100__u'); INSERT INTO tag VALUES (134,'additional author affiliation','700__u'); INSERT INTO idxINDEX VALUES (1,'global','This index contains words/phrases from global fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX VALUES (2,'collection','This index contains words/phrases from collection identifiers fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX VALUES (3,'abstract','This index contains words/phrases from abstract fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX VALUES (4,'author','This index contains fuzzy words/phrases from author fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX VALUES (5,'keyword','This index contains words/phrases from keyword fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX VALUES (6,'reference','This index contains words/phrases from references fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX VALUES (7,'reportnumber','This index contains words/phrases from report numbers fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX VALUES (8,'title','This index contains words/phrases from title fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX VALUES (9,'fulltext','This index contains words/phrases from fulltext fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX VALUES (10,'year','This index contains words/phrases from year fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX VALUES (11,'journal','This index contains words/phrases from journal publication information fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX VALUES (12,'collaboration','This index contains words/phrases from collaboration name fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX VALUES (13,'affiliation','This index contains words/phrases from institutional affiliation fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX VALUES (14,'exactauthor','This index contains exact words/phrases from author fields.','0000-00-00 00:00:00', ''); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (1,1); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (2,10); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (3,4); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (4,3); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (5,5); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (6,8); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (7,6); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (8,2); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (9,9); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (10,12); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (11,19); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (12,20); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (13,21); INSERT INTO idxINDEX_field (id_idxINDEX, id_field) VALUES (14,22); INSERT INTO sbmACTION VALUES ('Submit New Record','SBI','running','1998-08-17','2001-08-08','','Submit New Record'); INSERT INTO sbmACTION VALUES ('Modify Record','MBI','modify','1998-08-17','2001-11-07','','Modify Record'); INSERT INTO sbmACTION VALUES ('Submit New File','SRV','revise','0000-00-00','2001-11-07','','Submit New File'); INSERT INTO sbmACTION VALUES ('Approve Record','APP','approve','2001-11-08','2002-06-11','','Approve Record'); INSERT INTO sbmALLFUNCDESCR VALUES ('Ask_For_Record_Details_Confirmation',''); INSERT INTO sbmALLFUNCDESCR VALUES ('CaseEDS',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Create_Modify_Interface',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Create_Recid',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Finish_Submission',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Get_Info',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Get_Recid', 'This function gets the recid for a document with a given report-number (as stored in the global variable rn).'); INSERT INTO sbmALLFUNCDESCR VALUES ('Get_Report_Number',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Get_Sysno',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Insert_Modify_Record',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Insert_Record',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Is_Original_Submitter',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Is_Referee','This function checks whether the logged user is a referee for the current document'); INSERT INTO sbmALLFUNCDESCR VALUES ('Mail_Approval_Request_to_Referee',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Mail_Approval_Withdrawn_to_Referee',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Mail_Submitter',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Make_Modify_Record',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Make_Record',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Move_From_Pending',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Move_to_Done',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Move_to_Pending',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Print_Success',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Print_Success_Approval_Request',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Print_Success_APP',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Print_Success_DEL','Prepare a message for the user informing them that their record was successfully deleted.'); INSERT INTO sbmALLFUNCDESCR VALUES ('Print_Success_MBI',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Print_Success_SRV',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Register_Approval_Request',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Register_Referee_Decision',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Withdraw_Approval_Request',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Report_Number_Generation',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Second_Report_Number_Generation','Generate a secondary report number for a document.'); INSERT INTO sbmALLFUNCDESCR VALUES ('Send_Approval_Request',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Send_APP_Mail',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Send_Delete_Mail',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Send_Modify_Mail',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Send_SRV_Mail',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('Stamp_Replace_Single_File_Approval','Stamp a single file when a document is approved.'); INSERT INTO sbmALLFUNCDESCR VALUES ('Stamp_Uploaded_Files','Stamp some of the files that were uploaded during a submission.'); INSERT INTO sbmALLFUNCDESCR VALUES ('Test_Status',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Update_Approval_DB',NULL); INSERT INTO sbmALLFUNCDESCR VALUES ('User_is_Record_Owner_or_Curator',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Move_Files_to_Storage',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Make_Dummy_MARC_XML_Record',''); INSERT INTO sbmALLFUNCDESCR VALUES ('Move_FCKeditor_Files_to_Storage','Transfer files attached to the record with the FCKeditor'); INSERT INTO sbmALLFUNCDESCR VALUES ('Create_Upload_Files_Interface','Display generic interface to add/revise/delete files. To be used before function "Move_Uploaded_Files_to_Storage"'); INSERT INTO sbmALLFUNCDESCR VALUES ('Move_Uploaded_Files_to_Storage','Attach files uploaded with "Create_Upload_Files_Interface"'); -INSERT INTO sbmCHECKS VALUES ('AUCheck','function AUCheck(txt) {\r\n var res=1;\r\n tmp=txt.indexOf(\"\\015\");\r\n while (tmp != -1) {\r\n left=txt.substring(0,tmp);\r\n right=txt.substring(tmp+2,txt.length);\r\n txt=left + \"\\012\" + right;\r\n tmp=txt.indexOf(\"\\015\");\r\n }\r\n tmp=txt.indexOf(\"\\012\");\r\n if (tmp==-1){\r\n line=txt;\r\n txt=\'\';}\r\n else{\r\n line=txt.substring(0,tmp);\r\n txt=txt.substring(tmp+1,txt.length);}\r\n while (line != \"\"){\r\n coma=line.indexOf(\",\");\r\n left=line.substring(0,coma);\r\n right=line.substring(coma+1,line.length);\r\n coma2=right.indexOf(\",\");\r\n space=right.indexOf(\" \");\r\n if ((coma==-1)||(left==\"\")||(right==\"\")||(space!=0)||(coma2!=-1)){\r\n res=0;\r\n error_log=line;\r\n }\r\n tmp=txt.indexOf(\"\\012\");\r\n if (tmp==-1){\r\n line=txt;\r\n txt=\'\';}\r\n else{\r\n line=txt.substring(0,tmp-1);\r\n txt=txt.substring(tmp+1,txt.length);}\r\n }\r\n if (res == 0){\r\n alert(\"This author name cannot be managed \\: \\012\\012\" + error_log + \" \\012\\012It is not in the required format!\\012Put one author per line and a comma (,) between the name and the firstname initial letters. \\012The name is going first, followed by the firstname initial letters.\\012Do not forget the whitespace after the comma!!!\\012\\012Example \\: Put\\012\\012Le Meur, J Y \\012Baron, T \\012\\012for\\012\\012Le Meur Jean-Yves & Baron Thomas.\");\r\n return 0;\r\n } \r\n return 1; \r\n}','1998-08-18','0000-00-00','',''); -INSERT INTO sbmCHECKS VALUES ('DatCheckNew','function DatCheckNew(txt) {\r\n var res=1;\r\n if (txt.length != 10){res=0;}\r\n if (txt.indexOf(\"/\") != 2){res=0;}\r\n if (txt.lastIndexOf(\"/\") != 5){res=0;}\r\n tmp=parseInt(txt.substring(0,2),10);\r\n if ((tmp > 31)||(tmp < 1)||(isNaN(tmp))){res=0;}\r\n tmp=parseInt(txt.substring(3,5),10);\r\n if ((tmp > 12)||(tmp < 1)||(isNaN(tmp))){res=0;}\r\n tmp=parseInt(txt.substring(6,10),10);\r\n if ((tmp < 1)||(isNaN(tmp))){res=0;}\r\n if (txt.length == 0){res=1;}\r\n if (res == 0){\r\n alert(\"Please enter a correct Date \\012Format: dd/mm/yyyy\");\r\n return 0;\r\n }\r\n return 1; \r\n}','0000-00-00','0000-00-00','',''); +INSERT INTO sbmCHECKS VALUES ('AUCheck','function AUCheck(txt) {\r\n var res=1;\r\n tmp=txt.indexOf(\"\\015\");\r\n while (tmp != -1) {\r\n left=txt.substring(0,tmp);\r\n right=txt.substring(tmp+2,txt.length);\r\n txt=left + \"\\012\" + right;\r\n tmp=txt.indexOf(\"\\015\");\r\n }\r\n tmp=txt.indexOf(\"\\012\");\r\n if (tmp==-1){\r\n line=txt;\r\n txt=\'\';}\r\n else{\r\n line=txt.substring(0,tmp);\r\n txt=txt.substring(tmp+1,txt.length);}\r\n while (line != \"\"){\r\n coma=line.indexOf(\",\");\r\n left=line.substring(0,coma);\r\n right=line.substring(coma+1,line.length);\r\n coma2=right.indexOf(\",\");\r\n space=right.indexOf(\" \");\r\n if ((coma==-1)||(left==\"\")||(right==\"\")||(space!=0)||(coma2!=-1)){\r\n res=0;\r\n error_log=line;\r\n }\r\n tmp=txt.indexOf(\"\\012\");\r\n if (tmp==-1){\r\n line=txt;\r\n txt=\'\';}\r\n else{\r\n line=txt.substring(0,tmp-1);\r\n txt=txt.substring(tmp+1,txt.length);}\r\n }\r\n if (res == 0){\r\n alert(\"This author name cannot be managed \\: \\012\\012\" + error_log + \" \\012\\012It is not in the required format!\\012Put one author per line and a comma (,) between the name and the firstname initial letters. \\012The name is going first, followed by the firstname initial letters.\\012Do not forget the whitespace after the comma!!!\\012\\012Example \\: Put\\012\\012Le Meur, J Y \\012Baron, T \\012\\012for\\012\\012Le Meur Jean-Yves & Baron Thomas.\");\r\n return 0;\r\n } \r\n return 1; \r\n}','1998-08-18','0000-00-00','',''); +INSERT INTO sbmCHECKS VALUES ('DatCheckNew','function DatCheckNew(txt) {\r\n var res=1;\r\n if (txt.length != 10){res=0;}\r\n if (txt.indexOf(\"/\") != 2){res=0;}\r\n if (txt.lastIndexOf(\"/\") != 5){res=0;}\r\n tmp=parseInt(txt.substring(0,2),10);\r\n if ((tmp > 31)||(tmp < 1)||(isNaN(tmp))){res=0;}\r\n tmp=parseInt(txt.substring(3,5),10);\r\n if ((tmp > 12)||(tmp < 1)||(isNaN(tmp))){res=0;}\r\n tmp=parseInt(txt.substring(6,10),10);\r\n if ((tmp < 1)||(isNaN(tmp))){res=0;}\r\n if (txt.length == 0){res=1;}\r\n if (res == 0){\r\n alert(\"Please enter a correct Date \\012Format: dd/mm/yyyy\");\r\n return 0;\r\n }\r\n return 1; \r\n}','0000-00-00','0000-00-00','',''); INSERT INTO sbmFORMATEXTENSION VALUES ('WORD','.doc'); INSERT INTO sbmFORMATEXTENSION VALUES ('PostScript','.ps'); INSERT INTO sbmFORMATEXTENSION VALUES ('PDF','.pdf'); INSERT INTO sbmFORMATEXTENSION VALUES ('JPEG','.jpg'); INSERT INTO sbmFORMATEXTENSION VALUES ('JPEG','.jpeg'); INSERT INTO sbmFORMATEXTENSION VALUES ('GIF','.gif'); INSERT INTO sbmFORMATEXTENSION VALUES ('PPT','.ppt'); INSERT INTO sbmFORMATEXTENSION VALUES ('HTML','.htm'); INSERT INTO sbmFORMATEXTENSION VALUES ('HTML','.html'); INSERT INTO sbmFORMATEXTENSION VALUES ('Latex','.tex'); INSERT INTO sbmFORMATEXTENSION VALUES ('Compressed PostScript','.ps.gz'); INSERT INTO sbmFORMATEXTENSION VALUES ('Tarred Tex (.tar)','.tar'); INSERT INTO sbmFORMATEXTENSION VALUES ('Text','.txt'); INSERT INTO sbmFUNDESC VALUES ('Get_Report_Number','edsrn'); INSERT INTO sbmFUNDESC VALUES ('Send_Modify_Mail','addressesMBI'); INSERT INTO sbmFUNDESC VALUES ('Send_Modify_Mail','sourceDoc'); INSERT INTO sbmFUNDESC VALUES ('Register_Approval_Request','categ_file_appreq'); INSERT INTO sbmFUNDESC VALUES ('Register_Approval_Request','categ_rnseek_appreq'); INSERT INTO sbmFUNDESC VALUES ('Register_Approval_Request','note_file_appreq'); INSERT INTO sbmFUNDESC VALUES ('Register_Referee_Decision','decision_file'); INSERT INTO sbmFUNDESC VALUES ('Withdraw_Approval_Request','categ_file_withd'); INSERT INTO sbmFUNDESC VALUES ('Withdraw_Approval_Request','categ_rnseek_withd'); INSERT INTO sbmFUNDESC VALUES ('Report_Number_Generation','edsrn'); INSERT INTO sbmFUNDESC VALUES ('Report_Number_Generation','autorngen'); INSERT INTO sbmFUNDESC VALUES ('Report_Number_Generation','rnin'); INSERT INTO sbmFUNDESC VALUES ('Report_Number_Generation','counterpath'); INSERT INTO sbmFUNDESC VALUES ('Report_Number_Generation','rnformat'); INSERT INTO sbmFUNDESC VALUES ('Report_Number_Generation','yeargen'); INSERT INTO sbmFUNDESC VALUES ('Report_Number_Generation','nblength'); INSERT INTO sbmFUNDESC VALUES ('Mail_Approval_Request_to_Referee','categ_file_appreq'); INSERT INTO sbmFUNDESC VALUES ('Mail_Approval_Request_to_Referee','categ_rnseek_appreq'); INSERT INTO sbmFUNDESC VALUES ('Mail_Approval_Request_to_Referee','edsrn'); INSERT INTO sbmFUNDESC VALUES ('Mail_Approval_Withdrawn_to_Referee','categ_file_withd'); INSERT INTO sbmFUNDESC VALUES ('Mail_Approval_Withdrawn_to_Referee','categ_rnseek_withd'); INSERT INTO sbmFUNDESC VALUES ('Mail_Submitter','authorfile'); INSERT INTO sbmFUNDESC VALUES ('Mail_Submitter','status'); INSERT INTO sbmFUNDESC VALUES ('Send_Approval_Request','authorfile'); INSERT INTO sbmFUNDESC VALUES ('Create_Modify_Interface','fieldnameMBI'); INSERT INTO sbmFUNDESC VALUES ('Send_Modify_Mail','fieldnameMBI'); INSERT INTO sbmFUNDESC VALUES ('Update_Approval_DB','categformatDAM'); INSERT INTO sbmFUNDESC VALUES ('Update_Approval_DB','decision_file'); INSERT INTO sbmFUNDESC VALUES ('Send_SRV_Mail','categformatDAM'); INSERT INTO sbmFUNDESC VALUES ('Send_SRV_Mail','addressesSRV'); INSERT INTO sbmFUNDESC VALUES ('Send_Approval_Request','directory'); INSERT INTO sbmFUNDESC VALUES ('Send_Approval_Request','categformatDAM'); INSERT INTO sbmFUNDESC VALUES ('Send_Approval_Request','addressesDAM'); INSERT INTO sbmFUNDESC VALUES ('Send_Approval_Request','titleFile'); INSERT INTO sbmFUNDESC VALUES ('Send_APP_Mail','edsrn'); INSERT INTO sbmFUNDESC VALUES ('Mail_Submitter','titleFile'); INSERT INTO sbmFUNDESC VALUES ('Send_Modify_Mail','emailFile'); INSERT INTO sbmFUNDESC VALUES ('Get_Info','authorFile'); INSERT INTO sbmFUNDESC VALUES ('Get_Info','emailFile'); INSERT INTO sbmFUNDESC VALUES ('Get_Info','titleFile'); INSERT INTO sbmFUNDESC VALUES ('Make_Modify_Record','modifyTemplate'); INSERT INTO sbmFUNDESC VALUES ('Send_APP_Mail','addressesAPP'); INSERT INTO sbmFUNDESC VALUES ('Send_APP_Mail','categformatAPP'); INSERT INTO sbmFUNDESC VALUES ('Send_APP_Mail','newrnin'); INSERT INTO sbmFUNDESC VALUES ('Send_APP_Mail','decision_file'); INSERT INTO sbmFUNDESC VALUES ('Send_APP_Mail','comments_file'); INSERT INTO sbmFUNDESC VALUES ('CaseEDS','casevariable'); INSERT INTO sbmFUNDESC VALUES ('CaseEDS','casevalues'); INSERT INTO sbmFUNDESC VALUES ('CaseEDS','casesteps'); INSERT INTO sbmFUNDESC VALUES ('CaseEDS','casedefault'); INSERT INTO sbmFUNDESC VALUES ('Send_SRV_Mail','noteFile'); INSERT INTO sbmFUNDESC VALUES ('Send_SRV_Mail','emailFile'); INSERT INTO sbmFUNDESC VALUES ('Mail_Submitter','emailFile'); INSERT INTO sbmFUNDESC VALUES ('Mail_Submitter','edsrn'); INSERT INTO sbmFUNDESC VALUES ('Mail_Submitter','newrnin'); INSERT INTO sbmFUNDESC VALUES ('Make_Record','sourceTemplate'); INSERT INTO sbmFUNDESC VALUES ('Make_Record','createTemplate'); INSERT INTO sbmFUNDESC VALUES ('Print_Success','edsrn'); INSERT INTO sbmFUNDESC VALUES ('Print_Success','newrnin'); INSERT INTO sbmFUNDESC VALUES ('Print_Success','status'); INSERT INTO sbmFUNDESC VALUES ('Make_Modify_Record','sourceTemplate'); INSERT INTO sbmFUNDESC VALUES ('Move_Files_to_Storage','documenttype'); INSERT INTO sbmFUNDESC VALUES ('Move_Files_to_Storage','iconsize'); INSERT INTO sbmFUNDESC VALUES ('Move_Files_to_Storage','paths_and_suffixes'); INSERT INTO sbmFUNDESC VALUES ('Move_Files_to_Storage','rename'); INSERT INTO sbmFUNDESC VALUES ('Stamp_Uploaded_Files','files_to_be_stamped'); INSERT INTO sbmFUNDESC VALUES ('Stamp_Uploaded_Files','latex_template'); INSERT INTO sbmFUNDESC VALUES ('Stamp_Uploaded_Files','latex_template_vars'); INSERT INTO sbmFUNDESC VALUES ('Stamp_Uploaded_Files','stamp'); INSERT INTO sbmFUNDESC VALUES ('Make_Dummy_MARC_XML_Record','dummyrec_source_tpl'); INSERT INTO sbmFUNDESC VALUES ('Make_Dummy_MARC_XML_Record','dummyrec_create_tpl'); INSERT INTO sbmFUNDESC VALUES ('Print_Success_APP','decision_file'); INSERT INTO sbmFUNDESC VALUES ('Print_Success_APP','newrnin'); INSERT INTO sbmFUNDESC VALUES ('Send_Delete_Mail','edsrn'); INSERT INTO sbmFUNDESC VALUES ('Send_Delete_Mail','record_managers'); INSERT INTO sbmFUNDESC VALUES ('Second_Report_Number_Generation','2nd_rn_file'); INSERT INTO sbmFUNDESC VALUES ('Second_Report_Number_Generation','2nd_rn_format'); INSERT INTO sbmFUNDESC VALUES ('Second_Report_Number_Generation','2nd_rn_yeargen'); INSERT INTO sbmFUNDESC VALUES ('Second_Report_Number_Generation','2nd_rncateg_file'); INSERT INTO sbmFUNDESC VALUES ('Second_Report_Number_Generation','2nd_counterpath'); INSERT INTO sbmFUNDESC VALUES ('Second_Report_Number_Generation','2nd_nb_length'); INSERT INTO sbmFUNDESC VALUES ('Stamp_Replace_Single_File_Approval','file_to_be_stamped'); INSERT INTO sbmFUNDESC VALUES ('Stamp_Replace_Single_File_Approval','latex_template'); INSERT INTO sbmFUNDESC VALUES ('Stamp_Replace_Single_File_Approval','latex_template_vars'); INSERT INTO sbmFUNDESC VALUES ('Stamp_Replace_Single_File_Approval','new_file_name'); INSERT INTO sbmFUNDESC VALUES ('Stamp_Replace_Single_File_Approval','stamp'); INSERT INTO sbmFUNDESC VALUES ('Move_FCKeditor_Files_to_Storage','input_fields'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','maxsize'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','minsize'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','doctypes'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','restrictions'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','canDeleteDoctypes'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','canReviseDoctypes'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','canDescribeDoctypes'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','canCommentDoctypes'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','canKeepDoctypes'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','canAddFormatDoctypes'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','canRestrictDoctypes'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','canRenameDoctypes'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','canNameNewFiles'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','createRelatedFormats'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','keepDefault'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','showLinks'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','fileLabel'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','filenameLabel'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','descriptionLabel'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','commentLabel'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','restrictionLabel'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','startDoc'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','endDoc'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','defaultFilenameDoctypes'); INSERT INTO sbmFUNDESC VALUES ('Create_Upload_Files_Interface','maxFilesDoctypes'); INSERT INTO sbmFUNDESC VALUES ('Move_Uploaded_Files_to_Storage','iconsize'); INSERT INTO sbmFUNDESC VALUES ('Move_Uploaded_Files_to_Storage','createIconDoctypes'); INSERT INTO sbmFUNDESC VALUES ('Move_Uploaded_Files_to_Storage','forceFileRevision'); INSERT INTO sbmGFILERESULT VALUES ('HTML','HTML document'); INSERT INTO sbmGFILERESULT VALUES ('WORD','data'); INSERT INTO sbmGFILERESULT VALUES ('PDF','PDF document'); INSERT INTO sbmGFILERESULT VALUES ('PostScript','PostScript document'); INSERT INTO sbmGFILERESULT VALUES ('PostScript','data '); INSERT INTO sbmGFILERESULT VALUES ('PostScript','HP Printer Job Language data'); INSERT INTO sbmGFILERESULT VALUES ('jpg','JPEG image'); INSERT INTO sbmGFILERESULT VALUES ('Compressed PostScript','gzip compressed data'); INSERT INTO sbmGFILERESULT VALUES ('Tarred Tex (.tar)','tar archive'); INSERT INTO sbmGFILERESULT VALUES ('JPEG','JPEG image'); INSERT INTO sbmGFILERESULT VALUES ('GIF','GIF'); INSERT INTO collectiondetailedrecordpagetabs VALUES (8, 'usage;comments;metadata'); INSERT INTO collectiondetailedrecordpagetabs VALUES (19, 'usage;comments;metadata'); INSERT INTO collectiondetailedrecordpagetabs VALUES (18, 'usage;comments;metadata'); INSERT INTO collectiondetailedrecordpagetabs VALUES (17, 'usage;comments;metadata'); -- end of file diff --git a/modules/websubmit/lib/Makefile.am b/modules/websubmit/lib/Makefile.am index cc4a2e553..db2d2f8dc 100644 --- a/modules/websubmit/lib/Makefile.am +++ b/modules/websubmit/lib/Makefile.am @@ -1,45 +1,45 @@ ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. SUBDIRS = functions pylibdir = $(libdir)/python/invenio pylib_DATA = websubmit_config.py websubmit_engine.py file.py \ websubmit_dblayer.py \ websubmit_webinterface.py \ websubmit_templates.py \ websubmit_regression_tests.py \ websubmitadmin_config.py \ websubmitadmin_dblayer.py \ websubmitadmin_engine.py \ websubmitadmin_templates.py \ websubmitadmin_regression_tests.py \ websubmit_file_stamper.py \ websubmit_icon_creator.py \ websubmit_file_converter.py \ unoconv.py \ bibdocfile.py \ bibdocfilecli.py \ bibdocfile_regression_tests.py \ hocrlib.py -noinst_DATA = fulltext_files_migration_kit.py +noinst_DATA = fulltext_files_migration_kit.py icon_migration_kit.py EXTRA_DIST = $(pylib_DATA) $(noinst_DATA) CLEANFILES = *~ *.tmp *.pyc diff --git a/modules/websubmit/lib/bibdocfile.py b/modules/websubmit/lib/bibdocfile.py index 0beea8571..30abdcad8 100644 --- a/modules/websubmit/lib/bibdocfile.py +++ b/modules/websubmit/lib/bibdocfile.py @@ -1,3603 +1,3633 @@ ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """ This module implements the low-level API for dealing with fulltext files. - All the files associated to a I{record} (identified by a I{recid}) can be managed via an instance of the C{BibRecDocs} class. - A C{BibRecDocs} is a wrapper of the list of I{documents} attached to the record. - Each document is represented by an instance of the C{BibDoc} class. - A document is identified by a C{docid} and name (C{docname}). The docname must be unique within the record. A document is the set of all the formats and revisions of a piece of information. - A document has a type called C{doctype} and can have a restriction. - Each physical file, i.e. the concretization of a document into a particular I{version} and I{format} is represented by an instance of the C{BibDocFile} class. - The format is infact the extension of the physical file. - A comment and a description and other information can be associated to a BibDocFile. - A C{bibdoc} is a synonim for a document, while a C{bibdocfile} is a synonim for a physical file. @group Main classes: BibRecDocs,BibDoc,BibDocFile @group Other classes: BibDocMoreInfo,Md5Folder,InvenioWebSubmitFileError @group Main functions: decompose_file,stream_file,bibdocfile_*,download_url @group Configuration Variables: CFG_* """ __revision__ = "$Id$" import os import re import shutil import filecmp import time import random import socket import urllib2 import urllib import tempfile import cPickle import base64 import binascii import cgi import sys if sys.hexversion < 0x2060000: from md5 import md5 else: from hashlib import md5 try: import magic CFG_HAS_MAGIC = True except ImportError: CFG_HAS_MAGIC = False from datetime import datetime from mimetypes import MimeTypes from thread import get_ident from invenio import webinterface_handler_wsgi_utils as apache ## Let's set a reasonable timeout for URL request (e.g. FFT) socket.setdefaulttimeout(40) if sys.hexversion < 0x2040000: # pylint: disable-msg=W0622 from sets import Set as set # pylint: enable-msg=W0622 from invenio.shellutils import escape_shell_arg from invenio.dbquery import run_sql, DatabaseError, blob_to_string from invenio.errorlib import register_exception from invenio.bibrecord import record_get_field_instances, \ field_get_subfield_values, field_get_subfield_instances, \ encode_for_xml +from invenio.urlutils import create_url +from invenio.textutils import nice_size from invenio.access_control_engine import acc_authorize_action from invenio.config import CFG_SITE_LANG, CFG_SITE_URL, \ CFG_WEBDIR, CFG_WEBSUBMIT_FILEDIR,\ CFG_WEBSUBMIT_ADDITIONAL_KNOWN_FILE_EXTENSIONS, \ CFG_WEBSUBMIT_FILESYSTEM_BIBDOC_GROUP_LIMIT, CFG_SITE_SECURE_URL, \ CFG_BIBUPLOAD_FFT_ALLOWED_LOCAL_PATHS, \ CFG_TMPDIR, CFG_PATH_MD5SUM, \ CFG_WEBSUBMIT_STORAGEDIR, \ CFG_BIBDOCFILE_USE_XSENDFILE, \ CFG_BIBDOCFILE_MD5_CHECK_PROBABILITY -#from invenio.bibformat import format_record +from invenio.websubmit_config import CFG_WEBSUBMIT_ICON_SUBFORMAT_RE, \ + CFG_WEBSUBMIT_DEFAULT_ICON_SUBFORMAT +from invenio.bibformat import format_record import invenio.template websubmit_templates = invenio.template.load('websubmit') websearch_templates = invenio.template.load('websearch') #: block size when performing I/O. CFG_BIBDOCFILE_BLOCK_SIZE = 1024 * 8 #: threshold used do decide when to use Python MD5 of CLI MD5 algorithm. CFG_BIBDOCFILE_MD5_THRESHOLD = 256 * 1024 #: chunks loaded by the Python MD5 algorithm. CFG_BIBDOCFILE_MD5_BUFFER = 1024 * 1024 -#: wether to normalize e.g. ".JPEG" and ".jpg" into .jpeg. +#: whether to normalize e.g. ".JPEG" and ".jpg" into .jpeg. CFG_BIBDOCFILE_STRONG_FORMAT_NORMALIZATION = False #: flags that can be associated to files. CFG_BIBDOCFILE_AVAILABLE_FLAGS = ( 'PDF/A', 'STAMPED', 'PDFOPT', 'HIDDEN', 'CONVERTED', 'PERFORM_HIDE_PREVIOUS', 'OCRED' ) #: constant used if FFT correct with the obvious meaning. KEEP_OLD_VALUE = 'KEEP-OLD-VALUE' _mimes = MimeTypes(strict=False) _mimes.suffix_map.update({'.tbz2' : '.tar.bz2'}) _mimes.encodings_map.update({'.bz2' : 'bzip2'}) _magic_cookies = {} def _get_magic_cookies(): """ @return: a tuple of magic object. @rtype: (MAGIC_NONE, MAGIC_COMPRESS, MAGIC_MIME, MAGIC_COMPRESS + MAGIC_MIME) @note: ... not real magic. Just see: man file(1) """ thread_id = get_ident() if thread_id not in _magic_cookies: _magic_cookies[thread_id] = { magic.MAGIC_NONE : magic.open(magic.MAGIC_NONE), magic.MAGIC_COMPRESS : magic.open(magic.MAGIC_COMPRESS), magic.MAGIC_MIME : magic.open(magic.MAGIC_MIME), magic.MAGIC_COMPRESS + magic.MAGIC_MIME : magic.open(magic.MAGIC_COMPRESS + magic.MAGIC_MIME) } for key in _magic_cookies[thread_id].keys(): _magic_cookies[thread_id][key].load() return _magic_cookies[thread_id] def _generate_extensions(): """ Generate the regular expression to match all the known extensions. @return: the regular expression. @rtype: regular expression object """ _tmp_extensions = _mimes.encodings_map.keys() + \ _mimes.suffix_map.keys() + \ _mimes.types_map[1].keys() + \ CFG_WEBSUBMIT_ADDITIONAL_KNOWN_FILE_EXTENSIONS extensions = [] for ext in _tmp_extensions: if ext.startswith('.'): extensions.append(ext) else: extensions.append('.' + ext) extensions.sort() extensions.reverse() extensions = set([ext.lower() for ext in extensions]) extensions = '\\' + '$|\\'.join(extensions) + '$' extensions = extensions.replace('+', '\\+') return re.compile(extensions, re.I) #: Regular expression to recognized extensions. _extensions = _generate_extensions() class InvenioWebSubmitFileError(Exception): """ Exception raised in case of errors related to fulltext files. """ pass -def file_strip_ext(afile, skip_version=False, only_known_extensions=False): +def file_strip_ext(afile, skip_version=False, only_known_extensions=False, allow_subformat=True): """ Strip in the best way the extension from a filename. >>> file_strip_ext("foo.tar.gz") 'foo' >>> file_strip_ext("foo.buz.gz") 'foo.buz' >>> file_strip_ext("foo.buz") 'foo' >>> file_strip_ext("foo.buz", only_known_extensions=True) 'foo.buz' >>> file_strip_ext("foo.buz;1", skip_version=False, ... only_known_extensions=True) 'foo.buz;1' + >>> file_strip_ext("foo.gif;icon") + 'foo' + >>> file_strip_ext("foo.gif:icon", allow_subformat=False) + 'foo.gif:icon' @param afile: the path/name of a file. @type afile: string - @param skip_version: wether to skip a trailing ";version". + @param skip_version: whether to skip a trailing ";version". @type skip_version: bool - @param only_known_extensions: wether to strip out only known extensions or + @param only_known_extensions: whether to strip out only known extensions or to consider as extension anything that follows a dot. @type only_known_extensions: bool + @param allow_subformat: whether to consider also subformats as part of + the extension. + @type allow_subformat: bool @return: the name/path without the extension (and version). @rtype: string """ - if skip_version: + if skip_version or allow_subformat: afile = afile.split(';')[0] nextfile = _extensions.sub('', afile) if nextfile == afile and not only_known_extensions: nextfile = os.path.splitext(afile)[0] while nextfile != afile: afile = nextfile nextfile = _extensions.sub('', afile) return nextfile -def normalize_format(format): +def normalize_format(format, allow_subformat=True): """ Normalize the format, e.g. by adding a dot in front. @param format: the format/extension to be normalized. @type format: string + @param allow_subformat: whether to consider also subformats as part of + the extension. + @type allow_subformat: bool @return: the normalized format. @rtype; string """ + if allow_subformat: + subformat = format[format.rfind(';'):] + format = format[:format.rfind(';')] + else: + subformat = '' if format and format[0] != '.': format = '.' + format if CFG_BIBDOCFILE_STRONG_FORMAT_NORMALIZATION: if format not in ('.Z', '.H', '.C', '.CC'): format = format.lower() format = { '.jpg' : '.jpeg', '.htm' : '.html', '.tif' : '.tiff' }.get(format, format) - return format + return format + subformat def guess_format_from_url(url): """ Given a URL tries to guess it's extension. Different method will be used, including HTTP HEAD query, downloading the resource and using mime @param url: the URL for which the extension shuld be guessed. @type url: string @return: the recognized extension or empty string if it's impossible to recognize it. @rtype: string """ def parse_content_disposition(text): for item in text.split(';'): item = item.strip() if item.strip().startswith('filename='): return item[len('filename="'):-len('"')] def parse_content_type(text): return text.split(';')[0].strip() ## Let's try to guess the extension by considering the URL as a filename ext = decompose_file(url, skip_version=True, only_known_extensions=True)[2] if ext.startswith('.'): return ext if is_url_a_local_file(url) and CFG_HAS_MAGIC: ## if the URL corresponds to a local file, let's try to use ## the Python magic library to guess it try: magic_cookie = _get_magic_cookies()[magic.MAGIC_MIME] mimetype = magic_cookie.file(url) - ext = _mimes.guess_extension(content_type) + ext = _mimes.guess_extension(mimetype) if ext: return normalize_format(ext) except Exception: pass else: ## Since the URL is remote, let's try to perform a HEAD request ## and see the corresponding headers info = urllib2.urlopen(url).info() content_disposition = info.getheader('Content-Disposition') if content_disposition: filename = parse_content_disposition(content_disposition) if filename: return decompose_file(filename)[2] content_type = info.getheader('Content-Type') if content_type: content_type = parse_content_type(content_type) ext = _mimes.guess_extension(content_type) if ext: return normalize_format(ext) if CFG_HAS_MAGIC: ## Last solution: let's download the remote resource ## and use the Python magic library to guess the extension try: filename = download_url(url, format='') magic_cookie = _get_magic_cookies()[magic.MAGIC_MIME] mimetype = magic_cookie.file(filename) os.remove(filename) ext = _mimes.guess_extension(content_type) if ext: return normalize_format(ext) except Exception: pass return "" _docname_re = re.compile(r'[^-\w.]*') def normalize_docname(docname): """ Normalize the docname. At the moment the normalization is just returning the same string. @param docname: the docname to be normalized. @type docname: string @return: the normalized docname. @rtype: string """ #return _docname_re.sub('', docname) return docname def normalize_version(version): """ Normalize the version. The version can be either an integer or the keyword 'all'. Any other value will be transformed into the empty string. @param version: the version (either a number or 'all'). @type version: integer or string @return: the normalized version. @rtype: string """ try: int(version) except ValueError: if version.lower().strip() == 'all': return 'all' else: return '' return str(version) -def decompose_file(afile, skip_version=False, only_known_extensions=False): +def decompose_file(afile, skip_version=False, only_known_extensions=False, + allow_subformat=True): """ Decompose a file/path into its components dirname, basename and extension. >>> decompose_file('/tmp/foo.tar.gz') ('/tmp', 'foo', '.tar.gz') >>> decompose_file('/tmp/foo.tar.gz;1', skip_version=True) ('/tmp', 'foo', '.tar.gz') >>> decompose_file('http://www.google.com/index.html') ('http://www.google.com', 'index', '.html') @param afile: the path/name of a file. @type afile: string - @param skip_version: wether to skip a trailing ";version". + @param skip_version: whether to skip a trailing ";version". @type skip_version: bool - @param only_known_extensions: wether to strip out only known extensions or + @param only_known_extensions: whether to strip out only known extensions or to consider as extension anything that follows a dot. @type only_known_extensions: bool + @param allow_subformat: whether to consider also subformats as part of + the extension. + @type allow_subformat: bool @return: a tuple with the directory name, the docname and extension. @rtype: (dirname, docname, extension) @note: if a URL is provided, the scheme will be part of the dirname. @see: L{file_strip_ext} for the algorithm used to retrieve the extension. """ if skip_version: version = afile.split(';')[-1] try: int(version) afile = afile[:-len(version)-1] except ValueError: pass basename = os.path.basename(afile) dirname = afile[:-len(basename)-1] - base = file_strip_ext(basename, only_known_extensions=only_known_extensions) + base = file_strip_ext( + basename, + only_known_extensions=only_known_extensions, + allow_subformat=allow_subformat) extension = basename[len(base) + 1:] if extension: extension = '.' + extension return (dirname, base, extension) def decompose_file_with_version(afile): """ Decompose a file into dirname, basename, extension and version. >>> decompose_file_with_version('/tmp/foo.tar.gz;1') ('/tmp', 'foo', '.tar.gz', 1) @param afile: the path/name of a file. @type afile: string @return: a tuple with the directory name, the docname, extension and version. @rtype: (dirname, docname, extension, version) @raise ValueError: in case version does not exist it will. @note: if a URL is provided, the scheme will be part of the dirname. """ version_str = afile.split(';')[-1] version = int(version_str) afile = afile[:-len(version_str)-1] basename = os.path.basename(afile) dirname = afile[:-len(basename)-1] base = file_strip_ext(basename) extension = basename[len(base) + 1:] if extension: extension = '.' + extension return (dirname, base, extension, version) +def get_subformat_from_format(format): + """ + @return the subformat if any. + @rtype: string + >>> get_superformat_from_format('foo;bar') + 'bar' + >>> get_superformat_from_format('foo') + '' + """ + try: + return format[format.rindex(';') + 1:] + except ValueError: + return '' + +def get_superformat_from_format(format): + """ + @return the superformat if any. + @rtype: string + + >>> get_superformat_from_format('foo;bar') + 'foo' + >>> get_superformat_from_format('foo') + 'foo' + """ + try: + return format[:format.rindex(';')] + except ValueError: + return format def propose_next_docname(docname): """ Given a I{docname}, suggest a new I{docname} (useful when trying to generate a unique I{docname}). >>> propose_next_docname('foo') 'foo_1' >>> propose_next_docname('foo_1') 'foo_2' >>> propose_next_docname('foo_10') 'foo_11' @param docname: the base docname. @type docname: string @return: the next possible docname based on the given one. @rtype: string """ if '_' in docname: split_docname = docname.split('_') try: split_docname[-1] = str(int(split_docname[-1]) + 1) docname = '_'.join(split_docname) except ValueError: docname += '_1' else: docname += '_1' return docname class BibRecDocs: """ This class represents all the files attached to one record. @param recid: the record identifier. @type recid: integer - @param deleted_too: wether to consider deleted documents as normal + @param deleted_too: whether to consider deleted documents as normal documents (useful when trying to recover deleted information). @type deleted_too: bool - @param human_readable: wether numbers should be printed in human readable + @param human_readable: whether numbers should be printed in human readable format (e.g. 2048 bytes -> 2Kb) @ivar id: the record identifier as passed to the constructor. @type id: integer @ivar human_readable: the human_readable flag as passed to the constructor. @type human_readable: bool @ivar deleted_too: the deleted_too flag as passed to the constructor. @type deleted_too: bool @ivar bibdocs: the list of documents attached to the record. @type bibdocs: list of BibDoc """ def __init__(self, recid, deleted_too=False, human_readable=False): self.id = recid self.human_readable = human_readable self.deleted_too = deleted_too self.bibdocs = [] self.build_bibdoc_list() def __repr__(self): """ @return: the canonical string representation of the C{BibRecDocs}. @rtype: string """ return 'BibRecDocs(%s%s%s)' % (self.id, self.deleted_too and ', True' or '', self.human_readable and ', True' or '' ) def __str__(self): """ @return: an easy to be I{grepped} string representation of the whole C{BibRecDocs} content. @rtype: string """ out = '%i::::total bibdocs attached=%i\n' % (self.id, len(self.bibdocs)) out += '%i::::total size latest version=%s\n' % (self.id, nice_size(self.get_total_size_latest_version())) out += '%i::::total size all files=%s\n' % (self.id, nice_size(self.get_total_size())) for bibdoc in self.bibdocs: out += str(bibdoc) return out def empty_p(self): """ @return: True when the record has no attached documents. @rtype: bool """ return len(self.bibdocs) == 0 def deleted_p(self): """ @return: True if the corresponding record has been deleted. @rtype: bool """ from invenio.search_engine import record_exists return record_exists(self.id) == -1 def get_xml_8564(self): """ Return a snippet of I{MARCXML} representing the I{8564} fields corresponding to the current state. @return: the MARCXML representation. @rtype: string """ from invenio.search_engine import get_record out = '' record = get_record(self.id) fields = record_get_field_instances(record, '856', '4', ' ') for field in fields: urls = field_get_subfield_values(field, 'u') if urls and not bibdocfile_url_p(urls[0]): out += '\t\n' for subfield, value in field_get_subfield_instances(field): out += '\t\t%s\n' % (subfield, encode_for_xml(value)) out += '\t\n' for afile in self.list_latest_files(list_hidden=False): out += '\t\n' url = afile.get_url() description = afile.get_description() comment = afile.get_comment() if url: out += '\t\t%s\n' % encode_for_xml(url) if description: out += '\t\t%s\n' % encode_for_xml(description) if comment: out += '\t\t%s\n' % encode_for_xml(comment) out += '\t\n' - for bibdoc in self.bibdocs: - icon = bibdoc.get_icon() - if icon: - icon = icon.list_all_files() - if icon: - out += '\t\n' - out += '\t\t%s\n' % encode_for_xml(icon[0].get_url()) - out += '\t\ticon\n' - out += '\t\n' - return out def get_total_size_latest_version(self): """ Returns the total size used on disk by all the files belonging to this record and corresponding to the latest version. @return: the total size. @rtype: integer """ size = 0 for bibdoc in self.bibdocs: size += bibdoc.get_total_size_latest_version() return size def get_total_size(self): """ Return the total size used on disk of all the files belonging to this record of any version (not only the last as in L{get_total_size_latest_version}). @return: the total size. @rtype: integer """ size = 0 for bibdoc in self.bibdocs: size += bibdoc.get_total_size() return size def build_bibdoc_list(self): """ This method must be called everytime a I{bibdoc} is added, removed or modified. """ self.bibdocs = [] if self.deleted_too: res = run_sql("""SELECT id_bibdoc, type FROM bibrec_bibdoc JOIN bibdoc ON id=id_bibdoc WHERE id_bibrec=%s ORDER BY docname ASC""", (self.id,)) else: res = run_sql("""SELECT id_bibdoc, type FROM bibrec_bibdoc JOIN bibdoc ON id=id_bibdoc WHERE id_bibrec=%s AND status<>'DELETED' ORDER BY docname ASC""", (self.id,)) for row in res: cur_doc = BibDoc(docid=row[0], recid=self.id, doctype=row[1], human_readable=self.human_readable) self.bibdocs.append(cur_doc) def list_bibdocs(self, doctype=''): """ Returns the list all bibdocs object belonging to a recid. If C{doctype} is set, it returns just the bibdocs of that doctype. @param doctype: the optional doctype. @type doctype: string @return: the list of bibdocs. @rtype: list of BibDoc """ if not doctype: return self.bibdocs else: return [bibdoc for bibdoc in self.bibdocs if doctype == bibdoc.doctype] def get_bibdoc_names(self, doctype=''): """ Returns all the names of the documents associated with the bibdoc. If C{doctype} is set, restrict the result to all the matching doctype. @param doctype: the optional doctype. @type doctype: string @return: the list of document names. @rtype: list of string """ return [bibdoc.docname for bibdoc in self.list_bibdocs(doctype)] def check_file_exists(self, path): """ Check if a file with the same content of the file pointed in C{path} is already attached to this record. @param path: the file to be checked against. @type path: string @return: True if a file with the requested content is already attached to the record. @rtype: bool """ size = os.path.getsize(path) # Let's consider all the latest files files = self.list_latest_files() # Let's consider all the latest files with same size potential = [afile for afile in files if afile.get_size() == size] if potential: checksum = calculate_md5(path) # Let's consider all the latest files with the same size and the # same checksum potential = [afile for afile in potential if afile.get_checksum() == checksum] if potential: potential = [afile for afile in potential if filecmp.cmp(afile.get_full_path(), path)] if potential: return True else: # Gosh! How unlucky, same size, same checksum but not same # content! pass return False def propose_unique_docname(self, docname): """ Given C{docname}, return a new docname that is not already attached to the record. @param docname: the reference docname. @type docname: string @return: a docname not already attached. @rtype: string """ docname = normalize_docname(docname) goodname = docname i = 1 while goodname in self.get_bibdoc_names(): i += 1 goodname = "%s_%s" % (docname, i) return goodname def merge_bibdocs(self, docname1, docname2): """ This method merge C{docname2} into C{docname1}. 1. Given all the formats of the latest version of the files attached to C{docname2}, these files are added as new formats into C{docname1}. 2. C{docname2} is marked as deleted. @raise InvenioWebSubmitFileError: if at least one format in C{docname2} already exists in C{docname1}. (In this case the two bibdocs are preserved) - @note: comments and descriptions are also copied and if C{docname2} has - an icon and C{docname1} has not, the icon is imported. + @note: comments and descriptions are also copied. @note: if C{docname2} has a I{restriction}(i.e. if the I{status} is set) and C{docname1} doesn't, the restriction is imported. """ bibdoc1 = self.get_bibdoc(docname1) bibdoc2 = self.get_bibdoc(docname2) ## Check for possibility for bibdocfile in bibdoc2.list_latest_files(): format = bibdocfile.get_format() if bibdoc1.format_already_exists_p(format): raise InvenioWebSubmitFileError('Format %s already exists in bibdoc %s of record %s. It\'s impossible to merge bibdoc %s into it.' % (format, docname1, self.id, docname2)) - ## Importing Icon if needed. - icon1 = bibdoc1.get_icon() - icon2 = bibdoc2.get_icon() - if icon2 is not None and icon1 is None: - icon = icon2.list_latest_files()[0] - bibdoc1.add_icon(icon.get_full_path(), format=icon.get_format()) - ## Importing restriction if needed. restriction1 = bibdoc1.get_status() restriction2 = bibdoc2.get_status() if restriction2 and not restriction1: bibdoc1.set_status(restriction2) ## Importing formats for bibdocfile in bibdoc2.list_latest_files(): format = bibdocfile.get_format() comment = bibdocfile.get_comment() description = bibdocfile.get_description() bibdoc1.add_file_new_format(bibdocfile.get_full_path(), description=description, comment=comment, format=format) ## Finally deleting old bibdoc2 bibdoc2.delete() self.build_bibdoc_list() def get_docid(self, docname): """ @param docname: the document name. @type docname: string @return: the identifier corresponding to the given C{docname}. @rtype: integer @raise InvenioWebSubmitFileError: if the C{docname} does not corresponds to a document attached to this record. """ for bibdoc in self.bibdocs: if bibdoc.docname == docname: return bibdoc.id raise InvenioWebSubmitFileError, "Recid '%s' is not connected with a " \ "docname '%s'" % (self.id, docname) def get_docname(self, docid): """ @param docid: the document identifier. @type docid: integer @return: the name of the document corresponding to the given document identifier. @rtype: string @raise InvenioWebSubmitFileError: if the C{docid} does not corresponds to a document attached to this record. """ for bibdoc in self.bibdocs: if bibdoc.id == docid: return bibdoc.docname raise InvenioWebSubmitFileError, "Recid '%s' is not connected with a " \ "docid '%s'" % (self.id, docid) def has_docname_p(self, docname): """ @param docname: the document name, @type docname: string @return: True if a document with the given name is attached to this record. @rtype: bool """ for bibdoc in self.bibdocs: if bibdoc.docname == docname: return True return False def get_bibdoc(self, docname): """ @return: the bibdoc with a particular docname associated with this recid""" for bibdoc in self.bibdocs: if bibdoc.docname == docname: return bibdoc raise InvenioWebSubmitFileError, "Recid '%s' is not connected with " \ " docname '%s'" % (self.id, docname) def delete_bibdoc(self, docname): """ Deletes the document with the specified I{docname}. @param docname: the document name. @type docname: string """ for bibdoc in self.bibdocs: if bibdoc.docname == docname: bibdoc.delete() self.build_bibdoc_list() def add_bibdoc(self, doctype="Main", docname='file', never_fail=False): """ Add a new empty document object (a I{bibdoc}) to the list of documents of this record. @param doctype: the document type. @type doctype: string @param docname: the document name. @type docname: string @param never_fail: if True, this procedure will not fail, even if a document with the given name is already attached to this record. In this case a new name will be generated (see L{propose_unique_docname}). @type never_fail: bool @return: the newly created document object. @rtype: BibDoc @raise InvenioWebSubmitFileError: in case of any error. """ try: docname = normalize_docname(docname) if never_fail: docname = self.propose_unique_docname(docname) if docname in self.get_bibdoc_names(): raise InvenioWebSubmitFileError, "%s has already a bibdoc with docname %s" % (self.id, docname) else: bibdoc = BibDoc(recid=self.id, doctype=doctype, docname=docname, human_readable=self.human_readable) self.build_bibdoc_list() return bibdoc except Exception, e: register_exception() raise InvenioWebSubmitFileError(str(e)) def add_new_file(self, fullpath, doctype="Main", docname=None, never_fail=False, description=None, comment=None, format=None, flags=None): """ Directly add a new file to this record. Adds a new file with the following policy: - if the C{docname} is not set it is retrieved from the name of the file. - If a bibdoc with the given docname doesn't already exist, it is created and the file is added to it. - It it exist but it doesn't contain the format that is being added, the new format is added. - If the format already exists then if C{never_fail} is True a new bibdoc is created with a similar name but with a progressive number as a suffix and the file is added to it (see L{propose_unique_docname}). @param fullpath: the filesystme path of the document to be added. @type fullpath: string @param doctype: the type of the document. @type doctype: string @param docname: the document name. @type docname: string @param never_fail: if True, this procedure will not fail, even if a document with the given name is already attached to this record. In this case a new name will be generated (see L{propose_unique_docname}). @type never_fail: bool @param description: an optional description of the file. @type description: string @param comment: an optional comment to the file. @type comment: string @param format: the extension of the file. If not specified it will be guessed (see L{guess_format_from_url}). @type format: string @param flags: a set of flags to be associated with the file (see L{CFG_BIBDOCFILE_AVAILABLE_FLAGS}) @type flags: list of string @return: the elaborated document object. @rtype: BibDoc @raise InvenioWebSubmitFileError: in case of error. """ if docname is None: docname = decompose_file(fullpath)[1] if format is None: format = decompose_file(fullpath)[2] docname = normalize_docname(docname) try: bibdoc = self.get_bibdoc(docname) except InvenioWebSubmitFileError: # bibdoc doesn't already exists! bibdoc = self.add_bibdoc(doctype, docname, False) bibdoc.add_file_new_version(fullpath, description=description, comment=comment, format=format, flags=flags) self.build_bibdoc_list() else: try: bibdoc.add_file_new_format(fullpath, description=description, comment=comment, format=format, flags=flags) self.build_bibdoc_list() except InvenioWebSubmitFileError, e: # Format already exist! if never_fail: bibdoc = self.add_bibdoc(doctype, docname, True) bibdoc.add_file_new_version(fullpath, description=description, comment=comment, format=format, flags=flags) self.build_bibdoc_list() else: raise e return bibdoc def add_new_version(self, fullpath, docname=None, description=None, comment=None, format=None, flags=None): """ Adds a new file to an already existent document object as a new version. @param fullpath: the filesystem path of the file to be added. @type fullpath: string @param docname: the document name. If not specified it will be extracted from C{fullpath} (see L{decompose_file}). @type docname: string @param description: an optional description for the file. @type description: string @param comment: an optional comment to the file. @type comment: string @param format: the extension of the file. If not specified it will be guessed (see L{guess_format_from_url}). @type format: string @param flags: a set of flags to be associated with the file (see L{CFG_BIBDOCFILE_AVAILABLE_FLAGS}) @type flags: list of string @return: the elaborated document object. @rtype: BibDoc @raise InvenioWebSubmitFileError: in case of error. @note: previous files associated with the same document will be considered obsolete. """ if docname is None: docname = decompose_file(fullpath)[1] if format is None: format = decompose_file(fullpath)[2] if flags is None: flags = [] bibdoc = self.get_bibdoc(docname=docname) bibdoc.add_file_new_version(fullpath, description=description, comment=comment, format=format, flags=flags) self.build_bibdoc_list() return bibdoc def add_new_format(self, fullpath, docname=None, description=None, comment=None, format=None, flags=None): """ Adds a new file to an already existent document object as a new format. @param fullpath: the filesystem path of the file to be added. @type fullpath: string @param docname: the document name. If not specified it will be extracted from C{fullpath} (see L{decompose_file}). @type docname: string @param description: an optional description for the file. @type description: string @param comment: an optional comment to the file. @type comment: string @param format: the extension of the file. If not specified it will be guessed (see L{guess_format_from_url}). @type format: string @param flags: a set of flags to be associated with the file (see L{CFG_BIBDOCFILE_AVAILABLE_FLAGS}) @type flags: list of string @return: the elaborated document object. @rtype: BibDoc @raise InvenioWebSubmitFileError: in case the same format already exists. """ if docname is None: docname = decompose_file(fullpath)[1] if format is None: format = decompose_file(fullpath)[2] if flags is None: flags = [] bibdoc = self.get_bibdoc(docname=docname) bibdoc.add_file_new_format(fullpath, description=description, comment=comment, format=format, flags=flags) self.build_bibdoc_list() return bibdoc def list_latest_files(self, doctype='', list_hidden=True): """ Returns a list of the latest files. @param doctype: if set, only document of the given type will be listed. @type doctype: string @param list_hidden: if True, will list also files with the C{HIDDEN} flag being set. @type list_hidden: bool @return: the list of latest files. @rtype: list of BibDocFile """ docfiles = [] for bibdoc in self.list_bibdocs(doctype): docfiles += bibdoc.list_latest_files(list_hidden=list_hidden) return docfiles def display(self, docname="", version="", doctype="", ln=CFG_SITE_LANG, verbose=0, display_hidden=True): """ Returns an HTML representation of the the attached documents. @param docname: if set, include only the requested document. @type docname: string @param version: if not set, only the last version will be displayed. If 'all', all versions will be displayed. @type version: string (integer or 'all') @param doctype: is set, include only documents of the requested type. @type doctype: string @param ln: the language code. @type ln: string @param verbose: if greater than 0, includes debug information. @type verbose: integer - @param display_hidden: wether to include hidden files as well. + @param display_hidden: whether to include hidden files as well. @type display_hidden: bool @return: the formatted representation. @rtype: HTML string """ t = "" if docname: try: bibdocs = [self.get_bibdoc(docname)] except InvenioWebSubmitFileError: bibdocs = self.list_bibdocs(doctype) else: bibdocs = self.list_bibdocs(doctype) if bibdocs: types = list_types_from_array(bibdocs) fulltypes = [] for mytype in types: fulltype = { 'name' : mytype, 'content' : [], } for bibdoc in bibdocs: if mytype == bibdoc.get_type(): fulltype['content'].append(bibdoc.display(version, ln=ln, display_hidden=display_hidden)) fulltypes.append(fulltype) if verbose >= 9: verbose_files = str(self) else: verbose_files = '' t = websubmit_templates.tmpl_bibrecdoc_filelist( ln=ln, types = fulltypes, verbose_files=verbose_files ) return t def fix(self, docname): """ Algorithm that transform a broken/old bibdoc into a coherent one. Think of it as being the fsck of BibDocs. - All the files in the bibdoc directory will be renamed according to the document name. Proper .recid, .type, .md5 files will be created/updated. - In case of more than one file with the same format version a new bibdoc will be created in order to put does files. @param docname: the document name that need to be fixed. @type docname: string @return: the list of newly created bibdocs if any. @rtype: list of BibDoc @raise InvenioWebSubmitFileError: in case of issues that can not be fixed automatically. """ bibdoc = self.get_bibdoc(docname) versions = {} res = [] new_bibdocs = [] # List of files with the same version/format of # existing file which need new bibdoc. counter = 0 zero_version_bug = False if os.path.exists(bibdoc.basedir): for filename in os.listdir(bibdoc.basedir): if filename[0] != '.' and ';' in filename: name, version = filename.split(';') try: version = int(version) except ValueError: # Strange name register_exception() raise InvenioWebSubmitFileError, "A file called %s exists under %s. This is not a valid name. After the ';' there must be an integer representing the file version. Please, manually fix this file either by renaming or by deleting it." % (filename, bibdoc.basedir) if version == 0: zero_version_bug = True format = name[len(file_strip_ext(name)):] format = normalize_format(format) if not versions.has_key(version): versions[version] = {} new_name = 'FIXING-%s-%s' % (str(counter), name) try: shutil.move('%s/%s' % (bibdoc.basedir, filename), '%s/%s' % (bibdoc.basedir, new_name)) except Exception, e: register_exception() raise InvenioWebSubmitFileError, "Error in renaming '%s' to '%s': '%s'" % ('%s/%s' % (bibdoc.basedir, filename), '%s/%s' % (bibdoc.basedir, new_name), e) if versions[version].has_key(format): new_bibdocs.append((new_name, version)) else: versions[version][format] = new_name counter += 1 elif filename[0] != '.': # Strange name register_exception() raise InvenioWebSubmitFileError, "A file called %s exists under %s. This is not a valid name. There should be a ';' followed by an integer representing the file version. Please, manually fix this file either by renaming or by deleting it." % (filename, bibdoc.basedir) else: # we create the corresponding storage directory old_umask = os.umask(022) os.makedirs(bibdoc.basedir) # and save the father record id if it exists try: if self.id != "": recid_fd = open("%s/.recid" % bibdoc.basedir, "w") recid_fd.write(str(self.id)) recid_fd.close() if bibdoc.doctype != "": type_fd = open("%s/.type" % bibdoc.basedir, "w") type_fd.write(str(bibdoc.doctype)) type_fd.close() except Exception, e: register_exception() raise InvenioWebSubmitFileError, e os.umask(old_umask) if not versions: bibdoc.delete() else: for version, formats in versions.iteritems(): if zero_version_bug: version += 1 for format, filename in formats.iteritems(): destination = '%s%s;%i' % (docname, format, version) try: shutil.move('%s/%s' % (bibdoc.basedir, filename), '%s/%s' % (bibdoc.basedir, destination)) except Exception, e: register_exception() raise InvenioWebSubmitFileError, "Error in renaming '%s' to '%s': '%s'" % ('%s/%s' % (bibdoc.basedir, filename), '%s/%s' % (bibdoc.basedir, destination), e) try: recid_fd = open("%s/.recid" % bibdoc.basedir, "w") recid_fd.write(str(self.id)) recid_fd.close() type_fd = open("%s/.type" % bibdoc.basedir, "w") type_fd.write(str(bibdoc.doctype)) type_fd.close() except Exception, e: register_exception() raise InvenioWebSubmitFileError, "Error in creating .recid and .type file for '%s' folder: '%s'" % (bibdoc.basedir, e) self.build_bibdoc_list() res = [] for (filename, version) in new_bibdocs: if zero_version_bug: version += 1 new_bibdoc = self.add_bibdoc(doctype=bibdoc.doctype, docname=docname, never_fail=True) new_bibdoc.add_file_new_format('%s/%s' % (bibdoc.basedir, filename), version) res.append(new_bibdoc) try: os.remove('%s/%s' % (bibdoc.basedir, filename)) except Exception, e: register_exception() raise InvenioWebSubmitFileError, "Error in removing '%s': '%s'" % ('%s/%s' % (bibdoc.basedir, filename), e) Md5Folder(bibdoc.basedir).update(only_new=False) bibdoc._build_file_list() self.build_bibdoc_list() for bibdoc in self.bibdocs: if not run_sql('SELECT more_info FROM bibdoc WHERE id=%s', (bibdoc.id,)): ## Import from MARC only if the bibdoc has never had ## its more_info initialized. try: bibdoc.import_descriptions_and_comments_from_marc() except Exception, e: register_exception() raise InvenioWebSubmitFileError, "Error in importing description and comment from %s for record %s: %s" % (repr(bibdoc), self.id, e) return res def check_format(self, docname): """ Check for any format related issue. In case L{CFG_WEBSUBMIT_ADDITIONAL_KNOWN_FILE_EXTENSIONS} is altered or Python version changes, it might happen that a docname contains files which are no more docname + .format ; version, simply because the .format is now recognized (and it was not before, so it was contained into the docname). This algorithm verify if it is necessary to fix (seel L{fix_format}). @param docname: the document name whose formats should be verified. @type docname: string @return: True if format is correct. False if a fix is needed. @rtype: bool @raise InvenioWebSubmitFileError: in case of any error. """ bibdoc = self.get_bibdoc(docname) correct_docname = decompose_file(docname + '.pdf')[1] if docname != correct_docname: return False for filename in os.listdir(bibdoc.basedir): if not filename.startswith('.'): try: dummy, dummy, format, version = decompose_file_with_version(filename) except Exception: raise InvenioWebSubmitFileError('Incorrect filename "%s" for docname %s for recid %i' % (filename, docname, self.id)) if '%s%s;%i' % (correct_docname, format, version) != filename: return False return True def check_duplicate_docnames(self): """ Check wethever the record is connected with at least tho documents with the same name. @return: True if everything is fine. @rtype: bool """ docnames = set() for docname in self.get_bibdoc_names(): if docname in docnames: return False else: docnames.add(docname) return True def uniformize_bibdoc(self, docname): """ This algorithm correct wrong file name belonging to a bibdoc. @param docname: the document name whose formats should be verified. @type docname: string """ bibdoc = self.get_bibdoc(docname) for filename in os.listdir(bibdoc.basedir): if not filename.startswith('.'): try: dummy, dummy, format, version = decompose_file_with_version(filename) except ValueError: register_exception(alert_admin=True, prefix= "Strange file '%s' is stored in %s" % (filename, bibdoc.basedir)) else: os.rename(os.path.join(bibdoc.basedir, filename), os.path.join(bibdoc.basedir, '%s%s;%i' % (docname, format, version))) Md5Folder(bibdoc.basedir).update() bibdoc.touch() bibdoc._build_file_list('rename') def fix_format(self, docname, skip_check=False): """ Fixes format related inconsistencies. @param docname: the document name whose formats should be verified. @type docname: string @param skip_check: if True assume L{check_format} has already been called and the need for fix has already been found. If False, will implicitly call L{check_format} and skip fixing if no error is found. @type skip_check: bool @return: in case merging two bibdocs is needed but it's not possible. @rtype: bool """ if not skip_check: if self.check_format(docname): return True bibdoc = self.get_bibdoc(docname) correct_docname = decompose_file(docname + '.pdf')[1] need_merge = False if correct_docname != docname: need_merge = self.has_docname_p(correct_docname) if need_merge: proposed_docname = self.propose_unique_docname(correct_docname) run_sql('UPDATE bibdoc SET docname=%s WHERE id=%s', (proposed_docname, bibdoc.id)) self.build_bibdoc_list() self.uniformize_bibdoc(proposed_docname) try: self.merge_bibdocs(docname, proposed_docname) except InvenioWebSubmitFileError: return False else: run_sql('UPDATE bibdoc SET docname=%s WHERE id=%s', (correct_docname, bibdoc.id)) self.build_bibdoc_list() self.uniformize_bibdoc(correct_docname) else: self.uniformize_bibdoc(docname) return True def fix_duplicate_docnames(self, skip_check=False): """ Algotirthm to fix duplicate docnames. If a record is connected with at least two bibdoc having the same docname, the algorithm will try to merge them. @param skip_check: if True assume L{check_duplicate_docnames} has already been called and the need for fix has already been found. If False, will implicitly call L{check_duplicate_docnames} and skip fixing if no error is found. @type skip_check: bool """ if not skip_check: if self.check_duplicate_docnames(): return docnames = set() for bibdoc in self.list_bibdocs(): docname = bibdoc.docname if docname in docnames: new_docname = self.propose_unique_docname(bibdoc.docname) bibdoc.change_name(new_docname) self.merge_bibdocs(docname, new_docname) docnames.add(docname) class BibDoc: """ This class represents one document (i.e. a set of files with different formats and with versioning information that consitutes a piece of information. To instanciate a new document, the recid and the docname are mandatory. To instanciate an already existing document, either the recid and docname or the docid alone are sufficient to retrieve it. @param docid: the document identifier. @type docid: integer @param recid: the record identifier of the record to which this document belongs to. If the C{docid} is specified the C{recid} is automatically retrieven from the database. @type recid: integer @param docname: the document name. @type docname: string @param doctype: the document type (used when instanciating a new document). @type doctype: string - @param human_readable: wether sizes should be represented in a human + @param human_readable: whether sizes should be represented in a human readable format. @type human_readable: bool @raise InvenioWebSubmitFileError: in case of error. """ def __init__ (self, docid=None, recid=None, docname=None, doctype='Main', human_readable=False): """Constructor of a bibdoc. At least the docid or the recid/docname pair is needed.""" # docid is known, the document already exists if docname: docname = normalize_docname(docname) self.docfiles = [] self.md5s = None self.related_files = [] self.human_readable = human_readable if docid: if not recid: res = run_sql("SELECT id_bibrec,type FROM bibrec_bibdoc WHERE id_bibdoc=%s LIMIT 1", (docid,), 1) if res: recid = res[0][0] doctype = res[0][1] else: res = run_sql("SELECT id_bibdoc1,type FROM bibdoc_bibdoc WHERE id_bibdoc2=%s LIMIT 1", (docid,), 1) if res: main_docid = res[0][0] doctype = res[0][1] res = run_sql("SELECT id_bibrec,type FROM bibrec_bibdoc WHERE id_bibdoc=%s LIMIT 1", (main_docid,), 1) if res: recid = res[0][0] else: raise InvenioWebSubmitFileError, "The docid %s associated with docid %s is not associated with any record" % (main_docid, docid) else: raise InvenioWebSubmitFileError, "The docid %s is not associated to any recid or other docid" % docid else: res = run_sql("SELECT type FROM bibrec_bibdoc WHERE id_bibrec=%s AND id_bibdoc=%s LIMIT 1", (recid, docid,), 1) if res: doctype = res[0][0] else: #this bibdoc isn't associated with the corresponding bibrec. raise InvenioWebSubmitFileError, "Docid %s is not associated with the recid %s" % (docid, recid) # gather the other information res = run_sql("SELECT id,status,docname,creation_date,modification_date,text_extraction_date,more_info FROM bibdoc WHERE id=%s LIMIT 1", (docid,), 1) if res: self.cd = res[0][3] self.md = res[0][4] self.td = res[0][5] self.recid = recid self.docname = res[0][2] self.id = docid self.status = res[0][1] self.more_info = BibDocMoreInfo(docid, blob_to_string(res[0][6])) self.basedir = _make_base_dir(self.id) self.doctype = doctype else: # this bibdoc doesn't exist raise InvenioWebSubmitFileError, "The docid %s does not exist." % docid # else it is a new document else: if not docname: raise InvenioWebSubmitFileError, "You should specify the docname when creating a new bibdoc" else: self.recid = recid self.doctype = doctype self.docname = docname self.status = '' if recid: res = run_sql("SELECT b.id FROM bibrec_bibdoc bb JOIN bibdoc b on bb.id_bibdoc=b.id WHERE bb.id_bibrec=%s AND b.docname=%s LIMIT 1", (recid, docname), 1) if res: raise InvenioWebSubmitFileError, "A bibdoc called %s already exists for recid %s" % (docname, recid) self.id = run_sql("INSERT INTO bibdoc (status,docname,creation_date,modification_date) " "values(%s,%s,NOW(),NOW())", (self.status, docname)) if self.id: # we link the document to the record if a recid was # specified self.more_info = BibDocMoreInfo(self.id) res = run_sql("SELECT creation_date, modification_date, text_extraction_date FROM bibdoc WHERE id=%s", (self.id,)) self.cd = res[0][0] self.md = res[0][1] self.td = res[0][2] else: raise InvenioWebSubmitFileError, "New docid cannot be created" try: self.basedir = _make_base_dir(self.id) # we create the corresponding storage directory if not os.path.exists(self.basedir): old_umask = os.umask(022) os.makedirs(self.basedir) # and save the father record id if it exists try: if self.recid: recid_fd = open("%s/.recid" % self.basedir, "w") recid_fd.write(str(self.recid)) recid_fd.close() if self.doctype: type_fd = open("%s/.type" % self.basedir, "w") type_fd.write(str(self.doctype)) type_fd.close() except Exception, e: register_exception(alert_admin=True) raise InvenioWebSubmitFileError, e os.umask(old_umask) if self.recid: run_sql("INSERT INTO bibrec_bibdoc (id_bibrec, id_bibdoc, type) VALUES (%s,%s,%s)", (recid, self.id, self.doctype,)) except Exception, e: run_sql('DELETE FROM bibdoc WHERE id=%s', (self.id, )) run_sql('DELETE FROM bibrec_bibdoc WHERE id_bibdoc=%s', (self.id, )) register_exception(alert_admin=True) raise InvenioWebSubmitFileError, e # build list of attached files self._build_file_list('init') # link with related_files self._build_related_file_list() def __repr__(self): """ @return: the canonical string representation of the C{BibDoc}. @rtype: string """ return 'BibDoc(%s, %s, %s, %s, %s)' % (repr(self.id), repr(self.recid), repr(self.docname), repr(self.doctype), repr(self.human_readable)) def __str__(self): """ @return: an easy to be I{grepped} string representation of the whole C{BibDoc} content. @rtype: string """ out = '%s:%i:::docname=%s\n' % (self.recid or '', self.id, self.docname) out += '%s:%i:::doctype=%s\n' % (self.recid or '', self.id, self.doctype) out += '%s:%i:::status=%s\n' % (self.recid or '', self.id, self.status) out += '%s:%i:::basedir=%s\n' % (self.recid or '', self.id, self.basedir) out += '%s:%i:::creation date=%s\n' % (self.recid or '', self.id, self.cd) out += '%s:%i:::modification date=%s\n' % (self.recid or '', self.id, self.md) out += '%s:%i:::text extraction date=%s\n' % (self.recid or '', self.id, self.td) out += '%s:%i:::total file attached=%s\n' % (self.recid or '', self.id, len(self.docfiles)) if self.human_readable: out += '%s:%i:::total size latest version=%s\n' % (self.recid or '', self.id, nice_size(self.get_total_size_latest_version())) out += '%s:%i:::total size all files=%s\n' % (self.recid or '', self.id, nice_size(self.get_total_size())) else: out += '%s:%i:::total size latest version=%s\n' % (self.recid or '', self.id, self.get_total_size_latest_version()) out += '%s:%i:::total size all files=%s\n' % (self.recid or '', self.id, self.get_total_size()) for docfile in self.docfiles: out += str(docfile) - icon = self.get_icon() - if icon: - out += str(self.get_icon()) return out def format_already_exists_p(self, format): """ @param format: a format to be checked. @type format: string @return: True if a file of the given format already exists among the latest files. @rtype: bool """ format = normalize_format(format) for afile in self.list_latest_files(): if format == afile.get_format(): return True return False def get_status(self): """ @return: the status information. @rtype: string """ return self.status def get_text(self, version=None): """ @param version: the requested verson. If not set, the latest version will be used. @type version: integer @return: the textual content corresponding to the specified version of the document. @rtype: string """ if version is None: version = self.get_latest_version() if self.has_text(version): return open(os.path.join(self.basedir, '.text;%i' % version)).read() else: return "" def extract_text(self, version=None, perform_ocr=False, ln='en'): """ Try what is necessary to extract the textual information of a document. @param version: the version of the document for which text is required. If not specified the text will be retrieved from the last version. @type version: integer - @param perform_ocr: wether to perform OCR. + @param perform_ocr: whether to perform OCR. @type perform_ocr: bool @param ln: a two letter language code to give as a hint to the OCR procedure. @type ln: string @raise InvenioWebSubmitFileError: in case of error. @note: the text is extracted and cached for later use. Use L{get_text} to retrieve it. """ from invenio.websubmit_file_converter import get_best_format_to_extract_text_from, convert_file, InvenioWebSubmitFileConverterError if version is None: version = self.get_latest_version() docfiles = self.list_version_files(version) ## We try to extract text only from original or OCRed documents. filenames = [docfile.get_full_path() for docfile in docfiles if 'CONVERTED' not in docfile.flags or 'OCRED' in docfile.flags] try: filename = get_best_format_to_extract_text_from(filenames) except InvenioWebSubmitFileConverterError: ## We fall back on considering all the documents filenames = [docfile.get_full_path() for docfile in docfiles] try: filename = get_best_format_to_extract_text_from(filenames) except InvenioWebSubmitFileConverterError: open(os.path.join(self.basedir, '.text;%i' % version), 'w').write('') return try: convert_file(filename, os.path.join(self.basedir, '.text;%i' % version), '.txt', perform_ocr=perform_ocr, ln=ln) if version == self.get_latest_version(): run_sql("UPDATE bibdoc SET text_extraction_date=NOW() WHERE id=%s", (self.id, )) except InvenioWebSubmitFileConverterError, e: register_exception(alert_admin=True, prefix="Error in extracting text from bibdoc %i, version %i" % (self.id, version)) raise InvenioWebSubmitFileError, str(e) def touch(self): """ Update the modification time of the bibdoc (as in the UNIX command C{touch}). """ run_sql('UPDATE bibdoc SET modification_date=NOW() WHERE id=%s', (self.id, )) #if self.recid: #run_sql('UPDATE bibrec SET modification_date=NOW() WHERE id=%s', (self.recid, )) def set_status(self, new_status): """ Set a new status. A document with a status information is a restricted document that can be accessed only to user which as an authorization to the I{viewrestrdoc} WebAccess action with keyword status with value C{new_status}. @param new_status: the new status. If empty the document will be unrestricted. @type new_status: string @raise InvenioWebSubmitFileError: in case the reserved word 'DELETED' is used. """ if new_status != KEEP_OLD_VALUE: if new_status == 'DELETED': raise InvenioWebSubmitFileError('DELETED is a reserved word and can not be used for setting the status') run_sql('UPDATE bibdoc SET status=%s WHERE id=%s', (new_status, self.id)) self.status = new_status self.touch() self._build_file_list() self._build_related_file_list() def add_file_new_version(self, filename, description=None, comment=None, format=None, flags=None): """ Add a new version of a file. If no physical file is already attached to the document a the given file will have version 1. Otherwise the new file will have the current version number plus one. @param filename: the local path of the file. @type filename: string @param description: an optional description for the file. @type description: string @param comment: an optional comment to the file. @type comment: string @param format: the extension of the file. If not specified it will be retrieved from the filename (see L{decompose_file}). @type format: string @param flags: a set of flags to be associated with the file (see L{CFG_BIBDOCFILE_AVAILABLE_FLAGS}) @type flags: list of string @raise InvenioWebSubmitFileError: in case of error. """ try: latestVersion = self.get_latest_version() if latestVersion == 0: myversion = 1 else: myversion = latestVersion + 1 if os.path.exists(filename): if not os.path.getsize(filename) > 0: raise InvenioWebSubmitFileError, "%s seems to be empty" % filename if format is None: format = decompose_file(filename)[2] destination = "%s/%s%s;%i" % (self.basedir, self.docname, format, myversion) try: shutil.copyfile(filename, destination) os.chmod(destination, 0644) except Exception, e: register_exception() raise InvenioWebSubmitFileError, "Encountered an exception while copying '%s' to '%s': '%s'" % (filename, destination, e) self.more_info.set_description(description, format, myversion) self.more_info.set_comment(comment, format, myversion) if flags is None: flags = [] for flag in flags: if flag == 'PERFORM_HIDE_PREVIOUS': for afile in self.list_all_files(): format = afile.get_format() version = afile.get_version() if version < myversion: self.more_info.set_flag('HIDDEN', format, myversion) else: self.more_info.set_flag(flag, format, myversion) else: raise InvenioWebSubmitFileError, "'%s' does not exists!" % filename finally: self.touch() Md5Folder(self.basedir).update() self._build_file_list() def add_file_new_format(self, filename, version=None, description=None, comment=None, format=None, flags=None): """ Add a file as a new format. @param filename: the local path of the file. @type filename: string @param version: an optional specific version to which the new format should be added. If None, the last version will be used. @type version: integer @param description: an optional description for the file. @type description: string @param comment: an optional comment to the file. @type comment: string @param format: the extension of the file. If not specified it will be retrieved from the filename (see L{decompose_file}). @type format: string @param flags: a set of flags to be associated with the file (see L{CFG_BIBDOCFILE_AVAILABLE_FLAGS}) @type flags: list of string @raise InvenioWebSubmitFileError: if the given format already exists. """ try: if version is None: version = self.get_latest_version() if version == 0: version = 1 if os.path.exists(filename): if not os.path.getsize(filename) > 0: raise InvenioWebSubmitFileError, "%s seems to be empty" % filename if format is None: format = decompose_file(filename)[2] destination = "%s/%s%s;%i" % (self.basedir, self.docname, format, version) if os.path.exists(destination): raise InvenioWebSubmitFileError, "A file for docname '%s' for the recid '%s' already exists for the format '%s'" % (self.docname, self.recid, format) try: shutil.copyfile(filename, destination) os.chmod(destination, 0644) except Exception, e: register_exception() raise InvenioWebSubmitFileError, "Encountered an exception while copying '%s' to '%s': '%s'" % (filename, destination, e) self.more_info.set_comment(comment, format, version) self.more_info.set_description(description, format, version) if flags is None: flags = [] for flag in flags: if flag != 'PERFORM_HIDE_PREVIOUS': self.more_info.set_flag(flag, format, version) else: raise InvenioWebSubmitFileError, "'%s' does not exists!" % filename finally: Md5Folder(self.basedir).update() self.touch() self._build_file_list() def purge(self): """ Physically removes all the previous version of the given bibdoc. Everything but the last formats will be erased. """ version = self.get_latest_version() if version > 1: for afile in self.docfiles: if afile.get_version() < version: self.more_info.unset_comment(afile.get_format(), afile.get_version()) self.more_info.unset_description(afile.get_format(), afile.get_version()) for flag in CFG_BIBDOCFILE_AVAILABLE_FLAGS: self.more_info.unset_flag(flag, afile.get_format(), afile.get_version()) try: os.remove(afile.get_full_path()) except Exception, e: register_exception() Md5Folder(self.basedir).update() self.touch() self._build_file_list() def expunge(self): """ Physically remove all the traces of a given document. @note: an expunged BibDoc object shouldn't be used anymore or the result might be unpredicted. """ del self.md5s del self.more_info os.system('rm -rf %s' % escape_shell_arg(self.basedir)) run_sql('DELETE FROM bibrec_bibdoc WHERE id_bibdoc=%s', (self.id, )) run_sql('DELETE FROM bibdoc_bibdoc WHERE id_bibdoc1=%s OR id_bibdoc2=%s', (self.id, self.id)) run_sql('DELETE FROM bibdoc WHERE id=%s', (self.id, )) run_sql('INSERT DELAYED INTO hstDOCUMENT(action, id_bibdoc, docname, doctimestamp) VALUES("EXPUNGE", %s, %s, NOW())', (self.id, self.docname)) del self.docfiles del self.id del self.cd del self.md del self.td del self.basedir del self.recid del self.doctype del self.docname def revert(self, version): """ Revert the document to a given version. All the formats corresponding to that version are copied forward to a new version. @param version: the version to revert to. @type version: integer @raise InvenioWebSubmitFileError: in case of errors """ try: version = int(version) new_version = self.get_latest_version() + 1 for docfile in self.list_version_files(version): destination = "%s/%s%s;%i" % (self.basedir, self.docname, docfile.get_format(), new_version) if os.path.exists(destination): raise InvenioWebSubmitFileError, "A file for docname '%s' for the recid '%s' already exists for the format '%s'" % (self.docname, self.recid, docfile.get_format()) try: shutil.copyfile(docfile.get_full_path(), destination) os.chmod(destination, 0644) self.more_info.set_comment(self.more_info.get_comment(docfile.get_format(), version), docfile.get_format(), new_version) self.more_info.set_description(self.more_info.get_description(docfile.get_format(), version), docfile.get_format(), new_version) except Exception, e: register_exception() raise InvenioWebSubmitFileError, "Encountered an exception while copying '%s' to '%s': '%s'" % (docfile.get_full_path(), destination, e) finally: Md5Folder(self.basedir).update() self.touch() self._build_file_list() def import_descriptions_and_comments_from_marc(self, record=None): """ Import descriptions and comments from the corresponding MARC metadata. @param record: the record (if None it will be calculated). @type record: bibrecord recstruct @note: If record is passed it is directly used, otherwise it is retrieved from the MARCXML stored in the database. """ ## Let's get the record from invenio.search_engine import get_record if record is None: record = get_record(self.id) fields = record_get_field_instances(record, '856', '4', ' ') global_comment = None global_description = None local_comment = {} local_description = {} for field in fields: url = field_get_subfield_values(field, 'u') if url: ## Given a url url = url[0] if url == '%s/record/%s/files/' % (CFG_SITE_URL, self.recid): ## If it is a traditional /record/1/files/ one ## We have global description/comment for all the formats description = field_get_subfield_values(field, 'y') if description: global_description = description[0] comment = field_get_subfield_values(field, 'z') if comment: global_comment = comment[0] elif bibdocfile_url_p(url): ## Otherwise we have description/comment per format dummy, docname, format = decompose_bibdocfile_url(url) if docname == self.docname: description = field_get_subfield_values(field, 'y') if description: local_description[format] = description[0] comment = field_get_subfield_values(field, 'z') if comment: local_comment[format] = comment[0] ## Let's update the tables version = self.get_latest_version() for docfile in self.list_latest_files(): format = docfile.get_format() if format in local_comment: self.set_comment(local_comment[format], format, version) else: self.set_comment(global_comment, format, version) if format in local_description: self.set_description(local_description[format], format, version) else: self.set_description(global_description, format, version) self._build_file_list('init') - def get_icon(self): + def get_icon(self, subformat_re=CFG_WEBSUBMIT_ICON_SUBFORMAT_RE): """ - @return: the bibdoc corresponding to the icon of this document, or + @param subformat_re: by default the convention is that + L{CFG_WEBSUBMIT_ICON_SUBFORMAT_RE} is used as a subformat indicator to + mean that a particular format is to be used as an icon. + Specifiy a different subformat if you need to use a different + convention. + @type subformat_re: compiled regular expression + @return: the bibdocfile corresponding to the icon of this document, or None if any icon exists for this document. - @rtype: BibDoc + @rtype: BibDocFile + @warning: before I{subformat} were introduced this method was + returning a BibDoc, while now is returning a BibDocFile. Check + if your client code is compatible with this. """ - if self.related_files.has_key('Icon'): - return self.related_files['Icon'][0] - else: - return None + for docfile in self.list_latest_files(): + if subformat_re.match(docfile.get_subformat()): + return docfile + return None - def add_icon(self, filename, basename=None, format=None): + def add_icon(self, filename, format=None, subformat=CFG_WEBSUBMIT_DEFAULT_ICON_SUBFORMAT): """ Attaches icon to this document. @param filename: the local filesystem path to the icon. @type filename: string - @param basename: an optional name for the icon. If not specified - "icon-" followed by this document name will be used. - @type basename: string @param format: an optional format for the icon. If not specified it will be calculated after the filesystem path. @type format: string - @return: the icon bibdoc - @rtype: BibDoc + @param subformat: by default the convention is that + CFG_WEBSUBMIT_DEFAULT_ICON_SUBFORMAT is used as a subformat indicator to + mean that a particular format is to be used as an icon. + Specifiy a different subformat if you need to use a different + convention. + @type subformat: string @raise InvenioWebSubmitFileError: in case of errors. """ #first check if an icon already exists - existing_icon = self.get_icon() - if existing_icon is not None: - existing_icon.delete() - #then add the new one - if basename is None: - basename = 'icon-%s' % self.docname - if format is None: + if not format: format = decompose_file(filename)[2] - newicon = BibDoc(doctype='Icon', docname=basename, human_readable=self.human_readable) - newicon.add_file_new_version(filename, format=format) - try: - try: - old_umask = os.umask(022) - recid_fd = open("%s/.docid" % newicon.get_base_dir(), "w") - recid_fd.write(str(self.id)) - recid_fd.close() - type_fd = open("%s/.type" % newicon.get_base_dir(), "w") - type_fd.write(str(self.doctype)) - type_fd.close() - os.umask(old_umask) - run_sql("INSERT INTO bibdoc_bibdoc (id_bibdoc1, id_bibdoc2, type) VALUES (%s,%s,'Icon')", (self.id, newicon.get_id(),)) - except Exception, e: - register_exception() - raise InvenioWebSubmitFileError, "Encountered an exception while writing .docid and .doctype for folder '%s': '%s'" % (newicon.get_base_dir(), e) - finally: - Md5Folder(newicon.basedir).update() - self.touch() - self._build_related_file_list() - return newicon + if subformat: + format += ";%s" % subformat + + self.add_file_new_format(filename, format=format) - def delete_icon(self): + def delete_icon(self, subformat_re=CFG_WEBSUBMIT_ICON_SUBFORMAT_RE): """ + @param subformat_re: by default the convention is that + L{CFG_WEBSUBMIT_ICON_SUBFORMAT_RE} is used as a subformat indicator to + mean that a particular format is to be used as an icon. + Specifiy a different subformat if you need to use a different + convention. + @type subformat: compiled regular expression Removes the icon attached to the document if it exists. """ - existing_icon = self.get_icon() - if existing_icon is not None: - existing_icon.delete() - self.touch() - self._build_related_file_list() + for docfile in self.list_latest_files(): + if subformat_re.match(docfile.get_subformat()): + self.delete_file(docfile.get_format(), docfile.get_version()) def display(self, version="", ln=CFG_SITE_LANG, display_hidden=True): """ Returns an HTML representation of the this document. @param version: if not set, only the last version will be displayed. If 'all', all versions will be displayed. @type version: string (integer or 'all') @param ln: the language code. @type ln: string - @param display_hidden: wether to include hidden files as well. + @param display_hidden: whether to include hidden files as well. @type display_hidden: bool @return: the formatted representation. @rtype: HTML string """ t = "" if version == "all": docfiles = self.list_all_files(list_hidden=display_hidden) elif version != "": version = int(version) docfiles = self.list_version_files(version, list_hidden=display_hidden) else: docfiles = self.list_latest_files(list_hidden=display_hidden) - existing_icon = self.get_icon() - if existing_icon is not None: - existing_icon = existing_icon.list_all_files()[0] - imageurl = "%s/record/%s/files/%s" % \ - (CFG_SITE_URL, self.recid, urllib.quote(existing_icon.get_full_name())) + icon = self.get_icon() + if icon: + imageurl = icon.get_url() else: imageurl = "%s/img/smallfiles.gif" % CFG_SITE_URL versions = [] for version in list_versions_from_array(docfiles): currversion = { 'version' : version, 'previous' : 0, 'content' : [] } if version == self.get_latest_version() and version != 1: currversion['previous'] = 1 for docfile in docfiles: if docfile.get_version() == version: currversion['content'].append(docfile.display(ln = ln)) versions.append(currversion) t = websubmit_templates.tmpl_bibdoc_filelist( ln = ln, versions = versions, imageurl = imageurl, docname = self.docname, recid = self.recid ) return t def change_name(self, newname): """ Renames this document name. @param newname: the new name. @type newname: string @raise InvenioWebSubmitFileError: if the new name corresponds to a document already attached to the record owning this document. """ try: newname = normalize_docname(newname) res = run_sql("SELECT b.id FROM bibrec_bibdoc bb JOIN bibdoc b on bb.id_bibdoc=b.id WHERE bb.id_bibrec=%s AND b.docname=%s", (self.recid, newname)) if res: raise InvenioWebSubmitFileError, "A bibdoc called %s already exists for recid %s" % (newname, self.recid) try: for f in os.listdir(self.basedir): if not f.startswith('.'): try: (dummy, base, extension, version) = decompose_file_with_version(f) except ValueError: register_exception(alert_admin=True, prefix="Strange file '%s' is stored in %s" % (f, self.basedir)) else: shutil.move(os.path.join(self.basedir, f), os.path.join(self.basedir, '%s%s;%i' % (newname, extension, version))) except Exception, e: register_exception() raise InvenioWebSubmitFileError("Error in renaming the bibdoc %s to %s for recid %s: %s" % (self.docname, newname, self.recid, e)) run_sql("update bibdoc set docname=%s where id=%s", (newname, self.id,)) self.docname = newname finally: Md5Folder(self.basedir).update() self.touch() self._build_file_list('rename') self._build_related_file_list() def set_comment(self, comment, format, version=None): """ Updates the comment of a specific format/version of the document. @param comment: the new comment. @type comment: string @param format: the specific format for which the comment should be updated. @type format: string @param version: the specific version for which the comment should be updated. If not specified the last version will be used. @type version: integer """ if version is None: version = self.get_latest_version() format = normalize_format(format) self.more_info.set_comment(comment, format, version) self.touch() self._build_file_list('init') def set_description(self, description, format, version=None): """ Updates the description of a specific format/version of the document. @param description: the new description. @type description: string @param format: the specific format for which the description should be updated. @type format: string @param version: the specific version for which the description should be updated. If not specified the last version will be used. @type version: integer """ if version is None: version = self.get_latest_version() format = normalize_format(format) self.more_info.set_description(description, format, version) self.touch() self._build_file_list('init') def set_flag(self, flagname, format, version=None): """ Sets a flag for a specific format/version of the document. @param flagname: a flag from L{CFG_BIBDOCFILE_AVAILABLE_FLAGS}. @type flagname: string @param format: the specific format for which the flag should be set. @type format: string @param version: the specific version for which the flag should be set. If not specified the last version will be used. @type version: integer """ if version is None: version = self.get_latest_version() format = normalize_format(format) self.more_info.set_flag(flagname, format, version) self.touch() self._build_file_list('init') def has_flag(self, flagname, format, version=None): """ Checks if a particular flag for a format/version is set. @param flagname: a flag from L{CFG_BIBDOCFILE_AVAILABLE_FLAGS}. @type flagname: string @param format: the specific format for which the flag should be set. @type format: string @param version: the specific version for which the flag should be set. If not specified the last version will be used. @type version: integer @return: True if the flag is set. @rtype: bool """ if version is None: version = self.get_latest_version() format = normalize_format(format) return self.more_info.has_flag(flagname, format, version) def unset_flag(self, flagname, format, version=None): """ Unsets a flag for a specific format/version of the document. @param flagname: a flag from L{CFG_BIBDOCFILE_AVAILABLE_FLAGS}. @type flagname: string @param format: the specific format for which the flag should be unset. @type format: string @param version: the specific version for which the flag should be unset. If not specified the last version will be used. @type version: integer """ if version is None: version = self.get_latest_version() format = normalize_format(format) self.more_info.unset_flag(flagname, format, version) self.touch() self._build_file_list('init') def get_comment(self, format, version=None): """ Retrieve the comment of a specific format/version of the document. @param format: the specific format for which the comment should be retrieved. @type format: string @param version: the specific version for which the comment should be retrieved. If not specified the last version will be used. @type version: integer @return: the comment. @rtype: string """ if version is None: version = self.get_latest_version() format = normalize_format(format) return self.more_info.get_comment(format, version) def get_description(self, format, version=None): """ Retrieve the description of a specific format/version of the document. @param format: the specific format for which the description should be retrieved. @type format: string @param version: the specific version for which the description should be retrieved. If not specified the last version will be used. @type version: integer @return: the description. @rtype: string """ if version is None: version = self.get_latest_version() format = normalize_format(format) return self.more_info.get_description(format, version) def hidden_p(self, format, version=None): """ Returns True if the file specified by the given format/version is hidden. @param format: the specific format for which the description should be retrieved. @type format: string @param version: the specific version for which the description should be retrieved. If not specified the last version will be used. @type version: integer @return: True if hidden. @rtype: bool """ if version is None: version = self.get_latest_version() - return self.more_info.hidden_p(format, version) - - def icon_p(self): - """ - @return: True if this document is an icon attached to another - document. - @rtype: bool - """ - return run_sql("SELECT count(id_bibdoc2) FROM bibdoc_bibdoc WHERE id_bibdoc2=%s AND type='Icon'", (self.id, ))[0][0] > 0 + return self.more_info.has_flag('HIDDEN', format, version) def get_docname(self): """ @return: the name of this document. @rtype: string """ return self.docname def get_base_dir(self): """ @return: the base directory on the local filesystem for this document (e.g. C{/soft/cdsweb/var/data/files/g0/123}) @rtype: string """ return self.basedir def get_type(self): """ @return: the type of this document. @rtype: string""" return self.doctype def get_recid(self): """ @return: the record id of the record to which this document is attached. @rtype: integer """ return self.recid def get_id(self): """ @return: the id of this document. @rtype: integer """ return self.id def pdf_a_p(self): """ @return: True if this document contains a PDF in PDF/A format. @rtype: bool""" return self.has_flag('PDF/A', 'pdf') def has_text(self, require_up_to_date=False, version=None): """ Return True if the text of this document has already been extracted. @param require_up_to_date: if True check the text was actually extracted after the most recent format of the given version. @type require_up_to_date: bool @param version: a version for which the text should have been extracted. If not specified the latest version is considered. @type version: integer @return: True if the text has already been extracted. @rtype: bool """ if version is None: version = self.get_latest_version() if os.path.exists(os.path.join(self.basedir, '.text;%i' % version)): if not require_up_to_date: return True else: docfiles = self.list_version_files(version) text_md = datetime.fromtimestamp(os.path.getmtime(os.path.join(self.basedir, '.text;%i' % version))) for docfile in docfiles: if text_md <= docfile.md: return False return True return False def get_file(self, format, version=""): """ Returns a L{BibDocFile} instance of this document corresponding to the specific format and version. @param format: the specific format. @type format: string @param version: the specific version for which the description should be retrieved. If not specified the last version will be used. @type version: integer @return: the L{BibDocFile} instance. @rtype: BibDocFile """ if version == "": docfiles = self.list_latest_files() else: version = int(version) docfiles = self.list_version_files(version) format = normalize_format(format) for docfile in docfiles: if (docfile.get_format()==format or not format): return docfile + + ## Let's skip the subformat specification and consider just the + ## superformat + superformat = get_superformat_from_format(format) + for docfile in docfiles: + if get_superformat_from_format(docfile.get_format()) == superformat: + return docfile raise InvenioWebSubmitFileError, "No file called '%s' of format '%s', version '%s'" % (self.docname, format, version) def list_versions(self): """ @return: the list of existing version numbers for this document. @rtype: list of integer """ versions = [] for docfile in self.docfiles: if not docfile.get_version() in versions: versions.append(docfile.get_version()) versions.sort() return versions def delete(self): """ Delete this document. @see: L{undelete} for how to undelete the document. @raise InvenioWebSubmitFileError: in case of errors. """ try: today = datetime.today() self.change_name('DELETED-%s%s-%s' % (today.strftime('%Y%m%d%H%M%S'), today.microsecond, self.docname)) run_sql("UPDATE bibdoc SET status='DELETED' WHERE id=%s", (self.id,)) self.status = 'DELETED' except Exception, e: register_exception() raise InvenioWebSubmitFileError, "It's impossible to delete bibdoc %s: %s" % (self.id, e) def deleted_p(self): """ @return: True if this document has been deleted. @rtype: bool """ return self.status == 'DELETED' def empty_p(self): """ @return: True if this document is empty, i.e. it has no bibdocfile connected. @rtype: bool """ return len(self.docfiles) == 0 def undelete(self, previous_status=''): """ Undelete a deleted file (only if it was actually deleted via L{delete}). The previous C{status}, i.e. the restriction key can be provided. Otherwise the undeleted document will be public. @param previous_status: the previous status the should be restored. @type previous_status: string @raise InvenioWebSubmitFileError: in case of any error. """ bibrecdocs = BibRecDocs(self.recid) try: run_sql("UPDATE bibdoc SET status=%s WHERE id=%s AND status='DELETED'", (previous_status, self.id)) except Exception, e: raise InvenioWebSubmitFileError, "It's impossible to undelete bibdoc %s: %s" % (self.id, e) if self.docname.startswith('DELETED-'): try: # Let's remove DELETED-20080214144322- in front of the docname original_name = '-'.join(self.docname.split('-')[2:]) original_name = bibrecdocs.propose_unique_docname(original_name) self.change_name(original_name) except Exception, e: raise InvenioWebSubmitFileError, "It's impossible to restore the previous docname %s. %s kept as docname because: %s" % (original_name, self.docname, e) else: raise InvenioWebSubmitFileError, "Strange just undeleted docname isn't called DELETED-somedate-docname but %s" % self.docname def delete_file(self, format, version): """ Delete a specific format/version of this document on the filesystem. @param format: the particular format to be deleted. @type format: string @param version: the particular version to be deleted. @type version: integer @note: this operation is not reversible!""" try: afile = self.get_file(format, version) except InvenioWebSubmitFileError: return try: os.remove(afile.get_full_path()) except OSError: pass self.touch() self._build_file_list() def get_history(self): """ @return: a human readable and parsable string that represent the history of this document. @rtype: string """ ret = [] hst = run_sql("""SELECT action, docname, docformat, docversion, docsize, docchecksum, doctimestamp FROM hstDOCUMENT WHERE id_bibdoc=%s ORDER BY doctimestamp ASC""", (self.id, )) for row in hst: ret.append("%s %s '%s', format: '%s', version: %i, size: %s, checksum: '%s'" % (row[6].strftime('%Y-%m-%d %H:%M:%S'), row[0], row[1], row[2], row[3], nice_size(row[4]), row[5])) return ret def _build_file_list(self, context=''): """ Lists all files attached to the bibdoc. This function should be called everytime the bibdoc is modified. As a side effect it log everything that has happened to the bibdocfiles in the log facility, according to the context: "init": means that the function has been called; for the first time by a constructor, hence no logging is performed "": by default means to log every deleted file as deleted and every added file as added; "rename": means that every appearently deleted file is logged as renamef and every new file as renamet. """ def log_action(action, docid, docname, format, version, size, checksum, timestamp=''): """Log an action into the bibdoclog table.""" try: if timestamp: run_sql('INSERT DELAYED INTO hstDOCUMENT(action, id_bibdoc, docname, docformat, docversion, docsize, docchecksum, doctimestamp) VALUES(%s, %s, %s, %s, %s, %s, %s, %s)', (action, docid, docname, format, version, size, checksum, timestamp)) else: run_sql('INSERT DELAYED INTO hstDOCUMENT(action, id_bibdoc, docname, docformat, docversion, docsize, docchecksum, doctimestamp) VALUES(%s, %s, %s, %s, %s, %s, %s, NOW())', (action, docid, docname, format, version, size, checksum)) except DatabaseError: register_exception() def make_removed_added_bibdocfiles(previous_file_list): """Internal function for build the log of changed files.""" # Let's rebuild the previous situation old_files = {} for bibdocfile in previous_file_list: old_files[(bibdocfile.name, bibdocfile.format, bibdocfile.version)] = (bibdocfile.size, bibdocfile.checksum, bibdocfile.md) # Let's rebuild the new situation new_files = {} for bibdocfile in self.docfiles: new_files[(bibdocfile.name, bibdocfile.format, bibdocfile.version)] = (bibdocfile.size, bibdocfile.checksum, bibdocfile.md) # Let's subtract from added file all the files that are present in # the old list, and let's add to deleted files that are not present # added file. added_files = dict(new_files) deleted_files = {} for key, value in old_files.iteritems(): if added_files.has_key(key): del added_files[key] else: deleted_files[key] = value return (added_files, deleted_files) if context != 'init': previous_file_list = list(self.docfiles) res = run_sql("SELECT status,docname,creation_date," "modification_date,more_info FROM bibdoc WHERE id=%s", (self.id,)) self.cd = res[0][2] self.md = res[0][3] self.docname = res[0][1] self.status = res[0][0] self.more_info = BibDocMoreInfo(self.id, blob_to_string(res[0][4])) self.docfiles = [] if os.path.exists(self.basedir): self.md5s = Md5Folder(self.basedir) files = os.listdir(self.basedir) files.sort() for afile in files: if not afile.startswith('.'): try: filepath = os.path.join(self.basedir, afile) fileversion = int(re.sub(".*;", "", afile)) fullname = afile.replace(";%s" % fileversion, "") checksum = self.md5s.get_checksum(afile) (dirname, basename, format) = decompose_file(fullname) # we can append file: self.docfiles.append(BibDocFile(filepath, self.doctype, fileversion, basename, format, self.recid, self.id, self.status, checksum, self.more_info, human_readable=self.human_readable)) except Exception, e: register_exception() if context == 'init': return else: added_files, deleted_files = make_removed_added_bibdocfiles(previous_file_list) deletedstr = "DELETED" addedstr = "ADDED" if context == 'rename': deletedstr = "RENAMEDFROM" addedstr = "RENAMEDTO" for (docname, format, version), (size, checksum, md) in added_files.iteritems(): if context == 'rename': md = '' # No modification time log_action(addedstr, self.id, docname, format, version, size, checksum, md) for (docname, format, version), (size, checksum, md) in deleted_files.iteritems(): if context == 'rename': md = '' # No modification time log_action(deletedstr, self.id, docname, format, version, size, checksum, md) def _build_related_file_list(self): """Lists all files attached to the bibdoc. This function should be called everytime the bibdoc is modified within e.g. its icon. + @deprecated: use subformats instead. """ self.related_files = {} res = run_sql("SELECT ln.id_bibdoc2,ln.type,bibdoc.status FROM " "bibdoc_bibdoc AS ln,bibdoc WHERE id=ln.id_bibdoc2 AND " "ln.id_bibdoc1=%s", (self.id,)) for row in res: docid = row[0] doctype = row[1] if row[2] != 'DELETED': if not self.related_files.has_key(doctype): self.related_files[doctype] = [] cur_doc = BibDoc(docid=docid, human_readable=self.human_readable) self.related_files[doctype].append(cur_doc) def get_total_size_latest_version(self): """Return the total size used on disk of all the files belonging to this bibdoc and corresponding to the latest version.""" ret = 0 for bibdocfile in self.list_latest_files(): ret += bibdocfile.get_size() return ret def get_total_size(self): """Return the total size used on disk of all the files belonging to this bibdoc.""" ret = 0 for bibdocfile in self.list_all_files(): ret += bibdocfile.get_size() return ret def list_all_files(self, list_hidden=True): """Returns all the docfiles linked with the given bibdoc.""" if list_hidden: return self.docfiles else: return [afile for afile in self.docfiles if not afile.hidden_p()] def list_latest_files(self, list_hidden=True): """Returns all the docfiles within the last version.""" return self.list_version_files(self.get_latest_version(), list_hidden=list_hidden) def list_version_files(self, version, list_hidden=True): """Return all the docfiles of a particular version.""" version = int(version) return [docfile for docfile in self.docfiles if docfile.get_version() == version and (list_hidden or not docfile.hidden_p())] def get_latest_version(self): """ Returns the latest existing version number for the given bibdoc. If no file is associated to this bibdoc, returns '0'. """ version = 0 for bibdocfile in self.docfiles: if bibdocfile.get_version() > version: version = bibdocfile.get_version() return version def get_file_number(self): """Return the total number of files.""" return len(self.docfiles) def register_download(self, ip_address, version, format, userid=0): """Register the information about a download of a particular file.""" format = normalize_format(format) if format[:1] == '.': format = format[1:] format = format.upper() return run_sql("INSERT INTO rnkDOWNLOADS " "(id_bibrec,id_bibdoc,file_version,file_format," "id_user,client_host,download_time) VALUES " "(%s,%s,%s,%s,%s,INET_ATON(%s),NOW())", (self.recid, self.id, version, format, userid, ip_address,)) class BibDocFile: """This class represents a physical file in the CDS Invenio filesystem. It should never be instantiated directly""" def __init__(self, fullpath, doctype, version, name, format, recid, docid, status, checksum, more_info, human_readable=False): self.fullpath = os.path.abspath(fullpath) self.doctype = doctype self.docid = docid self.recid = recid self.version = version self.status = status self.checksum = checksum self.human_readable = human_readable self.description = more_info.get_description(format, version) self.format = normalize_format(format) + self.superformat = get_superformat_from_format(self.format) + self.subformat = get_subformat_from_format(self.format) if format == "": self.mime = "application/octet-stream" self.encoding = "" self.fullname = name else: - self.fullname = "%s%s" % (name, self.format) + self.fullname = "%s%s" % (name, self.superformat) (self.mime, self.encoding) = _mimes.guess_type(self.fullname) if self.mime is None: self.mime = "application/octet-stream" self.more_info = more_info self.comment = more_info.get_comment(format, version) self.flags = more_info.get_flags(format, version) self.hidden = 'HIDDEN' in self.flags self.size = os.path.getsize(fullpath) self.md = datetime.fromtimestamp(os.path.getmtime(fullpath)) try: self.cd = datetime.fromtimestamp(os.path.getctime(fullpath)) except OSError: self.cd = self.md self.name = name self.dir = os.path.dirname(fullpath) - self.url = '%s/record/%s/files/%s%s' % (CFG_SITE_URL, self.recid, urllib.quote(self.name), urllib.quote(self.format)) - self.fullurl = '%s?version=%s' % (self.url, self.version) + if self.subformat: + self.url = create_url('%s/record/%s/files/%s%s' % (CFG_SITE_URL, self.recid, self.name, self.superformat), {'subformat' : self.subformat}) + self.fullurl = create_url('%s/record/%s/files/%s%s' % (CFG_SITE_URL, self.recid, self.name, self.superformat), {'subformat' : self.subformat, 'version' : self.version}) + else: + self.url = create_url('%s/record/%s/files/%s%s' % (CFG_SITE_URL, self.recid, self.name, self.superformat), {}) + self.fullurl = create_url('%s/record/%s/files/%s%s' % (CFG_SITE_URL, self.recid, self.name, self.superformat), {'version' : self.version}) self.etag = '"%i%s%i"' % (self.docid, self.format, self.version) self.magic = None def __repr__(self): return ('BibDocFile(%s, %s, %i, %s, %s, %i, %i, %s, %s, %s, %s)' % (repr(self.fullpath), repr(self.doctype), self.version, repr(self.name), repr(self.format), self.recid, self.docid, repr(self.status), repr(self.checksum), repr(self.more_info), repr(self.human_readable))) def __str__(self): out = '%s:%s:%s:%s:fullpath=%s\n' % (self.recid, self.docid, self.version, self.format, self.fullpath) out += '%s:%s:%s:%s:fullname=%s\n' % (self.recid, self.docid, self.version, self.format, self.fullname) out += '%s:%s:%s:%s:name=%s\n' % (self.recid, self.docid, self.version, self.format, self.name) + out += '%s:%s:%s:%s:subformat=%s\n' % (self.recid, self.docid, self.version, self.format, get_subformat_from_format(self.format)) out += '%s:%s:%s:%s:status=%s\n' % (self.recid, self.docid, self.version, self.format, self.status) out += '%s:%s:%s:%s:checksum=%s\n' % (self.recid, self.docid, self.version, self.format, self.checksum) if self.human_readable: out += '%s:%s:%s:%s:size=%s\n' % (self.recid, self.docid, self.version, self.format, nice_size(self.size)) else: out += '%s:%s:%s:%s:size=%s\n' % (self.recid, self.docid, self.version, self.format, self.size) out += '%s:%s:%s:%s:creation time=%s\n' % (self.recid, self.docid, self.version, self.format, self.cd) out += '%s:%s:%s:%s:modification time=%s\n' % (self.recid, self.docid, self.version, self.format, self.md) out += '%s:%s:%s:%s:magic=%s\n' % (self.recid, self.docid, self.version, self.format, self.get_magic()) out += '%s:%s:%s:%s:mime=%s\n' % (self.recid, self.docid, self.version, self.format, self.mime) out += '%s:%s:%s:%s:encoding=%s\n' % (self.recid, self.docid, self.version, self.format, self.encoding) out += '%s:%s:%s:%s:url=%s\n' % (self.recid, self.docid, self.version, self.format, self.url) out += '%s:%s:%s:%s:fullurl=%s\n' % (self.recid, self.docid, self.version, self.format, self.fullurl) out += '%s:%s:%s:%s:description=%s\n' % (self.recid, self.docid, self.version, self.format, self.description) out += '%s:%s:%s:%s:comment=%s\n' % (self.recid, self.docid, self.version, self.format, self.comment) out += '%s:%s:%s:%s:hidden=%s\n' % (self.recid, self.docid, self.version, self.format, self.hidden) out += '%s:%s:%s:%s:flags=%s\n' % (self.recid, self.docid, self.version, self.format, self.flags) out += '%s:%s:%s:%s:etag=%s\n' % (self.recid, self.docid, self.version, self.format, self.etag) return out def display(self, ln = CFG_SITE_LANG): """Returns a formatted representation of this docfile.""" return websubmit_templates.tmpl_bibdocfile_filelist( ln = ln, recid = self.recid, version = self.version, name = self.name, - format = self.format, - size = self.size, + superformat = self.superformat, + subformat = self.subformat, + nice_size = nice_size(self.size), description = self.description or '' ) def is_restricted(self, req): """Returns restriction state. (see acc_authorize_action return values)""" if self.status not in ('', 'DELETED'): return acc_authorize_action(req, 'viewrestrdoc', status=self.status) elif self.status == 'DELETED': return (1, 'File has ben deleted') else: return (0, '') + def is_icon(self, subformat_re=CFG_WEBSUBMIT_ICON_SUBFORMAT_RE): + """ + @param subformat_re: by default the convention is that + L{CFG_WEBSUBMIT_ICON_SUBFORMAT_RE} is used as a subformat indicator to + mean that a particular format is to be used as an icon. + Specifiy a different subformat if you need to use a different + convention. + @type subformat: compiled regular expression + @return: True if this file is an icon. + @rtype: bool + """ + return bool(subformat_re.match(self.subformat)) + def hidden_p(self): return self.hidden def get_url(self): return self.url def get_type(self): return self.doctype def get_path(self): return self.fullpath def get_bibdocid(self): return self.docid def get_name(self): return self.name def get_full_name(self): return self.fullname def get_full_path(self): return self.fullpath def get_format(self): return self.format + def get_subformat(self): + return self.subformat + + def get_superformat(self): + return self.superformat + def get_size(self): return self.size def get_version(self): return self.version def get_checksum(self): return self.checksum def get_description(self): return self.description def get_comment(self): return self.comment def get_content(self): """Returns the binary content of the file.""" content_fd = open(self.fullpath, 'rb') content = content_fd.read() content_fd.close() return content def get_recid(self): """Returns the recid connected with the bibdoc of this file.""" return self.recid def get_status(self): """Returns the status of the file, i.e. either '', 'DELETED' or a restriction keyword.""" return self.status def get_magic(self): """Return all the possible guesses from the magic library about the content of the file.""" if self.magic is None and CFG_HAS_MAGIC: magic_cookies = _get_magic_cookies() magic_result = [] for key in magic_cookies.keys(): magic_result.append(magic_cookies[key].file(self.fullpath)) self.magic = tuple(magic_result) return self.magic def check(self): """Return True if the checksum corresponds to the file.""" return calculate_md5(self.fullpath) == self.checksum def stream(self, req): """Stream the file.""" if self.status: (auth_code, auth_message) = acc_authorize_action(req, 'viewrestrdoc', status=self.status) else: auth_code = 0 if auth_code == 0: if os.path.exists(self.fullpath): if random.random() < CFG_BIBDOCFILE_MD5_CHECK_PROBABILITY and calculate_md5(self.fullpath) != self.checksum: raise InvenioWebSubmitFileError, "File %s, version %i, for record %s is corrupted!" % (self.fullname, self.version, self.recid) - stream_file(req, self.fullpath, self.fullname, self.mime, self.encoding, self.etag, self.checksum, self.fullurl) + stream_file(req, self.fullpath, "%s%s" % (self.name, self.superformat), self.mime, self.encoding, self.etag, self.checksum, self.fullurl) raise apache.SERVER_RETURN, apache.DONE else: req.status = apache.HTTP_NOT_FOUND raise InvenioWebSubmitFileError, "%s does not exists!" % self.fullpath else: raise InvenioWebSubmitFileError, "You are not authorized to download %s: %s" % (self.fullname, auth_message) def stream_file(req, fullpath, fullname=None, mime=None, encoding=None, etag=None, md5=None, location=None): """This is a generic function to stream a file to the user. If fullname, mime, encoding, and location are not provided they will be guessed based on req and fullpath. md5 should be passed as an hexadecimal string. """ def normal_streaming(size): req.set_content_length(size) req.send_http_header() if not req.header_only: req.sendfile(fullpath) return "" def single_range(size, the_range): req.set_content_length(the_range[1]) req.headers_out['Content-Range'] = 'bytes %d-%d/%d' % (the_range[0], the_range[0] + the_range[1] - 1, size) req.status = apache.HTTP_PARTIAL_CONTENT req.send_http_header() if not req.header_only: req.sendfile(fullpath, the_range[0], the_range[1]) return "" def multiple_ranges(size, ranges, mime): req.status = apache.HTTP_PARTIAL_CONTENT boundary = '%s%04d' % (time.strftime('THIS_STRING_SEPARATES_%Y%m%d%H%M%S'), random.randint(0, 9999)) req.content_type = 'multipart/byteranges; boundary=%s' % boundary content_length = 0 for arange in ranges: content_length += len('--%s\r\n' % boundary) content_length += len('Content-Type: %s\r\n' % mime) content_length += len('Content-Range: bytes %d-%d/%d\r\n' % (arange[0], arange[0] + arange[1] - 1, size)) content_length += len('\r\n') content_length += arange[1] content_length += len('\r\n') content_length += len('--%s--\r\n' % boundary) req.set_content_length(content_length) req.send_http_header() if not req.header_only: for arange in ranges: req.write('--%s\r\n' % boundary, 0) req.write('Content-Type: %s\r\n' % mime, 0) req.write('Content-Range: bytes %d-%d/%d\r\n' % (arange[0], arange[0] + arange[1] - 1, size), 0) req.write('\r\n', 0) req.sendfile(fullpath, arange[0], arange[1]) req.write('\r\n', 0) req.write('--%s--\r\n' % boundary) req.flush() return "" def parse_date(date): """According to a date can come in three formats (in order of preference): Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format Moreover IE is adding some trailing information after a ';'. Wrong dates should be simpled ignored. This function return the time in seconds since the epoch GMT or None in case of errors.""" if not date: return None try: date = date.split(';')[0].strip() # Because of IE ## Sun, 06 Nov 1994 08:49:37 GMT return time.mktime(time.strptime(date, '%a, %d %b %Y %X %Z')) except: try: ## Sun, 06 Nov 1994 08:49:37 GMT return time.mktime(time.strptime(date, '%A, %d-%b-%y %H:%M:%S %Z')) except: try: ## Sun, 06 Nov 1994 08:49:37 GMT return time.mktime(date) except: return None def parse_ranges(ranges): """According to a (multiple) range request comes in the form: bytes=20-30,40-60,70-,-80 with the meaning: from byte to 20 to 30 inclusive (11 bytes) from byte to 40 to 60 inclusive (21 bytes) from byte 70 to (size - 1) inclusive (size - 70 bytes) from byte size - 80 to (size - 1) inclusive (80 bytes) This function will return the list of ranges in the form: [[first_byte, last_byte], ...] If first_byte or last_byte aren't specified they'll be set to None If the list is not well formatted it will return None """ try: if ranges.startswith('bytes') and '=' in ranges: ranges = ranges.split('=')[1].strip() else: return None ret = [] for arange in ranges.split(','): arange = arange.strip() if arange.startswith('-'): ret.append([None, int(arange[1:])]) elif arange.endswith('-'): ret.append([int(arange[:-1]), None]) else: ret.append(map(int, arange.split('-'))) return ret except: return None def parse_tags(tags): """Return a list of tags starting from a comma separated list.""" return [tag.strip() for tag in tags.split(',')] def fix_ranges(ranges, size): """Complementary to parse_ranges it will transform all the ranges into (first_byte, length), adjusting all the value based on the actual size provided. """ ret = [] for arange in ranges: if (arange[0] is None and arange[1] > 0) or arange[0] < size: if arange[0] is None: arange[0] = size - arange[1] elif arange[1] is None: arange[1] = size - arange[0] else: arange[1] = arange[1] - arange[0] + 1 arange[0] = max(0, arange[0]) arange[1] = min(size - arange[0], arange[1]) if arange[1] > 0: ret.append(arange) return ret def get_normalized_headers(headers): """Strip and lowerize all the keys of the headers dictionary plus strip, lowerize and transform known headers value into their value.""" ret = { 'if-match' : None, 'unless-modified-since' : None, 'if-modified-since' : None, 'range' : None, 'if-range' : None, 'if-none-match' : None, } for key, value in req.headers_in.iteritems(): key = key.strip().lower() value = value.strip() if key in ('unless-modified-since', 'if-modified-since'): value = parse_date(value) elif key == 'range': value = parse_ranges(value) elif key == 'if-range': value = parse_date(value) or parse_tags(value) elif key in ('if-match', 'if-none-match'): value = parse_tags(value) if value: ret[key] = value return ret if CFG_BIBDOCFILE_USE_XSENDFILE: ## If XSendFile is supported by the server, let's use it. if os.path.exists(fullpath): if fullname is None: fullname = os.path.basename(fullpath) req.headers_out["Content-Disposition"] = 'inline; filename="%s"' % fullname.replace('"', '\\"') req.headers_out["X-Sendfile"] = fullpath if mime is None: format = decompose_file(fullpath)[2] (mime, encoding) = _mimes.guess_type(fullpath) if mime is None: mime = "application/octet-stream" req.content_type = mime return "" else: raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND headers = get_normalized_headers(req.headers_in) if headers['if-match']: if etag is not None and etag not in headers['if-match']: raise apache.SERVER_RETURN, apache.HTTP_PRECONDITION_FAILED if os.path.exists(fullpath): mtime = os.path.getmtime(fullpath) if fullname is None: fullname = os.path.basename(fullpath) if mime is None: - format = decompose_file(fullpath)[2] (mime, encoding) = _mimes.guess_type(fullpath) if mime is None: mime = "application/octet-stream" if location is None: location = req.uri req.content_type = mime req.encoding = encoding req.filename = fullname req.headers_out["Last-Modified"] = time.strftime('%a, %d %b %Y %X GMT', time.gmtime(mtime)) req.headers_out["Accept-Ranges"] = "bytes" req.headers_out["Content-Location"] = location if etag is not None: req.headers_out["ETag"] = etag if md5 is not None: req.headers_out["Content-MD5"] = base64.encodestring(binascii.unhexlify(md5.upper()))[:-1] req.headers_out["Content-Disposition"] = 'inline; filename="%s"' % fullname.replace('"', '\\"') size = os.path.getsize(fullpath) if not size: try: raise Exception, '%s exists but is empty' % fullpath except Exception: register_exception(req=req, alert_admin=True) raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND if headers['if-modified-since'] and headers['if-modified-since'] >= mtime: raise apache.SERVER_RETURN, apache.HTTP_NOT_MODIFIED if headers['if-none-match']: if etag is not None and etag in headers['if-none-match']: raise apache.SERVER_RETURN, apache.HTTP_NOT_MODIFIED if headers['unless-modified-since'] and headers['unless-modified-since'] < mtime: return normal_streaming(size) if headers['range']: try: if headers['if-range']: if etag is None or etag not in headers['if-range']: return normal_streaming(size) ranges = fix_ranges(headers['range'], size) except: return normal_streaming(size) if len(ranges) > 1: return multiple_ranges(size, ranges, mime) elif ranges: return single_range(size, ranges[0]) else: raise apache.SERVER_RETURN, apache.HTTP_RANGE_NOT_SATISFIABLE else: return normal_streaming(size) else: raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND def stream_restricted_icon(req): """Return the content of the "Restricted Icon" file.""" stream_file(req, '%s/img/restricted.gif' % CFG_WEBDIR) raise apache.SERVER_RETURN, apache.DONE def list_types_from_array(bibdocs): """Retrieves the list of types from the given bibdoc list.""" types = [] for bibdoc in bibdocs: if not bibdoc.get_type() in types: types.append(bibdoc.get_type()) return types def list_versions_from_array(docfiles): """Retrieve the list of existing versions from the given docfiles list.""" versions = [] for docfile in docfiles: if not docfile.get_version() in versions: versions.append(docfile.get_version()) + versions.sort() + versions.reverse() return versions -def order_files_with_version(docfile1, docfile2): - """order docfile objects according to their version""" - version1 = docfile1.get_version() - version2 = docfile2.get_version() - return cmp(version2, version1) - def _make_base_dir(docid): """Given a docid it returns the complete path that should host its files.""" group = "g" + str(int(int(docid) / CFG_WEBSUBMIT_FILESYSTEM_BIBDOC_GROUP_LIMIT)) return os.path.join(CFG_WEBSUBMIT_FILEDIR, group, str(docid)) class Md5Folder: """Manage all the Md5 checksum about a folder""" def __init__(self, folder): """Initialize the class from the md5 checksum of a given path""" self.folder = folder try: self.load() except InvenioWebSubmitFileError: self.md5s = {} self.update() def update(self, only_new = True): """Update the .md5 file with the current files. If only_new is specified then only not already calculated file are calculated.""" if not only_new: self.md5s = {} if os.path.exists(self.folder): for filename in os.listdir(self.folder): if filename not in self.md5s and not filename.startswith('.'): self.md5s[filename] = calculate_md5(os.path.join(self.folder, filename)) self.store() def store(self): """Store the current md5 dictionary into .md5""" try: old_umask = os.umask(022) md5file = open(os.path.join(self.folder, ".md5"), "w") for key, value in self.md5s.items(): md5file.write('%s *%s\n' % (value, key)) md5file.close() os.umask(old_umask) except Exception, e: register_exception() raise InvenioWebSubmitFileError, "Encountered an exception while storing .md5 for folder '%s': '%s'" % (self.folder, e) def load(self): """Load .md5 into the md5 dictionary""" self.md5s = {} try: md5file = open(os.path.join(self.folder, ".md5"), "r") for row in md5file: md5hash = row[:32] filename = row[34:].strip() self.md5s[filename] = md5hash md5file.close() except IOError: self.update() except Exception, e: register_exception() raise InvenioWebSubmitFileError, "Encountered an exception while loading .md5 for folder '%s': '%s'" % (self.folder, e) def check(self, filename = ''): """Check the specified file or all the files for which it exists a hash for being coherent with the stored hash.""" if filename and filename in self.md5s.keys(): try: return self.md5s[filename] == calculate_md5(os.path.join(self.folder, filename)) except Exception, e: register_exception() raise InvenioWebSubmitFileError, "Encountered an exception while loading '%s': '%s'" % (os.path.join(self.folder, filename), e) else: for filename, md5hash in self.md5s.items(): try: if calculate_md5(os.path.join(self.folder, filename)) != md5hash: return False except Exception, e: register_exception() raise InvenioWebSubmitFileError, "Encountered an exception while loading '%s': '%s'" % (os.path.join(self.folder, filename), e) return True def get_checksum(self, filename): """Return the checksum of a physical file.""" md5hash = self.md5s.get(filename, None) if md5hash is None: self.update() # Now it should not fail! md5hash = self.md5s[filename] return md5hash def calculate_md5_external(filename): """Calculate the md5 of a physical file through md5sum Command Line Tool. This is suitable for file larger than 256Kb.""" try: md5_result = os.popen(CFG_PATH_MD5SUM + ' -b %s' % escape_shell_arg(filename)) ret = md5_result.read()[:32] md5_result.close() if len(ret) != 32: # Error in running md5sum. Let's fallback to internal # algorithm. return calculate_md5(filename, force_internal=True) else: return ret except Exception, e: raise InvenioWebSubmitFileError, "Encountered an exception while calculating md5 for file '%s': '%s'" % (filename, e) def calculate_md5(filename, force_internal=False): """Calculate the md5 of a physical file. This is suitable for files smaller than 256Kb.""" if not CFG_PATH_MD5SUM or force_internal or os.path.getsize(filename) < CFG_BIBDOCFILE_MD5_THRESHOLD: try: to_be_read = open(filename, "rb") computed_md5 = md5() while True: buf = to_be_read.read(CFG_BIBDOCFILE_MD5_BUFFER) if buf: computed_md5.update(buf) else: break to_be_read.close() return computed_md5.hexdigest() except Exception, e: register_exception() raise InvenioWebSubmitFileError, "Encountered an exception while calculating md5 for file '%s': '%s'" % (filename, e) else: return calculate_md5_external(filename) def bibdocfile_url_to_bibrecdocs(url): """Given an URL in the form CFG_SITE_[SECURE_]URL/record/xxx/files/... it returns a BibRecDocs object for the corresponding recid.""" recid = decompose_bibdocfile_url(url)[0] return BibRecDocs(recid) def bibdocfile_url_to_bibdoc(url): """Given an URL in the form CFG_SITE_[SECURE_]URL/record/xxx/files/... it returns a BibDoc object for the corresponding recid/docname.""" docname = decompose_bibdocfile_url(url)[1] return bibdocfile_url_to_bibrecdocs(url).get_bibdoc(docname) def bibdocfile_url_to_bibdocfile(url): """Given an URL in the form CFG_SITE_[SECURE_]URL/record/xxx/files/... it returns a BibDocFile object for the corresponding recid/docname/format.""" dummy, dummy, format = decompose_bibdocfile_url(url) return bibdocfile_url_to_bibdoc(url).get_file(format) def bibdocfile_url_to_fullpath(url): """Given an URL in the form CFG_SITE_[SECURE_]URL/record/xxx/files/... it returns the fullpath for the corresponding recid/docname/format.""" return bibdocfile_url_to_bibdocfile(url).get_full_path() def bibdocfile_url_p(url): """Return True when the url is a potential valid url pointing to a fulltext owned by a system.""" if url.startswith('%s/getfile.py' % CFG_SITE_URL) or url.startswith('%s/getfile.py' % CFG_SITE_SECURE_URL): return True if not (url.startswith('%s/record/' % CFG_SITE_URL) or url.startswith('%s/record/' % CFG_SITE_SECURE_URL)): return False splitted_url = url.split('/files/') return len(splitted_url) == 2 and splitted_url[0] != '' and splitted_url[1] != '' def get_docid_from_bibdocfile_fullpath(fullpath): """Given a bibdocfile fullpath (e.g. "CFG_WEBSUBMIT_FILEDIR/g0/123/bar.pdf;1") returns the docid (e.g. 123).""" if not fullpath.startswith(os.path.join(CFG_WEBSUBMIT_FILEDIR, 'g')): raise InvenioWebSubmitFileError, "Fullpath %s doesn't correspond to a valid bibdocfile fullpath" % fullpath dirname, base, extension, version = decompose_file_with_version(fullpath) try: return int(dirname.split('/')[-1]) except: raise InvenioWebSubmitFileError, "Fullpath %s doesn't correspond to a valid bibdocfile fullpath" % fullpath def decompose_bibdocfile_fullpath(fullpath): """Given a bibdocfile fullpath (e.g. "CFG_WEBSUBMIT_FILEDIR/g0/123/bar.pdf;1") returns a quadruple (recid, docname, format, version).""" if not fullpath.startswith(os.path.join(CFG_WEBSUBMIT_FILEDIR, 'g')): raise InvenioWebSubmitFileError, "Fullpath %s doesn't correspond to a valid bibdocfile fullpath" % fullpath dirname, base, extension, version = decompose_file_with_version(fullpath) try: docid = int(dirname.split('/')[-1]) bibdoc = BibDoc(docid) recid = bibdoc.get_recid() docname = bibdoc.get_docname() return recid, docname, extension, version except: raise InvenioWebSubmitFileError, "Fullpath %s doesn't correspond to a valid bibdocfile fullpath" % fullpath def decompose_bibdocfile_url(url): """Given a bibdocfile_url return a triple (recid, docname, format).""" if url.startswith('%s/getfile.py' % CFG_SITE_URL) or url.startswith('%s/getfile.py' % CFG_SITE_SECURE_URL): return decompose_bibdocfile_very_old_url(url) if url.startswith('%s/record/' % CFG_SITE_URL): recid_file = url[len('%s/record/' % CFG_SITE_URL):] elif url.startswith('%s/record/' % CFG_SITE_SECURE_URL): recid_file = url[len('%s/record/' % CFG_SITE_SECURE_URL):] else: raise InvenioWebSubmitFileError, "Url %s doesn't correspond to a valid record inside the system." % url recid_file = recid_file.replace('/files/', '/') recid, docname, format = decompose_file(urllib.unquote(recid_file)) if not recid and docname.isdigit(): ## If the URL was something similar to CFG_SITE_URL/record/123 return (int(docname), '', '') return (int(recid), docname, format) re_bibdocfile_old_url = re.compile(r'/record/(\d*)/files/') def decompose_bibdocfile_old_url(url): """Given a bibdocfile old url (e.g. CFG_SITE_URL/record/123/files) it returns the recid.""" g = re_bibdocfile_old_url.search(url) if g: return int(g.group(1)) raise InvenioWebSubmitFileError('%s is not a valid old bibdocfile url' % url) def decompose_bibdocfile_very_old_url(url): """Decompose an old /getfile.py? URL""" if url.startswith('%s/getfile.py' % CFG_SITE_URL) or url.startswith('%s/getfile.py' % CFG_SITE_SECURE_URL): params = urllib.splitquery(url)[1] if params: try: params = cgi.parse_qs(params) if 'docid' in params: docid = int(params['docid'][0]) bibdoc = BibDoc(docid) recid = bibdoc.get_recid() docname = bibdoc.get_docname() elif 'recid' in params: recid = int(params['recid'][0]) if 'name' in params: docname = params['name'][0] else: docname = '' else: raise InvenioWebSubmitFileError('%s has not enough params to correspond to a bibdocfile.' % url) format = normalize_format(params.get('format', [''])[0]) return (recid, docname, format) except Exception, e: raise InvenioWebSubmitFileError('Problem with %s: %s' % (url, e)) else: raise InvenioWebSubmitFileError('%s has no params to correspond to a bibdocfile.' % url) else: raise InvenioWebSubmitFileError('%s is not a valid very old bibdocfile url' % url) -def nice_size(size): - """Return a nicely printed size in kilo.""" - unit = 'B' - if size > 1024: - size /= 1024.0 - unit = 'KB' - if size > 1024: - size /= 1024.0 - unit = 'MB' - if size > 1024: - size /= 1024.0 - unit = 'GB' - return '%s %s' % (websearch_templates.tmpl_nice_number(size, max_ndigits_after_dot=2), unit) - def get_docname_from_url(url): """Return a potential docname given a url""" path = urllib2.urlparse.urlsplit(urllib.unquote(url))[2] filename = os.path.split(path)[-1] return file_strip_ext(filename) def get_format_from_url(url): """Return a potential format given a url""" path = urllib2.urlparse.urlsplit(urllib.unquote(url))[2] filename = os.path.split(path)[-1] return filename[len(file_strip_ext(filename)):] def clean_url(url): """Given a local url e.g. a local path it render it a realpath.""" protocol = urllib2.urlparse.urlsplit(url)[0] if protocol in ('', 'file'): path = urllib2.urlparse.urlsplit(urllib.unquote(url))[2] return os.path.abspath(path) else: return url def is_url_a_local_file(url): """Return True if the given URL is pointing to a local file.""" protocol = urllib2.urlparse.urlsplit(url)[0] return protocol in ('', 'file') def check_valid_url(url): """Check for validity of a url or a file.""" try: if is_url_a_local_file(url): path = urllib2.urlparse.urlsplit(urllib.unquote(url))[2] if os.path.abspath(path) != path: raise StandardError, "%s is not a normalized path (would be %s)." % (path, os.path.normpath(path)) for allowed_path in CFG_BIBUPLOAD_FFT_ALLOWED_LOCAL_PATHS + [CFG_TMPDIR, CFG_WEBSUBMIT_STORAGEDIR]: if path.startswith(allowed_path): dummy_fd = open(path) dummy_fd.close() return raise StandardError, "%s is not in one of the allowed paths." % path else: urllib2.urlopen(url) except Exception, e: raise StandardError, "%s is not a correct url: %s" % (url, e) def safe_mkstemp(suffix): """Create a temporary filename that don't have any '.' inside a part from the suffix.""" tmpfd, tmppath = tempfile.mkstemp(suffix=suffix, dir=CFG_TMPDIR) if '.' not in suffix: # Just in case format is empty return tmpfd, tmppath while '.' in os.path.basename(tmppath)[:-len(suffix)]: os.close(tmpfd) os.remove(tmppath) tmpfd, tmppath = tempfile.mkstemp(suffix=suffix, dir=CFG_TMPDIR) return (tmpfd, tmppath) def download_url(url, format=None, sleep=2): """Download a url (if it corresponds to a remote file) and return a local url to it.""" if format is None: format = decompose_file(url)[2] else: format = normalize_format(format) protocol = urllib2.urlparse.urlsplit(url)[0] tmpfd, tmppath = safe_mkstemp(format) try: try: if protocol in ('', 'file'): path = urllib2.urlparse.urlsplit(urllib.unquote(url))[2] if os.path.abspath(path) != path: raise StandardError, "%s is not a normalized path (would be %s)." % (path, os.path.normpath(path)) for allowed_path in CFG_BIBUPLOAD_FFT_ALLOWED_LOCAL_PATHS + [CFG_TMPDIR, CFG_WEBSUBMIT_STORAGEDIR]: if path.startswith(allowed_path): shutil.copy(path, tmppath) if os.path.getsize(tmppath) > 0: return tmppath else: raise StandardError, "%s seems to be empty" % url raise StandardError, "%s is not in one of the allowed paths." % path else: try: from_file = urllib2.urlopen(url) to_file = open(tmppath, 'w') while True: block = from_file.read(CFG_BIBDOCFILE_BLOCK_SIZE) if not block: break to_file.write(block) to_file.close() from_file.close() except Exception, e: raise StandardError, "Error when downloading %s into %s: %s" % (url, tmppath, e) if os.path.getsize(tmppath) > 0: return tmppath else: raise StandardError, "%s seems to be empty" % url except: os.remove(tmppath) raise finally: os.close(tmpfd) class BibDocMoreInfo: """ This class wraps contextual information of the documents, such as the - comments - descriptions - flags. Such information is kept separately per every format/version instance of the corresponding document and is searialized in the database, ready to be retrieved (but not searched). @param docid: the document identifier. @type docid: integer @param more_info: a serialized version of an already existing more_info object. If not specified this information will be readed from the database, and othewise an empty dictionary will be allocated. @raise ValueError: if docid is not a positive integer. @ivar docid: the document identifier as passed to the constructor. @type docid: integer @ivar more_info: the more_info dictionary that will hold all the additional document information. @type more_info: dict of dict of dict @note: in general this class is never instanciated in client code and never used outside bibdocfile module. @note: this class will be extended in the future to hold all the new auxiliary information about a document. """ def __init__(self, docid, more_info=None): if not (type(docid) in (long, int) and docid > 0): raise ValueError("docid is not a positive integer, but %s." % docid) self.docid = docid if more_info is None: res = run_sql('SELECT more_info FROM bibdoc WHERE id=%s', (docid, )) if res and res[0][0]: self.more_info = cPickle.loads(blob_to_string(res[0][0])) else: self.more_info = {} else: self.more_info = cPickle.loads(more_info) if 'descriptions' not in self.more_info: self.more_info['descriptions'] = {} if 'comments' not in self.more_info: self.more_info['comments'] = {} if 'flags' not in self.more_info: self.more_info['flags'] = {} def __repr__(self): """ @return: the canonical string representation of the C{BibDocMoreInfo}. @rtype: string """ return 'BibDocMoreInfo(%i, %s)' % (self.docid, repr(cPickle.dumps(self.more_info))) def flush(self): """ Flush this object to the database. """ run_sql('UPDATE bibdoc SET more_info=%s WHERE id=%s', (cPickle.dumps(self.more_info), self.docid)) def set_flag(self, flagname, format, version): """ Sets a flag. @param flagname: the flag to set (see L{CFG_BIBDOCFILE_AVAILABLE_FLAGS}). @type flagname: string @param format: the format for which the flag should set. @type format: string @param version: the version for which the flag should set: @type version: integer @raise ValueError: if the flag is not in L{CFG_BIBDOCFILE_AVAILABLE_FLAGS} """ if flagname in CFG_BIBDOCFILE_AVAILABLE_FLAGS: if not flagname in self.more_info['flags']: self.more_info['flags'][flagname] = {} if not version in self.more_info['flags'][flagname]: self.more_info['flags'][flagname][version] = {} if not format in self.more_info['flags'][flagname][version]: self.more_info['flags'][flagname][version][format] = {} self.more_info['flags'][flagname][version][format] = True self.flush() else: raise ValueError, "%s is not in %s" % (flagname, CFG_BIBDOCFILE_AVAILABLE_FLAGS) def get_comment(self, format, version): """ Returns the specified comment. @param format: the format for which the comment should be retrieved. @type format: string @param version: the version for which the comment should be retrieved. @type version: integer @return: the specified comment. @rtype: string """ try: assert(type(version) is int) format = normalize_format(format) return self.more_info['comments'].get(version, {}).get(format) except: register_exception() raise def get_description(self, format, version): """ Returns the specified description. @param format: the format for which the description should be retrieved. @type format: string @param version: the version for which the description should be retrieved. @type version: integer @return: the specified description. @rtype: string """ try: assert(type(version) is int) format = normalize_format(format) return self.more_info['descriptions'].get(version, {}).get(format) except: register_exception() raise def has_flag(self, flagname, format, version): """ Return True if the corresponding has been set. @param flagname: the name of the flag (see L{CFG_BIBDOCFILE_AVAILABLE_FLAGS}). @type flagname: string @param format: the format for which the flag should be checked. @type format: string @param version: the version for which the flag should be checked. @type version: integer @return: True if the flag is set for the given format/version. @rtype: bool @raise ValueError: if the flagname is not in L{CFG_BIBDOCFILE_AVAILABLE_FLAGS} """ if flagname in CFG_BIBDOCFILE_AVAILABLE_FLAGS: return self.more_info['flags'].get(flagname, {}).get(version, {}).get(format, False) else: raise ValueError, "%s is not in %s" % (flagname, CFG_BIBDOCFILE_AVAILABLE_FLAGS) def get_flags(self, format, version): """ Return the list of all the enabled flags. @param format: the format for which the list should be returned. @type format: string @param version: the version for which the list should be returned. @type version: integer @return: the list of enabled flags (from L{CFG_BIBDOCFILE_AVAILABLE_FLAGS}). @rtype: list of string """ return [flag for flag in self.more_info['flags'] if format in self.more_info['flags'][flag].get(version, {})] def set_comment(self, comment, format, version): """ Set a comment. @param comment: the comment to be set. @type comment: string @param format: the format for which the comment should be set. @type format: string @param version: the version for which the comment should be set: @type version: integer """ try: assert(type(version) is int and version > 0) format = normalize_format(format) if comment == KEEP_OLD_VALUE: comment = self.get_comment(format, version) or self.get_comment(format, version - 1) if not comment: self.unset_comment(format, version) self.flush() return if not version in self.more_info['comments']: self.more_info['comments'][version] = {} self.more_info['comments'][version][format] = comment self.flush() except: register_exception() raise def set_description(self, description, format, version): """ Set a description. @param description: the description to be set. @type description: string @param format: the format for which the description should be set. @type format: string @param version: the version for which the description should be set: @type version: integer """ try: assert(type(version) is int and version > 0) format = normalize_format(format) if description == KEEP_OLD_VALUE: description = self.get_description(format, version) or self.get_description(format, version - 1) if not description: self.unset_description(format, version) self.flush() return if not version in self.more_info['descriptions']: self.more_info['descriptions'][version] = {} self.more_info['descriptions'][version][format] = description self.flush() except: register_exception() raise def unset_comment(self, format, version): """ Unset a comment. @param format: the format for which the comment should be unset. @type format: string @param version: the version for which the comment should be unset: @type version: integer """ try: assert(type(version) is int and version > 0) del self.more_info['comments'][version][format] self.flush() except KeyError: pass except: register_exception() raise def unset_description(self, format, version): """ Unset a description. @param format: the format for which the description should be unset. @type format: string @param version: the version for which the description should be unset: @type version: integer """ try: assert(type(version) is int and version > 0) del self.more_info['descriptions'][version][format] self.flush() except KeyError: pass except: register_exception() raise def unset_flag(self, flagname, format, version): """ Unset a flag. @param flagname: the flag to be unset (see L{CFG_BIBDOCFILE_AVAILABLE_FLAGS}). @type flagname: string @param format: the format for which the flag should be unset. @type format: string @param version: the version for which the flag should be unset: @type version: integer @raise ValueError: if the flag is not in L{CFG_BIBDOCFILE_AVAILABLE_FLAGS} """ if flagname in CFG_BIBDOCFILE_AVAILABLE_FLAGS: try: del self.more_info['flags'][flagname][version][format] self.flush() except KeyError: pass else: raise ValueError, "%s is not in %s" % (flagname, CFG_BIBDOCFILE_AVAILABLE_FLAGS) def serialize(self): """ @return: the serialized version of this object. @rtype: string """ return cPickle.dumps(self.more_info) def readfile(filename): """ Read a file. @param filename: the name of the file to be read. @type filename: string @return: the text contained in the file. @rtype: string @note: Returns empty string in case of any error. @note: this function is useful for quick implementation of websubmit functions. """ try: return open(filename).read() except Exception: return '' diff --git a/modules/websubmit/lib/bibdocfile_regression_tests.py b/modules/websubmit/lib/bibdocfile_regression_tests.py index aabb42ebf..50e96d83d 100644 --- a/modules/websubmit/lib/bibdocfile_regression_tests.py +++ b/modules/websubmit/lib/bibdocfile_regression_tests.py @@ -1,238 +1,243 @@ # -*- coding: utf-8 -*- ## ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """BibDocFile Regression Test Suite.""" __revision__ = "$Id$" import unittest from invenio.testutils import make_test_suite, run_test_suite from invenio.bibdocfile import BibRecDocs#, BibDoc, BibDocFile from invenio.config import \ CFG_SITE_URL, \ - CFG_PREFIX, \ - CFG_WEBSUBMIT_FILEDIR + CFG_PREFIX, \ + CFG_WEBSUBMIT_FILEDIR class BibRecDocsTest(unittest.TestCase): """regression tests about BibRecDocs""" def test_BibRecDocs(self): """bibdocfile - BibRecDocs functions""" my_bibrecdoc = BibRecDocs(2) #add bibdoc my_bibrecdoc.add_new_file(CFG_PREFIX + '/lib/webtest/invenio/test.jpg', 'Main', 'img_test', False, 'test add new file', 'test', '.jpg') my_bibrecdoc.add_bibdoc(doctype='Main', docname='file', never_fail=False) self.assertEqual(len(my_bibrecdoc.list_bibdocs()), 3) my_added_bibdoc = my_bibrecdoc.get_bibdoc('file') #add bibdocfile in empty bibdoc my_added_bibdoc.add_file_new_version(CFG_PREFIX + '/lib/webtest/invenio/test.gif', \ - description= 'added in empty bibdoc', comment=None, format=None, hide_previous_versions=False) + description= 'added in empty bibdoc', comment=None, format=None, flags=['PERFORM_HIDE_PREVIOUS']) #propose unique docname self.assertEqual(my_bibrecdoc.propose_unique_docname('file'), 'file_2') #has docname self.assertEqual(my_bibrecdoc.has_docname_p('file'), True) #merge 2 bibdocs my_bibrecdoc.merge_bibdocs('img_test', 'file') self.assertEqual(len(my_bibrecdoc.get_bibdoc("img_test").list_all_files()), 2) #check file exists self.assertEqual(my_bibrecdoc.check_file_exists(CFG_PREFIX + '/lib/webtest/invenio/test.jpg'), True) #get bibdoc names self.assertEqual(my_bibrecdoc.get_bibdoc_names('Main')[0], '0104007_02') self.assertEqual(my_bibrecdoc.get_bibdoc_names('Main')[1],'img_test') #get total size - self.assertEqual(my_bibrecdoc.get_total_size(), 1628647) + self.assertEqual(my_bibrecdoc.get_total_size(), 1647591) #get total size latest version - self.assertEqual(my_bibrecdoc.get_total_size_latest_version(), 1628647) + self.assertEqual(my_bibrecdoc.get_total_size_latest_version(), 1647591) #display value = my_bibrecdoc.display(docname='img_test', version='', doctype='', ln='en', verbose=0, display_hidden=True) self.assert_("Main" in value) #get xml 8564 value = my_bibrecdoc.get_xml_8564() self.assert_('/record/2/files/img_test.jpg' in value) #check duplicate docnames self.assertEqual(my_bibrecdoc.check_duplicate_docnames(), True) + + def tearDown(self): + my_bibrecdoc = BibRecDocs(2) #delete my_bibrecdoc.delete_bibdoc('img_test') - + my_bibrecdoc.delete_bibdoc('file') class BibDocsTest(unittest.TestCase): """regression tests about BibDocs""" def test_BibDocs(self): - """bibdocfile - Bibdocs functions""" + """bibdocfile - BibDocs functions""" #add file my_bibrecdoc = BibRecDocs(2) my_bibrecdoc.add_new_file(CFG_PREFIX + '/lib/webtest/invenio/test.jpg', 'Main', 'img_test', False, 'test add new file', 'test', '.jpg') my_new_bibdoc = my_bibrecdoc.get_bibdoc("img_test") value = my_bibrecdoc.list_bibdocs() self.assertEqual(len(value), 2) #get total file (bibdoc) self.assertEqual(my_new_bibdoc.get_total_size(), 91750) #get recid self.assertEqual(my_new_bibdoc.get_recid(), 2) #change name my_new_bibdoc.change_name('new_name') #get docname self.assertEqual(my_new_bibdoc.get_docname(), 'new_name') #get type self.assertEqual(my_new_bibdoc.get_type(), 'Main') #get id self.assert_(my_new_bibdoc.get_id() > 80) #set status my_new_bibdoc.set_status('new status') #get status self.assertEqual(my_new_bibdoc.get_status(), 'new status') #get base directory self.assert_(my_new_bibdoc.get_base_dir().startswith(CFG_WEBSUBMIT_FILEDIR)) #get file number self.assertEqual(my_new_bibdoc.get_file_number(), 1) #add file new version - my_new_bibdoc.add_file_new_version(CFG_PREFIX + '/lib/webtest/invenio/test.jpg', description= 'the new version', comment=None, format=None, hide_previous_versions=False) + my_new_bibdoc.add_file_new_version(CFG_PREFIX + '/lib/webtest/invenio/test.jpg', description= 'the new version', comment=None, format=None, flags=["PERFORM_HIDE_PREVIOUS"]) self.assertEqual(my_new_bibdoc.list_versions(), [1, 2]) #revert my_new_bibdoc.revert(1) self.assertEqual(my_new_bibdoc.list_versions(), [1, 2, 3]) self.assertEqual(my_new_bibdoc.get_description('.jpg', version=3), 'test add new file') #get total size latest version self.assertEqual(my_new_bibdoc.get_total_size_latest_version(), 91750) #get latest version self.assertEqual(my_new_bibdoc.get_latest_version(), 3) #list latest files self.assertEqual(len(my_new_bibdoc.list_latest_files()), 1) self.assertEqual(my_new_bibdoc.list_latest_files()[0].get_version(), 3) #list version files self.assertEqual(len(my_new_bibdoc.list_version_files(1, list_hidden=True)), 1) #display value = my_new_bibdoc.display(version='', ln='en', display_hidden=True) self.assert_('>test add new file<' in value) #format already exist self.assertEqual(my_new_bibdoc.format_already_exists_p('.jpg'), True) #get file self.assertEqual(my_new_bibdoc.get_file('.jpg', version='1').get_version(), 1) #set description my_new_bibdoc.set_description('new description', '.jpg', version=1) #get description self.assertEqual(my_new_bibdoc.get_description('.jpg', version=1), 'new description') #set comment my_new_bibdoc.set_description('new comment', '.jpg', version=1) #get comment self.assertEqual(my_new_bibdoc.get_description('.jpg', version=1), 'new comment') #get history assert len(my_new_bibdoc.get_history()) > 0 #delete file my_new_bibdoc.delete_file('.jpg', 2) #list all files self.assertEqual(len(my_new_bibdoc.list_all_files()), 2) #delete file my_new_bibdoc.delete_file('.jpg', 3) #add new format my_new_bibdoc.add_file_new_format(CFG_PREFIX + '/lib/webtest/invenio/test.gif', version=None, description=None, comment=None, format=None) self.assertEqual(len(my_new_bibdoc.list_all_files()), 2) #delete file my_new_bibdoc.delete_file('.jpg', 1) #delete file my_new_bibdoc.delete_file('.gif', 1) #empty bibdoc self.assertEqual(my_new_bibdoc.empty_p(), True) #hidden? self.assertEqual(my_new_bibdoc.hidden_p('.jpg', version=1), False) #hide - my_new_bibdoc.set_hidden(True, '.jpg', version=1) + my_new_bibdoc.set_flag('HIDDEN', '.jpg', version=1) #hidden? self.assertEqual(my_new_bibdoc.hidden_p('.jpg', version=1), True) #add and get icon my_new_bibdoc.add_icon( CFG_PREFIX + '/lib/webtest/invenio/icon-test.gif', basename=None, format=None) value = my_bibrecdoc.list_bibdocs()[1] self.assertEqual(value.get_icon(), my_new_bibdoc.get_icon()) #delete icon my_new_bibdoc.delete_icon() #get icon self.assertEqual(my_new_bibdoc.get_icon(), None) - #icon_p - self.assertEqual(my_new_bibdoc.icon_p(), False) #delete my_new_bibdoc.delete() self.assertEqual(my_new_bibdoc.deleted_p(), True) #undelete my_new_bibdoc.undelete(previous_status='') + + def tearDown(self): + my_bibrecdoc = BibRecDocs(2) #delete - my_bibrecdoc.delete_bibdoc('new-name') + my_bibrecdoc.delete_bibdoc('img_test') + my_bibrecdoc.delete_bibdoc('new_name') class BibDocFilesTest(unittest.TestCase): """regression tests about BibDocFiles""" def test_BibDocFiles(self): - """bibdocfile - BibdocFiles functions """ + """bibdocfile - BibDocFile functions """ #add bibdoc my_bibrecdoc = BibRecDocs(2) my_bibrecdoc.add_new_file(CFG_PREFIX + '/lib/webtest/invenio/test.jpg', 'Main', 'img_test', False, 'test add new file', 'test', '.jpg') my_new_bibdoc = my_bibrecdoc.get_bibdoc("img_test") my_new_bibdocfile = my_new_bibdoc.list_all_files()[0] #get url self.assertEqual(my_new_bibdocfile.get_url(), CFG_SITE_URL + '/record/2/files/img_test.jpg') #get type self.assertEqual(my_new_bibdocfile.get_type(), 'Main') #get path self.assert_(my_new_bibdocfile.get_path().startswith(CFG_WEBSUBMIT_FILEDIR)) self.assert_(my_new_bibdocfile.get_path().endswith('/img_test.jpg;1')) #get bibdocid self.assertEqual(my_new_bibdocfile.get_bibdocid(), my_new_bibdoc.get_id()) #get name self.assertEqual(my_new_bibdocfile.get_name() , 'img_test') #get full name self.assertEqual(my_new_bibdocfile.get_full_name() , 'img_test.jpg') #get full path self.assert_(my_new_bibdocfile.get_full_path().startswith(CFG_WEBSUBMIT_FILEDIR)) self.assert_(my_new_bibdocfile.get_full_path().endswith('/img_test.jpg;1')) #get format self.assertEqual(my_new_bibdocfile.get_format(), '.jpg') #get version self.assertEqual(my_new_bibdocfile.get_version(), 1) #get description self.assertEqual(my_new_bibdocfile.get_description(), my_new_bibdoc.get_description('.jpg', version=1)) #get comment self.assertEqual(my_new_bibdocfile.get_comment(), my_new_bibdoc.get_comment('.jpg', version=1)) #get recid self.assertEqual(my_new_bibdocfile.get_recid(), 2) #get status self.assertEqual(my_new_bibdocfile.get_status(), '') #get size self.assertEqual(my_new_bibdocfile.get_size(), 91750) #get checksum self.assertEqual(my_new_bibdocfile.get_checksum(), '28ec893f9da735ad65de544f71d4ad76') #check self.assertEqual(my_new_bibdocfile.check(), True) #display value = my_new_bibdocfile.display(ln='en') assert 'files/img_test.jpg?version=1">' in value #hidden? self.assertEqual(my_new_bibdocfile.hidden_p(), False) #delete my_new_bibdoc.delete() self.assertEqual(my_new_bibdoc.deleted_p(), True) TEST_SUITE = make_test_suite(BibRecDocsTest, \ BibDocsTest, \ BibDocFilesTest) if __name__ == "__main__": run_test_suite(TEST_SUITE, warn_user=True) diff --git a/modules/websubmit/lib/bibdocfilecli.py b/modules/websubmit/lib/bibdocfilecli.py index 4b4080aac..1376e44cc 100644 --- a/modules/websubmit/lib/bibdocfilecli.py +++ b/modules/websubmit/lib/bibdocfilecli.py @@ -1,1113 +1,1086 @@ # -*- coding: utf-8 -*- ## ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """ BibDocAdmin CLI administration tool """ __revision__ = "$Id$" import sys import re import os import time import fnmatch import datetime from logging import getLogger, debug, DEBUG from optparse import OptionParser, OptionGroup, OptionValueError from tempfile import mkstemp from invenio.errorlib import register_exception from invenio.config import CFG_TMPDIR, CFG_SITE_URL, CFG_WEBSUBMIT_FILEDIR from invenio.bibdocfile import BibRecDocs, BibDoc, InvenioWebSubmitFileError, \ nice_size, check_valid_url, clean_url, get_docname_from_url, \ guess_format_from_url, KEEP_OLD_VALUE, decompose_bibdocfile_fullpath, \ bibdocfile_url_to_bibdoc, decompose_bibdocfile_url, \ CFG_BIBDOCFILE_AVAILABLE_FLAGS from invenio.intbitset import intbitset from invenio.search_engine import perform_request_search from invenio.textutils import wrap_text_in_a_box, wait_for_user from invenio.dbquery import run_sql from invenio.bibtask import task_low_level_submission from invenio.textutils import encode_for_xml from invenio.websubmit_file_converter import can_perform_ocr def _xml_mksubfield(key, subfield, fft): return fft.get(key, None) is not None and '\t\t%s\n' % (subfield, encode_for_xml(str(fft[key]))) or '' def _xml_mksubfields(key, subfield, fft): ret = "" for value in fft.get(key, []): ret += '\t\t%s\n' % (subfield, encode_for_xml(string(value))) return ret def _xml_fft_creator(fft): """Transform an fft dictionary (made by keys url, docname, format, - new_docname, icon, comment, description, restriction, doctype, into an xml + new_docname, comment, description, restriction, doctype, into an xml string.""" debug('Input FFT structure: %s' % fft) out = '\t\n' out += _xml_mksubfield('url', 'a', fft) out += _xml_mksubfield('docname', 'n', fft) out += _xml_mksubfield('format', 'f', fft) out += _xml_mksubfield('new_docname', 'm', fft) out += _xml_mksubfield('doctype', 't', fft) out += _xml_mksubfield('description', 'd', fft) out += _xml_mksubfield('comment', 'z', fft) out += _xml_mksubfield('restriction', 'r', fft) - out += _xml_mksubfield('icon', 'x', fft) out += _xml_mksubfields('options', 'o', fft) out += _xml_mksubfield('version', 'v', fft) out += '\t\n' debug('FFT created: %s' % out) return out def ffts_to_xml(ffts_dict): """Transform a dictionary: recid -> ffts where ffts is a list of fft dictionary into xml. """ debug('Input FFTs dictionary: %s' % ffts_dict) out = '' recids = ffts_dict.keys() recids.sort() for recid in recids: ffts = ffts_dict[recid] if ffts: out += '\n' out += '\t%i\n' % recid for fft in ffts: out += _xml_fft_creator(fft) out += '\n' debug('MARC to Upload: %s' % out) return out _shift_re = re.compile("([-\+]{0,1})([\d]+)([dhms])") def _parse_datetime(var): """Returns a date string according to the format string. It can handle normal date strings and shifts with respect to now.""" if not var: return None date = time.time() factors = {"d":24*3600, "h":3600, "m":60, "s":1} m = _shift_re.match(var) if m: sign = m.groups()[0] == "-" and -1 or 1 factor = factors[m.groups()[2]] value = float(m.groups()[1]) return datetime.datetime.fromtimestamp(date + sign * factor * value) else: return datetime.datetime.strptime(var, "%Y-%m-%d %H:%M:%S") def _parse_date_range(var): """Returns the two dates contained as a low,high tuple""" limits = var.split(",") if len(limits)==1: low = _parse_datetime(limits[0]) return low, None if len(limits)==2: low = _parse_datetime(limits[0]) high = _parse_datetime(limits[1]) return low, high return None, None def cli_quick_match_all_recids(options): """Return an quickly an approximate but (by excess) list of good recids.""" url = getattr(options, 'url', None) if url: return intbitset([decompose_bibdocfile_url(url)[0]]) path = getattr(options, 'path', None) if path: return intbitset([decompose_bibdocfile_fullpath(path)[0]]) collection = getattr(options, 'collection', None) pattern = getattr(options, 'pattern', None) recids = getattr(options, 'recids', None) md_rec = getattr(options, 'md_rec', None) cd_rec = getattr(options, 'cd_rec', None) tmp_date_query = [] tmp_date_params = [] if recids is None: debug('Initially considering all the recids') recids = intbitset(run_sql('SELECT id FROM bibrec')) if not recids: print >> sys.stderr, 'WARNING: No record in the database' if md_rec[0] is not None: tmp_date_query.append('modification_date>=%s') tmp_date_params.append(md_rec[0]) if md_rec[1] is not None: tmp_date_query.append('modification_date<=%s') tmp_date_params.append(md_rec[1]) if cd_rec[0] is not None: tmp_date_query.append('creation_date>=%s') tmp_date_params.append(cd_rec[0]) if cd_rec[1] is not None: tmp_date_query.append('creation_date<=%s') tmp_date_params.append(cd_rec[1]) if tmp_date_query: tmp_date_query = ' AND '.join(tmp_date_query) tmp_date_params = tuple(tmp_date_params) query = 'SELECT id FROM bibrec WHERE %s' % tmp_date_query debug('Query: %s, param: %s' % (query, tmp_date_params)) recids &= intbitset(run_sql(query % tmp_date_query, tmp_date_params)) debug('After applying dates we obtain recids: %s' % recids) if not recids: print >> sys.stderr, 'WARNING: Time constraints for records are too strict' if collection or pattern: recids &= intbitset(perform_request_search(cc=collection or '', p=pattern or '')) debug('After applyings pattern and collection we obtain recids: %s' % recids) debug('Quick recids: %s' % recids) return recids def cli_quick_match_all_docids(options, recids=None): """Return an quickly an approximate but (by excess) list of good docids.""" url = getattr(options, 'url', None) if url: return intbitset([bibdocfile_url_to_bibdoc(url).get_id()]) path = getattr(options, 'path', None) if path: return intbitset([decompose_bibdocfile_fullpath(path)[0]]) deleted_docs = getattr(options, 'deleted_docs', None) action_undelete = getattr(options, 'action', None) == 'undelete' docids = getattr(options, 'docids', None) md_doc = getattr(options, 'md_doc', None) cd_doc = getattr(options, 'cd_doc', None) if docids is None: debug('Initially considering all the docids') docids = intbitset(run_sql('SELECT id_bibdoc FROM bibrec_bibdoc')) else: debug('Initially considering this docids: %s' % docids) tmp_query = [] tmp_params = [] if deleted_docs is None and action_undelete: deleted_docs = 'only' if deleted_docs == 'no': tmp_query.append('status<>"DELETED"') elif deleted_docs == 'only': tmp_query.append('status="DELETED"') if md_doc[0] is not None: tmp_query.append('modification_date>=%s') tmp_params.append(md_doc[0]) if md_doc[1] is not None: tmp_query.append('modification_date<=%s') tmp_params.append(md_doc[1]) if cd_doc[0] is not None: tmp_query.append('creation_date>=%s') tmp_params.append(cd_doc[0]) if cd_doc[1] is not None: tmp_query.append('creation_date<=%s') tmp_params.append(cd_doc[1]) if tmp_query: tmp_query = ' AND '.join(tmp_query) tmp_params = tuple(tmp_params) query = 'SELECT id FROM bibdoc WHERE %s' % tmp_query debug('Query: %s, param: %s' % (query, tmp_params)) docids &= intbitset(run_sql(query, tmp_params)) debug('After applying dates we obtain docids: %s' % docids) return docids def cli_slow_match_single_recid(options, recid, recids=None, docids=None): """Apply all the given queries in order to assert wethever a recid match or not. if with_docids is True, the recid is matched if it has at least one docid that is matched""" debug('cli_slow_match_single_recid checking: %s' % recid) deleted_docs = getattr(options, 'deleted_docs', None) deleted_recs = getattr(options, 'deleted_recs', None) empty_recs = getattr(options, 'empty_recs', None) docname = cli2docname(options) bibrecdocs = BibRecDocs(recid, deleted_too=(deleted_docs != 'no')) if bibrecdocs.deleted_p() and (deleted_recs == 'no'): return False elif not bibrecdocs.deleted_p() and (deleted_recs != 'only'): if docids: for bibdoc in bibrecdocs.list_bibdocs(): if bibdoc.get_id() in docids: break else: return False if docname: for other_docname in bibrecdocs.get_bibdoc_names(): if docname and fnmatch.fnmatchcase(other_docname, docname): break else: return False if bibrecdocs.empty_p() and (empty_recs != 'no'): return True elif not bibrecdocs.empty_p() and (empty_recs != 'only'): return True return False def cli_slow_match_single_docid(options, docid, recids=None, docids=None): """Apply all the given queries in order to assert wethever a recid match or not.""" debug('cli_slow_match_single_docid checking: %s' % docid) empty_docs = getattr(options, 'empty_docs', None) docname = getattr(options, 'docname', None) if recids is None: recids = cli_quick_match_all_recids(options) bibdoc = BibDoc(docid) if docname and not fnmatch.fnmatchcase(bibdoc.get_docname(), docname): debug('docname %s does not match the pattern %s' % (repr(bibdoc.get_docname()), repr(docname))) return False elif bibdoc.get_recid() and bibdoc.get_recid() not in recids: debug('recid %s is not in pattern %s' % (repr(bibdoc.get_recid()), repr(recids))) return False elif empty_docs == 'no' and bibdoc.empty_p(): debug('bibdoc is empty') return False elif empty_docs == 'only' and not bibdoc.empty_p(): debug('bibdoc is not empty') return False else: return True def cli2recid(options, recids=None, docids=None): """Given the command line options return a recid.""" recids = list(cli_recids_iterator(options, recids=recids, docids=docids)) if len(recids) == 1: return recids[0] if recids: raise StandardError, "More than one recid has been matched: %s" % recids else: raise StandardError, "No recids matched" def cli2docid(options, recids=None, docids=None): """Given the command line options return a docid.""" docids = list(cli_docids_iterator(options, recids=recids, docids=docids)) if len(docids) == 1: return docids[0] if docids: raise StandardError, "More than one docid has been matched: %s" % docids else: raise StandardError, "No docids matched" -def cli2icon(options): - """Return a good value for the icon.""" - icon = getattr(options, 'set_icon', None) - if icon is None: - icon = KEEP_OLD_VALUE - elif icon: - icon = clean_url(icon) - check_valid_url(icon) - return icon - def cli2description(options): """Return a good value for the description.""" description = getattr(options, 'set_description', None) if description is None: description = KEEP_OLD_VALUE return description def cli2restriction(options): """Return a good value for the restriction.""" restriction = getattr(options, 'set_restriction', None) if restriction is None: restriction = KEEP_OLD_VALUE return restriction def cli2comment(options): """Return a good value for the comment.""" comment = getattr(options, 'set_comment', None) if comment is None: comment = KEEP_OLD_VALUE return comment def cli2doctype(options): """Return a good value for the doctype.""" doctype = getattr(options, 'set_doctype', None) if not doctype: return 'Main' return doctype def cli2docname(options, docid=None, url=None): """Given the command line options and optional precalculated docid returns the corresponding docname.""" if docid: bibdoc = BibDoc(docid=docid) return bibdoc.get_docname() docname = getattr(options, 'docname', None) if docname is not None: return docname if url is not None: return get_docname_from_url(url) else: return None def cli2format(options, url=None): """Given the command line options returns the corresponding format.""" format = getattr(options, 'format', None) if format is not None: return format elif url is not None: ## FIXME: to deploy once conversion-tools branch is merged #return guess_format_from_url(url) return guess_format_from_url(url) else: raise OptionValueError("Not enough information to retrieve a valid format") def cli_recids_iterator(options, recids=None, docids=None): """Slow iterator over all the matched recids. if with_docids is True, the recid must be attached to at least a matched docid""" debug('cli_recids_iterator') if recids is None: recids = cli_quick_match_all_recids(options) debug('working on recids: %s, docids: %s' % (recids, docids)) for recid in recids: if cli_slow_match_single_recid(options, recid, recids, docids): yield recid raise StopIteration def cli_docids_iterator(options, recids=None, docids=None): """Slow iterator over all the matched docids.""" if recids is None: recids = cli_quick_match_all_recids(options) if docids is None: docids = cli_quick_match_all_docids(options) for docid in docids: if cli_slow_match_single_docid(options, docid, recids, docids): yield docid raise StopIteration class OptionParserSpecial(OptionParser): def format_help(self, *args, **kwargs): result = OptionParser.format_help(self, *args, **kwargs) if hasattr(self, 'trailing_text'): return "%s\n%s\n" % (result, self.trailing_text) else: return result def prepare_option_parser(): """Parse the command line options.""" def _ids_ranges_callback(option, opt, value, parser): """Callback for optparse to parse a set of ids ranges in the form nnn1-nnn2,mmm1-mmm2... returning the corresponding intbitset. """ try: debug('option: %s, opt: %s, value: %s, parser: %s' % (option, opt, value, parser)) debug('Parsing range: %s' % value) value = ranges2ids(value) setattr(parser.values, option.dest, value) except Exception, e: raise OptionValueError("It's impossible to parse the range '%s' for option %s: %s" % (value, opt, e)) def _date_range_callback(option, opt, value, parser): """Callback for optparse to parse a range of dates in the form [date1],[date2]. Both date1 and date2 could be optional. the date can be expressed absolutely ("%Y-%m-%d %H:%M:%S") or relatively (([-\+]{0,1})([\d]+)([dhms])) to the current time.""" try: value = _parse_date_range(value) setattr(parser.values, option.dest, value) except Exception, e: raise OptionValueError("It's impossible to parse the range '%s' for option %s: %s" % (value, opt, e)) parser = OptionParserSpecial(usage="usage: %prog [options]", #epilog="""With you select the range of record/docnames/single files to work on. Note that some actions e.g. delete, append, revise etc. works at the docname level, while others like --set-comment, --set-description, at single file level and other can be applied in an iterative way to many records in a single run. Note that specifing docid(2) takes precedence over recid(2) which in turns takes precedence over pattern/collection search.""", version=__revision__) parser.trailing_text = """ Examples: $ bibdocfile --append foo.tar.gz --recid=1 $ bibdocfile --revise http://foo.com?search=123 --with-docname='sam' --format=pdf --recid=3 --set-docname='pippo' # revise for record 3 # the document sam, renaming it to pippo. $ bibdocfile --delete --with-docname="*sam" --all # delete all documents # starting ending # with "sam" $ bibdocfile --undelete -c "Test Collection" # undelete documents for # the collection $ bibdocfile --get-info --recids=1-4,6-8 # obtain informations $ bibdocfile -r 1 --with-docname=foo --set-docname=bar # Rename a document """ query_options = OptionGroup(parser, 'Query options') query_options.add_option('-r', '--recids', action="callback", callback=_ids_ranges_callback, type='string', dest='recids', help='matches records by recids, e.g.: --recids=1-3,5-7') query_options.add_option('-d', '--docids', action="callback", callback=_ids_ranges_callback, type='string', dest='docids', help='matches documents by docids, e.g.: --docids=1-3,5-7') query_options.add_option('-a', '--all', action='store_true', dest='all', help='Select all the records') query_options.add_option("--with-deleted-recs", choices=['yes', 'no', 'only'], type="choice", dest="deleted_recs", help="'Yes' to also match deleted records, 'no' to exclude them, 'only' to match only deleted ones", metavar="yes/no/only", default='no') query_options.add_option("--with-deleted-docs", choices=['yes', 'no', 'only'], type="choice", dest="deleted_docs", help="'Yes' to also match deleted documents, 'no' to exclude them, 'only' to match only deleted ones (e.g. for undeletion)", metavar="yes/no/only", default='no') query_options.add_option("--with-empty-recs", choices=['yes', 'no', 'only'], type="choice", dest="empty_recs", help="'Yes' to also match records without attached documents, 'no' to exclude them, 'only' to consider only such records (e.g. for statistics)", metavar="yes/no/only", default='no') query_options.add_option("--with-empty-docs", choices=['yes', 'no', 'only'], type="choice", dest="empty_docs", help="'Yes' to also match documents without attached files, 'no' to exclude them, 'only' to consider only such documents (e.g. for sanity checking)", metavar="yes/no/only", default='no') query_options.add_option("--with-record-modification-date", action="callback", callback=_date_range_callback, dest="md_rec", nargs=1, type="string", default=(None, None), help="matches records modified date1 and date2; dates can be expressed relatively, e.g.:\"-5m,2030-2-23 04:40\" # matches records modified since 5 minutes ago until the 2030...", metavar="date1,date2") query_options.add_option("--with-record-creation-date", action="callback", callback=_date_range_callback, dest="cd_rec", nargs=1, type="string", default=(None, None), help="matches records created between date1 and date2; dates can be expressed relatively", metavar="date1,date2") query_options.add_option("--with-document-modification-date", action="callback", callback=_date_range_callback, dest="md_doc", nargs=1, type="string", default=(None, None), help="matches documents modified between date1 and date2; dates can be expressed relatively", metavar="date1,date2") query_options.add_option("--with-document-creation-date", action="callback", callback=_date_range_callback, dest="cd_doc", nargs=1, type="string", default=(None, None), help="matches documents created between date1 and date2; dates can be expressed relatively", metavar="date1,date2") query_options.add_option("--url", dest="url", help='matches the document referred by the URL, e.g. "%s/record/1/files/foobar.pdf?version=2"' % CFG_SITE_URL) query_options.add_option("--path", dest="path", help='matches the document referred by the internal filesystem path, e.g. %s/g0/1/foobar.pdf\\;1' % CFG_WEBSUBMIT_FILEDIR) query_options.add_option("--with-docname", dest="docname", help='matches documents with the given docname (accept wildcards)') query_options.add_option("--with-doctype", dest="doctype", help='matches documents with the given doctype') query_options.add_option('-p', '--pattern', dest='pattern', help='matches records by pattern') query_options.add_option('-c', '--collection', dest='collection', help='matches records by collection') query_options.add_option('--force', dest='force', help='force an action even when it\'s not necessary e.g. textify on an already textified bibdoc.', action='store_true', default=False) parser.add_option_group(query_options) getting_information_options = OptionGroup(parser, 'Actions for getting information') getting_information_options.add_option('--get-info', dest='action', action='store_const', const='get-info', help='print all the informations about the matched record/documents') getting_information_options.add_option('--get-disk-usage', dest='action', action='store_const', const='get-disk-usage', help='print disk usage statistics of the matched documents') getting_information_options.add_option('--get-history', dest='action', action='store_const', const='get-history', help='print the matched documents history') parser.add_option_group(getting_information_options) setting_information_options = OptionGroup(parser, 'Actions for setting information') setting_information_options.add_option('--set-doctype', dest='set_doctype', help='specify the new doctype', metavar='doctype') setting_information_options.add_option('--set-description', dest='set_description', help='specify a description', metavar='description') setting_information_options.add_option('--set-comment', dest='set_comment', help='specify a comment', metavar='comment') setting_information_options.add_option('--set-restriction', dest='set_restriction', help='specify a restriction tag', metavar='restriction') setting_information_options.add_option('--set-docname', dest='new_docname', help='specifies a new docname for renaming', metavar='docname') setting_information_options.add_option("--unset-comment", action="store_const", const='', dest="set_comment", help="remove any comment") setting_information_options.add_option("--unset-descriptions", action="store_const", const='', dest="set_description", help="remove any description") setting_information_options.add_option("--unset-restrictions", action="store_const", const='', dest="set_restriction", help="remove any restriction") setting_information_options.add_option("--hide", dest="action", action='store_const', const='hide', help="hides matched documents and revisions") setting_information_options.add_option("--unhide", dest="action", action='store_const', const='unhide', help="hides matched documents and revisions") parser.add_option_group(setting_information_options) revising_options = OptionGroup(parser, 'Action for revising content') revising_options.add_option("--append", dest='append_path', help='specify the URL/path of the file that will appended to the bibdoc', metavar='PATH/URL') revising_options.add_option("--revise", dest='revise_path', help='specify the URL/path of the file that will revise the bibdoc', metavar='PATH/URL') revising_options.add_option("--revert", dest='action', action='store_const', const='revert', help='reverts a document to the specified version') revising_options.add_option("--delete", action='store_const', const='delete', dest='action', help='soft-delete the matched documents (applies to all revisions and formats)') revising_options.add_option("--hard-delete", action='store_const', const='hard_delete', dest='action', help='hard-delete the matched documents (applies to matched revisions and formats)') revising_options.add_option("--undelete", action='store_const', const='undelete', dest='action', help='undelete previosuly soft-deleted documents (applies to all revisions and formats)') revising_options.add_option("--purge", action='store_const', const='purge', dest='action', help='purge (i.e. hard-delete previous versions) the matched documents') revising_options.add_option("--expunge", action='store_const', const='expunge', dest='action', help='expunge (i.e. hard-delete any version and formats) the matched documents') revising_options.add_option("--with-versions", dest="version", help="specifies the version(s) to be used with hard-delete, hide, revert, e.g.: 1-2,3 or all") revising_options.add_option("--with-format", dest="format", help='to specify a format when appending/revising/deleting/reverting a document, e.g. "pdf"', metavar='FORMAT') revising_options.add_option("--with-hide-previous", dest='hide_previous', action='store_true', help='when revising, hides previous versions', default=False) parser.add_option_group(revising_options) housekeeping_options = OptionGroup(parser, 'Actions for housekeeping') housekeeping_options.add_option("--check-md5", action='store_const', const='check-md5', dest='action', help='check md5 checksum validity of files') housekeeping_options.add_option("--check-format", action='store_const', const='check-format', dest='action', help='check if any format-related inconsistences exists') housekeeping_options.add_option("--check-duplicate-docnames", action='store_const', const='check-duplicate-docnames', dest='action', help='check for duplicate docnames associated with the same record') housekeeping_options.add_option("--update-md5", action='store_const', const='update-md5', dest='action', help='update md5 checksum of files') housekeeping_options.add_option("--fix-all", action='store_const', const='fix-all', dest='action', help='fix inconsistences in filesystem vs database vs MARC') housekeeping_options.add_option("--fix-marc", action='store_const', const='fix-marc', dest='action', help='synchronize MARC after filesystem/database') housekeeping_options.add_option("--fix-format", action='store_const', const='fix-format', dest='action', help='fix format related inconsistences') housekeeping_options.add_option("--fix-duplicate-docnames", action='store_const', const='fix-duplicate-docnames', dest='action', help='fix duplicate docnames associated with the same record') parser.add_option_group(housekeeping_options) experimental_options = OptionGroup(parser, 'Experimental options (do not expect to find them in the next release)') - experimental_options.add_option('--set-icon', dest='set_icon', help='attache the specified icon to the matched documents', metavar='URL/PATH') - experimental_options.add_option("--unset-icon", action="store_const", const='', dest="set_icon", help="remove any icon on the matched documents") experimental_options.add_option('--textify', dest='action', action='store_const', const='textify', help='extract text from matched documents and store it for later indexing') experimental_options.add_option('--with-ocr', dest='perform_ocr', action='store_true', default=False, help='when used with --textify, wether to perform OCR') parser.add_option_group(experimental_options) parser.add_option('-D', '--debug', action='store_true', dest='debug', default=False) parser.add_option('-H', '--human-readable', dest='human_readable', action='store_true', default=False, help='print sizes in human readable format (e.g., 1KB 234MB 2GB)') parser.add_option('--yes-i-know', action='store_true', dest='yes-i-know', help='use with care!') return parser def print_info(recid, docid, info): """Nicely print info about a recid, docid pair.""" print '%i:%i:%s' % (recid, docid, info) -def bibupload_ffts(ffts, append=False): +def bibupload_ffts(ffts, append=False, debug=False): """Given an ffts dictionary it creates the xml and submit it.""" xml = ffts_to_xml(ffts) if xml: print xml tmp_file_fd, tmp_file_name = mkstemp(suffix='.xml', prefix="bibdocfile_%s" % time.strftime("%Y-%m-%d_%H:%M:%S"), dir=CFG_TMPDIR) os.write(tmp_file_fd, xml) os.close(tmp_file_fd) os.chmod(tmp_file_name, 0644) if append: wait_for_user("This will be appended via BibUpload") - task = task_low_level_submission('bibupload', 'bibdocfile', '-a', tmp_file_name, '-N', 'FFT', '-S2') + if debug: + task = task_low_level_submission('bibupload', 'bibdocfile', '-a', tmp_file_name, '-N', 'FFT', '-S2', '-v9') + else: + task = task_low_level_submission('bibupload', 'bibdocfile', '-a', tmp_file_name, '-N', 'FFT', '-S2', '-v9') print "BibUpload append submitted with id %s" % task else: wait_for_user("This will be corrected via BibUpload") - task = task_low_level_submission('bibupload', 'bibdocfile', '-c', tmp_file_name, '-N', 'FFT', '-S2') + if debug: + task = task_low_level_submission('bibupload', 'bibdocfile', '-c', tmp_file_name, '-N', 'FFT', '-S2', '-v9') + else: + task = task_low_level_submission('bibupload', 'bibdocfile', '-c', tmp_file_name, '-N', 'FFT', '-S2') print "BibUpload correct submitted with id %s" % task else: print >> sys.stderr, "WARNING: no MARC to upload." return True def ranges2ids(parse_string): """Parse a string and return the intbitset of the corresponding ids.""" ids = intbitset() ranges = parse_string.split(",") for arange in ranges: tmp_ids = arange.split("-") if len(tmp_ids)==1: ids.add(int(tmp_ids[0])) else: if int(tmp_ids[0]) > int(tmp_ids[1]): # sanity check tmp = tmp_ids[0] tmp_ids[0] = tmp_ids[1] tmp_ids[1] = tmp ids += xrange(int(tmp_ids[0]), int(tmp_ids[1]) + 1) return ids def cli_append(options, append_path): """Create a bibupload FFT task submission for appending a format.""" recid = cli2recid(options) comment = getattr(options, 'comment', None) description = getattr(options, 'comment', None) restriction = getattr(options, 'restriction', None) doctype = getattr(options, 'doctype', None) or 'Main' - icon = cli2icon(options) - if icon == KEEP_OLD_VALUE: - icon = None docname = cli2docname(options, url=append_path) if not docname: raise OptionValueError, 'Not enough information to retrieve a valid docname' format = cli2format(options, append_path) url = clean_url(append_path) check_valid_url(url) ffts = {recid: [{ 'docname' : docname, 'comment' : comment, 'description' : description, 'restriction' : restriction, 'doctype' : doctype, - 'icon' : icon, 'format' : format, 'url' : url }]} return bibupload_ffts(ffts, append=True) def cli_revise(options, revise_path): """Create a bibupload FFT task submission for appending a format.""" recid = cli2recid(options) comment = cli2comment(options) description = cli2description(options) restriction = cli2restriction(options) docname = cli2docname(options, url=revise_path) hide_previous = getattr(options, 'hide_previous', None) if not docname: raise OptionValueError, 'Not enough information to retrieve a valid docname' format = cli2format(options, revise_path) doctype = cli2doctype(options) - icon = cli2icon(options) url = clean_url(revise_path) new_docname = getattr(options, 'new_docname', None) check_valid_url(url) ffts = {recid : [{ 'docname' : docname, 'new_docname' : new_docname, 'comment' : comment, 'description' : description, 'restriction' : restriction, 'doctype' : doctype, - 'icon' : icon, 'format' : format, 'url' : url, 'options' : hide_previous and ['PERFORM_HIDE_PREVIOUS'] or None }]} return bibupload_ffts(ffts) def cli_set_batch(options): """Change in batch the doctype, description, comment and restriction.""" ffts = {} doctype = getattr(options, 'set_doctype', None) description = getattr(options, 'set_description', None) comment = getattr(options, 'set_comment', None) restriction = getattr(options, 'set_restriction', None) with_format = getattr(options, 'format', None) for docid in cli_docids_iterator(options): bibdoc = BibDoc(docid) recid = bibdoc.get_recid() docname = bibdoc.get_docname() fft = [] if description is not None or comment is not None: for bibdocfile in bibdoc.list_latest_files(): format = bibdocfile.get_format() if not with_format or with_format == format: fft.append({ 'docname': docname, 'restriction': restriction, 'comment': comment, 'description': description, 'format': format, 'doctype': doctype }) else: fft.append({ 'docname': docname, 'restriction': restriction, 'doctype': doctype, }) ffts[recid] = fft return bibupload_ffts(ffts, append=False) def cli_textify(options): """Extract text to let indexing on fulltext be possible.""" force = getattr(options, 'force', None) perform_ocr = getattr(options, 'perform_ocr', None) if perform_ocr: if not can_perform_ocr(): print >> sys.stderr, "WARNING: OCR requested but OCR is not possible" perform_ocr = False if perform_ocr: additional = ' using OCR (this might take some time)' else: additional = '' for docid in cli_docids_iterator(options): bibdoc = BibDoc(docid) print 'Extracting text for docid %s%s...' % (docid, additional), sys.stdout.flush() if force or not bibdoc.has_text(require_up_to_date=True): try: bibdoc.extract_text(perform_ocr=perform_ocr) print "DONE" except InvenioWebSubmitFileError, e: print >> sys.stderr, "WARNING: %s" % e else: print "not needed" def cli_rename(options): """Rename a docname within a recid.""" new_docname = getattr(options, 'new_docname', None) docid = cli2docid(options) bibdoc = BibDoc(docid) docname = bibdoc.get_docname() recid = bibdoc.get_recid() ffts = {recid : [{'docname' : docname, 'new_docname' : new_docname}]} return bibupload_ffts(ffts, append=False) -def cli_set_icon(options): - """Rename a docname within a recid.""" - docid = cli2docid(options) - bibdoc = BibDoc(docid) - docname = bibdoc.get_docname() - recid = bibdoc.get_recid() - icon = cli2icon(options) - ffts = {recid : [{'docname' : docname, 'icon' : icon}]} - return bibupload_ffts(ffts, append=False) - def cli_fix_all(options): """Fix all the records of a recid_set.""" ffts = {} for recid in cli_recids_iterator(options): ffts[recid] = [] for docname in BibRecDocs(recid).get_bibdoc_names(): ffts[recid].append({'docname' : docname, 'doctype' : 'FIX-ALL'}) return bibupload_ffts(ffts, append=False) def cli_fix_marc(options, explicit_recid_set=None): """Fix all the records of a recid_set.""" ffts = {} if explicit_recid_set is not None: for recid in explicit_recid_set: ffts[recid] = [{'doctype' : 'FIX-MARC'}] else: for recid in cli_recids_iterator(options): ffts[recid] = [{'doctype' : 'FIX-MARC'}] return bibupload_ffts(ffts, append=False) def cli_check_format(options): """Check if any format-related inconsistences exists.""" count = 0 tot = 0 duplicate = False for recid in cli_recids_iterator(options): tot += 1 bibrecdocs = BibRecDocs(recid) if not bibrecdocs.check_duplicate_docnames(): print >> sys.stderr, "recid %s has duplicate docnames!" broken = True duplicate = True else: broken = False for docname in bibrecdocs.get_bibdoc_names(): if not bibrecdocs.check_format(docname): print >> sys.stderr, "recid %s with docname %s need format fixing" % (recid, docname) broken = True if broken: count += 1 if count: result = "%d out of %d records need their formats to be fixed." % (count, tot) else: result = "All records appear to be correct with respect to formats." if duplicate: result += " Note however that at least one record appear to have duplicate docnames. You should better fix this situation by using --fix-duplicate-docnames." print wrap_text_in_a_box(result, style="conclusion") return not(duplicate or count) def cli_check_duplicate_docnames(options): """Check if some record is connected with bibdoc having the same docnames.""" count = 0 tot = 0 for recid in cli_recids_iterator(options): tot += 1 bibrecdocs = BibRecDocs(recid) if bibrecdocs.check_duplicate_docnames(): count += 1 print sys.stderr, "recid %s has duplicate docnames!" if count: print "%d out of %d records have duplicate docnames." % (count, tot) return False else: print "All records appear to be correct with respect to duplicate docnames." return True def cli_fix_format(options): """Fix format-related inconsistences.""" fixed = intbitset() tot = 0 for recid in cli_recids_iterator(options): tot += 1 bibrecdocs = BibRecDocs(recid) for docname in bibrecdocs.get_bibdoc_names(): if not bibrecdocs.check_format(docname): if bibrecdocs.fix_format(docname, skip_check=True): print >> sys.stderr, "%i has been fixed for docname %s" % (recid, docname) else: print >> sys.stderr, "%i has been fixed for docname %s. However note that a new bibdoc might have been created." % (recid, docname) fixed.add(recid) if fixed: print "Now we need to synchronize MARC to reflect current changes." cli_fix_marc(options, explicit_recid_set=fixed) print wrap_text_in_a_box("%i out of %i record needed to be fixed." % (tot, len(fixed)), style="conclusion") return not fixed def cli_fix_duplicate_docnames(options): """Fix duplicate docnames.""" fixed = intbitset() tot = 0 for recid in cli_recids_iterator(): tot += 1 bibrecdocs = BibRecDocs(recid) if not bibrecdocs.check_duplicate_docnames(): bibrecdocs.fix_duplicate_docnames(skip_check=True) print >> sys.stderr, "%i has been fixed for duplicate docnames." % recid fixed.add(recid) if fixed: print "Now we need to synchronize MARC to reflect current changes." cli_fix_marc(options, explicit_recid_set=fixed) print wrap_text_in_a_box("%i out of %i record needed to be fixed." % (tot, len(fixed)), style="conclusion") return not fixed def cli_delete(options): """Delete the given docid_set.""" ffts = {} for docid in cli_docids_iterator(options): bibdoc = BibDoc(docid) - if not bibdoc.icon_p(): - ## Icons are indirectly deleted with the relative bibdoc. - docname = bibdoc.get_docname() - recid = bibdoc.get_recid() - if recid not in ffts: - ffts[recid] = [{'docname' : docname, 'doctype' : 'DELETE'}] - else: - ffts[recid].append({'docname' : docname, 'doctype' : 'DELETE'}) + docname = bibdoc.get_docname() + recid = bibdoc.get_recid() + if recid not in ffts: + ffts[recid] = [{'docname' : docname, 'doctype' : 'DELETE'}] + else: + ffts[recid].append({'docname' : docname, 'doctype' : 'DELETE'}) return bibupload_ffts(ffts) def cli_delete_file(options): """Delete the given file irreversibely.""" docid = cli2docid(options) recid = cli2recid(options, docids=intbitset([docid])) format = cli2format(options) docname = BibDoc(docid).get_docname() version = getattr(options, 'version', None) ffts = {recid : [{'docname' : docname, 'version' : version, 'format' : format, 'doctype' : 'DELETE-FILE'}]} return bibupload_ffts(ffts) def cli_revert(options): """Revert a bibdoc to a given version.""" docid = cli2docid(options) recid = cli2recid(options, docids=intbitset([docid])) docname = BibDoc(docid).get_docname() version = getattr(options, 'version', None) try: version = int(version) if 0 >= version: raise ValueError except ValueError: raise OptionValueError, 'when reverting, version should be valid positive integer, not %s' % version ffts = {recid : [{'docname' : docname, 'version' : version, 'doctype' : 'REVERT'}]} return bibupload_ffts(ffts) def cli_undelete(options): """Delete the given docname""" docname = cli2docname(options) restriction = getattr(options, 'restriction', None) count = 0 if not docname: docname = 'DELETED-*-*' if not docname.startswith('DELETED-'): docname = 'DELETED-*-' + docname to_be_undeleted = intbitset() fix_marc = intbitset() setattr(options, 'deleted_docs', 'only') for docid in cli_docids_iterator(options): bibdoc = BibDoc(docid) if bibdoc.get_status() == 'DELETED' and fnmatch.fnmatch(bibdoc.get_docname(), docname): to_be_undeleted.add(docid) fix_marc.add(bibdoc.get_recid()) count += 1 print '%s (docid %s from recid %s) will be undeleted to restriction: %s' % (bibdoc.get_docname(), docid, bibdoc.get_recid(), restriction) wait_for_user("I'll proceed with the undeletion") for docid in to_be_undeleted: bibdoc = BibDoc(docid) bibdoc.undelete(restriction) cli_fix_marc(options, explicit_recid_set=fix_marc) print wrap_text_in_a_box("%s bibdoc successfuly undeleted with status '%s'" % (count, restriction), style="conclusion") def cli_get_info(options): """Print all the info of the matched docids or recids.""" debug('Getting info!') human_readable = bool(getattr(options, 'human_readable', None)) debug('human_readable: %s' % human_readable) deleted_docs = getattr(options, 'deleted_docs', None) in ('yes', 'only') debug('deleted_docs: %s' % deleted_docs) if getattr(options, 'docids', None): for docid in cli_docids_iterator(options): sys.stdout.write(str(BibDoc(docid, human_readable=human_readable))) else: for recid in cli_recids_iterator(options): sys.stdout.write(str(BibRecDocs(recid, deleted_too=deleted_docs, human_readable=human_readable))) def cli_purge(options): """Purge the matched docids.""" ffts = {} for docid in cli_docids_iterator(options): bibdoc = BibDoc(docid) recid = bibdoc.get_recid() docname = bibdoc.get_docname() if recid: if recid not in ffts: ffts[recid] = [] ffts[recid].append({ 'docname' : docname, 'doctype' : 'PURGE', }) return bibupload_ffts(ffts) def cli_expunge(options): """Expunge the matched docids.""" ffts = {} for docid in cli_docids_iterator(options): bibdoc = BibDoc(docid) recid = bibdoc.get_recid() docname = bibdoc.get_docname() if recid: if recid not in ffts: ffts[recid] = [] ffts[recid].append({ 'docname' : docname, 'doctype' : 'EXPUNGE', }) return bibupload_ffts(ffts) def cli_get_history(options): """Print the history of a docid_set.""" for docid in cli_docids_iterator(options): bibdoc = BibDoc(docid) history = bibdoc.get_history() for row in history: print_info(bibdoc.get_recid(), docid, row) def cli_get_disk_usage(options): """Print the space usage of a docid_set.""" human_readable = getattr(options, 'human_readable', None) total_size = 0 total_latest_size = 0 for docid in cli_docids_iterator(options): bibdoc = BibDoc(docid) size = bibdoc.get_total_size() total_size += size latest_size = bibdoc.get_total_size_latest_version() total_latest_size += latest_size if human_readable: print_info(bibdoc.get_recid(), docid, 'size=%s' % nice_size(size)) print_info(bibdoc.get_recid(), docid, 'latest version size=%s' % nice_size(latest_size)) else: print_info(bibdoc.get_recid(), docid, 'size=%s' % size) print_info(bibdoc.get_recid(), docid, 'latest version size=%s' % latest_size) if human_readable: print wrap_text_in_a_box('total size: %s\n\nlatest version total size: %s' % (nice_size(total_size), nice_size(total_latest_size)), style='conclusion') else: print wrap_text_in_a_box('total size: %s\n\nlatest version total size: %s' % (total_size, total_latest_size), style='conclusion') def cli_check_md5(options): """Check the md5 sums of a docid_set.""" failures = 0 for docid in cli_docids_iterator(options): bibdoc = BibDoc(docid) if bibdoc.md5s.check(): print_info(bibdoc.get_recid(), docid, 'checksum OK') else: for afile in bibdoc.list_all_files(): if not afile.check(): failures += 1 print_info(bibdoc.get_recid(), docid, '%s failing checksum!' % afile.get_full_path()) if failures: print wrap_text_in_a_box('%i files failing' % failures , style='conclusion') else: print wrap_text_in_a_box('All files are correct', style='conclusion') def cli_update_md5(options): """Update the md5 sums of a docid_set.""" for docid in cli_docids_iterator(options): bibdoc = BibDoc(docid) if bibdoc.md5s.check(): print_info(bibdoc.get_recid(), docid, 'checksum OK') else: for afile in bibdoc.list_all_files(): if not afile.check(): print_info(bibdoc.get_recid(), docid, '%s failing checksum!' % afile.get_full_path()) wait_for_user('Updating the md5s of this document can hide real problems.') bibdoc.md5s.update(only_new=False) def cli_hide(options): """Hide the matched versions of documents.""" documents_to_be_hidden = {} to_be_fixed = intbitset() versions = getattr(options, 'versions', 'all') if versions != 'all': try: versions = ranges2ids(versions) except: raise OptionValueError, 'You should specify correct versions. Not %s' % versions else: versions = intbitset(trailing_bits=True) for docid in cli_docids_iterator(options): bibdoc = BibDoc(docid) recid = bibdoc.get_recid() if recid: for bibdocfile in bibdoc.list_all_files(): this_version = bibdocfile.get_version() this_format = bibdocfile.get_format() if this_version in versions: if docid not in documents_to_be_hidden: documents_to_be_hidden[docid] = [] documents_to_be_hidden[docid].append((this_version, this_format)) to_be_fixed.add(recid) print '%s (docid: %s, recid: %s) will be hidden' % (bibdocfile.get_full_name(), docid, recid) wait_for_user('Proceeding to hide the matched documents...') for docid, documents in documents_to_be_hidden.iteritems(): bibdoc = BibDoc(docid) for version, format in documents: bibdoc.set_flag('HIDDEN', format, version) return cli_fix_marc(options, to_be_fixed) def cli_unhide(options): """Unhide the matched versions of documents.""" documents_to_be_unhidden = {} to_be_fixed = intbitset() versions = getattr(options, 'versions', 'all') if versions != 'all': try: versions = ranges2ids(versions) except: raise OptionValueError, 'You should specify correct versions. Not %s' % versions else: versions = intbitset(trailing_bits=True) for docid in cli_docids_iterator(options): bibdoc = BibDoc(docid) recid = bibdoc.get_recid() if recid: for bibdocfile in bibdoc.list_all_files(): this_version = bibdocfile.get_version() this_format = bibdocfile.get_format() if this_version in versions: if docid not in documents_to_be_unhidden: - documents_to_be_hidden[docid] = [] + documents_to_be_unhidden[docid] = [] documents_to_be_unhidden[docid].append((this_version, this_format)) to_be_fixed.add(recid) print '%s (docid: %s, recid: %s) will be unhidden' % (bibdocfile.get_full_name(), docid, recid) wait_for_user('Proceeding to unhide the matched documents...') for docid, documents in documents_to_be_unhidden.iteritems(): bibdoc = BibDoc(docid) for version, format in documents: bibdoc.unset_flag('HIDDEN', format, version) return cli_fix_marc(options, to_be_fixed) def main(): parser = prepare_option_parser() (options, args) = parser.parse_args() if getattr(options, 'debug', None): getLogger().setLevel(DEBUG) debug('test') debug('options: %s, args: %s' % (options, args)) try: if not getattr(options, 'action', None) and \ not getattr(options, 'append_path', None) and \ not getattr(options, 'revise_path', None): if getattr(options, 'set_doctype', None) is not None or \ getattr(options, 'set_comment', None) is not None or \ getattr(options, 'set_description', None) is not None or \ getattr(options, 'set_restriction', None) is not None: cli_set_batch(options) elif getattr(options, 'new_docname', None): cli_rename(options) - elif getattr(options, 'set_icon', None) is not None: - cli_set_icon(options) else: print >> sys.stderr, "ERROR: no action specified" sys.exit(1) elif getattr(options, 'append_path', None): cli_append(options, getattr(options, 'append_path', None)) elif getattr(options, 'revise_path', None): cli_revise(options, getattr(options, 'revise_path', None)) elif options.action == 'textify': cli_textify(options) elif getattr(options, 'action', None) == 'get-history': cli_get_history(options) elif getattr(options, 'action', None) == 'get-info': cli_get_info(options) elif getattr(options, 'action', None) == 'get-disk-usage': cli_get_disk_usage(options) elif getattr(options, 'action', None) == 'check-md5': cli_check_md5(options) elif getattr(options, 'action', None) == 'update-md5': cli_update_md5(options) elif getattr(options, 'action', None) == 'fix-all': cli_fix_all(options) elif getattr(options, 'action', None) == 'fix-marc': cli_fix_marc(options) elif getattr(options, 'action', None) == 'delete': cli_delete(options) elif getattr(options, 'action', None) == 'delete-file': cli_delete_file(options) elif getattr(options, 'action', None) == 'fix-duplicate-docnames': cli_fix_duplicate_docnames(options) elif getattr(options, 'action', None) == 'fix-format': cli_fix_format(options) elif getattr(options, 'action', None) == 'check-duplicate-docnames': cli_check_duplicate_docnames(options) elif getattr(options, 'action', None) == 'check-format': cli_check_format(options) elif getattr(options, 'action', None) == 'undelete': cli_undelete(options) elif getattr(options, 'action', None) == 'purge': cli_purge(options) elif getattr(options, 'action', None) == 'expunge': cli_expunge(options) elif getattr(options, 'action', None) == 'revert': cli_revert(options) elif getattr(options, 'action', None) == 'hide': cli_hide(options) elif getattr(options, 'action', None) == 'unhide': cli_unhide(options) else: print >> sys.stderr, "ERROR: Action %s is not valid" % getattr(options, 'action', None) sys.exit(1) except StandardError, e: register_exception() print >> sys.stderr, 'ERROR: %s' % e sys.exit(1) if __name__ == '__main__': main() diff --git a/modules/websubmit/lib/fulltext_files_migration_kit.py b/modules/websubmit/lib/fulltext_files_migration_kit.py index db5484f37..408143fa0 100644 --- a/modules/websubmit/lib/fulltext_files_migration_kit.py +++ b/modules/websubmit/lib/fulltext_files_migration_kit.py @@ -1,142 +1,142 @@ ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. __revision__ = "$Id$" """This script updates the filesystem structure of fulltext files in order to make it coherent with bibdocfile implementation (bibdocfile.py structure is backward compatible with file.py structure, but the viceversa is not true). """ import sys from invenio.intbitset import intbitset from invenio.textutils import wrap_text_in_a_box from invenio.config import CFG_LOGDIR, CFG_SITE_SUPPORT_EMAIL from invenio.dbquery import run_sql, OperationalError from invenio.bibdocfile import BibRecDocs, InvenioWebSubmitFileError from datetime import datetime def retrieve_fulltext_recids(): """Returns the list of all the recid number linked with at least a fulltext file.""" res = run_sql('SELECT DISTINCT id_bibrec FROM bibrec_bibdoc') return intbitset(res) def fix_recid(recid, logfile): """Fix a given recid.""" print "Upgrading record %s ->" % recid, print >> logfile, "Upgrading record %s:" % recid bibrec = BibRecDocs(recid) print >> logfile, bibrec docnames = bibrec.get_bibdoc_names() try: for docname in docnames: print docname, new_bibdocs = bibrec.fix(docname) new_bibdocnames = [bibdoc.get_docname() for bibdoc in new_bibdocs] if new_bibdocnames: print "(created bibdocs: '%s')" % "', '".join(new_bibdocnames), print >> logfile, "(created bibdocs: '%s')" % "', '".join(new_bibdocnames) except InvenioWebSubmitFileError, e: print >> logfile, BibRecDocs(recid) print "%s -> ERROR", e return False else: print >> logfile, BibRecDocs(recid) print "-> OK" return True def backup_tables(drop=False): """This function create a backup of bibrec_bibdoc, bibdoc and bibdoc_bibdoc tables. Returns False in case dropping of previous table is needed.""" if drop: run_sql('DROP TABLE bibrec_bibdoc_backup') run_sql('DROP TABLE bibdoc_backup') run_sql('DROP TABLE bibdoc_bibdoc_backup') try: run_sql("""CREATE TABLE bibrec_bibdoc_backup (KEY id_bibrec(id_bibrec), KEY id_bibdoc(id_bibdoc)) SELECT * FROM bibrec_bibdoc""") run_sql("""CREATE TABLE bibdoc_backup (PRIMARY KEY id(id)) SELECT * FROM bibdoc""") run_sql("""CREATE TABLE bibdoc_bibdoc_backup (KEY id_bibdoc1(id_bibdoc1), KEY id_bibdoc2(id_bibdoc2)) SELECT * FROM bibdoc_bibdoc""") except OperationalError, e: if not drop: return False raise e return True def check_yes(): """Return True if the user types 'yes'.""" try: return raw_input().strip() == 'yes' except KeyboardInterrupt: return False def main(): """Core loop.""" logfilename = '%s/fulltext_files_migration_kit-%s.log' % (CFG_LOGDIR, datetime.today().strftime('%Y%m%d%H%M%S')) try: logfile = open(logfilename, 'w') except IOError, e: print wrap_text_in_a_box('NOTE: it\'s impossible to create the log:\n\n %s\n\nbecause of:\n\n %s\n\nPlease run this migration kit as the same user who runs Invenio (e.g. Apache)' % (logfilename, e), style='conclusion', break_long=False) sys.exit(1) recids = retrieve_fulltext_recids() print wrap_text_in_a_box ("""This script migrate the filesystem structure used to store fulltext files to the new stricter structure. This script must not be run during normal Invenio operations. It is safe to run this script. No file will be deleted. Anyway it is recommended to run a backup of the filesystem structure just in case. A backup of the database tables involved will be automatically performed.""", style='important') print "%s records will be migrated/fixed." % len(recids) print "Please type yes if you want to go further:", if not check_yes(): print "INTERRUPTED" sys.exit(1) print "Backing up database tables" try: if not backup_tables(): print wrap_text_in_a_box("""It appears that is not the first time that you run this script. Backup tables have been already created by a previous run. In order for the script to go further they need to be removed.""", style='important') print "Please, type yes if you agree to remove them and go further:", if not check_yes(): print wrap_text_in_a_box("INTERRUPTED", style='conclusion') sys.exit(1) print "Backing up database tables (after dropping previous backup)", - backup_tables() + backup_tables(drop=True) print "-> OK" else: print "-> OK" except Exception, e: print wrap_text_in_a_box("Unexpected error while backing up tables. Please, do your checks: %s" % e, style='conclusion') sys.exit(1) print "Created a complete log file into %s" % logfilename for recid in recids: if not fix_recid(recid, logfile): logfile.close() print wrap_text_in_a_box(title="INTERRUPTED BECAUSE OF ERROR!", body="""Please see the log file %s for what was the status of record %s prior to the error. Contact %s in case of problems, attaching the log.""" % (logfilename, recid, CFG_SITE_SUPPORT_EMAIL), style='conclusion') sys.exit(1) print wrap_text_in_a_box("DONE", style='conclusion') if __name__ == '__main__': main() diff --git a/modules/websubmit/lib/fulltext_files_migration_kit.py b/modules/websubmit/lib/icon_migration_kit.py similarity index 52% copy from modules/websubmit/lib/fulltext_files_migration_kit.py copy to modules/websubmit/lib/icon_migration_kit.py index db5484f37..3b0b97c8d 100644 --- a/modules/websubmit/lib/fulltext_files_migration_kit.py +++ b/modules/websubmit/lib/icon_migration_kit.py @@ -1,142 +1,148 @@ ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -__revision__ = "$Id$" +""" +This script updates the filesystem and database structure WRT icons. -"""This script updates the filesystem structure of fulltext files in order -to make it coherent with bibdocfile implementation (bibdocfile.py structure is backward -compatible with file.py structure, but the viceversa is not true). +In particular it will move all the icons information out of bibdoc_bibdoc +tables and into the normal bibdoc + subformat infrastructure. """ import sys -from invenio.intbitset import intbitset -from invenio.textutils import wrap_text_in_a_box -from invenio.config import CFG_LOGDIR, CFG_SITE_SUPPORT_EMAIL -from invenio.dbquery import run_sql, OperationalError -from invenio.bibdocfile import BibRecDocs, InvenioWebSubmitFileError from datetime import datetime -def retrieve_fulltext_recids(): - """Returns the list of all the recid number linked with at least a fulltext - file.""" - res = run_sql('SELECT DISTINCT id_bibrec FROM bibrec_bibdoc') - return intbitset(res) +from invenio.textutils import wrap_text_in_a_box, wait_for_user +from invenio.bibtask import check_running_process_user +from invenio.dbquery import run_sql, OperationalError +from invenio.bibdocfile import BibDoc, BibRecDocs +from invenio.config import CFG_LOGDIR, CFG_SITE_SUPPORT_EMAIL +from invenio.bibdocfilecli import cli_fix_marc +from invenio.errorlib import register_exception +from invenio.intbitset import intbitset -def fix_recid(recid, logfile): - """Fix a given recid.""" - print "Upgrading record %s ->" % recid, - print >> logfile, "Upgrading record %s:" % recid +def retrieve_bibdoc_bibdoc(): + return run_sql('SELECT id_bibdoc1, id_bibdoc2 from bibdoc_bibdoc') - bibrec = BibRecDocs(recid) - print >> logfile, bibrec - docnames = bibrec.get_bibdoc_names() - try: - for docname in docnames: - print docname, - new_bibdocs = bibrec.fix(docname) - new_bibdocnames = [bibdoc.get_docname() for bibdoc in new_bibdocs] - if new_bibdocnames: - print "(created bibdocs: '%s')" % "', '".join(new_bibdocnames), - print >> logfile, "(created bibdocs: '%s')" % "', '".join(new_bibdocnames) - except InvenioWebSubmitFileError, e: - print >> logfile, BibRecDocs(recid) - print "%s -> ERROR", e - return False - else: - print >> logfile, BibRecDocs(recid) - print "-> OK" - return True +def get_recid_from_docid(docid): + return run_sql('SELECT id_bibrec FROM bibrec_bibdoc WHERE id_bibdoc=%s', (docid, )) def backup_tables(drop=False): """This function create a backup of bibrec_bibdoc, bibdoc and bibdoc_bibdoc tables. Returns False in case dropping of previous table is needed.""" if drop: - run_sql('DROP TABLE bibrec_bibdoc_backup') - run_sql('DROP TABLE bibdoc_backup') - run_sql('DROP TABLE bibdoc_bibdoc_backup') + run_sql('DROP TABLE bibdoc_bibdoc_backup_for_icon') try: - run_sql("""CREATE TABLE bibrec_bibdoc_backup (KEY id_bibrec(id_bibrec), - KEY id_bibdoc(id_bibdoc)) SELECT * FROM bibrec_bibdoc""") - run_sql("""CREATE TABLE bibdoc_backup (PRIMARY KEY id(id)) - SELECT * FROM bibdoc""") - run_sql("""CREATE TABLE bibdoc_bibdoc_backup (KEY id_bibdoc1(id_bibdoc1), + run_sql("""CREATE TABLE bibdoc_bibdoc_backup_for_icon (KEY id_bibdoc1(id_bibdoc1), KEY id_bibdoc2(id_bibdoc2)) SELECT * FROM bibdoc_bibdoc""") except OperationalError, e: if not drop: return False raise e return True -def check_yes(): - """Return True if the user types 'yes'.""" +def fix_bibdoc_bibdoc(id_bibdoc1, id_bibdoc2, logfile): + """ + Migrate an icon. + """ + + try: + the_bibdoc = BibDoc(id_bibdoc1) + except Exception, err: + msg = "WARNING: when opening docid %s: %s" % (id_bibdoc1, err) + print >> logfile, msg + print msg + return True try: - return raw_input().strip() == 'yes' - except KeyboardInterrupt: + recid = the_bibdoc.get_recid() + msg = "Fixing icon for recid %s: document %s (docid %s)" % (recid, the_bibdoc.get_docname(), id_bibdoc1) + print msg, + print >> logfile, msg, + the_icon = BibDoc(id_bibdoc2) + for a_file in the_icon.list_latest_files(): + the_bibdoc.add_icon(a_file.get_full_path(), format=a_file.get_format()) + the_icon.delete() + run_sql("DELETE FROM bibdoc_bibdoc WHERE id_bibdoc1=%s AND id_bibdoc2=%s", (id_bibdoc1, id_bibdoc2)) + print "OK" + print >> logfile, "OK" + return True + except Exception, err: + print "ERROR: %s" % err + print >> logfile, "ERROR: %s" % err + register_exception() return False def main(): """Core loop.""" + check_running_process_user() logfilename = '%s/fulltext_files_migration_kit-%s.log' % (CFG_LOGDIR, datetime.today().strftime('%Y%m%d%H%M%S')) try: logfile = open(logfilename, 'w') except IOError, e: print wrap_text_in_a_box('NOTE: it\'s impossible to create the log:\n\n %s\n\nbecause of:\n\n %s\n\nPlease run this migration kit as the same user who runs Invenio (e.g. Apache)' % (logfilename, e), style='conclusion', break_long=False) sys.exit(1) - recids = retrieve_fulltext_recids() - print wrap_text_in_a_box ("""This script migrate the filesystem structure used to store fulltext files to the new stricter structure. + bibdoc_bibdoc = retrieve_bibdoc_bibdoc() + + print wrap_text_in_a_box ("""This script migrate the filesystem structure used to store icons files to the new stricter structure. This script must not be run during normal Invenio operations. It is safe to run this script. No file will be deleted. Anyway it is recommended to run a backup of the filesystem structure just in case. A backup of the database tables involved will be automatically performed.""", style='important') - print "%s records will be migrated/fixed." % len(recids) - print "Please type yes if you want to go further:", - - if not check_yes(): - print "INTERRUPTED" - sys.exit(1) + if not bibdoc_bibdoc: + print wrap_text_in_a_box("No need for migration", style='conclusion') + return + print "%s icons will be migrated/fixed." % len(bibdoc_bibdoc) + wait_for_user() print "Backing up database tables" try: if not backup_tables(): print wrap_text_in_a_box("""It appears that is not the first time that you run this script. Backup tables have been already created by a previous run. In order for the script to go further they need to be removed.""", style='important') - print "Please, type yes if you agree to remove them and go further:", - - if not check_yes(): - print wrap_text_in_a_box("INTERRUPTED", style='conclusion') - sys.exit(1) + wait_for_user() print "Backing up database tables (after dropping previous backup)", - backup_tables() + backup_tables(drop=True) print "-> OK" else: print "-> OK" except Exception, e: print wrap_text_in_a_box("Unexpected error while backing up tables. Please, do your checks: %s" % e, style='conclusion') sys.exit(1) + to_fix_marc = intbitset() print "Created a complete log file into %s" % logfilename - for recid in recids: - if not fix_recid(recid, logfile): + try: + try: + for id_bibdoc1, id_bibdoc2 in bibdoc_bibdoc: + for recid in get_recid_from_docid(id_bibdoc1): + to_fix_marc.add(recid[0]) + if not fix_bibdoc_bibdoc(id_bibdoc1, id_bibdoc2, logfile): + raise StandardError("Error when correcting document ID %s" % id_bibdoc1) + print wrap_text_in_a_box("DONE", style='conclusion') + except: logfile.close() - print wrap_text_in_a_box(title="INTERRUPTED BECAUSE OF ERROR!", body="""Please see the log file %s for what was the status of record %s prior to the error. Contact %s in case of problems, attaching the log.""" % (logfilename, recid, CFG_SITE_SUPPORT_EMAIL), + register_exception() + print wrap_text_in_a_box(title="INTERRUPTED BECAUSE OF ERROR!", body="""Please see the log file %s for what was the status of record %s prior to the error. Contact %s in case of problems, attaching the log.""" % (logfilename, BibDoc(id_bibdoc1).get_recid(), CFG_SITE_SUPPORT_EMAIL), style='conclusion') sys.exit(1) - print wrap_text_in_a_box("DONE", style='conclusion') + finally: + print "Scheduling FIX-MARC to synchronize MARCXML for updated records." + cli_fix_marc(options={}, explicit_recid_set=to_fix_marc) + if __name__ == '__main__': main() diff --git a/modules/websubmit/lib/websubmit_config.py b/modules/websubmit/lib/websubmit_config.py index d81dc920c..5848447b0 100644 --- a/modules/websubmit/lib/websubmit_config.py +++ b/modules/websubmit/lib/websubmit_config.py @@ -1,210 +1,226 @@ ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """CDS Invenio Submission Web Interface config file.""" __revision__ = "$Id$" +import re + ## test: test = "FALSE" ## CC all action confirmation mails to administrator? (0 == NO; 1 == YES) CFG_WEBSUBMIT_COPY_MAILS_TO_ADMIN = 0 ## During submission, warn user if she is going to leave the ## submission by following some link on the page? ## Does not work with Opera and Konqueror. ## This requires all submission functions to set Javascript variable ## 'user_must_confirm_before_leaving_page' to 'false' before ## programmatically submitting a form , or else users will be asked ## confirmation after each submission step. ## (0 == NO; 1 == YES) CFG_WEBSUBMIT_CHECK_USER_LEAVES_SUBMISSION = 0 ## List of keywords/format parameters that should not write by default ## corresponding files in submission directory (`curdir'). Some other ## filenames not included here are reserved too, such as those ## containing non-alphanumeric chars (excepted underscores '_'), for ## eg all names containing a dot ('bibdocactions.log', ## 'performed_actions.log', etc.) CFG_RESERVED_SUBMISSION_FILENAMES = ['SuE', 'files', 'lastuploadedfile', 'curdir', 'function_log', 'SN'] ## CFG_WEBSUBMIT_BEST_FORMATS_TO_EXTRACT_TEXT_FROM -- a comma-separated ## list of document extensions in decrescent order of preference ## to suggest what is considered the best format to extract text from. CFG_WEBSUBMIT_BEST_FORMATS_TO_EXTRACT_TEXT_FROM = ('txt', 'html', 'xml', 'odt', 'doc', 'docx', 'djvu', 'pdf', 'ps', 'ps.gz') ## CFG_WEBSUBMIT_DESIRED_CONVERSIONS -- a dictionary having as keys ## a format and as values the corresponding list of desired converted ## formats. CFG_WEBSUBMIT_DESIRED_CONVERSIONS = { 'pdf' : ('ps.gz', ), 'ps.gz' : ('pdf', ), 'djvu' : ('ps.gz', 'pdf'), 'docx' : ('doc', 'odt', 'pdf', 'ps.gz'), 'doc' : ('odt', 'pdf', 'ps.gz'), 'rtf' : ('pdf', 'odt', 'ps.gz'), 'odt' : ('pdf', 'doc', 'ps.gz'), 'pptx' : ('ppt', 'odp', 'pdf', 'ps.gz'), 'ppt' : ('odp', 'pdf', 'ps.gz'), 'odp' : ('pdf', 'ppt', 'ps.gz'), 'xlsx' : ('xls', 'ods', 'csv'), 'xls' : ('ods', 'csv'), 'ods' : ('xls', 'csv'), 'tiff' : ('pdf', 'ps.gz'), 'tif' : ('pdf', 'ps.gz') } +## CFG_WEBSUBMIT_ICON_SUBFORMAT_RE -- a subformat is an Invenio concept to give +## file formats more semantic. For example "foo.gif;icon" has ".gif;icon" +## 'format', ".gif" 'superformat' and "icon" 'subformat'. That means that this +## particular format/instance of the "foo" document, not only is a ".gif" but +## is in the shape of an "icon", i.e. most probably it will be low-resolution. +## This configuration variable let the administrator to decide which implicit +## convention will be used to know which formats will be meant to be used +## as an icon. +CFG_WEBSUBMIT_ICON_SUBFORMAT_RE = re.compile(r"icon.*") + +## CFG_WEBSUBMIT_DEFAULT_ICON_SUBFORMAT -- this is the default subformat used +## when creating new icons. +CFG_WEBSUBMIT_DEFAULT_ICON_SUBFORMAT = "icon" + class InvenioWebSubmitFunctionError(Exception): """This exception should only ever be raised by WebSubmit functions. It will be caught and handled by the WebSubmit core itself. It is used to signal to WebSubmit core that one of the functions encountered a FATAL ERROR situation that should all further execution of the submission. The exception will carry an error message in its "value" string. This message will probably be displayed on the user's browser in an Invenio "error" box, and may be logged for the admin to examine. Again: If this exception is raised by a WebSubmit function, an error message will displayed and the submission ends in failure. Extends: Exception. """ def __init__(self, value): """Set the internal "value" attribute to that of the passed "value" parameter. @param value: (string) - an error string to display to the user. """ Exception.__init__(self) self.value = value def __str__(self): """Return oneself as a string (actually, return the contents of self.value). @return: (string) """ return str(self.value) class InvenioWebSubmitFunctionStop(Exception): """This exception should only ever be raised by WebSubmit functions. It will be caught and handled by the WebSubmit core itself. It is used to signal to WebSubmit core that one of the functions encountered a situation that should prevent the functions that follow it from being executed, and that WebSubmit core should display some sort of message to the user. This message will be stored in the "value" attribute of the object. *** NOTE: In the current WebSubmit, this "value" is ususally a JavaScript string that redirects the user's browser back to the Web form phase of the submission. The use of JavaScript, however is going to be removed in the future, so the mechanism may change. *** Extends: Exception. """ def __init__(self, value): """Set the internal "value" attribute to that of the passed "value" parameter. @param value: (string) - a string to display to the user. """ Exception.__init__(self) self.value = value def __str__(self): """Return oneself as a string (actually, return the contents of self.value). @return: (string) """ return str(self.value) class InvenioWebSubmitFunctionWarning(Exception): """This exception should be raised by a WebSubmit function when unexpected behaviour is encountered during the execution of the function. The unexpected behaviour should not have been so serious that execution had to be halted, but since the function was unable to perform its task, the event must be logged. Logging of the exception will be performed by WebSubmit. Extends: Exception. """ def __init__(self, value): """Set the internal "value" attribute to that of the passed "value" parameter. @param value: (string) - a string to write to the log. """ Exception.__init__(self) self.value = value def __str__(self): """Return oneself as a string (actually, return the contents of self.value). @return: (string) """ return str(self.value) class InvenioWebSubmitFileStamperError(Exception): """This exception should be raised by websubmit_file_stamper when an error is encoutered that prevents a file from being stamped. When caught, this exception should be used to stop processing with a failure signal. Extends: Exception. """ def __init__(self, value): """Set the internal "value" attribute to that of the passed "value" parameter. @param value: (string) - a string to write to the log. """ Exception.__init__(self) self.value = value def __str__(self): """Return oneself as a string (actually, return the contents of self.value). @return: (string) """ return str(self.value) class InvenioWebSubmitIconCreatorError(Exception): """This exception should be raised by websubmit_icon_creator when an error is encoutered that prevents an icon from being created. When caught, this exception should be used to stop processing with a failure signal. Extends: Exception. """ def __init__(self, value): """Set the internal "value" attribute to that of the passed "value" parameter. @param value: (string) - a string to write to the log. """ Exception.__init__(self) self.value = value def __str__(self): """Return oneself as a string (actually, return the contents of self.value). @return: (string) """ return str(self.value) diff --git a/modules/websubmit/lib/websubmit_templates.py b/modules/websubmit/lib/websubmit_templates.py index d15389079..80950fba1 100644 --- a/modules/websubmit/lib/websubmit_templates.py +++ b/modules/websubmit/lib/websubmit_templates.py @@ -1,3082 +1,3091 @@ ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. __revision__ = "$Id$" import urllib import time import cgi import gettext import string import locale import re import operator import os from invenio.config import \ CFG_SITE_URL, \ CFG_VERSION, \ CFG_SITE_URL, \ CFG_SITE_LANG from invenio.messages import gettext_set_language from invenio.dateutils import convert_datetext_to_dategui from invenio.urlutils import create_html_link from invenio.webmessage_mailutils import email_quoted_txt2html from invenio.htmlutils import escape_html from websubmit_config import \ CFG_WEBSUBMIT_CHECK_USER_LEAVES_SUBMISSION import invenio.template class Template: # Parameters allowed in the web interface for fetching files files_default_urlargd = { 'version': (str, ""), # version "" means "latest" 'docname': (str, ""), # the docname (optional) 'format' : (str, ""), # the format - 'verbose' : (int, 0) # the verbosity + 'verbose' : (int, 0), # the verbosity + 'subformat' : (str, ""), # the subformat } def tmpl_submit_home_page(self, ln, catalogues): """ The content of the home page of the submit engine Parameters: - 'ln' *string* - The language to display the interface in - 'catalogues' *string* - The HTML code for the catalogues list """ # load the right message language _ = gettext_set_language(ln) return """ """ % { 'document_types' : _("Document types available for submission"), 'please_select' : _("Please select the type of document you want to submit"), 'catalogues' : catalogues, 'ln' : ln, } def tmpl_submit_home_catalog_no_content(self, ln): """ The content of the home page of submit in case no doctypes are available Parameters: - 'ln' *string* - The language to display the interface in """ # load the right message language _ = gettext_set_language(ln) out = "

" + _("No document types available.") + "

\n" return out def tmpl_submit_home_catalogs(self, ln, catalogs): """ Produces the catalogs' list HTML code Parameters: - 'ln' *string* - The language to display the interface in - 'catalogs' *array* - The catalogs of documents, each one a hash with the properties: - 'id' - the internal id - 'name' - the name - 'sons' - sub-catalogs - 'docs' - the contained document types, in the form: - 'id' - the internal id - 'name' - the name There is at least one catalog """ # load the right message language _ = gettext_set_language(ln) # import pprint # out = "
" + pprint.pformat(catalogs)
         out = ""
         for catalog in catalogs:
             out += "\n
    " out += self.tmpl_submit_home_catalogs_sub(ln, catalog) out += "\n
\n" return out def tmpl_print_warning(self, msg, type, prologue, epilogue): """Prints warning message and flushes output. Parameters: - 'msg' *string* - The message string - 'type' *string* - the warning type - 'prologue' *string* - HTML code to display before the warning - 'epilogue' *string* - HTML code to display after the warning """ out = '\n%s' % (prologue) if type: out += '%s: ' % type out += '%s%s' % (msg, epilogue) return out def tmpl_submit_home_catalogs_sub(self, ln, catalog): """ Recursive function that produces a catalog's HTML display Parameters: - 'ln' *string* - The language to display the interface in - 'catalog' *array* - A catalog of documents, with the properties: - 'id' - the internal id - 'name' - the name - 'sons' - sub-catalogs - 'docs' - the contained document types, in the form: - 'id' - the internal id - 'name' - the name """ # load the right message language _ = gettext_set_language(ln) if catalog['level'] == 1: out = "
  • %s\n" % catalog['name'] else: if catalog['level'] == 2: out = "
  • %s\n" % cgi.escape(catalog['name']) else: if catalog['level'] > 2: out = "
  • %s\n" % cgi.escape(catalog['name']) if len(catalog['docs']) or len(catalog['sons']): out += "
      \n" if len(catalog['docs']) != 0: for row in catalog['docs']: out += self.tmpl_submit_home_catalogs_doctype(ln, row) if len(catalog['sons']) != 0: for row in catalog['sons']: out += self.tmpl_submit_home_catalogs_sub(ln, row) if len(catalog['docs']) or len(catalog['sons']): out += "
  • " else: out += "" return out def tmpl_submit_home_catalogs_doctype(self, ln, doc): """ Recursive function that produces a catalog's HTML display Parameters: - 'ln' *string* - The language to display the interface in - 'doc' *array* - A catalog of documents, with the properties: - 'id' - the internal id - 'name' - the name """ # load the right message language _ = gettext_set_language(ln) return """
  • %s
  • """ % create_html_link('%s/submit' % CFG_SITE_URL, {'doctype' : doc['id'], 'ln' : ln}, doc['name']) def tmpl_action_page(self, ln, uid, guest, pid, now, doctype, description, docfulldesc, snameCateg, lnameCateg, actionShortDesc, indir, statustext): """ Recursive function that produces a catalog's HTML display Parameters: - 'ln' *string* - The language to display the interface in - 'guest' *boolean* - If the user is logged in or not - 'pid' *string* - The current process id - 'now' *string* - The current time (security control features) - 'doctype' *string* - The selected doctype - 'description' *string* - The description of the doctype - 'docfulldesc' *string* - The title text of the page - 'snameCateg' *array* - The short names of all the categories of documents - 'lnameCateg' *array* - The long names of all the categories of documents - 'actionShortDesc' *array* - The short names (codes) for the different actions - 'indir' *array* - The directories for each of the actions - 'statustext' *array* - The names of the different action buttons """ # load the right message language _ = gettext_set_language(ln) out = "" out += """

    %(continue_explain)s
    Access Number:

    """ % { 'continue_explain' : _("To continue with a previously interrupted submission, enter an access number into the box below:"), 'doctype' : doctype, 'go' : _("GO"), 'ln' : ln, } return out def tmpl_warning_message(self, ln, msg): """ Produces a warning message for the specified text Parameters: - 'ln' *string* - The language to display the interface in - 'msg' *string* - The message to display """ # load the right message language _ = gettext_set_language(ln) return """
    %s
    """ % msg def tmpl_page_interface(self, ln, docname, actname, curpage, nbpages, nextPg, access, nbPg, doctype, act, fields, javascript, mainmenu): """ Produces a page with the specified fields (in the submit chain) Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The document type - 'docname' *string* - The document type name - 'actname' *string* - The action name - 'act' *string* - The action - 'curpage' *int* - The current page of submitting engine - 'nbpages' *int* - The total number of pages - 'nextPg' *int* - The next page - 'access' *string* - The submission number - 'nbPg' *string* - ?? - 'fields' *array* - the fields to display in the page, with each record having the structure: - 'fullDesc' *string* - the description of the field - 'text' *string* - the HTML code of the field - 'javascript' *string* - if the field has some associated javascript code - 'type' *string* - the type of field (T, F, I, H, D, S, R) - 'name' *string* - the name of the field - 'rows' *string* - the number of rows for textareas - 'cols' *string* - the number of columns for textareas - 'val' *string* - the default value of the field - 'size' *string* - the size for text fields - 'maxlength' *string* - the maximum length for text fields - 'htmlcode' *string* - the complete HTML code for user-defined fields - 'typename' *string* - the long name of the type - 'javascript' *string* - the javascript code to insert in the page - 'mainmenu' *string* - the url of the main menu """ # load the right message language _ = gettext_set_language(ln) # top menu out = """
    \n" # Display the navigation cell # Display "previous page" navigation arrows out += """
    %(docname)s   %(actname)s  """ % { 'docname' : docname, 'actname' : actname, } for i in range(1, nbpages+1): if i == int(curpage): out += """""" % curpage else: out += """""" % (i, i) out += """
       page: %s  %s   
     %(summary)s(2) 

    """ % { 'summary' : _("SUMMARY"), 'doctype' : cgi.escape(doctype), 'act' : cgi.escape(act), 'access' : cgi.escape(access), 'nextPg' : cgi.escape(nextPg), 'curpage' : cgi.escape(curpage), 'nbPg' : cgi.escape(nbPg), 'ln' : cgi.escape(ln), } for field in fields: if field['javascript']: out += """ """ % field['javascript'] # now displays the html form field(s) out += "%s\n%s\n" % (field['fullDesc'], field['text']) out += javascript out += "
     
     
    """ if int(curpage) != 1: out += """ """ % { 'prpage' : int(curpage) - 1, 'images' : CFG_SITE_URL + '/img', 'prevpage' : _("Previous page"), } else: out += """ """ # Display the submission number out += """ \n""" % { 'submission' : _("Submission number") + '(1)', 'access' : cgi.escape(access), } # Display the "next page" navigation arrow if int(curpage) != int(nbpages): out += """ """ % { 'nxpage' : int(curpage) + 1, 'images' : CFG_SITE_URL + '/img', 'nextpage' : _("Next page"), } else: out += """ """ out += """
      %(prevpage)s %(prevpage)s  %(submission)s: %(access)s %(nextpage)s %(nextpage)s  


    %(back)s


    %(take_note)s
    %(explain_summary)s
    """ % { 'surequit' : _("Are you sure you want to quit this submission?"), 'check_not_already_enabled': CFG_WEBSUBMIT_CHECK_USER_LEAVES_SUBMISSION and 'false' or 'true', 'back' : _("Back to main menu"), 'mainmenu' : cgi.escape(mainmenu), 'images' : CFG_SITE_URL + '/img', 'take_note' : '(1) ' + _("This is your submission access number. It can be used to continue with an interrupted submission in case of problems."), 'explain_summary' : '(2) ' + _("Mandatory fields appear in red in the SUMMARY window."), } return out def tmpl_submit_field(self, ln, field): """ Produces the HTML code for the specified field Parameters: - 'ln' *string* - The language to display the interface in - 'field' *array* - the field to display in the page, with the following structure: - 'javascript' *string* - if the field has some associated javascript code - 'type' *string* - the type of field (T, F, I, H, D, S, R) - 'name' *string* - the name of the field - 'rows' *string* - the number of rows for textareas - 'cols' *string* - the number of columns for textareas - 'val' *string* - the default value of the field - 'size' *string* - the size for text fields - 'maxlength' *string* - the maximum length for text fields - 'htmlcode' *string* - the complete HTML code for user-defined fields - 'typename' *string* - the long name of the type """ # load the right message language _ = gettext_set_language(ln) # If the field is a textarea if field['type'] == 'T': ## Field is a textarea: text = "" \ % (field['name'], field['rows'], field['cols'], cgi.escape(str(field['val']), 1)) # If the field is a file upload elif field['type'] == 'F': ## the field is a file input: text = """""" \ % (field['name'], field['size'], "%s" \ % ((field['maxlength'] in (0, None) and " ") or (""" maxlength="%s\"""" % field['maxlength'])) ) # If the field is a text input elif field['type'] == 'I': ## Field is a text input: text = """""" \ % (field['name'], field['size'], field['val'], "%s" \ % ((field['maxlength'] in (0, None) and " ") or (""" maxlength="%s\"""" % field['maxlength'])) ) # If the field is a hidden input elif field['type'] == 'H': text = "" % (field['name'], field['val']) # If the field is user-defined elif field['type'] == 'D': text = field['htmlcode'] # If the field is a select box elif field['type'] == 'S': text = field['htmlcode'] # If the field type is not recognized else: text = "%s: unknown field type" % field['typename'] return text def tmpl_page_interface_js(self, ln, upload, field, fieldhtml, txt, check, level, curdir, values, select, radio, curpage, nbpages, returnto): """ Produces the javascript for validation and value filling for a submit interface page Parameters: - 'ln' *string* - The language to display the interface in - 'upload' *array* - booleans if the field is a field - 'field' *array* - the fields' names - 'fieldhtml' *array* - the fields' HTML representation - 'txt' *array* - the fields' long name - 'check' *array* - if the fields should be checked (in javascript) - 'level' *array* - strings, if the fields should be filled (M) or not (O) - 'curdir' *array* - the current directory of the submission - 'values' *array* - the current values of the fields - 'select' *array* - booleans, if the controls are "select" controls - 'radio' *array* - booleans, if the controls are "radio" controls - 'curpage' *int* - the current page - 'nbpages' *int* - the total number of pages - 'returnto' *array* - a structure with 'field' and 'page', if a mandatory field on antoher page was not completed """ # load the right message language _ = gettext_set_language(ln) nbFields = len(upload) # if there is a file upload field, we change the encoding type out = """""" return out def tmpl_page_do_not_leave_submission_js(self, ln): """ Code to ask user confirmation when leaving the page, so that the submission is not interrupted by mistake. All submission functions should set the Javascript variable 'user_must_confirm_before_leaving_page' to 'false' before programmatically submitting the submission form. Parameters: - 'ln' *string* - The language to display the interface in """ # load the right message language _ = gettext_set_language(ln) out = ''' ''' % (CFG_WEBSUBMIT_CHECK_USER_LEAVES_SUBMISSION and 'true' or 'false', _('Your modifications will not be saved.').replace('"', '\\"')) return out def tmpl_page_endaction(self, ln, nextPg, startPg, access, curpage, nbPg, nbpages, doctype, act, docname, actname, mainmenu, finished, function_content, next_action): """ Produces the pages after all the fields have been submitted. Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The document type - 'act' *string* - The action - 'docname' *string* - The document type name - 'actname' *string* - The action name - 'curpage' *int* - The current page of submitting engine - 'startPg' *int* - The start page - 'nextPg' *int* - The next page - 'access' *string* - The submission number - 'nbPg' *string* - total number of pages - 'nbpages' *string* - number of pages (?) - 'mainmenu' *string* - the url of the main menu - 'finished' *bool* - if the submission is finished - 'function_content' *string* - HTML code produced by some function executed - 'next_action' *string* - if there is another action to be completed, the HTML code for linking to it """ # load the right message language _ = gettext_set_language(ln) out = """
    """ % { 'finished' : _("finished!"), } else: for i in range(1, nbpages + 1): out += """""" % (i,i) out += """
    %(docname)s   %(actname)s  """ % { 'nextPg' : cgi.escape(nextPg), 'startPg' : cgi.escape(startPg), 'access' : cgi.escape(access), 'curpage' : cgi.escape(curpage), 'nbPg' : cgi.escape(nbPg), 'doctype' : cgi.escape(doctype), 'act' : cgi.escape(act), 'docname' : docname, 'actname' : actname, 'mainmenu' : cgi.escape(mainmenu), 'ln' : cgi.escape(ln), } if finished == 1: out += """
      %(finished)s   
       %s %(end_action)s  
     %(summary)s(2) """ % { 'end_action' : _("end of action"), 'summary' : _("SUMMARY"), 'doctype' : cgi.escape(doctype), 'act' : cgi.escape(act), 'access' : cgi.escape(access), 'ln' : cgi.escape(ln), } out += """

    %(function_content)s %(next_action)s

    """ % { 'function_content' : function_content, 'next_action' : next_action, } if finished == 0: out += """%(submission)s²: %(access)s""" % { 'submission' : _("Submission no"), 'access' : cgi.escape(access), } else: out += " \n" out += """


    """ # Add the "back to main menu" button if finished == 0: out += """ %(back)s

    """ % { 'surequit' : _("Are you sure you want to quit this submission?"), 'back' : _("Back to main menu"), 'images' : CFG_SITE_URL + '/img', 'mainmenu' : cgi.escape(mainmenu), 'check_not_already_enabled': CFG_WEBSUBMIT_CHECK_USER_LEAVES_SUBMISSION and 'false' or 'true', } else: out += """ %(back)s

    """ % { 'back' : _("Back to main menu"), 'images' : CFG_SITE_URL + '/img', 'mainmenu' : cgi.escape(mainmenu), } return out def tmpl_function_output(self, ln, display_on, action, doctype, step, functions): """ Produces the output of the functions. Parameters: - 'ln' *string* - The language to display the interface in - 'display_on' *bool* - If debug information should be displayed - 'doctype' *string* - The document type - 'action' *string* - The action - 'step' *int* - The current step in submission - 'functions' *aray* - HTML code produced by functions executed and informations about the functions - 'name' *string* - the name of the function - 'score' *string* - the score of the function - 'error' *bool* - if the function execution produced errors - 'text' *string* - the HTML code produced by the function """ # load the right message language _ = gettext_set_language(ln) out = "" if display_on: out += """

    %(function_list)s

    """ % { 'function_list' : _("Here is the %(x_action)s function list for %(x_doctype)s documents at level %(x_step)s") % { 'x_action' : action, 'x_doctype' : doctype, 'x_step' : step, }, 'function' : _("Function"), 'score' : _("Score"), 'running' : _("Running function"), } for function in functions: out += """""" % { 'name' : function['name'], 'score' : function['score'], 'result' : function['error'] and (_("Function %s does not exist.") % function['name'] + "
    ") or function['text'] } out += "
    %(function)s%(score)s%(running)s
    %(name)s%(score)s%(result)s
    " else: for function in functions: if not function['error']: out += function['text'] return out def tmpl_next_action(self, ln, actions): """ Produces the output of the functions. Parameters: - 'ln' *string* - The language to display the interface in - 'actions' *array* - The actions to display, in the structure - 'page' *string* - the starting page - 'action' *string* - the action (in terms of submission) - 'doctype' *string* - the doctype - 'nextdir' *string* - the path to the submission data - 'access' *string* - the submission number - 'indir' *string* - ?? - 'name' *string* - the name of the action """ # load the right message language _ = gettext_set_language(ln) out = "

    %(haveto)s

      " % { 'haveto' : _("You must now"), } i = 0 for action in actions: if i > 0: out += " " + _("or") + " " i += 1 out += """
    • %(name)s
    • """ % action out += "
    " return out def tmpl_filelist(self, ln, filelist='', recid='', docname='', version=''): """ Displays the file list for a record. Parameters: - 'ln' *string* - The language to display the interface in - 'recid' *int* - The record id - 'docname' *string* - The document name - 'version' *int* - The version of the document - 'filelist' *string* - The HTML string of the filelist (produced by the BibDoc classes) """ # load the right message language _ = gettext_set_language(ln) title = _("record") + ' #' + '%s' % (CFG_SITE_URL, recid, recid) if docname != "": title += ' ' + _("document") + ' #' + str(docname) if version != "": title += ' ' + _("version") + ' #' + str(version) out = """
    %s
    """ % (filelist) return out def tmpl_bibrecdoc_filelist(self, ln, types, verbose_files=''): """ Displays the file list for a record. Parameters: - 'ln' *string* - The language to display the interface in - 'types' *array* - The different types to display, each record in the format: - 'name' *string* - The name of the format - 'content' *array of string* - The HTML code produced by tmpl_bibdoc_filelist, for the right files - 'verbose_files' - A string representing in a verbose way the file information. """ # load the right message language _ = gettext_set_language(ln) out = "" for mytype in types: out += "%s %s:" % (mytype['name'], _("file(s)")) out += "
      " for content in mytype['content']: out += content out += "
    " if verbose_files: out += "
    %s
    " % verbose_files return out def tmpl_bibdoc_filelist(self, ln, versions=[], imageurl='', recid='', docname=''): """ Displays the file list for a record. Parameters: - 'ln' *string* - The language to display the interface in - 'versions' *array* - The different versions to display, each record in the format: - 'version' *string* - The version - 'content' *string* - The HTML code produced by tmpl_bibdocfile_filelist, for the right file - 'previous' *bool* - If the file has previous versions - 'imageurl' *string* - The URL to the file image - 'recid' *int* - The record id - 'docname' *string* - The name of the document """ # load the right message language _ = gettext_set_language(ln) out = """""" % { 'imageurl' : imageurl, 'docname' : docname } for version in versions: if version['previous']: versiontext = """
    (%(see)s %(previous)s)""" % { 'see' : _("see"), 'siteurl' : CFG_SITE_URL, 'docname' : urllib.quote(docname), 'recID': recid, 'previous': _("previous"), 'ln_link': (ln != CFG_SITE_LANG and '&ln=' + ln) or '', } else: versiontext = "" out += """" out += "" return out - def tmpl_bibdocfile_filelist(self, ln, recid, name, version, format, size, description): + def tmpl_bibdocfile_filelist(self, ln, recid, name, version, superformat, subformat, nice_size, description): """ Displays a file in the file list. Parameters: - 'ln' *string* - The language to display the interface in - 'recid' *int* - The id of the record - 'name' *string* - The name of the file - 'version' *string* - The version - - 'format' *string* - The display format + - 'superformat' *string* - The display superformat - - 'size' *string* - The size of the file + - 'subformat' *string* - The display subformat + + - 'nice_size' *string* - The nice_size of the file - 'description' *string* - The description that might have been associated to the particular file """ # load the right message language _ = gettext_set_language(ln) + urlbase = '%s/record/%s/files/%s' % ( + CFG_SITE_URL, + recid, + '%s%s' % (name, superformat)) + + urlargd = {'version' : version} + if subformat: + urlargd['subformat'] = subformat + + link_label = '%s%s' % (name, superformat) + if subformat: + link_label += ' (%s)' % subformat + + link = create_html_link(urlbase, urlargd, cgi.escape(link_label)) + return """ - - %(name)s%(format)s - + %(link)s - [%(size)s B] + [%(nice_size)s] %(description)s """ % { - 'siteurl' : CFG_SITE_URL, - 'recid' : recid, - 'quoted_name' : urllib.quote(name), - 'name' : cgi.escape(name), - 'version' : version, - 'name' : cgi.escape(name), - 'quoted_format' : urllib.quote(format), - 'format' : cgi.escape(format), - 'size' : size, + 'link' : link, + 'nice_size' : nice_size, 'description' : cgi.escape(description), } def tmpl_submit_summary (self, ln, values): """ Displays the summary for the submit procedure. Parameters: - 'ln' *string* - The language to display the interface in - 'values' *array* - The values of submit. Each of the records contain the following fields: - 'name' *string* - The name of the field - 'mandatory' *bool* - If the field is mandatory or not - 'value' *string* - The inserted value - 'page' *int* - The submit page on which the field is entered """ # load the right message language _ = gettext_set_language(ln) out = """""" % \ { 'images' : CFG_SITE_URL + '/img' } for value in values: if value['mandatory']: color = "red" else: color = "" out += """""" % { 'color' : color, 'name' : value['name'], 'value' : value['value'], 'page' : value['page'], 'ln' : ln } out += "
    %(name)s %(value)s
    " return out def tmpl_yoursubmissions(self, ln, order, doctypes, submissions): """ Displays the list of the user's submissions. Parameters: - 'ln' *string* - The language to display the interface in - 'order' *string* - The ordering parameter - 'doctypes' *array* - All the available doctypes, in structures: - 'id' *string* - The doctype id - 'name' *string* - The display name of the doctype - 'selected' *bool* - If the doctype should be selected - 'submissions' *array* - The available submissions, in structures: - 'docname' *string* - The document name - 'actname' *string* - The action name - 'status' *string* - The status of the document - 'cdate' *string* - Creation date - 'mdate' *string* - Modification date - 'id' *string* - The id of the submission - 'reference' *string* - The display name of the doctype - 'pending' *bool* - If the submission is pending - 'act' *string* - The action code - 'doctype' *string* - The doctype code """ # load the right message language _ = gettext_set_language(ln) out = "" out += """
    " return out def tmpl_yourapprovals(self, ln, referees): """ Displays the doctypes and categories for which the user is referee Parameters: - 'ln' *string* - The language to display the interface in - 'referees' *array* - All the doctypes for which the user is referee: - 'doctype' *string* - The doctype - 'docname' *string* - The display name of the doctype - 'categories' *array* - The specific categories for which the user is referee: - 'id' *string* - The category id - 'name' *string* - The display name of the category """ # load the right message language _ = gettext_set_language(ln) out = """ " out += '''

    To see the status of documents for which approval has been requested, click here

    ''' % {'url' : CFG_SITE_URL} return out def tmpl_publiline_selectdoctype(self, ln, docs): """ Displays the doctypes that the user can select Parameters: - 'ln' *string* - The language to display the interface in - 'docs' *array* - All the doctypes that the user can select: - 'doctype' *string* - The doctype - 'docname' *string* - The display name of the doctype """ # load the right message language _ = gettext_set_language(ln) out = """ %s""" % (ln, _("Go to specific approval workflow")) return out def tmpl_publiline_selectcplxdoctype(self, ln, docs): """ Displays the doctypes that the user can select in a complex workflow Parameters: - 'ln' *string* - The language to display the interface in - 'docs' *array* - All the doctypes that the user can select: - 'doctype' *string* - The doctype - 'docname' *string* - The display name of the doctype """ # load the right message language _ = gettext_set_language(ln) out = """
    """ return out def tmpl_publiline_selectcateg(self, ln, doctype, title, categories): """ Displays the categories from a doctype that the user can select Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The doctype - 'title' *string* - The doctype name - 'categories' *array* - All the categories that the user can select: - 'id' *string* - The id of the category - 'waiting' *int* - The number of documents waiting - 'approved' *int* - The number of approved documents - 'rejected' *int* - The number of rejected documents """ # load the right message language _ = gettext_set_language(ln) out = """ """ % { 'key' : _("Key"), 'pending' : _("Pending"), 'images' : CFG_SITE_URL + '/img', 'waiting' : _("Waiting for approval"), 'approved' : _("Approved"), 'already_approved' : _("Already approved"), 'rejected' : _("Rejected"), 'rejected_text' : _("Rejected"), 'somepending' : _("Some documents are pending."), } return out def tmpl_publiline_selectcplxcateg(self, ln, doctype, title, types): """ Displays the categories from a doctype that the user can select Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The doctype - 'title' *string* - The doctype name - 'categories' *array* - All the categories that the user can select: - 'id' *string* - The id of the category - 'waiting' *int* - The number of documents waiting - 'approved' *int* - The number of approved documents - 'rejected' *int* - The number of rejected documents """ # load the right message language _ = gettext_set_language(ln) out = "" #out = """ # # # # #
    # # """ % { # 'title' : title, # 'list_type' : _("List of specific approvals"), # } columns = [] columns.append ({'apptype' : 'RRP', 'list_categ' : _("List of refereing categories"), 'id_form' : 0, }) #columns.append ({'apptype' : 'RPB', # 'list_categ' : _("List of publication categories"), # 'id_form' : 1, # }) #columns.append ({'apptype' : 'RDA', # 'list_categ' : _("List of direct approval categories"), # 'id_form' : 2, # }) for column in columns: out += """ """ # Key out += """ """ % { 'key' : _("Key"), 'pending' : _("Pending"), 'images' : CFG_SITE_URL + '/img', 'waiting' : _("Waiting for approval"), 'approved' : _("Approved"), 'already_approved' : _("Already approved"), 'rejected' : _("Rejected"), 'rejected_text' : _("Rejected"), 'cancelled' : _("Cancelled"), 'cancelled_text' : _("Cancelled"), 'somepending' : _("Some documents are pending."), } return out def tmpl_publiline_selectdocument(self, ln, doctype, title, categ, docs): """ Displays the documents that the user can select in the specified category Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The doctype - 'title' *string* - The doctype name - 'categ' *string* - the category - 'docs' *array* - All the categories that the user can select: - 'RN' *string* - The id of the document - 'status' *string* - The status of the document """ # load the right message language _ = gettext_set_language(ln) out = """ """ return out def tmpl_publiline_selectcplxdocument(self, ln, doctype, title, categ, categname, docs, apptype): """ Displays the documents that the user can select in the specified category Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The doctype - 'title' *string* - The doctype name - 'categ' *string* - the category - 'docs' *array* - All the categories that the user can select: - 'RN' *string* - The id of the document - 'status' *string* - The status of the document - 'apptype' *string* - the approval type """ # load the right message language _ = gettext_set_language(ln) listtype = "" if apptype == "RRP": listtype = _("List of refereed documents") elif apptype == "RPB": listtype = _("List of publication documents") elif apptype == "RDA": listtype = _("List of direct approval documents") out = """ """ return out def tmpl_publiline_displaydoc(self, ln, doctype, docname, categ, rn, status, dFirstReq, dLastReq, dAction, access, confirm_send, auth_code, auth_message, authors, title, sysno, newrn, note): """ Displays the categories from a doctype that the user can select Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The doctype - 'docname' *string* - The doctype name - 'categ' *string* - the category - 'rn' *string* - The document RN (id number) - 'status' *string* - The status of the document - 'dFirstReq' *string* - The date of the first approval request - 'dLastReq' *string* - The date of the last approval request - 'dAction' *string* - The date of the last action (approval or rejection) - 'confirm_send' *bool* - must display a confirmation message about sending approval email - 'auth_code' *bool* - authorised to referee this document - 'auth_message' *string* - ??? - 'authors' *string* - the authors of the submission - 'title' *string* - the title of the submission - 'sysno' *string* - the unique database id for the record - 'newrn' *string* - the record number assigned to the submission - 'note' *string* - Note about the approval request. """ # load the right message language _ = gettext_set_language(ln) if status == "waiting": image = """""" % (CFG_SITE_URL + '/img') elif status == "approved": image = """""" % (CFG_SITE_URL + '/img') elif status == "rejected": image = """""" % (CFG_SITE_URL + '/img') else: image = "" out = """ """ return out def tmpl_publiline_displaycplxdoc(self, ln, doctype, docname, categ, rn, apptype, status, dates, isPubCom, isEdBoard, isReferee, isProjectLeader, isAuthor, authors, title, sysno, newrn): # load the right message language _ = gettext_set_language(ln) if status == "waiting": image = """""" % (CFG_SITE_URL + '/img') elif status == "approved": image = """""" % (CFG_SITE_URL + '/img') elif status == "rejected": image = """""" % (CFG_SITE_URL + '/img') elif status == "cancelled": image = """""" % (CFG_SITE_URL + '/img') else: image = "" out = """ """ return out def tmpl_publiline_displaycplxdocitem(self, doctype, categ, rn, apptype, action, comments, (user_can_view_comments, user_can_add_comment, user_can_delete_comment), selected_category, selected_topic, selected_group_id, comment_subject, comment_body, ln): _ = gettext_set_language(ln) if comments and user_can_view_comments: comments_text = '' comments_overview = '
      ' for comment in comments: (cmt_uid, cmt_nickname, cmt_title, cmt_body, cmt_date, cmt_priority, cmtid) = comment comments_overview += '
    • %s - %s (%s)
    • ' % (cmtid, cmt_nickname, cmt_title, convert_datetext_to_dategui (cmt_date)) comments_text += """
      %s - %s (%s)ReplyTop
      %s
      """ % (cmtid, cmt_nickname, cmt_title, convert_datetext_to_dategui (cmt_date), CFG_SITE_URL, doctype, apptype, categ, rn, cmt_uid, ln, email_quoted_txt2html(cmt_body)) comments_overview += '
    ' else: comments_text = '' comments_overview = 'None.' body = '' if user_can_view_comments: body += """

    %(comments_label)s

    """ if user_can_view_comments: body += """%(comments)s""" if user_can_add_comment: validation = """ """ % {'button_label': _("Add Comment")} body += self.tmpl_publiline_displaywritecomment (doctype, categ, rn, apptype, action, _("Add Comment"), comment_subject, validation, comment_body, ln) body %= { 'comments_label': _("Comments"), 'action': action, 'button_label': _("Write a comment"), 'comments': comments_text} content = '
    ' out = """

    %(comments_overview_label)s

    %(comments_overview)s
    %(body)s
    """ % { 'comments_overview_label' : _('Comments overview'), 'comments_overview' : comments_overview, 'body' : body,} return out def tmpl_publiline_displaywritecomment(self, doctype, categ, rn, apptype, action, write_label, title, validation, reply_message, ln): _ = gettext_set_language(ln) return """

    %(write_label)s

    %(title_label)s:

    %(comment_label)s:


    %(validation)s
    """ % {'write_label': write_label, 'title_label': _("Title"), 'title': title, 'comment_label': _("Comment"), 'rn' : rn, 'categ' : categ, 'doctype' : doctype, 'apptype' : apptype, 'action' : action, 'validation' : validation, 'reply_message' : reply_message, 'ln' : ln, } def tmpl_publiline_displaydocplxaction(self, ln, doctype, categ, rn, apptype, action, status, authors, title, sysno, subtitle1, email_user_pattern, stopon1, users, extrausers, stopon2, subtitle2, usersremove, stopon3, validate_btn): # load the right message language _ = gettext_set_language(ln) if status == "waiting": image = """""" % (CFG_SITE_URL + '/img') elif status == "approved": image = """""" % (CFG_SITE_URL + '/img') elif status == "rejected": image = """""" % (CFG_SITE_URL + '/img') else: image = "" out = """ """ if ((apptype == "RRP") or (apptype == "RPB")) and ((action == "EdBoardSel") or (action == "RefereeSel")): out += """ """ if action == "EdBoardSel": out += """ """ if validate_btn != "": out += """
    """ % { 'rn' : rn, 'categ' : categ, 'doctype' : doctype, 'apptype' : apptype, 'action' : action, 'validate_btn' : validate_btn, 'ln': ln, } return out def tmpl_publiline_displaycplxrecom(self, ln, doctype, categ, rn, apptype, action, status, authors, title, sysno, msg_to, msg_to_group, msg_subject): # load the right message language _ = gettext_set_language(ln) if status == "waiting": image = """""" % (CFG_SITE_URL + '/img') elif status == "approved": image = """""" % (CFG_SITE_URL + '/img') elif status == "rejected": image = """""" % (CFG_SITE_URL + '/img') else: image = "" out = """ """ # escape forbidden character msg_to = escape_html(msg_to) msg_to_group = escape_html(msg_to_group) msg_subject = escape_html(msg_subject) write_box = """
    """ if msg_to != "": addr_box = """ """ % {'users_label': _("User"), 'to_users' : msg_to, } if msg_to_group != "": addr_box += """ """ % {'groups_label': _("Group"), 'to_groups': msg_to_group, } elif msg_to_group != "": addr_box = """ """ % {'groups_label': _("Group"), 'to_groups': msg_to_group, } else: addr_box = """ """ write_box += addr_box write_box += """
    %(to_label)s%(users_label)s %(to_users)s
      %(groups_label)s %(to_groups)s%(groups_label)s %(to_groups)s   
         
    %(subject_label)s
    %(message_label)s
    """ write_box = write_box % {'rn' : rn, 'categ' : categ, 'doctype' : doctype, 'apptype' : apptype, 'action' : action, 'subject' : msg_subject, 'to_label': _("To:"), 'subject_label': _("Subject:"), 'message_label': _("Message:"), 'send_label': _("SEND"), 'select' : _("Select:"), 'approve' : _("approve"), 'reject' : _("reject"), 'ln': ln, } out += write_box return out def displaycplxdoc_displayauthaction(action, linkText): return """ (%(linkText)s)""" % { "action" : action, "linkText" : linkText } diff --git a/modules/websubmit/lib/websubmit_webinterface.py b/modules/websubmit/lib/websubmit_webinterface.py index 2d9fc5a1f..5ef1793fd 100644 --- a/modules/websubmit/lib/websubmit_webinterface.py +++ b/modules/websubmit/lib/websubmit_webinterface.py @@ -1,1000 +1,957 @@ ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Invenio is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. __lastupdated__ = """$Date$""" __revision__ = "$Id$" import os import time import cgi import sys from urllib import urlencode from invenio.config import \ CFG_ACCESS_CONTROL_LEVEL_SITE, \ CFG_SITE_LANG, \ CFG_SITE_NAME, \ CFG_SITE_NAME_INTL, \ CFG_SITE_URL, \ CFG_SITE_SECURE_URL, \ CFG_WEBSUBMIT_STORAGEDIR, \ CFG_PREFIX from invenio import webinterface_handler_wsgi_utils as apache from invenio.dbquery import run_sql from invenio.access_control_config import VIEWRESTRCOLL from invenio.access_control_mailcookie import mail_cookie_create_authorize_action from invenio.access_control_engine import acc_authorize_action from invenio.access_control_admin import acc_is_role from invenio.webpage import page, create_error_box, pageheaderonly, \ pagefooteronly from invenio.webuser import getUid, page_not_authorized, collect_user_info, isGuestUser, isUserSuperAdmin from invenio.websubmit_config import * from invenio.webinterface_handler import wash_urlargd, WebInterfaceDirectory from invenio.urlutils import make_canonical_urlargd, redirect_to_url from invenio.messages import gettext_set_language from invenio.search_engine import \ guess_primary_collection_of_a_record, get_colID, record_exists, \ create_navtrail_links, check_user_can_view_record, record_empty from invenio.bibdocfile import BibRecDocs, normalize_format, file_strip_ext, \ stream_restricted_icon, BibDoc, InvenioWebSubmitFileError, stream_file, \ - decompose_file, propose_next_docname + decompose_file, propose_next_docname, get_subformat_from_format from invenio.errorlib import register_exception from invenio.websubmit_icon_creator import create_icon, InvenioWebSubmitIconCreatorError import invenio.template websubmit_templates = invenio.template.load('websubmit') from invenio.websearchadminlib import get_detailed_page_tabs from invenio.session import get_session import invenio.template webstyle_templates = invenio.template.load('webstyle') websearch_templates = invenio.template.load('websearch') try: from invenio.fckeditor_invenio_connector import FCKeditorConnectorInvenio fckeditor_available = True except ImportError, e: fckeditor_available = False class WebInterfaceFilesPages(WebInterfaceDirectory): def __init__(self,recid): self.recid = recid def _lookup(self, component, path): # after /record//files/ every part is used as the file # name filename = component def getfile(req, form): args = wash_urlargd(form, websubmit_templates.files_default_urlargd) ln = args['ln'] _ = gettext_set_language(ln) uid = getUid(req) user_info = collect_user_info(req) verbose = args['verbose'] if verbose >= 1 and not isUserSuperAdmin(user_info): # Only SuperUser can see all the details! verbose = 0 if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE > 1: return page_not_authorized(req, "/record/%s" % self.recid, navmenuid='submit') if record_exists(self.recid) < 1: msg = "

    %s

    " % _("Requested record does not seem to exist.") return warningMsg(msg, req, CFG_SITE_NAME, ln) if record_empty(self.recid): msg = "

    %s

    " % _("Requested record does not seem to have been integrated.") return warningMsg(msg, req, CFG_SITE_NAME, ln) (auth_code, auth_msg) = check_user_can_view_record(user_info, self.recid) if auth_code and user_info['email'] == 'guest' and not user_info['apache_user']: cookie = mail_cookie_create_authorize_action(VIEWRESTRCOLL, {'collection' : guess_primary_collection_of_a_record(self.recid)}) target = '/youraccount/login' + \ make_canonical_urlargd({'action': cookie, 'ln' : ln, 'referer' : \ CFG_SITE_URL + user_info['uri']}, {}) return redirect_to_url(req, target) elif auth_code: return page_not_authorized(req, "../", \ text = auth_msg) readonly = CFG_ACCESS_CONTROL_LEVEL_SITE == 1 # From now on: either the user provided a specific file # name (and a possible version), or we return a list of # all the available files. In no case are the docids # visible. try: bibarchive = BibRecDocs(self.recid) except InvenioWebSubmitFileError, e: register_exception(req=req, alert_admin=True) msg = "

    %s

    %s

    " % ( _("The system has encountered an error in retrieving the list of files for this document."), _("The error has been logged and will be taken in consideration as soon as possible.")) return warningMsg(msg, req, CFG_SITE_NAME, ln) if bibarchive.deleted_p(): return print_warning(req, _("Requested record does not seem to exist.")) docname = '' format = '' version = '' if filename: # We know the complete file name, guess which docid it # refers to ## TODO: Change the extension system according to ext.py from setlink ## and have a uniform extension mechanism... docname = file_strip_ext(filename) format = filename[len(docname):] if format and format[0] != '.': format = '.' + format + if args['subformat']: + format += ';%s' % args['subformat'] else: docname = args['docname'] if not format: format = args['format'] + if args['subformat']: + format += ';%s' % args['subformat'] if not version: version = args['version'] # version could be either empty, or all or an integer try: int(version) except ValueError: if version != 'all': version = '' display_hidden = isUserSuperAdmin(user_info) if version != 'all': # search this filename in the complete list of files for doc in bibarchive.list_bibdocs(): if docname == doc.get_docname(): try: docfile = doc.get_file(format, version) if docfile.get_status() == '': # The file is not resticted, let's check for # collection restriction then. (auth_code, auth_message) = check_user_can_view_record(user_info, self.recid) if auth_code: + req.status = apache.HTTP_UNAUTHORIZED + if get_subformat_from_format(format).startswith('icon'): + return stream_restricted_icon(req) return warningMsg(_("The collection to which this file belong is restricted: ") + auth_message, req, CFG_SITE_NAME, ln) else: # The file is probably restricted on its own. # Let's check for proper authorization then (auth_code, auth_message) = docfile.is_restricted(req) if auth_code != 0: + req.status = apache.HTTP_UNAUTHORIZED + if get_subformat_from_format(format).startswith('icon'): + return stream_restricted_icon(req) return warningMsg(_("This file is restricted: ") + auth_message, req, CFG_SITE_NAME, ln) if display_hidden or not docfile.hidden_p(): if not readonly: - ip = str(req.get_remote_host(apache.REMOTE_NOLOOKUP)) + ip = str(req.remote_ip) res = doc.register_download(ip, version, format, uid) try: return docfile.stream(req) except InvenioWebSubmitFileError, msg: register_exception(req=req, alert_admin=True) + req.status = apache.HTTP_INTERNAL_SERVER_ERROR return warningMsg(_("An error has happened in trying to stream the request file."), req, CFG_SITE_NAME, ln) else: + req.status = apache.HTTP_UNAUTHORIZED warn = print_warning(_("The requested file is hidden and you don't have the proper rights to access it.")) except InvenioWebSubmitFileError, msg: register_exception(req=req, alert_admin=True) - if docfile.get_status() == '': - # The file is not resticted, let's check for - # collection restriction then. - (auth_code, auth_message) = check_user_can_view_record(user_info, self.recid) - if auth_code: - return warningMsg(_("The collection to which this file belong is restricted: ") + auth_message, req, CFG_SITE_NAME, ln) - else: - # The file is probably restricted on its own. - # Let's check for proper authorization then - (auth_code, auth_message) = docfile.is_restricted(req) - if auth_code != 0: - return warningMsg(_("This file is restricted: ") + auth_message, req, CFG_SITE_NAME, ln) - - if display_hidden or not docfile.hidden_p(): - if not readonly: - ip = str(req.remote_ip) - res = doc.register_download(ip, version, format, uid) - try: - return docfile.stream(req) - except InvenioWebSubmitFileError, msg: - register_exception(req=req, alert_admin=True) - return warningMsg(_("An error has happened in trying to stream the request file."), req, CFG_SITE_NAME, ln) - else: - warn = print_warning(_("The requested file is hidden and you don't have the proper rights to access it.")) - - elif doc.get_icon() is not None and doc.get_icon().docname == file_strip_ext(filename): - icon = doc.get_icon() - try: - iconfile = icon.get_file(format, version) - except InvenioWebSubmitFileError, msg: - register_exception(req=req, alert_admin=True) - return warningMsg(_("An error has happened in trying to retrieve the corresponding icon."), req, CFG_SITE_NAME, ln) - - if iconfile.get_status() == '': - # The file is not resticted, let's check for - # collection restriction then. - (auth_code, auth_message) = check_user_can_view_record(user_info, self.recid) - if auth_code: - return stream_restricted_icon(req) - else: - # The file is probably restricted on its own. - # Let's check for proper authorization then - (auth_code, auth_message) = iconfile.is_restricted(req) - if auth_code != 0: - return stream_restricted_icon(req) - - if not readonly: - ip = str(req.remote_ip) - res = doc.register_download(ip, version, format, uid) - try: - return iconfile.stream(req) - except InvenioWebSubmitFileError, msg: - register_exception(req=req, alert_admin=True) - return warningMsg(_("An error has happened in trying to stream the corresponding icon."), req, CFG_SITE_NAME, ln) - - if docname and format and display_hidden: + if docname and format: req.status = apache.HTTP_NOT_FOUND warn = print_warning(_("Requested file does not seem to exist.")) else: warn = '' filelist = bibarchive.display("", version, ln=ln, verbose=verbose, display_hidden=display_hidden) t = warn + websubmit_templates.tmpl_filelist( ln=ln, recid=self.recid, docname=args['docname'], version=version, filelist=filelist) cc = guess_primary_collection_of_a_record(self.recid) unordered_tabs = get_detailed_page_tabs(get_colID(cc), self.recid, ln) ordered_tabs_id = [(tab_id, values['order']) for (tab_id, values) in unordered_tabs.iteritems()] ordered_tabs_id.sort(lambda x,y: cmp(x[1],y[1])) link_ln = '' if ln != CFG_SITE_LANG: link_ln = '?ln=%s' % ln tabs = [(unordered_tabs[tab_id]['label'], \ '%s/record/%s/%s%s' % (CFG_SITE_URL, self.recid, tab_id, link_ln), \ tab_id == 'files', unordered_tabs[tab_id]['enabled']) \ for (tab_id, order) in ordered_tabs_id if unordered_tabs[tab_id]['visible'] == True] top = webstyle_templates.detailed_record_container_top(self.recid, tabs, args['ln']) bottom = webstyle_templates.detailed_record_container_bottom(self.recid, tabs, args['ln']) title, description, keywords = websearch_templates.tmpl_record_page_header_content(req, self.recid, args['ln']) return pageheaderonly(title=title, navtrail=create_navtrail_links(cc=cc, aas=0, ln=ln) + \ ''' > %s > %s''' % \ (CFG_SITE_URL, self.recid, title, _("Access to Fulltext")), description="", keywords="keywords", uid=uid, language=ln, req=req, navmenuid='search', navtrail_append_title_p=0) + \ websearch_templates.tmpl_search_pagestart(ln) + \ top + t + bottom + \ websearch_templates.tmpl_search_pageend(ln) + \ pagefooteronly(lastupdated=__lastupdated__, language=ln, req=req) return getfile, [] def __call__(self, req, form): """Called in case of URLs like /record/123/files without trailing slash. """ args = wash_urlargd(form, websubmit_templates.files_default_urlargd) ln = args['ln'] link_ln = '' if ln != CFG_SITE_LANG: link_ln = '?ln=%s' % ln return redirect_to_url(req, '%s/record/%s/files/%s' % (CFG_SITE_URL, self.recid, link_ln)) def websubmit_legacy_getfile(req, form): """ Handle legacy /getfile.py URLs """ args = wash_urlargd(form, { 'recid': (int, 0), 'docid': (int, 0), 'version': (str, ''), 'name': (str, ''), 'format': (str, ''), 'ln' : (str, CFG_SITE_LANG) }) _ = gettext_set_language(args['ln']) def _getfile_py(req, recid=0, docid=0, version="", name="", format="", ln=CFG_SITE_LANG): if not recid: ## Let's obtain the recid from the docid if docid: try: bibdoc = BibDoc(docid=docid) recid = bibdoc.get_recid() except InvenioWebSubmitFileError, e: return warningMsg(_("An error has happened in trying to retrieve the requested file."), req, CFG_SITE_NAME, ln) else: return warningMsg(_('Not enough information to retrieve the document'), req, CFG_SITE_NAME, ln) else: if not name and docid: ## Let's obtain the name from the docid try: bibdoc = BibDoc(docid) name = bibdoc.get_docname() except InvenioWebSubmitFileError, e: return warningMsg(_("An error has happened in trying to retrieving the requested file."), req, CFG_SITE_NAME, ln) format = normalize_format(format) redirect_to_url(req, '%s/record/%s/files/%s%s?ln=%s%s' % (CFG_SITE_URL, recid, name, format, ln, version and 'version=%s' % version or ''), apache.HTTP_MOVED_PERMANENTLY) return _getfile_py(req, **args) # -------------------------------------------------- from invenio.websubmit_engine import home, action, interface, endaction class WebInterfaceSubmitPages(WebInterfaceDirectory): _exports = ['summary', 'sub', 'direct', '', 'attachfile', 'uploadfile', 'getuploadedfile'] def uploadfile(self, req, form): """ Similar to /submit, but only consider files. Nice for asynchronous Javascript uploads. Should be used to upload a single file. Also try to create an icon, and return URL to file(s) + icon(s) Authentication is performed based on session ID passed as parameter instead of cookie-based authentication, due to the use of this URL by the Flash plugin (to upload multiple files at once), which does not route cookies. FIXME: consider adding /deletefile and /modifyfile functions + parsing of additional parameters to rename files, add comments, restrictions, etc. """ if sys.hexversion < 0x2060000: try: import simplejson as json simplejson_available = True except ImportError: # Okay, no Ajax app will be possible, but continue anyway, # since this package is only recommended, not mandatory. simplejson_available = False else: import json simplejson_available = True argd = wash_urlargd(form, { 'doctype': (str, ''), 'access': (str, ''), 'indir': (str, ''), 'session_id': (str, ''), 'rename': (str, ''), }) curdir = None if not form.has_key("indir") or \ not form.has_key("doctype") or \ not form.has_key("access"): return apache.HTTP_BAD_REQUEST else: curdir = os.path.join(CFG_WEBSUBMIT_STORAGEDIR, argd['indir'], argd['doctype'], argd['access']) user_info = collect_user_info(req) if form.has_key("session_id"): # Are we uploading using Flash, which does not transmit # cookie? The expect to receive session_id as a form # parameter. First check that IP addresses do not # mismatch. A ValueError will be raises if there is # something wrong session = get_session(req=req, sid=argd['session_id']) try: session = get_session(req=req, sid=argd['session_id']) except ValueError, e: return apache.HTTP_BAD_REQUEST # Retrieve user information. We cannot rely on the session here. res = run_sql("SELECT uid FROM session WHERE session_key=%s", (argd['session_id'],)) if len(res): uid = res[0][0] user_info = collect_user_info(uid) try: act_fd = file(os.path.join(curdir, 'act')) action = act_fd.read() act_fd.close() except: act = "" # Is user authorized to perform this action? (auth_code, auth_msg) = acc_authorize_action(uid, "submit", verbose=0, doctype=argd['doctype'], act=action) if acc_is_role("submit", doctype=argd['doctype'], act=action) and auth_code != 0: # User cannot submit return apache.HTTP_UNAUTHORIZED else: # Process the upload and get the response added_files = {} for key, formfields in form.items(): filename = key.replace("[]", "") file_to_open = os.path.join(curdir, filename) if hasattr(formfields, "filename") and formfields.filename: dir_to_open = os.path.abspath(os.path.join(curdir, 'files', str(user_info['uid']), key)) try: assert(dir_to_open.startswith(CFG_WEBSUBMIT_STORAGEDIR)) except AssertionError: register_exception(req=req, prefix='curdir="%s", key="%s"' % (curdir, key)) return apache.HTTP_FORBIDDEN if not os.path.exists(dir_to_open): try: os.makedirs(dir_to_open) except: register_exception(req=req, alert_admin=True) return apache.HTTP_FORBIDDEN filename = formfields.filename ## Before saving the file to disc, wash the filename (in particular ## washing away UNIX and Windows (e.g. DFS) paths): filename = os.path.basename(filename.split('\\')[-1]) filename = filename.strip() if filename != "": # Check that file does not already exist n = 1 while os.path.exists(os.path.join(dir_to_open, filename)): #dirname, basename, extension = decompose_file(new_destination_path) basedir, name, extension = decompose_file(filename) new_name = propose_next_docname(name) filename = new_name + extension # This may be dangerous if the file size is bigger than the available memory fp = open(os.path.join(dir_to_open, filename), "w") fp.write(formfields.file.read()) fp.close() fp = open(os.path.join(curdir, "lastuploadedfile"), "w") fp.write(filename) fp.close() fp = open(file_to_open, "w") fp.write(filename) fp.close() try: # Create icon (icon_path, icon_name) = create_icon( { 'input-file' : os.path.join(dir_to_open, filename), 'icon-name' : filename, # extension stripped automatically 'icon-file-format' : 'gif', 'multipage-icon' : False, 'multipage-icon-delay' : 100, 'icon-scale' : "300>", # Resize only if width > 300 'verbosity' : 0, }) icons_dir = os.path.join(os.path.join(curdir, 'icons', str(user_info['uid']), key)) if not os.path.exists(icons_dir): # Create uid/icons dir if needed os.makedirs(icons_dir) os.rename(os.path.join(icon_path, icon_name), os.path.join(icons_dir, icon_name)) added_files[key] = {'name': filename, 'iconName': icon_name} except InvenioWebSubmitIconCreatorError, e: # We could not create the icon added_files[key] = {'name': filename} continue else: return apache.HTTP_BAD_REQUEST # Send our response if simplejson_available: return json.dumps(added_files) def getuploadedfile(self, req, form): """ Stream uploaded files. For the moment, restrict to files in ./curdir/files/uid or ./curdir/icons/uid directory, so that we are sure we stream files only to the user who uploaded them. """ argd = wash_urlargd(form, {'indir': (str, None), 'doctype': (str, None), 'access': (str, None), 'icon': (int, 0), 'key': (str, None), 'filename': (str, None)}) if None in argd.values(): return apache.HTTP_BAD_REQUEST uid = getUid(req) if argd['icon']: file_path = os.path.join(CFG_WEBSUBMIT_STORAGEDIR, argd['indir'], argd['doctype'], argd['access'], 'icons', str(uid), argd['key'], argd['filename'] ) else: file_path = os.path.join(CFG_WEBSUBMIT_STORAGEDIR, argd['indir'], argd['doctype'], argd['access'], 'files', str(uid), argd['key'], argd['filename'] ) abs_file_path = os.path.abspath(file_path) if abs_file_path.startswith(CFG_WEBSUBMIT_STORAGEDIR): # Check if file exist. Note that icon might not yet have # been created. for i in range(5): if os.path.exists(abs_file_path): return stream_file(req, abs_file_path) time.sleep(1) # Send error 404 in all other cases return apache.HTTP_NOT_FOUND def attachfile(self, req, form): """ Process requests received from FCKeditor to upload files. If the uploaded file is an image, create an icon version """ if not fckeditor_available: return apache.HTTP_NOT_FOUND if not form.has_key('type'): form['type'] = 'File' if not form.has_key('NewFile') or \ not form['type'] in \ ['File', 'Image', 'Flash', 'Media']: return apache.HTTP_NOT_FOUND uid = getUid(req) # URL where the file can be fetched after upload user_files_path = '%(CFG_SITE_URL)s/submit/getattachedfile/%(uid)s' % \ {'uid': uid, 'CFG_SITE_URL': CFG_SITE_URL} # Path to directory where uploaded files are saved user_files_absolute_path = '%(CFG_PREFIX)s/var/tmp/attachfile/%(uid)s' % \ {'uid': uid, 'CFG_PREFIX': CFG_PREFIX} try: os.makedirs(user_files_absolute_path) except: pass # Create a Connector instance to handle the request conn = FCKeditorConnectorInvenio(form, recid=-1, uid=uid, allowed_commands=['QuickUpload'], allowed_types = ['File', 'Image', 'Flash', 'Media'], user_files_path = user_files_path, user_files_absolute_path = user_files_absolute_path) user_info = collect_user_info(req) (auth_code, auth_msg) = acc_authorize_action(user_info, 'attachsubmissionfile') if user_info['email'] == 'guest' and not user_info['apache_user']: # User is guest: must login prior to upload data = conn.sendUploadResults(1, '', '', 'Please login before uploading file.') elif auth_code: # User cannot submit data = conn.sendUploadResults(1, '', '', 'Sorry, you are not allowed to submit files.') else: # Process the upload and get the response data = conn.doResponse() # At this point, the file has been uploaded. The FCKeditor # submit the image in form['NewFile']. However, the image # might have been renamed in between by the FCK connector on # the server side, by appending (%04d) at the end of the base # name. Retrieve that file uploaded_file_path = os.path.join(user_files_absolute_path, form['type'].lower(), form['NewFile'].filename) uploaded_file_path = retrieve_most_recent_attached_file(uploaded_file_path) uploaded_file_name = os.path.basename(uploaded_file_path) # Create an icon if form.get('type','') == 'Image': try: (icon_path, icon_name) = create_icon( { 'input-file' : uploaded_file_path, 'icon-name' : os.path.splitext(uploaded_file_name)[0], 'icon-file-format' : os.path.splitext(uploaded_file_name)[1][1:] or 'gif', 'multipage-icon' : False, 'multipage-icon-delay' : 100, 'icon-scale' : "300>", # Resize only if width > 300 'verbosity' : 0, }) # Move original file to /original dir, and replace it with icon file original_user_files_absolute_path = os.path.join(user_files_absolute_path, 'image', 'original') if not os.path.exists(original_user_files_absolute_path): # Create /original dir if needed os.mkdir(original_user_files_absolute_path) os.rename(uploaded_file_path, original_user_files_absolute_path + os.sep + uploaded_file_name) os.rename(icon_path + os.sep + icon_name, uploaded_file_path) except InvenioWebSubmitIconCreatorError, e: pass # Transform the headers into something ok for mod_python for header in conn.headers: if not header is None: if header[0] == 'Content-Type': req.content_type = header[1] else: req.headers_out[header[0]] = header[1] # Send our response req.send_http_header() req.write(data) def _lookup(self, component, path): """ This handler is invoked for the dynamic URLs (for getting and putting attachments) Eg: /submit/getattachedfile/41336978/image/myfigure.png /submit/attachfile/41336978/image/myfigure.png """ if component == 'getattachedfile' and len(path) > 2: uid = path[0] # uid of the submitter file_type = path[1] # file, image, flash or media (as # defined by FCKeditor) if file_type in ['file', 'image', 'flash', 'media']: file_name = '/'.join(path[2:]) # the filename def answer_get(req, form): """Accessing files attached to submission.""" form['file'] = file_name form['type'] = file_type form['uid'] = uid return self.getattachedfile(req, form) return answer_get, [] # All other cases: file not found return None, [] def getattachedfile(self, req, form): """ Returns a file uploaded to the submission 'drop box' by the FCKeditor. """ argd = wash_urlargd(form, {'file': (str, None), 'type': (str, None), 'uid': (int, 0)}) # Can user view this record, i.e. can user access its # attachments? uid = getUid(req) user_info = collect_user_info(req) if not argd['file'] is None: # Prepare path to file on disk. Normalize the path so that # ../ and other dangerous components are removed. path = os.path.abspath(CFG_PREFIX + '/var/tmp/attachfile/' + \ '/' + str(argd['uid']) + \ '/' + argd['type'] + '/' + argd['file']) # Check that we are really accessing attachements # directory, for the declared record. if path.startswith(CFG_PREFIX + '/var/tmp/attachfile/') and os.path.exists(path): return stream_file(req, path) # Send error 404 in all other cases return(apache.HTTP_NOT_FOUND) def direct(self, req, form): """Directly redirected to an initialized submission.""" args = wash_urlargd(form, {'sub': (str, ''), 'access' : (str, '')}) sub = args['sub'] access = args['access'] ln = args['ln'] _ = gettext_set_language(ln) uid = getUid(req) if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "direct", navmenuid='submit') myQuery = req.args if not sub: return warningMsg(_("Sorry, 'sub' parameter missing..."), req, ln=ln) res = run_sql("SELECT docname,actname FROM sbmIMPLEMENT WHERE subname=%s", (sub,)) if not res: return warningMsg(_("Sorry. Cannot analyse parameter"), req, ln=ln) else: # get document type doctype = res[0][0] # get action name action = res[0][1] # retrieve other parameter values params = dict(form) # find existing access number if not access: # create 'unique' access number pid = os.getpid() now = time.time() access = "%i_%s" % (now,pid) # retrieve 'dir' value res = run_sql ("SELECT dir FROM sbmACTION WHERE sactname=%s", (action,)) dir = res[0][0] mainmenu = req.headers_in.get('referer') params['access'] = access params['act'] = action params['doctype'] = doctype params['startPg'] = '1' params['mainmenu'] = mainmenu params['ln'] = ln params['indir'] = dir url = "%s/submit?%s" % (CFG_SITE_URL, urlencode(params)) redirect_to_url(req, url) def sub(self, req, form): """DEPRECATED: /submit/sub is deprecated now, so raise email to the admin (but allow submission to continue anyway)""" args = wash_urlargd(form, {'password': (str, '')}) uid = getUid(req) if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../sub/", navmenuid='submit') try: raise DeprecationWarning, 'submit/sub handler has been used. Please use submit/direct. e.g. "submit/sub?RN=123@SBIFOO" -> "submit/direct?RN=123&sub=SBIFOO"' except DeprecationWarning: register_exception(req=req, alert_admin=True) ln = args['ln'] _ = gettext_set_language(ln) #DEMOBOO_RN=DEMO-BOOK-2008-001&ln=en&password=1223993532.26572%40APPDEMOBOO params = dict(form) password = args['password'] if password: del params['password'] if "@" in password: params['access'], params['sub'] = password.split('@', 1) else: params['sub'] = password else: args = str(req.args).split('@') if len(args) > 1: params = {'sub' : args[-1]} args = '@'.join(args[:-1]) params.update(cgi.parse_qs(args)) else: return warningMsg(_("Sorry, invalid URL..."), req, ln=ln) url = "%s/submit/direct?%s" % (CFG_SITE_URL, urlencode(params, doseq=True)) redirect_to_url(req, url) def summary(self, req, form): args = wash_urlargd(form, { 'doctype': (str, ''), 'act': (str, ''), 'access': (str, ''), 'indir': (str, '')}) uid = getUid(req) if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../summary", navmenuid='submit') t="" curdir = os.path.join(CFG_WEBSUBMIT_STORAGEDIR, args['indir'], args['doctype'], args['access']) try: assert(curdir == os.path.abspath(curdir)) except AssertionError: register_exception(req=req, alert_admin=True, prefix='Possible cracking tentative: indir="%s", doctype="%s", access="%s"' % (args['indir'], args['doctype'], args['access'])) return warningMsg("Invalid parameters") subname = "%s%s" % (args['act'], args['doctype']) res = run_sql("select sdesc,fidesc,pagenb,level from sbmFIELD where subname=%s " "order by pagenb,fieldnb", (subname,)) nbFields = 0 values = [] for arr in res: if arr[0] != "": val = { 'mandatory' : (arr[3] == 'M'), 'value' : '', 'page' : arr[2], 'name' : arr[0], } if os.path.exists(os.path.join(curdir, curdir,arr[1])): fd = open(os.path.join(curdir, arr[1]),"r") value = fd.read() fd.close() value = value.replace("\n"," ") value = value.replace("Select:","") else: value = "" val['value'] = value values.append(val) return websubmit_templates.tmpl_submit_summary( ln = args['ln'], values = values, ) def index(self, req, form): args = wash_urlargd(form, { 'c': (str, CFG_SITE_NAME), 'doctype': (str, ''), 'act': (str, ''), 'startPg': (str, "1"), 'access': (str, ''), 'mainmenu': (str, ''), 'fromdir': (str, ''), 'nextPg': (str, ''), 'nbPg': (str, ''), 'curpage': (str, '1'), 'step': (str, '0'), 'mode': (str, 'U'), }) ## Strip whitespace from beginning and end of doctype and action: args["doctype"] = args["doctype"].strip() args["act"] = args["act"].strip() def _index(req, c, ln, doctype, act, startPg, access, mainmenu, fromdir, nextPg, nbPg, curpage, step, mode): uid = getUid(req) if isGuestUser(uid): return redirect_to_url(req, "%s/youraccount/login%s" % ( CFG_SITE_SECURE_URL, make_canonical_urlargd({ 'referer' : CFG_SITE_URL + req.unparsed_uri, 'ln' : args['ln']}, {}))) if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../submit", navmenuid='submit') if doctype=="": return home(req,c,ln) elif act=="": return action(req,c,ln,doctype) elif int(step)==0: return interface(req, c, ln, doctype, act, startPg, access, mainmenu, fromdir, nextPg, nbPg, curpage) else: return endaction(req, c, ln, doctype, act, startPg, access,mainmenu, fromdir, nextPg, nbPg, curpage, step, mode) return _index(req, **args) # Answer to both /submit/ and /submit __call__ = index def errorMsg(title, req, c=None, ln=CFG_SITE_LANG): # load the right message language _ = gettext_set_language(ln) if c is None: c = CFG_SITE_NAME_INTL.get(ln, CFG_SITE_NAME) return page(title = _("Error"), body = create_error_box(req, title=title, verbose=0, ln=ln), description="%s - Internal Error" % c, keywords="%s, Internal Error" % c, uid = getUid(req), language=ln, req=req, navmenuid='submit') def warningMsg(title, req, c=None, ln=CFG_SITE_LANG): # load the right message language _ = gettext_set_language(ln) if c is None: c = CFG_SITE_NAME_INTL.get(ln, CFG_SITE_NAME) return page(title = _("Warning"), body = title, description="%s - Internal Error" % c, keywords="%s, Internal Error" % c, uid = getUid(req), language=ln, req=req, navmenuid='submit') def print_warning(msg, type='', prologue='
    ', epilogue='
    '): """Prints warning message and flushes output.""" if msg: return websubmit_templates.tmpl_print_warning( msg = msg, type = type, prologue = prologue, epilogue = epilogue, ) else: return '' def retrieve_most_recent_attached_file(file_path): """ Retrieve the latest file that has been uploaded with the FCKeditor. This is the only way to retrieve files that the FCKeditor has renamed after the upload. Eg: 'prefix/image.jpg' was uploaded but did already exist. FCKeditor silently renamed it to 'prefix/image(1).jpg': >>> retrieve_most_recent_attached_file('prefix/image.jpg') 'prefix/image(1).jpg' """ (base_path, filename) = os.path.split(file_path) base_name = os.path.splitext(filename)[0] file_ext = os.path.splitext(filename)[1][1:] most_recent_filename = filename i = 0 while True: i += 1 possible_filename = "%s(%d).%s" % \ (base_name, i, file_ext) if os.path.exists(base_path + os.sep + possible_filename): most_recent_filename = possible_filename else: break return os.path.join(base_path, most_recent_filename)