changeset 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 b3260d1d2419
children b518b9f904e3
files amuse-database-admin.asd amuse-db-datasets.asd amuse-midifile-datasets.asd amuse.asd base/database/database-connect.lisp base/database/generics.lisp base/database/implementations-functions.lisp base/database/implementations-setup.lisp base/database/package.lisp base/datasets/classes.lisp base/datasets/datasets-db/classes.lisp base/datasets/datasets-db/constructors.lisp base/datasets/datasets-db/datasets-db-setup.lisp base/datasets/datasets-db/methods.lisp base/datasets/datasets-file/classes.lisp base/datasets/datasets-file/constructors.lisp base/datasets/datasets-file/methods.lisp base/datasets/datasets-functions.lisp base/datasets/functions.lisp base/datasets/generics.lisp base/datasets/package.lisp base/generics.lisp base/package.lisp implementations/meredith/tests/import-raph-c-data.lisp implementations/midi-db/examples/example.lisp implementations/midi/methods.lisp
diffstat 26 files changed, 278 insertions(+), 143 deletions(-) [+]
line wrap: on
line diff
--- a/amuse-database-admin.asd	Thu Feb 24 11:23:18 2011 +0000
+++ b/amuse-database-admin.asd	Thu Feb 24 11:23:18 2011 +0000
@@ -8,11 +8,9 @@
 	    ((:module database
 		      :components
 		      ((:file "package")
-		       (:file "classes" :depends-on ("package"))
 		       (:file "database-connect" :depends-on ("package"))
-		       (:file "datasets-functions" :depends-on ("datasets-setup"))
-		       (:file "datasets-setup" :depends-on ("database-connect"))
 		       (:file "generics" :depends-on ("package"))
-		       (:file "implementations-functions" :depends-on ("implementations-setup"))
-		       (:file "implementations-setup" :depends-on ("package"))
-		       ))))))
+		       (:file "implementations-functions"
+			      :depends-on ("implementations-setup"))
+		       (:file "implementations-setup"
+			      :depends-on ("package"))))))))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/amuse-db-datasets.asd	Thu Feb 24 11:23:18 2011 +0000
@@ -0,0 +1,17 @@
+(asdf:defsystem amuse-db-datasets
+  :name "amuse-db-datasets"
+  :description "Functionality for working with datasets stored in an
+  AMuSE database."
+  :depends-on ("amuse" "amuse-database-admin")
+  :components
+  ((:module base
+	    :components
+	    ((:module datasets
+		      :components
+		      ((:module datasets-db
+				:components
+				((:file "classes")
+				 (:file "constructors" :depends-on ("classes"))
+				 (:file "datasets-db-setup")
+				 (:file "methods" :depends-on ("classes"))
+				 ))))))))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/amuse-midifile-datasets.asd	Thu Feb 24 11:23:18 2011 +0000
@@ -0,0 +1,16 @@
+(asdf:defsystem amuse-midifile-datasets
+  :name "amuse-midifile-datasets"
+  :description "Functionality for working with datasets of midifile
+  stored in a file system directory."
+  :depends-on ("amuse")
+  :components
+  ((:module base
+	    :components
+	    ((:module datasets
+		      :components
+		      ((:module datasets-file
+				:components
+				((:file "classes")
+				 (:file "constructors" :depends-on ("classes"))
+				 (:file "methods" :depends-on ("classes"))
+				 ))))))))
--- a/amuse.asd	Thu Feb 24 11:23:18 2011 +0000
+++ b/amuse.asd	Thu Feb 24 11:23:18 2011 +0000
@@ -3,7 +3,7 @@
   :description ""
   :depends-on ("midi" "mips")
   :components 
