Changeset 219 for branches/new-datamodel


Ignore:
Timestamp:
03/09/10 11:11:24 (15 years ago)
Author:
lgiessmann
Message:

new-datamodel: added delete-construct to TopicC, NameC, OccurrenceC, PersistentIdC, ItemIdentifierC, ReifiableConstructC, SubjectLocatorC, VariantC and all their version-associations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified branches/new-datamodel/src/model/datamodel.lisp

    r218 r219  
    764764
    765765;;; PointerC
     766(defmethod delete-construct :before ((construct PointerC))
     767  (dolist (p-assoc (slot-p construct 'identified-construct))
     768    (delete-construct p-assoc)))
     769
     770
    766771(defgeneric owned-p (construct)
    767772  (:documentation "Returns t if the passed construct is referenced by a parent
     
    786791
    787792
     793;;; PointerAssociationC
     794(defmethod delete-construct :before ((construct PointerAssociationC))
     795  (delete-1-n-association construct 'identifier))
     796
     797
     798;;; ItemIdAssociationC
     799(defmethod delete-construct :before ((construct ItemIdAssociationC))
     800  (delete-1-n-association construct 'parent-construct))
     801
     802
     803;;; TopicIdAssociationC
     804(defmethod delete-construct :before ((construct TopicIdAssociationC))
     805  (delete-1-n-association construct 'parent-construct))
     806
     807
     808;;; PersistentIdAssociationC
     809(defmethod delete-construct :before ((construct PersistentIdAssociationC))
     810  (delete-1-n-association construct 'parent-construct))
     811
     812
     813;;; SubjectLocatorAssociationC
     814(defmethod delete-construct :before ((construct SubjectLocatorAssociationC))
     815  (delete-1-n-association construct 'parent-construct))
     816
     817
     818;;; ReifierAssociationC
     819(defmethod delete-construct :before ((construct ReifierAssociationC))
     820  (delete-1-n-association construct 'reifiable-construct)
     821  (delete-1-n-association construct 'reifier-topic))
     822
     823
     824;;; TypeAssociationC
     825(defmethod delete-construct :before ((construct TypeAssociationC))
     826  (delete-1-n-association construct 'type-topic)
     827  (delete-1-n-association construct 'typable-construct))
     828
     829
     830;;; ScopeAssociationC
     831(defmethod delete-construct :before ((construct ScopeAssociationC))
     832  (delete-1-n-association construct 'theme-topic)
     833  (delete-1-n-association construct 'scopable-construct))
     834
     835
     836;;; CharacteristicAssociationC
     837(defmethod delete-construct :before ((construct CharacteristicAssociationC))
     838  (delete-1-n-association construct 'charactersitic))
     839
     840
     841;;; OccurrenceAssociationC
     842(defmethod delete-construct :before ((construct OccurrenceAssociationC))
     843  (delete-1-n-association construct 'parent-construct))
     844
     845
     846;;; NameAssociationC
     847(defmethod delete-construct :before ((construct NameAssociationC))
     848  (delete-1-n-association construct 'parent-construct))
     849
     850
     851;;; VariantAssociationC
     852(defmethod delete-construct :before ((construct VariantAssociationC))
     853  (delete-1-n-association construct 'parent-construct))
     854
     855
    788856;;; TopicC
     857(defmethod delete-construct :before ((construct TopicC))
     858  (let ((psis-to-delete
     859         (map 'list #'identifier (slot-p construct 'psis)))
     860        (sls-to-delete
     861         (map 'list #'identifier (slot-p construct 'psis)))
     862        (names-to-delete
     863         (map 'list #'characteristic (slot-p construct 'names)))
     864        (occurrences-to-delete (slot-p construct 'occurrences))
     865        ;TODO: roles -> associations?
     866        (typables-to-delete
     867         (map 'list #'typable-construct (slot-p construct 'used-as-type)))
     868        (reifier-assocs-to-delete (slot-p construct 'reified-construct)))
     869    (dolist (construct-to-delete (append psis-to-delete
     870                                         sls-to-delete
     871                                         names-to-delete
     872                                         occurrences-to-delete
     873                                         typables-to-delete
     874                                         reifier-assocs-to-delete))
     875      (delete-construct construct-to-delete)))
     876  (dolist (scope-assoc-to-delete (slot-p construct 'used-as-theme))
     877    (delete-construct scope-assoc-to-delete))
     878  (dolist (tm (slot-p construct 'in-topicmaps))
     879    (remove-association construct 'in-topicmaps tm)))
     880
     881
    789882(defmethod owned-p ((construct TopicC))
    790883  (when (slot-p construct 'in-topicmaps)
     
    11941287
    11951288;;; NameC
     1289(defmethod delete-construct :before ((construct NameC))
     1290  (dolist (variant-to-delete
     1291            (map 'list #'characteristic
     1292                 (slot-p construct 'variants)))
     1293    (delete-construct variant-to-delete)))
     1294
     1295
    11961296(defgeneric variants (construct &key revision)
    11971297  (:documentation "Returns all variants that correspond with the given revision
     
    12441344
    12451345;;; CharacteristicC
     1346(defmethod delete-construct :before ((construct CharacteristicC))
     1347  (dolist (characteristic-assoc-to-delete (slot-p construct 'parent))
     1348    (delete-construct characteristic-assoc-to-delete)))
     1349
     1350
    12461351(defmethod owned-p ((construct CharacteristicC))
    12471352  (when (slot-p construct 'parent)
     
    14731578
    14741579;;; ReifiableConstructC
     1580(defmethod delete-construct :before ((construct ReifiableConstructC))
     1581  (let ((iis-to-delete
     1582         (map 'list #'identifier (slot-p construct 'item-identifiers)))
     1583        (reifier-tops-to-delete
     1584         (map 'list #'reifier-topic (slot-p construct 'reifier))))
     1585    (dolist (construct-to-delete (append iis-to-delete reifier-tops-to-delete))
     1586      (delete-construct construct-to-delete))))
     1587
     1588
    14751589(defgeneric item-identifiers (construct &key revision)
    14761590  (:documentation "Returns the ItemIdentifierC-objects that correspond
     
    15881702
    15891703;;; ScopableC
     1704(defmethod delete-construct :before ((construct ScopableC))
     1705  (dolist (scope-assoc-to-delete (slot-p construct 'themes))
     1706    (delete-construct scope-assoc-to-delete)))
     1707
     1708
    15901709(defgeneric themes (construct &key revision)
    15911710  (:documentation "Returns all topics that correspond with the given revision
     
    16331752
    16341753;;; TypableC
     1754(defmethod delete-construct :before ((construct TypableC))
     1755  (dolist (type-assoc-to-delete (slot-p construct 'instance-of))
     1756    (delete-construct type-assoc-to-delete)))
     1757
    16351758(defgeneric instance-of (construct &key revision)
    16361759  (:documentation "Returns the type topic that is set on the passed
     
    16911814
    16921815;;; TopicMapC
     1816(defmethod delete-construct :before ((construct TopicMapC))
     1817  (dolist (top (slot-p construct 'topics))
     1818    (remove-association construct 'topics top))
     1819  (dolist (assoc (slot-p construct 'associations))
     1820    (remove-association construct 'associations assoc)))
     1821
     1822
    16931823(defgeneric topics (construct &key revision)
    16941824  (:documentation "Returns all TopicC-objects that are contained in the tm.")
Note: See TracChangeset for help on using the changeset viewer.