Changeset 290 for branches/new-datamodel
- Timestamp:
- 04/29/10 10:17:20 (15 years ago)
- Location:
- branches/new-datamodel/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/new-datamodel/src/model/datamodel.lisp ¶
r288 r290 3087 3087 (:method ((construct ReifiableConstructC) (reifier-topic TopicC) 3088 3088 &key (revision *TM-REVISION*)) 3089 (when (and (reified-construct reifier-topic :revision revision) 3090 (not (equivalent-constructs construct 3091 (reified-construct 3092 reifier-topic :revision revision)))) 3093 (error (make-condition 'not-mergable-error 3094 :message (format nil "From add-reifier(): ~a and ~a can't be merged since the reified-constructs (~a ~a) are not mergable" 3095 reifier-topic (reifier construct :revision revision) (reified-construct reifier-topic :revision revision) construct) 3096 :construct-1 construct 3097 :construct-2 (reified-construct reifier-topic :revision revision)))) 3089 3098 (let ((merged-reifier-topic 3090 3099 (if (reifier construct :revision revision) … … 3853 3862 (destination-reified (reified-construct destination 3854 3863 :revision revision))) 3855 (unless (eql (type-of source-reified) (type-of destination-reified)) 3864 (when (and source-reified destination-reified 3865 (not (eql (type-of source-reified) 3866 (type-of destination-reified)))) 3856 3867 (error (make-condition 'not-mergable-error 3857 3868 :message (format nil "From move-reified-construct(): ~a and ~a can't be merged since the reified-constructs are not of the same type ~a ~a" … … 3869 3880 (source-reified 3870 3881 (delete-reifier source source-reified :revision revision) 3871 (add-reifier destination source-reified:revision revision)3882 (add-reifier source-reified destination :revision revision) 3872 3883 source-reified) 3873 3884 (destination-reified 3874 (add-reifier destination destination-reified:revision revision)3885 (add-reifier destination-reified destination :revision revision) 3875 3886 destination-reified))))) 3876 3887 -
TabularUnified branches/new-datamodel/src/unit_tests/datamodel_test.lisp ¶
r288 r290 89 89 :test-merge-constructs-TopicC-6 90 90 :test-merge-constructs-TopicC-7 91 :test-merge-constructs-TopicC-8)) 91 :test-merge-constructs-TopicC-8 92 :test-merge-constructs-TopicC-9)) 92 93 93 94 … … 3555 3556 (signals not-mergable-error (add-reifier occ-3 reifier-1)) 3556 3557 (is (eql (add-reifier occ-2 reifier-1) occ-1)) 3558 (is-false (set-exclusive-or (list occ-1 occ-3) (occurrences top-1))) 3557 3559 (is-true (marked-as-deleted-p top-2)) 3558 (is-true (marked-as-deleted-p occ-2))))))) 3560 (is-true (marked-as-deleted-p occ-2)) 3561 (is (= (length (d::versions top-1)) 2)) 3562 (is (= (length (d::versions top-2)) 1)) 3563 (is-true (find-if #'(lambda(vi) 3564 (and (= (d::end-revision vi) rev-3) 3565 (= (d::start-revision vi) rev-1))) 3566 (d::versions top-1))) 3567 (is-true (find-if #'(lambda(vi) 3568 (and (= (d::end-revision vi) 0) 3569 (= (d::start-revision vi) rev-3))) 3570 (d::versions top-1))) 3571 (is-true (find-if #'(lambda(vi) 3572 (and (= (d::end-revision vi) rev-3) 3573 (= (d::start-revision vi) rev-2))) 3574 (d::versions top-2))) 3575 (is (= (length (slot-value occ-2 'd::parent)) 1)) 3576 (is (= (length (slot-value occ-1 'd::parent)) 1)) 3577 (is-true (find-if #'(lambda(vi) 3578 (and (= (d::end-revision vi) rev-3) 3579 (= (d::start-revision vi) rev-2))) 3580 (first (map 'list #'d::versions 3581 (slot-value occ-2 'd::parent))))) 3582 (is-true (find-if #'(lambda(vi) 3583 (and (= (d::end-revision vi) rev-3) 3584 (= (d::start-revision vi) rev-1))) 3585 (first (map 'list #'d::versions 3586 (slot-value occ-1 'd::parent))))) 3587 (is-true (find-if #'(lambda(vi) 3588 (and (= (d::end-revision vi) 0) 3589 (= (d::start-revision vi) rev-3))) 3590 (first (map 'list #'d::versions 3591 (slot-value occ-1 'd::parent)))))))))) 3592 3593 3594 (test test-merge-constructs-TopicC-9 () 3595 "Tests the generic move-referenced-constructs corresponding to TopicC." 3596 (with-fixture with-empty-db (*db-dir*) 3597 (let ((rev-1 100) 3598 (rev-2 200) 3599 (rev-3 300) 3600 (rev-4 400) 3601 (psi-1 (make-construct 'PersistentIdC :uri "psi-1")) 3602 (psi-2 (make-construct 'PersistentIdC :uri "psi-2"))) 3603 (let ((top-1 (make-construct 'TopicC :start-revision rev-2 3604 :psis (list psi-2))) 3605 (top-2 (make-construct 'TopicC :start-revision rev-2)) 3606 (top-3 (make-construct 'TopicC :start-revision rev-1)) 3607 (reifier-1 (make-construct 'TopicC :start-revision rev-1)) 3608 (reifier-2 (make-construct 'TopicC :start-revision rev-2 3609 :psis (list psi-1))) 3610 (reifier-3 (make-construct 'TopicC :start-revision rev-1)) 3611 (reifier-4 (make-construct 'TopicC :start-revision rev-1)) 3612 (type-1 (make-construct 'TopicC :start-revision rev-1)) 3613 (type-2 (make-construct 'TopicC :start-revision rev-1))) 3614 (let ((occ-1 (make-construct 'OccurrenceC 3615 :start-revision rev-2 3616 :instance-of type-1 3617 :charvalue "occ" 3618 :reifier reifier-1 3619 :parent top-1)) 3620 (occ-2 (make-construct 'OccurrenceC 3621 :start-revision rev-2 3622 :instance-of type-2 3623 :charvalue "occ" 3624 :reifier reifier-3 3625 :parent top-2)) 3626 (occ-3 (make-construct 'OccurrenceC 3627 :start-revision rev-1 3628 :instance-of type-1 3629 :charvalue "occ" 3630 :reifier reifier-4 3631 :parent top-3))) 3632 (setf *TM-REVISION* rev-3) 3633 (is (eql (reifier occ-2) reifier-3)) 3634 (signals not-mergable-error (add-reifier occ-1 reifier-3)) 3635 (is (eql occ-1 (add-reifier occ-1 reifier-2))) 3636 (is-true (marked-as-deleted-p reifier-2)) 3637 (is-false (set-exclusive-or (list psi-1) (psis reifier-1))) 3638 (setf *TM-REVISION* rev-4) 3639 (is (eql (add-reifier occ-1 reifier-4) occ-3)) 3640 (is-true (marked-as-deleted-p top-1)) 3641 (is-false (marked-as-deleted-p top-3)) 3642 (is-false (set-exclusive-or (list psi-2) (psis top-3))) 3643 (is-false (marked-as-deleted-p top-2)) 3644 (is-false (set-exclusive-or (list occ-2) (occurrences top-2)))))))) 3559 3645 3560 3646 3561 3647 ;;TODO: merge topics caused by variant-item-identifiers 3562 ;;TODO: mrege topics caused by reifying the same reified-construct3563 3648 ;;TODO: merge associations caused by a merge of their characteristics 3564 3649 … … 3632 3717 (it.bese.fiveam:run! 'test-merge-constructs-TopicC-7) 3633 3718 (it.bese.fiveam:run! 'test-merge-constructs-TopicC-8) 3719 (it.bese.fiveam:run! 'test-merge-constructs-TopicC-9) 3634 3720 )
Note: See TracChangeset
for help on using the changeset viewer.