Matrix-like PKs based on three optional IN-constrained strings?

Hello,
I have a DB of actions that I want to represent. I want to model a number of actions as you know them from classic GUIs:
open
openFile
saveAs
exportToDirectory
reverseEngineerFromDatabase
As I analyzed the problem, I came to the conclusion, the keys above (which they ultimately are) have at least three parts:
1. an action: VARCHAR(20) CHECK (action IN ('open', 'save', 'export', 'reverseEngineer', ...))
2. a preposition: VARCHAR(4) CHECK (preposition IN ('as', 'to', 'from', ...))
3. a target: VARCHAR(20) CHECK (target IN ('file', 'directory', 'database', ...))
So the rule to construct the final key would be:
<action> + <preposition> + <target>
to model all sorts of combinations/permutations (forget about uppercasing the preposition and target if there for a moment).
As you can see from the strings, I have three dimensions of predefined values from which I construct the final key. Not every combination is possible, I want to represent valid combinations by an extra table having entries like:
INSERT INTO ValidActions ('open', '', '')
INSERT INTO ValidActions ('open', '', 'file')
INSERT INTO ValidActions ('save', 'as')
INSERT INTO ValidActions ('export', 'to', 'directory')
INSERT INTO ValidActions ('reverseEngineer', 'from', 'database')
My question is now:
How do I solve this, given that the PK is composed of ... PRIMARY KEY (action, preposition, target) ... and that an action has an OPTIONAL preposition and target? I have not come to a final decision, but I might relax the action to be optional, too, and then demand that either <action> OR <target> MUST be set.
How do I model matrix-like composed PKs consisting of a number of optionals? I currently see no other way of adding empty strings '' to the check constraint, however AFAIK Oracle does not make a difference between NULL and the empty string ''. How would such a solution look like?
I could use the final string as PK, but how do I make sure that string consists of the predefined ones only?
Karsten
PS: note action and target are actually two separate tables.

What about using a model like this? I used surrogate keys because I wasn't sure if the ACTION, PREPOSITION and TARGET values were truly immutable. You could easily remove these from the model and use the respective columns as the PK for each table.
DROP TABLE ACT_PRE_TAR;
DROP TABLE ACTIONS;
CREATE TABLE ACTIONS
        ACTION_ID       NUMBER  PRIMARY KEY
,       ACTION          VARCHAR2(15) NOT NULL
,       CONSTRAINT ACTION#UNQ UNIQUE (ACTION)
INSERT INTO ACTIONS VALUES(1,'open');
INSERT INTO ACTIONS VALUES(2,'save');
INSERT INTO ACTIONS VALUES(3,'export');
INSERT INTO ACTIONS VALUES(4,'reverseEngineer');
DROP TABLE PREPOSITIONS;
CREATE TABLE PREPOSITIONS
        PREPOSITION_ID  NUMBER  PRIMARY KEY
,       PREPOSITION     VARCHAR2(10) NOT NULL
,       CONSTRAINT PREPOSITION#UNQ UNIQUE (PREPOSITION)
INSERT INTO PREPOSITIONS VALUES (1,'as');
INSERT INTO PREPOSITIONS VALUES (2,'to');
INSERT INTO PREPOSITIONS VALUES (3,'from');
DROP TABLE TARGETS;
CREATE TABLE TARGETS
        TARGET_ID       NUMBER  PRIMARY KEY
,       TARGET          VARCHAR2(10) NOT NULL
,       CONSTRAINT TARGETS#UNQ UNIQUE (TARGET)
INSERT INTO TARGETS VALUES (1,'file');
INSERT INTO TARGETS VALUES (2,'directory');
INSERT INTO TARGETS VALUES (3,'database');
CREATE TABLE ACT_PRE_TAR
        ACTION_ID       NUMBER  REFERENCES ACTIONS(ACTION_ID)
,       PREPOSITION_ID  NUMBER  REFERENCES PREPOSITIONS(PREPOSITION_ID)
,       TARGET_ID       NUMBER  REFERENCES TARGETS(TARGET_ID)
,       CONSTRAINT ACT_PRE_TAR#UNQ UNIQUE (ACTION_ID, PREPOSITION_ID, TARGET_ID)
);Based on your sample data the following result is produced:
SQL> SELECT  ACTION
  2  ,       PREPOSITION
  3  ,       TARGET
  4  FROM            ACT_PRE_TAR
  5  LEFT OUTER JOIN ACTIONS         ON ACTIONS.ACTION_ID            = ACT_PRE_TAR.ACTION_ID
  6  LEFT OUTER JOIN PREPOSITIONS    ON PREPOSITIONS.PREPOSITION_ID  = ACT_PRE_TAR.PREPOSITION_ID
  7  LEFT OUTER JOIN TARGETS         ON TARGETS.TARGET_ID            = ACT_PRE_TAR.TARGET_ID
  8  /
