473,395 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

sql code for UML composition relation - anyone?

hi, I got confused for a moment about creating data structure for UML
composition (strong aggregation) relation one-to-many.

I used Rose/DataModeler to do so.
[Parent] <filled_diamond>-------- [Child]

I got P/FK (primary key of my component is foreign key of it's container) in
my child table:

Parent: PK Parent_ID
Child: P/FK Parent_ID

that way I found out I got relation 1:1, I'm still not sure how to create
data structure realizing compositiona one-to-many.
Jan 19 '07 #1
4 5479
fireball,

It looks to me like your model is defining a 1:n structure, not 1:1.

ParentTable
------------
ParentID (PK)

ChildTable
------------
ChildID (PK)
ParentID (FK)

ChildTable data example
--------------
ChildID, ParentID
1, 100
2, 100
3, 100

In this scenario, you can have one Parent (100) for many Children (1,2,3).
To implement this physically, just make sure you have a ParentID column in
the ChildTable that references the ParentTable.

Is that the question you were asking?

-- Bill

"fireball" <fi******@onet.kropka.euwrote in message
news:eo**********@nemesis.news.tpi.pl...
hi, I got confused for a moment about creating data structure for UML
composition (strong aggregation) relation one-to-many.

I used Rose/DataModeler to do so.
[Parent] <filled_diamond>-------- [Child]

I got P/FK (primary key of my component is foreign key of it's container)
in my child table:

Parent: PK Parent_ID
Child: P/FK Parent_ID

that way I found out I got relation 1:1, I'm still not sure how to create
data structure realizing compositiona one-to-many.


Jan 19 '07 #2
Bill thx for your time!

Your example looks like aggregation 1:many, that's correct - but the problem
is I need to create _strong_ aggregation (=composition) 1:many,
distinguishing from simple (weak) aggregation, your example seem to realize:

So I created two relations in my Rose:
a) aggregation (empty diamond) 1..*
b) composition (filled diamond( 1..*
and then I transformed it to data mode: And what I got?

a)
ParentTable
------------
ParentID (PK)

ChildTable
------------
ChildID (PK)
ParentID (FK)

b)
ParentTable
------------
ParentID (PK)

ChildTable
------------
ParentID (PFK)

which means for me 1:1, (and telling the truth, looks like
generalization/specialization - am I correct or not?)

TIA for further discussion
Jan 22 '07 #3
_strong_ aggregation (=composition)
(weak) aggregation

in other word's, how to make database data structure for _identyfying_
aggregation (1..*).
Jan 22 '07 #4
fireball,

Unless I am missing something, you've already definded a strong aggregation.
The child cannot exist without the parent - this is easy to enforce in the
database via referential integrity.

-- Bill
"fireball" <fi******@onet.kropka.euwrote in message
news:ep**********@atlantis.news.tpi.pl...
>_strong_ aggregation (=composition)
(weak) aggregation


in other word's, how to make database data structure for _identyfying_
aggregation (1..*).

Jan 23 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Milind | last post by:
Hi, I was trying to implement a composition relation, somthing of the following type: class A { public: class B {
4
by: Jenni | last post by:
Hopefully someone out there can help. I am currently trying to write some code to allow me to delete a table, then recreate it and re-establish the relationships. I seem to have hit a snag in the...
3
by: GGerard | last post by:
Hello Does anyone know if it is possible with Access 2000 to create relationships between tables using code? Thanks G.Gerard
41
by: Seth | last post by:
I am in need of source code for the Aho Corasick algorithm. I have tried searching the web but can't seem to find any code. Is there a good site for c code I can search? Thanks in advance.
10
by: Bret Pehrson | last post by:
Since managed code (C++/C#/etc.) doesn't support multiple inheritance, does anyone have a suitable work-around? To me, this is a *serious* limitation of the .NET subsystem. I'm aware of...
4
by: Frederik Vanderhaegen | last post by:
Hi, Can anyone explain me the difference between aggregation and composition? I know that they both are "whole-part" relationships and that composition parts are destroyed when the composition...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
6
by: Bart Simpson | last post by:
I remember reading on parashift recently, that "Composition is for code reuse, inheritance is for flexibility" see (http://www.parashift.com/c++-faq-lite/smalltalk.html#faq-30.4) This confused...
5
by: jyck91 | last post by:
Can anyone give me some ideas to organise a composition analyzer in C? It analyses an english composition. What functions should it include? eg. frequency of letter/ words thanks for help
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.