How would I do this? - Related categories

M

McGiv

I'm designing a database using ORM in Visio. I'm stuck on what seems
like an easy problem but which has stumped me.

I have a Category object

Category
CatId (primary)
ParentCategoryId (zero for root)
Name
Level

I also want each Category to have zero or many Related categories. A
category cannot be related to itself.


so I created RelatedCategory with 2 facts connected to category


Facts 1
Each RelatedCategory has Exactly One Category
Each Category has Zero or One Relatedcategory

Facts 2 (identical to fact 1)
Each RelatedCategory has Exactly One Category
Each Category has Zero or One Relatedcategory

In the orm source this doesn't have any errors but when I convert to a
database model I get:

Starting Build...
CATEGORY DATABASE MODEL.VSD : Updating existing database model project.
Category ORM Source Model.vsd : Merging Source Model.
Category ORM Source Model.vsd : error M1007: 'RelatedCategory has
Category' : Predicate [fact] has more than one definition.
Category ORM Source Model.vsd : error M2005: 'MR (RelatedCategory has
Category)' : Constraint has more than one definition. Please remove
all but one.
Category ORM Source Model.vsd : error M2005: 'UC (RelatedCategory has
Category)' : Constraint has more than one definition. Please remove
all but one.
Build failed - 3 error(s) 0 warning(s)
Build failed - 3 error(s) 0 warning(s)


So - how do you do something like this? Is there a way of creating
virtual Category objects call them Category1 and category2 so this
conflict won't happen?

Cheers,
McGiv
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top