ORM Question

A

Aravind Hande

Hello,

I have the following entities, facts and constraints

Entity: LookupEntityX (Code)
--Code has possible values 'A', 'B', 'C', 'D', 'E'.
Fact: LookupEntityX has CodeDesc (character value type); Mandatory

Fact: ParentTableY (ID) has LookupEntityX (code) (at most one)
Fact: ParentTableY (ID) has Instructions (character value type) (at most
one)
Neither of the above ParentTableY roles are mandatory roles.

I have a subset constraint from the Instructions to the LookupEntityX role
above.
(because the Instructions is required only when LookupEntityX value is 'A'
or 'B')

Is there are any way I can explicitly state this requirement that the
Instructions
needs to be filled only when LookupEntityX is 'A' or 'B'? If so, how
should I go
about doing it?

Any help will be greatly appreciated.

Thanks,
Aravind Hande
 
C

Chang Oh [MSFT]

Hi, Scot.

I am always glad when you can step up for us. Having ORM experts like you always looking after others interested in ORM makes a lot of
difference.

--

Chang Oh
Visual Studio Enterprise Frameworks and Tools

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified
at http://www.microsoft.com/info/cpyright.htm
--------------------
From: "Scot A. Becker" <[email protected]>
References: <[email protected]>
Subject: Re: ORM Question
Date: Thu, 31 Jul 2003 20:39:28 -0500
Lines: 67
Organization: Orthogonal Software Corporation
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.visio.database.modeling
NNTP-Posting-Host: c-66-41-56-141.mn.client2.attbi.com 66.41.56.141
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.visio.database.modeling:2981
X-Tomcat-NG: microsoft.public.visio.database.modeling

Hi Aravind,

There may a way to do this, although it may not do exactly what you are
looking for (e.g. generate the code to enforce the rule).

The potential solution involves subtypes. You'll need to introduce a
sub-type of Parent Table. Define this Subtype as being a Parent Table whose
LookupEntityX is 'A' or 'B'. Here is the part that may not work for you: are
there any facts that are only applicable if the LookupEntityX is A or B? If
so, is one of them mandatory? If so, then you could put the subset
constraint between that mandatory subtype-only fact and the Instructions
fact which would, in effect, make the instructions fact mandatory for
LookupEntityX A or B.

The subtype rule will not get generated as code, but the subset constraint
will, so you are part of the way there.

This may not work, but it might get you thinking in the right direction.
Whenever you have facts and/or constraints that only sometimes are
applicable, subtyping is usually the solution. Perhaps there is a way to
restructure your model to use subtypes in this manner.

If this won't work, you'll have to specify it as a textual rule and code it
manually.

Hope that helps,
Scot.
...............................................
Scot Becker

Orthogonal Software
www.orthogonalsoftware.com
 

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