# HG changeset patch # User j.forth # Date 1298546598 0 # Node ID 317fe3126c6cd7a80d9fc6b5297b0438e4cfd676 # Parent de60993404c1cfed65c54fd9c9556f74139c71e0 add database-admin function to create composition identifiers from file Ignore-this: ff758dc4be1061baebae471feee53f00 darcs-hash:20090820181949-16a00-389500f68b818adca481631fc7ae26be59a8ad4a.gz committer: Jamie Forth diff -r de60993404c1 -r 317fe3126c6c base/database/datasets-functions.lisp --- a/base/database/datasets-functions.lisp Thu Feb 24 11:23:18 2011 +0000 +++ b/base/database/datasets-functions.lisp Thu Feb 24 11:23:18 2011 +0000 @@ -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 " diff -r de60993404c1 -r 317fe3126c6c base/database/package.lisp --- a/base/database/package.lisp Thu Feb 24 11:23:18 2011 +0000 +++ b/base/database/package.lisp Thu Feb 24 11:23:18 2011 +0000 @@ -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