ACTION          PREPOSITIO TARGET
open
open                       file
save            as
export          to         directory
reverseEngineer from       database

Similar Messages

  • My iTunes will ONLY backup my iPhone ONCE *SO* VERY quickly, almost as if it's done nothing... (not the three options for rollback as promised) HELP! Please Read...

    Hi there,
       thanks in advance for any help you can give me on this, but, my iTunes will perform a backup on my iPhone ONCE. By which I mean, it will do another new backup again if I want it to, and that's all fine... but it's supposed to hold (I think) THREE states of backup that the user has saved at various points in order that the user can choose and rollback/restore from whichever one they want.
    There is none of that. I get the drop-down menu if I choose to restore... but it's pointless as there's only ever one option.
    At the moment, no matter how close together I perform the backups, or how far apart... I get ONE backup saved in my iTunes.
    As far as I can tell this is also ONE backup between iCloud or the computer. i.e. I don't get one for each. Just whichever I performed most recently.
      iTunes absolutely DID NOT used to do this. I used to get the three options and it took a little bit of a wait for the backup process to go through fully.
      Can anybody help or shed some light on this?
    As a sidenote: It's slightly concerning that the backup process it performs is now lightning quick and it almost seems as if it's doing nothing, when in fact my iPhone is absolutely, irresponsibly rammed with everything... hence the worrying need for backups and solving this issue etc. etc.
      Please can anyone help me with this, or even give a little support?
    P.S. Yes, I fully anticipate being told not to have my iPhone so stuffed etc. etc. It's got about 1-2gb free and I figure you should get to use what you pay for
      Thank you so much in advance.

       I have to say, this is so weird because it's actually become this way in the past week maybe, and I'm sure me saying this here will be disputed, ridiculed and belittled, and that's absolutely fair, but I've got to say it... up until a few days ago, my iTunes sync/backup area really would keep more than one backup for my one, single iPhone. They were all timed and dated with a drop-down menu (which appeared if I clicked the restore button) to choose which one I wanted to roll back to, for example. Sure, I'd read about the three backups thing etc. etc. and perhaps I got that wrong or misunderstood, but I can honestly say, I only ever had at the most two backups, that I could drop-down and choose to restore from. They were there. Same iPhone. Different dates.
       At the time, when this seemed to be the case, the backing-up process took quite a while. I would leave it to progress while I went and made a cup of tea, come back and it still wasn't finished running. So, not really AGES, but a little while.
       Now, when I perform a backup, the progress bar almost shoots across to a finish. I'll 'fess up... that worries me most of all. I can live without the luxury of a menu of backups... but if it does it once, I'd like to be sure it does it at all.
    Much more importantly though, thank you for your replies so far.
    Any further input, even if it's to belittle or shame is totally welcome. I'd like to understand this a bit more.
    Thanks again.

  • How do I create a dropdown with three options so that only one is visible in a form (non-flowable)

    I'm working on a form which needs to provides three options for the user out of a drop down list. When the user chooses one option, only that subform is to be visible. Two of the three subforms are text fields, and the third subform is a series of fields which are editable by the user.
    How do i create a dropdown with three options in it, so that in each instance only one subform is visible? This needs to happen in the same space on the main form.

    Hi Nellie,
    Here is the form back to you. There were three main issues:
    In order for dynamic behaviour, like showing and hiding, the form must be saved as a Dynamic XML Form in the save-as dialog.
    While you can use a minus sign when naming objects and subforms, it will cause scripts to fail. I have changed the name of the subforms so that they now use an underscore.
    The dropdown had specified values in the Object > Binding palette (1, 2, 3), so the script needs to use these in the if statements.
    When sharing forms on Acrobat.com, the best option is to select the file in your workspace and then click Publish. This will make it available to anyone who has the published URL.
    I hope that helps,
    Niall

  • Manage User Matrix Like System Matrix

    Greetings Experts,
    Environment: B1 2007A, C#
    I have created a UD matrix on a UD form. I want to handle that matrix(and the table it is bound to) as if it were a child of the Service Contract form/table. This would mean that my user defined matrix would have a many-to-one relationship to the Service Contract number. BUT, how do I manage this? How can I make the Service Contract number relate to my UD matrix records and "limit" what I see on that matrix like the parent-child system objects do? Is this even possible with UDOs?
    Please let me know if you need more explanation.
    Thank you.
    Edited by: Lock45 on Jul 6, 2010 5:42 AM
    Edited by: Lock45 on Jul 6, 2010 5:43 AM

    Hi
    Do you want to open and insert data manually in your UD matrix and here you want to relate the service no. or when adding a service document you want to insert data automatically in your UD matrix ?
    you can have a field at the header of your form and open the service documents based on your condition and select the service no. and then insert data into your matrix..
    Regards

  • Issue while populating a Transient VO based on three VO's

    Hi,
    I have transient VO which is being populated based on Three SQL based VO. Each VO returns a Column and all these three columns needs to be shown as a table in UI.
    I populated a TransientVO by iterating the the Three VO's since the number of Rows returned are always finite (12).
    I dragged an dropped the TransientVO as a ADF Read Only Table.
    On click of a Button in UI I am executing an AMImpl method which populates the TransientVO.
    Issue which I am facing is ..
    even though the 12 Rows gets populated in TransientVO, I am able to see only 11 Rows in the UI and 1st Row is always Null,
    Please find my AMImpl code snippet below which I am using for Populating the transient VO.
    sqlVO1.reset();
    sqlVO2.reset();
    sqlVO3.reset();
    TransientVO.reset();
    for (int i =0 ; i < 12; i++)
            row1= (Past12InventoryVORowImpl) sqlVO1.next();
            row3 = (Past36InventoryVORowImpl) sqlVO2.next();
            row2 = (Past24InventoryVORowImpl) sqlVO3.next();
            transientVoRow = (InventoryGridTransVORowImpl)TransientVO.next();
            if(row1 != null && row2 != null && row3!= null && transientVoRow!= null){ 
             transientVoRow.setPeriod(row1.getMonth());
             transientVoRow.setPast12SalesAmount(row1.getSalesAmount());
             transientVoRow.setPast24SalesAmount(row2.getSalesAmount());
             transientVoRow.setPast36SalesAmount(row3.getSalesAmount());
             transientVoRow.setPast12SalesCount(row1.getSalesCount()); 
              transientVoRow.setPast24SalesCount(row2.getSalesCount());
              transientVoRow.setPast36SalesCount(row3.getSalesCount());
    }}Please let me know is there a better way of doing this ? Also I want to know is it possible to have a dynamic table in which each columns are referencing to different ViewObjects. like in my case
    I want a Table a to have some sets of columns from 3 Different VO.

    Hi!
    I don't think it's possible to bind one table to multiple VOs. A binding uses one iterator (binding), and one iterator means one VO.
    I understand that your transient VO is shown in the UI as a table.
    The reason for the empty row is that TransientVO.reset() does not really reset the iterator, since the iterator binding immediately navigates the default RowSet iterator's currency back to the first row after the reset.
    So if there's a binding on a VO, you can no longer reset the default iterator to the slot before the first row.
    In order to populate your table in code, you should create a new RowSetIterator (which automatically is on the slot before the first row), then use that iterator to navigate over the rows, and then remove the RowSetIterator again.
    Something like:
    RowSetIterator transientIter = TransientVO.createRowSetIterator( null );
    while( transientIter.hasNext() ) {
       transientVoRow = (InventoryGridTransVORowImpl)transientIter.next();
       // fill row
    transientIter.closeRowSetIterator();Sascha

  • Im trying to install windows 7 in on my macbook pro, i thought it just install like intel based PC, so i use windows 7 DVD, i format the harddisk, and installation failed. When i reboot, OS X is missing, because i've format my harddisk. So what should ido

    Im trying to install windows 7 in on my macbook pro, i thought it just install like intel based PC, so i use windows 7 DVD, i format the harddisk, and installation failed. When i reboot, OS X is missing, because i've format my harddisk. So what should i do to make my MBP is with windows 7

    Thanks for all of your help!  Big time!
    Guys, I been in the business working on PC and MAC for years. So I am not green at this, I was looking for some kind of option to get past the boot loader..  Which is failing. 
    I know how to boot into these modes.. Done tons of research before posting and couldn't find anything.
    It will not go into  Internet Recovery, or any thing else.  I hear the sound .. then that is it.. I get nothing else..
    I have tried clearing the NVRAM which is Option + Command + P + R
    Still nothing..
    So I thought I would try here to see if maybe there was some trick out there someone might know of that would work.
    What else guys?  I am hitting th keys right..

  • I have an Acrobat 8 which is all I need.  Installed on my new computer which is using Windows 8.  Each time I open Acrobat I get a window that say unable to registrator.  It gives me three options try again, redo, never register.

    I have an Acrobat 8 which is all I need.  Installed on my new computer which is using Windows 8.  Each time I open Acrobat I get a window that say unable to registrator.  It gives me three options try again, redo, never register.  No matter which option I choose I cannot stop the window from opening each time I open the computer.
    Any suggestions?

    Probably far too old to register. Sounds like a bug, stopping the "never" selection from working. You may be stuck with it.

  • How i can "apt-get autoremove" and "autoclean" like debian based?

    hi, i would like to know how to do "apt-get autoremove" and "apt-get autoclean" like debian based linux in arch for cleaning the system?
    thanks you for this community....

    BTW: With Arch, you don't have to! (TM) Or that's the impression I have anyway. See the remove options, there are flags which basically allow you to remove 'unneeded' stuff -when- it becomes unneeded.
    For example:
    Debian:
    apt-get install sniffles - also installs libsniffle, libsniffle-dev
    apt-get --purge remove sniffles - leaves libsniffle, libsniffle-dev which then have to be removed via autoremove. I'm not sure under what circumstances this won't even work and you'll end up having to use deborphan or somesuch
    Arch:
    pacman -S sniffles - also installs libsniffle, libsniffle-dev
    pacman -Rcns sniffles - also removes libsniffle and libsniffle-dev
    Perfect operating system:
    <package manager> <install option> sniffles - laughs and blames it on temporary insanity that you'd want to install anything having anything to do with sniffles.

  • How can I make a new genius mix? Apple has made two automatically, but I would like one based on other genres within my iTunes library. I have tried updating my genius mixes to no avail.

    How can I make a new genius mix? I do not want to make a genius playlist. Genius has already created two mixes but I would like another based on other genres within my extensive music library. I have tried updating Genius from Store>Update Genius but to no avail. Thank you!

    Hi. The two user tips both describe a sequence of steps that should get your library from the point where it threatens to wipe data from your device to where it is syncing normally, while recovering as much information as possible. It may still be necessary to wipe and reload the device but this should only take place once all the data that can be recovered has been recovered.
    Doing step 1 of 8 and then complaining things aren't the way you want them to be yet strikes me as premature...
    Since you appear to have all your media content, and we are discussing an iPod classic, not an iOS device, the main worries are already taken care of. What's left is ratings, playcounts, playlist membership and checked status. Since your device holds only part of your library at best you could only recover the missing data for the content that is on the device using third party tools.
    Recreating the previous checked/unchecked status of every track in your library from where you are now may not be that easy. Syncing with selected playlists has many advantages, one of which would have been that you would have a named playlist that could have been retrieved by 3rd party software if you had used this method.
    You haven't explained what caused your problem in the first place, but if you have a Previous iTunes Libraries folder holding old copies of your iTunes database (generated with each iTunes update) then it would be possible to restore the most recent of these and then update the library with any changes in your media folder.
    BTW Apple doesn't offer free support for this kind of issue with iTunes.
    tt2

  • How do I view and open all my files again that are on my external hard drive?? Error message saying 'The disk you inserted was not readable by this computer' Three options are Initialize, Ignore or Eject.

    I have recently purchased Toshiba 1TB hard drive and I set it up and I was able to transfer all my files onto it such as my music, photos, documents. I had correctly ejected and used it again and all these files were safely stored and accessible afterwards. However after I rebooted my computer as it had been going slow and I had too much clogging it up once I reconnected the external hard drive I have error message saying 'The disk you inserted was not readable by this computer' Three options are Initialize, Ignore or Eject. How do I access all my files? I set it up to work on both mac and windows. I have tried both another mac and windows computer and same issue occurs?? I am worried that all my personal files are gone but am confused as the drive has had absolutely no damage to it as it was in a very short time frame and its never left the same spot. Any help would be greatly appreciated. Thanks

    Thanks for your quick response. I had a look at your discussion... I tried it on a Windows machine and I thought that was compatible with ExFAT?
    Therefore I need to attempt to use my external hard drive with a machine that boasts OS X 10.6.5 or above and then it should work?
    Thanks

  • Deleting duplicate rows based on three columns in Oracle 8i

    Hi all,
    The database we use is Oracle 8i.
    The query below raises the too_many_rows exception when I launch an application. So I want to delete the duplicated rows :
    select polarisation_1, polarisation_2
    into v_pol1_tech, v_pol2_tech
    from v_cfh_lien_element
    where nom_lien = p_nom_lien
    AND num_canal_1 = p_num_canal_1
    AND freq_emise_1 = p_freq_emise_1;
    Notice that with many possible values of the parameters p_nom_lien, p_num_canal_1 and p_freq_emise_1 then the exception is raised.
    So how to delete generally the duplicated rows based on the three columns "nom_lien" , "num_canal_1" and "freq_emise_1" ?
    Thank you very much indeed.

    Check the other thread with same question deleting duplicate rows based on three columns in Oracle 8i

  • Itunes in my Ipad only gives me three options: itunes U, Podcasts and download. What do I do?

    iTunes in my iPad only gives me three options: iTunes U, Podcasts and downloads (which, by the way, doesn't go beyond the terms and conditions). How do I get the rest of the options?

    Well, Meg, I'm more than sorry too. It is not our intention to violate any terms. We are only trying to find a viable and legal way to be able to enjoy the full potential of our iPad and, of course, pay for it as expected. Even when I'm at fault for not doing some research before buying it, it is certainly unfortunate to discover that we won't be getting our money's worth after all. If you ever hear about this limitation changing, please, let me know. Thank you for all your help.

  • Hi, I want to have my phone "on ring" so my alarm will go off (have one set every night) but I DON'T want it to ring (just vibrate). It seems like there is no "none" option of Ringer. Anything I can do?

    Hi, I want to have my phone "on ring" so my alarm will go off (have one set every night) but I DON'T want it to ring (just vibrate). It seems like there is no "none" option of Ringer. Anything I can do? So basically it seems my options are 1. silence the entire phone therefore also silencing my alarms OR 2. Leaving the ringer on low, putting all other notifications to vibrate, yet the ringer is STILL on. That's annoying!

    The alarm will ring even if the switch is on Silent.

  • I recently bought a new macbook and installed Acrobate Pro. My settings/preferences did not come over and I do not have the same style options for my signature.  It now only allows me three options and the style I have been using for the last year is not

    I recently bought a new macbook and installed Acrobate Pro. My settings/preferences did not come over and I do not have the same style options for my signature.  It now only allows me three options and the style I have been using for the last year is not there.  How do I add additional options and get my preferred signature style back?

    Hi Amanda ,
    Which version of Acrobat are you using?
    Which signature style are you talking about?
    You can go ahead and try uninstalling and reinstalling it and see if that works for you .
    Use the cleaner tool to uninstall it .Here is the link.
    Download Adobe Reader and Acrobat Cleaner Tool - Adobe Labs
    You can refer to the following link to re install it .
    https://helpx.adobe.com/acrobat/kb/acrobat-downloads.html
    Regards
    Sukrit Dhingra

  • Would like to see a language option added to the app search filter.

    Who would like to see a language option added to the app search filter?

    You can provide feedback here
    http://www.apple.com/feedback/

Maybe you are looking for

  • AM extension:Problem in Lov.

    Hi Experts, I did an extension for the Main AM of the page..After get extended except Lov's Everthing is working fine. Please let me know whats the problem for lov's after extend the AM. is there any solution to resolve this. Thanks Bharat Hegde

  • What was wrong with OS 10.5 airport settings

    I'm wondering what was specifically wrong with the networking built into 10.5. I noticed that one of the fixes says "Improves compatibility with third-party wireless wide-area network devices". What compatability issues did they resolve?

  • Need Clarification on Account Managing in Azure

    Hello Pro's, Need your help in knowing the details of managing accounts and subscription. I have an azure account maintained under pay as you go model running projects for two different customer with single subscription. Now I have to separate them w

  • Compiling SWC Problem

    I have been for the life of me trying to compile my custom AS3 classes into a SWC. But following the instructions to make a Flex Library Project into a SWC doesn't work. I get no error message or anything, The SWC just doesn't compile into the bin fo

  • HT4528 I preordered the iPhone 5 when will it be on my door step?

    When will it be here I'm curious I pre ordered it last Friday