【正文】
:=donaldDuck。 end type Product。 foreach (part in ) ()。 := NULL。 (3) := thePenthouse。 := Oright。 end type TR 。 define setR(oright) is begin := self。 right:Tright。 ……] ……] right: Tright。 … ak: TkR。 end type Office。 := self。 !!recursive call of partList return resultSet end define partList –采用結(jié)構(gòu) II define partList is var resultSet: ProductSet。 ? 低效 ,需到 theSuperPart節(jié)點的所有組件中尋找self 第 III種冗余組合模式 type product is body [… super: Product; sub: ProductSet; … ] end type product ? 該模式的使用中,重要的是維護 DB的一致性 N:M關(guān)系舉例 Engineers Products designs ? 方式一 ,采用組合的冗余表達方式 type Engineer is type Product is body body […… […… designs: ProductSet。 type Woman is … husband : Man inverse Man$wife。 復(fù)合對象引用的支持 ? GOM支持對象間引用的更復(fù)雜的語義描述 ? 引用的分類 — 弱引用 : (weak reference)兩個對象 o1,o2除了它們之間存在一個引用聯(lián)系外,沒有任何其它的語義約束,即它們在同一個語義層次上是獨立的兩個實體,則稱 o1,o2間是一個弱引用 — 復(fù)合對象引用 :(posite reference) 復(fù)合對象對部分對象的引用具有復(fù)雜的語義約束。 說明:文檔的“章”可以共享,但當(dāng)所有引用它的章被刪除時,“章”的內(nèi)容也自然不再存在 2. 客戶檔案依賴合同而存在 — 依賴 一個客戶可以簽多份合同 — 共享 當(dāng)所有合同到期后,該客戶也就不再出現(xiàn) 獨立 — 共享復(fù)合對象的引用 ? 語義表示:部分對象即是共享的也是獨立的 (約束最弱 ) ? 示例:發(fā)動機設(shè)計圖 — 共享的部分對象可以用在不同的汽車設(shè)計中;當(dāng)汽車型號更新?lián)Q代了,發(fā)動機設(shè)計仍然需要保存 type CarDesign is body [ engineDesign : independent shared MotorDesihn。 r1 r12 r11 r112 r111 ? 包含一對互逆聯(lián)系屬性的窗口類型定義如下: type Rectangle is body [ height,length:float。 end type Man。 return false。 ……] end type Product 。 示例分析 (二 ) ? 工程師與部門間的 1:N的聯(lián)系 type Engineer is type Division is body body […… […… worksfor: Division。 … entitiyn: Tn。] end type Tleft。] end type TR。第九章 聯(lián)系的實現(xiàn) ? 對象類型間通過屬性的引用建立了對象實例間的聯(lián)系 ? 本章重點研究對象間聯(lián)系的語義及其實現(xiàn)方法 ? 對象間的聯(lián)系可以是 n元聯(lián)系 (n≥2 ) n個對象間通過一個聯(lián)系進行聯(lián)接 ? 其中最簡單,常用的是二元聯(lián)系 (n=2) ? 二元聯(lián)系中,二個對象間的聯(lián)系語義有 1:1, 1:N, N:1, N:M 167。 right:Tright。 ……] ……] right: Tright。 T1 T2 a1 ak Tn R … type TR with extension is Body [entitiy1: T1 。 end define moveToOffice。沿partof路徑進行導(dǎo)航或訪問 Super: Super: Super: Super: Super: Super: Super: Super: ? B:通過 Sub屬性 —表達了