Changeset 232 for branches/new-datamodel/src/model
- Timestamp:
- 03/18/10 12:39:15 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/new-datamodel/src/model/datamodel.lisp ¶
r231 r232 126 126 ;; add-psi, add-locator 127 127 128 128 ;;TODO: all add-<construct> methods hve to add an version info to the 129 ;; owner-construct 129 130 ;;TODO: finalize add-reifier 130 131 ;;TODO: replace add-to-version-history in VersionedAssociationC with a pseudo … … 663 664 664 665 ;;; generic definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 666 (defgeneric get-all-characteristics (parent-construct characteristic-symbol) 667 (:documentation "Returns all characterisitcs of the passed type the parent 668 construct was ever associated with.")) 669 670 665 671 (defgeneric equivalent-construct (construct &key start-revision 666 672 &allow-other-keys) … … 811 817 812 818 ;;; TopicMapconstructC 819 (defmethod get-all-characteristics ((parent-construct TopicC) 820 (characteristic-symbol symbol)) 821 (cond ((OccurrenceC-p characteristic-symbol) 822 (map 'list #'characteristic (slot-p parent-construct 'occurrences))) 823 ((NameC-p characteristic-symbol) 824 (map 'list #'characteristic (slot-p parent-construct 'names))))) 825 826 813 827 (defgeneric TopicMapConstructC-p (class-symbol) 814 828 (:documentation "Returns t if the passed class is equal to TopicMapConstructC … … 1092 1106 :identifier topic-identifier))) 1093 1107 (add-to-version-history assoc :start-revision revision)))) 1108 (when (typep construct 'TopicC) 1109 (add-to-version-history construct :start-revision revision)) 1094 1110 construct))) 1095 1111 … … 1145 1161 :identifier psi))) 1146 1162 (add-to-version-history assoc :start-revision revision)))) 1163 (add-to-version-history construct :start-revision revision) 1147 1164 construct))) 1148 1165 … … 1198 1215 :identifier locator))) 1199 1216 (add-to-version-history assoc :start-revision revision)))) 1217 (add-to-version-history construct :start-revision revision) 1200 1218 construct))) 1201 1219 … … 1248 1266 :characteristic name))) 1249 1267 (add-to-version-history assoc :start-revision revision)))) 1268 (add-to-version-history construct :start-revision revision) 1250 1269 construct)) 1251 1270 … … 1297 1316 :characteristic occurrence))) 1298 1317 (add-to-version-history assoc :start-revision revision)))) 1318 (add-to-version-history construct :start-revision revision) 1299 1319 construct)) 1300 1320 … … 1601 1621 1602 1622 ;;; NameC 1623 (defmethod get-all-characteristics ((parent-construct NameC) 1624 (characteristic-symbol symbol)) 1625 (when (VariantC-p characteristic-symbol) 1626 (map 'list #'characteristic (slot-p parent-construct 'variants)))) 1627 1628 1603 1629 (defgeneric NameC-p (class-symbol) 1604 1630 (:documentation "Returns t if the passed symbol is equal to Name.") … … 1748 1774 :parent-construct construct))) 1749 1775 (add-to-version-history assoc :start-revision revision)))) 1776 (add-to-version-history construct :start-revision revision) 1750 1777 construct)) 1751 1778 … … 1843 1870 :parent-construct parent-construct))) 1844 1871 (add-to-version-history assoc :start-revision revision))))) 1872 (add-to-version-history parent-construct :start-revision revision) 1845 1873 construct) 1846 1874 … … 2000 2028 :identifier item-identifier))) 2001 2029 (add-to-version-history assoc :start-revision revision)))) 2030 (when (or (typep construct 'TopicC) 2031 (typep construct 'AssociationC) 2032 (typep construct 'TopicMapC)) 2033 (add-to-version-history construct :start-revision revision)) 2002 2034 construct))) 2003 2035 … … 2050 2082 :reifier-topic merged-reifier-topic))) 2051 2083 (add-to-version-history assoc :start-revision revision)))) 2084 (when (or (typep construct 'TopicC) 2085 (typep construct 'AssociationC) 2086 (typep construct 'TopicMapC)) 2087 (add-to-version-history construct :start-revision revision)) 2052 2088 construct)))) 2053 2089 … … 2138 2174 :scopable-construct construct))) 2139 2175 (add-to-version-history assoc :start-revision revision)))) 2176 (when (typep construct 'AssociationC) 2177 (add-to-version-history construct :start-revision revision)) 2140 2178 construct)) 2141 2179 … … 2208 2246 :typable-construct construct))) 2209 2247 (add-to-version-history assoc :start-revision revision))))) 2248 (when (typep construct 'AssociationC) 2249 (add-to-version-history construct :start-revision revision)) 2210 2250 construct)) 2211 2251 … … 2301 2341 2302 2342 2343 (defun make-characteristic (class-symbol charvalue 2344 &key (start-revision *TM-REVISION*) 2345 (datatype *xml-string*) (themes nil) 2346 (instance-of nil) (variants nil) 2347 (parent-construct nil)) 2348 "Returns a characteristic object with the passed parameters. 2349 If an equivalent construct has already existed this one is returned. 2350 To check if there is existing an equivalent construct the parameter 2351 parent-construct must be set." 2352 (declare (symbol class-symbol) (string charvalue) (integer start-revision) 2353 (list themes variants) 2354 (type (or null string) datatype) 2355 (type (or null TopicC) instance-of) 2356 (type (or null TopicC NameC) parent-construct)) 2357 (let ((characteristic 2358 (let ((existing-characteristic 2359 (when parent-construct 2360 (remove-if 2361 #'null 2362 (map 'list #'(lambda(existing-characteristic) 2363 (when (equivalent-construct 2364 existing-characteristic 2365 :start-revision start-revision 2366 :datatype datatype :themes themes 2367 :instance-of instance-of) 2368 existing-characteristic)) 2369 (get-all-characteristics parent-construct 2370 class-symbol)))))) 2371 (if existing-characteristic 2372 existing-characteristic 2373 (make-instance class-symbol :charvalue charvalue 2374 :datatype datatype))))) 2375 (dolist (theme themes) 2376 (add-theme characteristic theme :revision start-revision)) 2377 (when instance-of 2378 (add-type characteristic instance-of :revision start-revision)) 2379 (dolist (variant variants) 2380 (add-variant characteristic variant :revision start-revision)) 2381 (when parent-construct 2382 (add-parent characteristic parent-construct :revision start-revision)))) 2383 2303 2384 2304 2385 (defun make-pointer (class-symbol uri 2305 2386 &key (start-revision *TM-REVISION*) (xtm-id nil) 2306 2387 (identified-construct nil)) 2307 "Returns a pointer object with the specified parameters." 2388 "Returns a pointer object with the specified parameters. 2389 If an equivalen construct has already existed this one is returned." 2308 2390 (declare (symbol class-symbol) (string uri) (integer start-revision) 2309 2391 (type (or null string) xtm-id)
Note: See TracChangeset
for help on using the changeset viewer.