-  ((:module base 
+  ((:module base
             :components 
             ((:file "package")
              (:file "conditions" :depends-on ("package"))
@@ -11,7 +11,13 @@
              (:file "classes" :depends-on ("package" "generics"))
              (:file "constructors" :depends-on ("package"))
              (:file "generics" :depends-on ("package"))
-             (:file "methods" :depends-on ("package" "generics" "classes"))))
+             (:file "methods" :depends-on ("package" "generics" "classes"))
+	     (:module datasets :depends-on ("package")
+		      :components
+		      ((:file "package")
+		       (:file "classes" :depends-on ("package"))
+		       (:file "functions" :depends-on ("package"))
+		       (:file "generics" :depends-on ("package"))))))
    (:module utils
             :components
             ((:file "package")
--- a/base/database/database-connect.lisp	Thu Feb 24 11:23:18 2011 +0000
+++ b/base/database/database-connect.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -74,8 +74,10 @@
   (warn "You now need to manually edit ~A."
 	(namestring (%make-db-option-file-pathname))))
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;=====================================================================
 ;;; Helper functions
+;;;=====================================================================
 
 (defun %get-database-connection (connection-spec)
   (clsql:connect connection-spec
--- a/base/database/generics.lisp	Thu Feb 24 11:23:18 2011 +0000
+++ b/base/database/generics.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -1,8 +1,5 @@
 (cl:in-package #:amuse-database-admin)
 
-(defgeneric make-composition-identifier (package composition-id))
-
-
 ;;;====================================================================
 ;;; Generic functions for querying the database
 ;;;
--- a/base/database/implementations-functions.lisp	Thu Feb 24 11:23:18 2011 +0000
+++ b/base/database/implementations-functions.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -2,6 +2,7 @@
 
 (defun register-new-implementation (package-object &optional
 				    (database *amuse-database*))
+  "FIXME: Needs to check it doesn't already exist!"
   #.(clsql:locally-enable-sql-reader-syntax)
   (clsql:insert-records :into "amuse_implementations"
 			:attributes '([implementation-name])
--- a/base/database/implementations-setup.lisp	Thu Feb 24 11:23:18 2011 +0000
+++ b/base/database/implementations-setup.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -10,8 +10,10 @@
   (%drop-implementations-table database)
   (%drop-implementation-stored-routines database))
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;=====================================================================
 ;;; Helper functions
+;;;=====================================================================
 
 (defun %create-implementations-table (database)
   #.(clsql:locally-enable-sql-reader-syntax)
--- 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
@@ -5,15 +5,7 @@
 	   #:*amuse-database*
 	   #:make-db-option-file
 
-	   #:make-new-dataset		; datasets-functions
-	   #:assign-composition-to-dataset
-	   #:assign-compositions-to-dataset
-	   #:make-composition-identifiers-from-file
-	   #:get-dataset
- 	   #:make-amuse-dataset-identifier
-
-	   #:make-composition-identifier ; generics
-	   #:list-collections
+	   #:list-collections		 ; generics
 	   #:list-compositions
 
 	   #:register-new-implementation ; implementation functions
--- a/base/datasets/classes.lisp	Thu Feb 24 11:23:18 2011 +0000
+++ b/base/datasets/classes.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -1,18 +1,14 @@
-(cl:in-package #:amuse-database-admin)
+(cl:in-package #:amuse-datasets)
 
-(defclass amuse-dataset-identifier (identifier)
-  ((dataset-id :reader dataset-id
-	       :initarg :dataset-id))
+;;; Abstract classes for datasets.
+
+(defclass dataset-identifier (identifier) ()
   (:documentation "A dataset is a set of pieces used for a particualar
 analytical task. A dataset is not necessarily the same thing as a
 corpus or collection (are these things different?). Corpus indicates
 that a set of pieces have been curated in some way and in that sense
 `belong together'. A dataset is just simply a set of pieces gathered
 together to analyse, and the pieces can be from any corpus or
-backend (hence the amuse- prefix"))
+backend."))
 
-(defclass amuse-dataset (list-slot-sequence)
-  ((identifier :initarg :identifier
-	       :reader identifier)
-   (description :initarg :description
-		:reader description)))
+(defclass dataset (list-slot-sequence) ())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/datasets/datasets-db/classes.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -0,0 +1,12 @@
+(cl:in-package #:amuse-datasets)
+
+(defclass db-dataset-identifier (dataset-identifier)
+  ((dataset-id :reader dataset-id
+	       :initarg :dataset-id))
+  (:documentation "A dataset stored in a database."))
+
+(defclass db-dataset (dataset)
+  ((identifier :initarg :identifier
+	       :reader identifier)
+   (description :initarg :description
+		:reader description)))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/datasets/datasets-db/constructors.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -0,0 +1,26 @@
+(cl:in-package #:amuse-datasets)
+
+(defun make-db-dataset-identifier (dataset-id)
+  (make-instance 'db-dataset-identifier
+		 :dataset-id dataset-id))
+
+(defun make-new-dataset-record (description &optional
+				(database
+				 amuse-database-admin:*amuse-database*))
+  "A dataset is a set of pieces used for a particualar analytical
+task. A dataset is not necessarily the same thing as a corpus or
+collection (are these things different?). Corpus indicates that a set
+of pieces have been curated in some way and in that sense `belong
+together'. A dataset is just simply a set of pieces gathered together
+to analyse, and the pieces can be from any corpus or backend."
+  (let (dataset-id)
+    #.(clsql:locally-enable-sql-reader-syntax)
+    (clsql:insert-records :into "amuse_datasets"
+			  :attributes '([description])
+			  :values (list description)
+			  :database database)
+    #.(clsql:locally-disable-sql-reader-syntax)
+    (setf dataset-id (clsql-mysql::mysql-insert-id
+		      (clsql-mysql::database-mysql-ptr
+		       database)))
+    (make-db-dataset-identifier dataset-id)))
--- a/base/datasets/datasets-db/datasets-db-setup.lisp	Thu Feb 24 11:23:18 2011 +0000
+++ b/base/datasets/datasets-db/datasets-db-setup.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -1,15 +1,19 @@
 (cl:in-package #:amuse-database-admin)
 
-(defun create-datasets-table (&optional (database *amuse-database*))
+(defun create-datasets-table (&optional (database
+					 amuse-database-admin:*amuse-database*))
   (%create-datasets-table database)
   (%create-datasets-join-table database))
 
-(defun drop-datasets-table (&optional (database *amuse-database*))
+(defun drop-datasets-table (&optional (database
+				       amuse-database-admin:*amuse-database*))
   (%drop-datasets-table database)
   (%drop-datasets-join-table database))
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;=====================================================================
 ;;; Helper functions
+;;;=====================================================================
 
 (defun %create-datasets-table (database)
   #.(clsql:locally-enable-sql-reader-syntax)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/datasets/datasets-db/methods.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -0,0 +1,56 @@
+(cl:in-package #:amuse-datasets)
+
+(defmethod make-dataset ((identifier db-dataset-identifier)
+			 composition-identifiers &optional
+			 description)
+  (make-instance 'db-dataset
+		 :%data composition-identifiers
+		 :identifier identifier
+		 :description description))
+
+(defmethod get-dataset ((dataset-identifier db-dataset-identifier))
+  (let ((dataset-header (clsql:query (format nil "
+SELECT description
+FROM amuse_datasets
+WHERE dataset_id = ~S" (dataset-id dataset-identifier))
+				     :database
+				     amuse-database-admin:*amuse-database*
+				     :flatp t
+				     :field-names nil))
+	(dataset-rows (clsql:query (format nil "
+SELECT implementation_name, composition_id
+FROM amuse_datasets_join
+LEFT JOIN amuse_implementations
+USING (implementation_id)
+WHERE dataset_id = ~S"
+					   (dataset-id
+					    dataset-identifier))
+				   :flatp t
+				   :field-names nil
+				   :database
+				   amuse-database-admin:*amuse-database*)))
+    (make-dataset dataset-identifier
+		  (%init-dataset-rows dataset-rows)
+		  (car dataset-header))))
+
+(defun %init-dataset-rows (dataset-rows)
+  (loop for row in dataset-rows
+     collect (make-composition-identifier
+	      (find-package (first row)) (second row))
+     into composition-identifiers
+     finally (return composition-identifiers)))
+
+(defmethod assign-composition-to-dataset (composition-identifier
+					  (dataset-identifier
+					   db-dataset-identifier))
+  (clsql:execute-command (format nil "
+INSERT INTO amuse_datasets_join
+SET dataset_id := ~S,
+implementation_id := (SELECT get_impl_id('~A')),
+composition_id := ~S;"
+					(dataset-id dataset-identifier)
+					(amuse-database-admin:implementation-namestring
+					 composition-identifier)
+					(composition-id
+					 composition-identifier)))
+			 :database amuse-database-admin:*amuse-database*)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/datasets/datasets-file/classes.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -0,0 +1,24 @@
+(cl:in-package #:amuse-datasets)
+
+(defclass file-dataset-identifier (dataset-identifier) ()
+  (:documentation "Abstract class for file-based dataset
+  identifiers."))
+
+(defclass midifile-dataset-identifier (file-dataset-identifier)
+  ((dataset-path :reader dataset-path
+	     :initarg :dataset-path)
+   (implementation-package :reader implementation-package
+	    :initarg :implementation-package))
+  (:documentation "Identifier for dataset of midifiles stored in a
+  directory."))
+
+(defclass file-dataset (dataset) ()
+  (:documentation "Abstract class for file-based datasets."))
+
+(defclass midifile-dataset (file-dataset)
+  ((identifier :initarg :identifier
+	       :reader identifier)
+   (description :initarg :description
+		:initform nil
+		:reader description))
+  (:documentation "A dataset of midifiles stored in a directory."))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/datasets/datasets-file/constructors.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -0,0 +1,12 @@
+(cl:in-package #:amuse-datasets)
+
+(defun make-midifile-dataset-identifier (dataset-path
+					 &optional (implementation-package
+						    *package*))
+  "*package* is bound to the package in which the function is called,
+e.g. if you are in-package amuse-midi, the implementation-package will
+be amuse-midi. If you are calling this from within a different
+package, use find-package."
+  (make-instance 'midifile-dataset-identifier
+		 :dataset-path dataset-path
+		 :implementation-package implementation-package))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/datasets/datasets-file/methods.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -0,0 +1,27 @@
+(cl:in-package #:amuse-datasets)
+
+(defmethod make-dataset ((identifier midifile-dataset-identifier)
+			 composition-identifiers &optional
+			 description)
+  (make-instance 'midifile-dataset
+		 :%data composition-identifiers
+		 :identifier identifier
+		 :description description))
+
+(defmethod get-dataset ((dataset-identifier midifile-dataset-identifier))
+  (let ((midifile-paths
+	 (append (directory (merge-pathnames (dataset-path
+					      dataset-identifier) "*.mid*"))
+		 (directory (merge-pathnames (dataset-path
+					      dataset-identifier) "*.MID*")))))
+    (unless midifile-paths
+      (warn "No midifiles in: ~A" (dataset-path dataset-identifier))
+      (return-from get-dataset nil))
+    (loop for path in midifile-paths
+	 collect (make-composition-identifier
+		  (implementation-package dataset-identifier) path)
+	 into composition-identifiers
+	 finally (return (make-dataset dataset-identifier
+				       composition-identifiers)))))
+
+
--- a/base/datasets/datasets-functions.lisp	Thu Feb 24 11:23:18 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-(cl:in-package #:amuse-database-admin)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Constructors
-
-(defun make-amuse-dataset-identifier (dataset-id)
-  (make-instance 'amuse-dataset-identifier
-		 :dataset-id dataset-id))
-
-(defun %make-amuse-dataset (dataset-identifier description
-			    composition-identifiers)
-  (make-instance 'amuse-dataset
-		 :%data composition-identifiers
-		 :identifier dataset-identifier
-		 :description description))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Database functions
-
-(defun make-new-dataset (description &optional (database
-						*amuse-database*))
-  "A dataset is a set of pieces used for a particualar analytical
-task. A dataset is not necessarily the same thing as a corpus or
-collection (are these things different?). Corpus indicates that a set
-of pieces have been curated in some way and in that sense `belong
-together'. A dataset is just simply a set of pieces gathered together
-to analyse, and the pieces can be from any corpus or backend."
-  (let (dataset-id)
-    #.(clsql:locally-enable-sql-reader-syntax)
-    (clsql:insert-records :into "amuse_datasets"
-			  :attributes '([description])
-			  :values (list description)
-			  :database database)
-    #.(clsql:locally-disable-sql-reader-syntax)
-    (setf dataset-id (clsql-mysql::mysql-insert-id
-		      (clsql-mysql::database-mysql-ptr
-		       database)))
-    (make-amuse-dataset-identifier dataset-id)))
-
-(defun assign-composition-to-dataset (composition-identifier
-				      dataset-identifier
-				      &optional (database
-						 *amuse-database*))
-  (clsql:execute-command (format nil "
-INSERT INTO amuse_datasets_join
-SET dataset_id := ~S,
-implementation_id := (SELECT get_impl_id('~A')),
-composition_id := ~S;"
-					(dataset-id dataset-identifier)
-					(implementation-namestring
-					 composition-identifier)
-					(composition-id
-					 composition-identifier)))
-			 :database database)
-
-(defun assign-compositions-to-dataset (composition-identifiers
-				       dataset-identifier
-				       &optional (database
-						  *amuse-database*))
-  "This should be done more sensibly."
-  (loop for identifier in composition-identifiers
-     do (assign-composition-to-dataset identifier
-				       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 "
-SELECT description
-FROM amuse_datasets
-WHERE dataset_id = ~S" (dataset-id dataset-identifier))
-				     :database database
-				     :flatp t
-				     :field-names nil))
-	(dataset-rows (clsql:query (format nil "
-SELECT implementation_name, composition_id
-FROM amuse_datasets_join
-LEFT JOIN amuse_implementations
-USING (implementation_id)
-WHERE dataset_id = ~S"
-					   (dataset-id
-					    dataset-identifier))
-				   :flatp t
-				   :field-names nil
-				   :database database)))
-    (%make-amuse-dataset dataset-identifier (car dataset-header)
-			 (%init-dataset-rows dataset-rows))))
-
-(defun %init-dataset-rows (dataset-rows)
-  (loop for row in dataset-rows
-     collect (make-composition-identifier (find-package
-					   (first row)) (second row))
-     into composition-identifiers
-     finally (return composition-identifiers)))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/datasets/functions.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -0,0 +1,19 @@
+(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)))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/datasets/generics.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -0,0 +1,9 @@
+(cl:in-package #:amuse-datasets)
+
+(defgeneric make-dataset (dataset-identifier composition-identifiers
+					     &optional description))
+
+(defgeneric get-dataset (dataset-identifier))
+
+(defgeneric assign-composition-to-dataset (composition-identifier
+					   dataset-identifier))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/datasets/package.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -0,0 +1,12 @@
+(cl:defpackage #:amuse-datasets
+  (:use #:common-lisp #:amuse)
+  (:export #:make-dataset		; generics
+	   #:get-dataset
+	   #:assign-composition-to-dataset
+	   
+	   #:make-composition-identifiers-from-file ; functions
+	   #:assign-compositions-to-dataset
+
+	   #:make-db-dataset-identifier	; constructors from implementations
+	   #:make-midifile-dataset-identifier
+	   ))
--- a/base/generics.lisp	Thu Feb 24 11:23:18 2011 +0000
+++ b/base/generics.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -8,6 +8,10 @@
 
 (defgeneric composition-id (object))
 
+(defgeneric make-composition-identifier (package composition-id)
+  (:documentation "Generic composition identifier constructor, useful
+  for programmatically generating identifiers."))
+
 ;;; Pulling compositions from the database 
 
 (defgeneric get-composition (identifier)
--- a/base/package.lisp	Thu Feb 24 11:23:18 2011 +0000
+++ b/base/package.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -17,6 +17,7 @@
 	   #:composition
 	   #:%set-composition
 	   #:composition-identifier
+	   #:make-composition-identifier
 	   #:constituent-identifier
 	   #:moment
 	   #:period
--- a/implementations/meredith/tests/import-raph-c-data.lisp	Thu Feb 24 11:23:18 2011 +0000
+++ b/implementations/meredith/tests/import-raph-c-data.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -2,10 +2,10 @@
 
 (asdf:oos 'asdf:load-op 'amuse-meredith)
 
-(connect-to-database :database-name "test")
+(connect-to-database)
 
 ;; Tell the database about the new implementation.
-(amuse-database-admin:register-new-implementation *package*)
+;(amuse-database-admin:register-new-implementation *package*)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Add the datasets to the database
--- a/implementations/midi-db/examples/example.lisp	Thu Feb 24 11:23:18 2011 +0000
+++ b/implementations/midi-db/examples/example.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -12,4 +12,3 @@
 
 (defparameter *composition*
   (get-composition (make-midi-db-composition-identifier 1)))
-
--- a/implementations/midi/methods.lisp	Thu Feb 24 11:23:18 2011 +0000
+++ b/implementations/midi/methods.lisp	Thu Feb 24 11:23:18 2011 +0000
@@ -136,6 +136,14 @@
     sig))
 
 
+;;;=====================================================================
+;;; Specialized constructors
+;;;=====================================================================
+
+(defmethod make-composition-identifier ((package (eql *package*))
+				       pathname)
+  (make-midifile-identifier pathname))
+
 
 ;; Allow derived sequences from remove-if, etc. to preserve other slot
 ;; info (timesigs, etc)