view base/datasets/functions.lisp @ 251:6a3adca16910

Refactor dataset stuff out of amuse-database-admin, and add midifile-dataset.
author Jamie Forth <j.forth@gold.ac.uk>
date Thu, 24 Feb 2011 11:23:18 +0000
parents
children
line wrap: on
line source
(cl:in-package #:amuse-datasets)

(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 assign-compositions-to-dataset (composition-identifiers
				       dataset-identifier)
  "This could be done more sensibly, at least for datasets stored in
the database."
  (loop for identifier in composition-identifiers
     do (assign-composition-to-dataset identifier
				       dataset-identifier)))