anchor.diff:      (bt:destroy-thread *entity-system-thread*))
     (setf *entity-system-thread* nil))
   
  +;;;
  +;;; Entity
  +;;;
   (defdao entity ()
     ((id :col-type serial :reader id)
      (comment :col-type (or db-null text)))
     (:keys id))
   
  +(defun entity-id (entity)
  +  ;; Just numbers for now.
  +  entity)
  +
  +(defun create-entity (&key comment)
  +  (id (with-db () (make-dao 'entity :comment (or comment :null)))))
  +
  +;;;
  +;;; Modifiers
  +;;;
   (defdao modifier ()
     ((id :col-type serial :reader id)
      (entity-id :col-type bigint :initarg :entity-id)
  
positive.code:   (:keys id)
    (:index package name id entity-id))
  
  (defun entity-id (entity)
    ;; Just numbers for now.
    entity)
  
  (defun list-modifiers (entity &optional (package *package*))
    (with-db ()
      (query (sql-compile `(:select :* :from 'modifier
  
negative.code:           (query q :column)
            (query q :single)))))
  
  ;;;
  ;;; Entity OIDs
  ;;;
  ;;; - These are meant to be unique, human-readable identifiers. Sort of like global variables.
  ;;;   Example: (setf (entity-oid e) "example-objects:chair")
  ;;;
  (defun entity-oid (entity)
    (with-db () (modifier-value entity 'oid)))
  
  (defun (setf entity-oid) (new-value entity)
    (with-db ()
      (with-transaction ()
        (cond ((entity-oid entity)
               (setf (modifier-value entity 'oid 'text-value) new-value))
              ((find-entity-by-oid new-value)
               (error "~S must be a globally unique identifier, but it already identifies entity ~A."
                      new-value (find-entity-by-oid new-value)))
              (t
               (add-modifier entity 'oid new-value
                             :description "Unique external identifier for entity."))))))
  
  (defun find-entity-by-oid (oid)
    (find-by-modifier-value 'oid oid))
  
  ;;;
  ;;; Events
  ;;;
  (defdao event-execution ()
    ((id :col-type serial :reader id)
     (event-id :col-type bigint :initarg :event-id)
  