473,231 Members | 1,640 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,231 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 5470
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: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.