Need advise on how to model this rule

Hi,
I got stuck in modelling some rule. I will try to paint the picture using some example:
Assume the following entities (and relations)
the child (the children)
     the toy (the childs toys)
the cupboard (the cupboards)
I would like to construct a boolean saying that all children can store their most favorite toy in the best cupboard
What I have tried so far:
I have inferred a relation for the best cupboard.
I also inferred a relation for the most favorite toy of a child.
Now I get stuck. What should be the way to do this? Is it possible? I have the feeling I am missing something. It might be versy simple, but I am relative new to OPA.
Any help is very much appreciated.
Cheers,
Han Joosten

Hi Han,
When I first had a go at this, I had several inferred relationships and it got complicated, so I tried to simplify it down to minimal inferred relationships. Here's what I did...
Entities and Relationships
Containment Relationships
Global --> one-to-many --> the child (relationship text: the children)
the child --> one-to-many --> the child's toy (relationship text: the child's toys; reverse text: the toy of the child)
Global --> one-to-many --> the cupboard (relationship text: the cupboards)
Inferred Relationships
the cupboard --> many-to-many --> the child's toy (relationship text: the cupboard's toys)
Note: Before you can write rules associating two different entities, you need to set up a relationship between them in the Properties file.
Rules
Determine the best cupboard...
I made up a number attribute 'the cupboard's priority'. The best cupboard is the one with the lowest priority number, i.e. the cupboard with priority 1 beats the cupboard with priority 2.
the cupboard is the best cupboard if
the cupboard's priority = the priority number of the top cupboard
the priority number of the top cupboard = InstanceMinimum(the cupboards, the cupboard's priority)
If you wanted to reverse the priority logic so that the highest number is the 'best', use InstanceMaximum instead.
Determine the favourite toy...
Similar approach with the toys:
the child's toy is the favourite toy if
the child's toy's priority = the priority number of the child's top toy
the priority number of the child's top toy = InstanceMinimum(the child's toys, the child's toy's priority)
Put the favourite toy of each child in the best cupboard...
Write a membership rule to associate the child's toys and the cupboards:
the child's toy is a member of the cupboard's toys if
the cupboard is the best cupboard and
ForScope(the toy of the child)
the child's toy is the favourite toy
Procedural rules to tie it all together...
The rules above do all the tricky logic work. If you want a Global level rule which ties it all together, you could add procedural rules, e.g.
the appropriate cupboard has been determined for all the favourite toys if
ForAll(the children, the child's favourite toy has been determined) and
ForAll(the cupboards, it is known whether or not the cupboard is the best cupboard)
the child's favourite toy has been determined if
ForAll(the child's toys, it is known whether or not the child's toy is the favourite toy)
Test case
I tried the following test scenario, which worked as expected.
Inputs
Child: Bart
Toys: Krusty Doll (priority 1), Television (priority 2)
Child: Lisa
Toys: Saxophone (priority 1), Malibu Stacy (priority 2)
Cupboard: Cupboard A (priority 1)
Cupboard: Cupboard B (priority 2)
Results
Cupboard A is the best cupboard
Instances of 'the child's toy' associated with Cupboard A: Krusty Doll, Saxophone
Cupboard B is not the best cupboard
No instances of 'the child's toy' associated with Cupboard B.
Further comments
If each child can have multiple 'favourite' toys (all of which can go in the best cupboard), then make 'the child's toy is the favourite toy' a base level attribute. Any toy where 'the child's toy is the favourite toy'=true will be associated with the best cupboard, i.e. Cupboard A in the scenario above.
Depending on what else you need to do, it may be worth creating an inferred relationship for 'the child's favourite toys', e.g.
the child's toy is a member of the child's favourite toys if
IsMemberOf(the child's toy, the child's toys) and
the child's toy is the favourite toy
Cheers,
Jasmine

Similar Messages

  • Lightroom crashes at start up with the error message "Lightroom encountered an error when reading from its preview cache and needs to quit".  Please advise on how to fix this error.  Thanks

    Lightroom crashes at start up with the error message "Lightroom encountered an error when reading from its preview cache and needs to quit".  Please advise on how to fix this error.  Thanks

    You probably need to delete your preview cache.  See here  
    Why And How To Clear Your Lightroom Cache - Lightroom Fanatic
    Preference and other file locations in Lightroom 5

  • Hi, I'm unable to use my speaker when I'm using Mac OS. However, I'm able to do so for Windows 7 OS on Bootcamp. Can anyone please advise on how to rectify this problem? I would greatly appreciate your help, thank you.

    Hi, I'm unable to use my speaker when I'm using Mac OS, which means I'm unable to unmute, decrease or increase the volume. However, I'm able to do so for Windows 7 OS on Bootcamp. Can anyone please advise on how to rectify this problem? I would greatly appreciate your help, thank you.

    Hi Zac, sorry to hear about your troubles, but that's why us other users are here to try to help in these instances.
    Open Console in Utilities & see if there are any clues or repeating messages when this connection drop happens.

  • I have a mountain lion 10.8.5 version installed on my 2012 Macbook air but there is no Wireless Network application installed. Can anyone advise me how to fix this or get it installed, thanks.

    I have a mountain lion 10.8.5 version installed on my 2012 Macbook air but there is no Wireless Network application installed. Can anyone advise me how to fix this or get it installed, thanks.

    thank you Eric/Joe, what I actually was looking for is wireless diagnostic utility not the wireless diagnostic assistant as per your advise but have found the resolution right here http://support.apple.com/kb/HT5606

  • Hello. Recently I am having a problem of loading video from youtube. The message "loading" keeps go on and on and nothing happens.Can you advise on how to fix this problem ?

    Hello.
    Recently I am having a problem of loading videos from Youtube.
    The message " loading" keeps go on and on and nothing happens. Can you advise on how to fix this problem.
    Thank you inadvance.

    This problem has been fixed. I rebooted my laptop after clearing my Firefox cache and deleting all cookies. Once my laptop was rebooted, I opened Firefox and now I can access the regular YouTube site, not the mobile site.

  • Music library crashes on iphone 5.  Can anyone advise on how to fix this?

    I have a new iPhone 5 and when I transferred all my data from previous iphone I find my music library crashes.  Can anyone advise on how to fix this? I've already tried to sync with my itunes library on my computer.

    Basics from the manual are restart, reset, restore.

  • I do not know how to get the music that I buy on itunes, on my mac, onto an ipod. I have already authorized my computer and "downloaded" my music, but that did not do anything. Please I really need to know how to do this on my own but I am stuck.Thank you

    I do not know how to get the music that I buy on itunes, on my mac, onto an ipod. I have already authorized my computer and "downloaded" my music, but that did not do anything, or provid the results that I was expecting, at least. Please, I really need to know how to do this on my own but I do not know what to do.Thank you in advance to anyone that is answering this question that I know most everyone but me knows how to accomplish. thanks!!!

    In iTunes go to the Help menu in the upper menu bar.  Then click on iTunes Help. Then on Sync your iPod, iPhone or iPad and follow the instructions.

  • I Need to know how to do this!

    I am needing to know how to do this. Is there a plugin for dreamweaver to do this, and what is this called
    At the top click on "SCHEDULE A TOUR" or "REQUEST BROCHURE" The window it opens is what I am needing to know
    http://www.thesolana.com/

    That site appears to be using Shadowbox
    http://www.shadowbox-js.com/
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics |  Print | Media Specialists
    www.alt-web.com/

  • I have an Iphone 4S and it looks like I connected my iphone to my computer and need to know how I undo this.

    I have an Iphone 4S & it looks like I connected my iphone to airplay on my computer and I need to know how to undo this.Can anyone help me?

    Getting back is hard, but go to Settings > Mail, Contacts, Calendars and under Calendars check the time for syncing...set that as far back as you can, the default is one month.

  • I just purchased photos from shutterstock and they said it will download as .eps file. They said I would need vector editor such as adobe illustrator to convert the image to a jpeg. Could anyone advise me how to do this? This is all very foreign to me. Th

    I just purchased photos from shutterstock and they said it will download as a .eps file.They said I would need vector editor such as adobe illustrator to convert the image to a jpeg. Could anyone advise me on how to do this? This is all very foreign to me.
    The Swanky Lady

    File>Open to open your eps file
    File>Export to export your image as a jpg.
    In the export dialog box just below where you type in the filename is a file type, that is where you choose jpg.
    What ever you do, do not delete the eps file. Should you ever need to access the original you will have have.
    I recommend that instead of jpg you choose psd, tiff, or png and use jpg only for sharing. Jpg is a lossy format meaning each time you edit the file and save it, the quality of that file degrades. The formats I recommend are lossless formats, you can edit them all you want no data is being discarded unless you choose to do so.

  • I am wanting to transfer sms messages to pc and print them. Can anyone advise me how to do this. i have iphone 3.

    Can anyone advise me how to transfer my sms messages onto my pc and print them out? Do i need to purchase software for this and are there any recommended? Thanks.

    You can take screen shots on your phone & email the pics to yourself, but the easiest way is to get this software, import them to your computer, then print them:
    http://www.wideanglesoftware.com/touchcopy/index.php

  • How to model this data

    In the sample data below, there are rows that contain header names, followed by a row with the data.
    The problem is that some of the "header" column values change.  They represent "sizes" boxes.
    Name | BoxType | Color | Qty | 45 | 11 | 13.5
    Compx | F | Red | 32 | 1 | 0 | 34
    Name | BoxType | Color | Qty | 75 | 11 | 12.5
    QuickMartZ | G | Blue | 68 | 13 | 7 | 77
    Name | BoxType | Color | Qty | 75 | 11 | 45
    QuickMartZ | F | Blue | 22 | 17 | 72 | 12
    How could I model this data or re-shape it into a schema such as
    Table
    =========
    AccountName
    BoxType
    Color
    Qty
    Size
    Ultimately I need to be able to extract a "rolled up" count of the boxes by size and their quantity
    Something like this
    AccountName
    BoxType
    Color
    Qty_Size1
    Qty_Size2
    Qty_Size3
    Qty_Size4
    Qty_Size5
    Qty_SizeN...

    Without some value which links the two rows together (other than the order of rows how do we know the box in the line above Compx belongs to it?) I don't think this is going to be possible as a set based solution.
    You could use a cursor to move through the rows RBAR:
    DECLARE @table TABLE (name VARCHAR(20), boxType VARCHAR(20), color VARCHAR(20), qty VARCHAR(4), col1 INT, col2 INT, col3 FLOAT)
    INSERT INTO @table (name, boxType, color, qty, col1, col2, col3)
    VALUES
    ('Name', 'BoxType', 'Color', 'Qty', 45, 11, 13.5),
    ('Compx', 'F', 'Red', '32', 1, 0 , 34),
    ('Name', 'BoxType', 'Color', 'Qty', 75, 11, 12.5),
    ('QuickMartZ', 'G', 'Blue', '68', 13, 7 , 77),
    ('Name', 'BoxType', 'Color', 'Qty', 75, 11, 45),
    ('QuickMartZ', 'F', 'Blue', '22', 17, 72, 12)
    DECLARE @name VARCHAR(20), @boxType VARCHAR(20), @color VARCHAR(20), @qty VARCHAR(4), @col1 INT, @col2 INT, @col3 FLOAT,
    @pname VARCHAR(20), @pboxType VARCHAR(20), @pcolor VARCHAR(20), @pqty VARCHAR(4), @pcol1 INT, @pcol2 INT, @pcol3 FLOAT
    DECLARE @products TABLE (name VARCHAR(20), boxType VARCHAR(20), color VARCHAR(20), qty VARCHAR(4), size1 FLOAT, size2 FLOAT, size3 FLOAT)
    DECLARE @boxes TABLE (name VARCHAR(20), boxType VARCHAR(20), size1 FLOAT, size2 FLOAT, size3 FLOAT)
    DECLARE c1 CURSOR
    FOR SELECT *
    FROM @table
    OPEN c1
    FETCH c1 INTO @name, @boxType, @color, @qty, @col1, @col2, @col3
    WHILE @@FETCH_STATUS <> -1
    BEGIN
    IF @name = 'name'
    BEGIN
    SET @pname = @name
    SET @pboxType = @boxType
    SET @pcolor = @color
    SET @pqty = @qty
    SET @pcol1 = @col1
    SET @pcol2 = @col2
    SET @pcol3 = @col3
    END
    IF @name <> 'name'
    BEGIN
    INSERT INTO @products (name, boxType, color, qty, size1, size2, size3) VALUES (@name, @boxType, @color, @qty, @col1, @col2, @col3)
    INSERT INTO @boxes (name, boxType, size1, size2, size3) VALUES (@name, @boxType, @pcol1, @pcol2, @pcol3)
    END
    FETCH c1 INTO @name, @boxType, @color, @qty, @col1, @col2, @col3
    END
    CLOSE c1
    DEALLOCATE c1
    SELECT *
    FROM @products
    SELECT *
    FROM @boxes

  • Need help on how to do this :

    This might be a little off topic, but since it
    invovles a cf app, I thought I would post here for
    help.
    The problem I am having seems simple enough, but I cannot get
    it to work.
    My form contains two radio buttons and two input
    fields.
    Button 1 corresponds to field 1 and button 2
    corresonpds to field 2.
    One of the buttons must be select and I have
    javascript to check for that. Now here is my problem :
    If button 1 is selected, then field 1 must be filled
    in, and if button 2 is selected, then field 2 must be
    filled in.
    I have javascript to check for entries in the fields,
    but I cannot seem to combine both together to get them
    to work.
    So if they attempt to submit without checking one of
    the buttons, I display an error message. If they check
    button 1 and do not fill in field 1 and attempt to
    submit, then I need to display an alert (error
    message), same for button 2 and field 2.
    Can someone please help and show me how to do this ?
    Thanks

    quote:
    Originally posted by:
    trojnfn
    Can somebody please help me with this ?
    Writing down the requirements in english is a good way to go
    about it. Reading your first post I would understand your
    requirements to be
    1. if they attempt to submit without checking one of the
    buttons, I display an error message.
    2. If they check button 1 and do not fill in field 1 and
    attempt to submit, then I need to display an alert (error
    message)
    3. Repeat #2 for button 2 and field 2
    In psuedo-code that might translate to
    if (neither button is checked) {
    display error message
    else if (button1 is checked and field1 is empty) {
    display an error message
    else if (button2 is checked and field2 is empty) {
    display an error message
    else {
    everything is okay. submit the form
    Then translate that into javascript. The code needs some
    extra work like trimming values, but its a good starting point.
    I'll leave the rest up to you.
    <script language="javascript">
    // code assumes your form fields have the unique id's
    'button1' , 'button2' , 'field1', 'field2'.
    function validateForm(buyer_form) {
    //determine if buttons 1 and 2 are checked
    var isButton1Checked =
    document.getElementById('button1').checked;
    var isButton2Checked =
    document.getElementById('button2').checked;
    //get the values of fields 1 and 2
    var field1Value = document.getElementById('field1').value;
    var field2Value = document.getElementById('field2').value;
    //if neither button is checked
    if (!isButton1Checked && !isButton2Checked) {
    alert("Please Indicate whether you wish to send a NOR letter
    to this supplier, or not");
    //if button 1 is checked but field 1 is empty
    else if (isButton1Checked && field1Value == "") {
    alert("When button 1 is checked, you must enter a value in
    Field 1");
    //if button 2 is checked but field 2 is empty
    else if (isButton2Checked && field2Value == "") {
    alert("When button 2 is checked, you must enter a value in
    Field 2");
    //if okay, submit the form
    else {
    buyer_form.submit();
    </script>
    If you haven't already, you should familiarize yourself with
    DOM javascript. Elements should have a unique ID so they can be
    accessed using:
    document.getElementById('theIDOfTheElementYouWant'); Note, element
    ID is not the same as "name".
    http://www.w3schools.com/htmldom/met_doc_getelementbyid.asp

  • I need to know how to do this PLEASE!!!

    I am very new to flash. And I really need al the help i can get to design something of this style. http://tutvid.com/tutorials/flash/tutorials/slideOutInfoPanels.php i just need to know how to have panels like that that when you click they expand. the tutorial starts after he has created this. Any help whatsoever would be greatly appreciated. AND im pretty sure its easy to do.

    In iTunes go to the Help menu in the upper menu bar.  Then click on iTunes Help. Then on Sync your iPod, iPhone or iPad and follow the instructions.

  • I need to know how to draw this in Photoshop cs5

    I need to know how to do these type arrows

    Hello!
    It seems that these lines with arrows have been drawn normally, then rotated in 3D space.
    See this help page: http://helpx.adobe.com/photoshop/using/creating-3d-objects-animations-photoshop.html#creat e_3d_objects_from_2d_images_photoshop_extended

Maybe you are looking for

  • Shuffle is not recognized by windows xp or itunes.

    I have a ipod mini that is working wonderfully but when I tried to connect my son's shuffle - nothing happened. I have reinstalled ipod software & itunes, charged and reset the shuffle - everything I could think of. I am unable to restore it because

  • Oracle VM Manager 3.1.1 build 399

    Hi All, We've released the latest Oracle VM Manager 3.1.1 patch update (build 399) to My Oracle Support. See the download instructions at OTN. http://www.oracle.com/technetwork/server-storage/vm/downloads/index.html Download Oracle VM Manager 3.1.1 P

  • IPhone video cable

    I had been using the Apple Composite Video cable to play video podcasts to my analog TV. ios6 seems to have broken this feature and all I can get out to the TV is audio. Apple's web site shows the cable compatible with iphone 4,l but i don't think it

  • Report help does not work

    We have generated a headstart online helpfile belhelp.htm All works fine when using online help with forms: the help text uses help context id and bookmarks in het htm file. Altough help text for all reports is generated in belhelp.htm, following err

  • The software that you choose does not match the Selected Printer

    Hi Friends, I am trying to install a network Printer suing my Win Xp SP3 PC. Since there is no drivers installed in this PC, I tried to select Have Disk option in the Bonjour Printer Setup Wizard and selected the INF file provided by the Manufaturer.