Mercurial > hg > amuse
changeset 295:ced696bd9871
add database-admin function to create composition identifiers from file
Ignore-this: ff758dc4be1061baebae471feee53f00
darcs-hash:20090820181949-16a00-389500f68b818adca481631fc7ae26be59a8ad4a.gz
author | j.forth <j.forth@gold.ac.uk> |
---|---|
date | Thu, 20 Aug 2009 19:19:49 +0100 |
parents | 61dfbaea3c0b |
children | 68aadc4eb96d |
files | base/database/datasets-functions.lisp base/database/package.lisp |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/base/database/datasets-functions.lisp Tue Jul 28 20:07:04 2009 +0100 +++ b/base/database/datasets-functions.lisp Thu Aug 20 19:19:49 2009 +0100 @@ -64,6 +64,16 @@ dataset-identifier database))) +(defun make-composition-identifiers-from-file (package pathname) + "This reads a file that contains one id per line, and returns a list +of composition-identifiers (specialised on package). It is useful for +reading files that have been exported from the database, for use with +the above functions." + (with-open-file (stream pathname :direction :input) + (loop for id = (read stream nil) + while id + collect (make-composition-identifier package id)))) + (defun get-dataset (dataset-identifier &optional (database *amuse-database*)) (let ((dataset-header (clsql:query (format nil "
--- a/base/database/package.lisp Tue Jul 28 20:07:04 2009 +0100 +++ b/base/database/package.lisp Thu Aug 20 19:19:49 2009 +0100 @@ -7,6 +7,8 @@ #:make-new-dataset ; datasets-functions #:assign-composition-to-dataset + #:assign-compositions-to-dataset + #:make-composition-identifiers-from-file #:get-dataset #:make-amuse-dataset-identifier