Changeset 213 for branches/new-datamodel
- Timestamp:
- 02/26/10 15:50:44 (15 years ago)
- Location:
- branches/new-datamodel/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/new-datamodel/src/model/datamodel.lisp ¶
r212 r213 95 95 96 96 97 ;;TODO: add-type/add-parent/add-<x>-identifier handle situation where 98 ;; new objects hve to be bound in an earlier revision than one 99 ;; where a object is already bound 97 100 ;;TODO: finalize add-reifier 98 101 ;;TODO: replace add-to-version-history in VersionedAssociationC with a pseudo … … 171 174 172 175 (defpclass TypableC() 173 ((instance-of :associate (TypeAssociationC typ e-topic)176 ((instance-of :associate (TypeAssociationC typable-construct) 174 177 :inherit t 175 178 :documentation "Contains all association-objects that contain … … 1528 1531 (filter-slot-value-by-revision construct 'player 1529 1532 :start-revision revision)))) 1533 ;;TODO: search a player-assoc for the passed construct that was set in an older version 1530 1534 (cond ((and already-set-player 1531 1535 (eql (first already-set-player) player-topic)) … … 1764 1768 (map 'list #'type-topic 1765 1769 (filter-slot-value-by-revision construct 'instance-of 1766 :start-revision revision)))) 1767 (cond ((and already-set-type 1768 (eql (first already-set-type) type-topic)) 1770 :start-revision revision))) 1771 (same-type-assoc 1772 (loop for type-assoc in (slot-p construct 'instance-of) 1773 when (eql (type-topic type-assoc) type-topic) 1774 return type-assoc))) 1775 (when (and already-set-type 1776 (not (eql type-topic already-set-type))) 1777 (error "From add-type(): ~a can't be typed by ~a since it is typed by ~a" 1778 construct type-topic already-set-type)) 1779 (cond (already-set-type 1769 1780 (let ((type-assoc 1770 1781 (loop for type-assoc in (slot-p construct 'instance-of) … … 1772 1783 return type-assoc))) 1773 1784 (add-to-version-history type-assoc :start-revision revision))) 1774 ((not already-set-type) 1785 (same-type-assoc 1786 (add-to-version-history same-type-assoc :start-revision revision)) 1787 (t 1775 1788 (let ((assoc 1776 1789 (make-instance 'TypeAssociationC 1777 1790 :type-topic type-topic 1778 1791 :typable-construct construct))) 1779 (add-to-version-history assoc :start-revision revision))) 1780 (t 1781 (error "From add-type(): ~a can't be typed by ~a since it is already typed by the topic ~a" 1782 construct type-topic already-set-type))) 1783 construct))) 1792 (add-to-version-history assoc :start-revision revision))))) 1793 construct)) 1784 1794 1785 1795 -
TabularUnified branches/new-datamodel/src/unit_tests/datamodel_test.lisp ¶
r212 r213 31 31 :test-OccurrenceC 32 32 :test-VariantC 33 :test-NameC)) 33 :test-NameC 34 :test-TypableC)) 34 35 35 36 … … 690 691 (add-parent name-2 top-1 :revision revision-8) 691 692 (is (eql top-1 (parent name-2)))))) 693 694 695 (test test-TypableC () 696 "Tests various functions of the base class TypableC." 697 (with-fixture with-empty-db (*db-dir*) 698 (let ((name-1 (make-instance 'NameC)) 699 (name-2 (make-instance 'NameC)) 700 (top-1 (make-instance 'TopicC)) 701 (top-2 (make-instance 'TopicC)) 702 (revision-0-5 50) 703 (revision-1 100) 704 (revision-2 200) 705 (revision-3 300)) 706 (setf *TM-REVISION* revision-1) 707 (is-false (instance-of name-1)) 708 (add-type name-1 top-1) 709 (is (eql top-1 (instance-of name-1))) 710 (is-false (instance-of name-1 :revision revision-0-5)) 711 (is (eql top-1 (instance-of name-1 :revision revision-2))) 712 (signals error (add-type name-1 top-2)) 713 (add-type name-2 top-1 :revision revision-2) 714 (is (= (length (union (list name-1 name-2) 715 (used-as-type top-1))) 2)) 716 (is (= (length (union (list name-1) 717 (used-as-type top-1 718 :revision revision-1))) 1)) 719 (delete-type name-1 top-1 :revision revision-3) 720 (is-false (instance-of name-1)) 721 (is (= (length (union (list name-2) 722 (used-as-type top-1))) 1)) 723 (add-type name-1 top-1 :revision revision-3) 724 (is (eql top-1 (instance-of name-1))) 725 (is (= (length (union (list name-1 name-2) 726 (used-as-type top-1))) 2)) 727 (is (= (length (slot-value top-1 'd::used-as-type)) 2))))) 692 728 693 729 … … 708 744 (it.bese.fiveam:run! 'test-VariantC) 709 745 (it.bese.fiveam:run! 'test-NameC) 746 (it.bese.fiveam:run! 'test-TypableC) 710 747 )
Note: See TracChangeset
for help on using the changeset viewer.