Mapping elements of VRA to a number

hi,
My project involves maintaining the database for a bus company.
Each bus_route is divided into regions. Each bus-stop on a route maps to a region.
eg. bus-stop numbers 1,2,4,5,6,8 map to Region 2.
I was thinking of having a table regions with the following structure:
create table regions
Region_id NUMBER,
route_id VARCHAR2(20),
bus_stops stops_va
INSERT INTO regions VALUES(2, '459UP', STOPS_VA(1,2,4,5, 6, 8));
However, given a route_id and bus-stop number determining the region is a little tedious involving
looping through the varray elements of all rows with given route_id.
Is there an easier and more efficient way of doing this?
Amina

Amina
You may find it easier to stick to a relational model if you want to be able to query rapidly:
Region ---< Stop ----<Route-Stop>----- Route
Route-Stop represents the M:M relationship between Route and Stop. I'm assuming that a Stop is always in the same Region (for all the bus routes that use the stop). Assuming your bus company works like the London Underground (stop = station) then for example
Stop "Victoria Station" is in region 1;
It is on 3 lines (District, Circle, Victoria Line)
It is stop #4 on Victoria Line; (counting from Brixton)
It is stop #12 on District Line; (counting from Ealing Broadway)
It is stop #8 on Circle Line (counting anti-clockwise from Edgeware Road)
(see map at http://www.tfl.gov.uk/tfl/pdfdocs/colourmap.pdf). Actually, for timetabling purposes its on at least 10 lines (Circle line both ways, Victoria line both ways, District Line both ways to each of Wimbledon, Richmond, Ealing ...)
I'm presuming that the Route-Stop would have a stop_number (start to finish of route).
So if you want to list out a bus route from beginning to end:
select rt.route_id, rt.route_desc,
st.stop_id, st.stop_desc,
rs.stop_number,
rg.region_id, rg.region
from routes rt
inner join route_stops rs on rs.route_id = rt.route_id
inner join stops st on st.stop_id = rs.stop_id
inner join regions rg on rg.region_id = st.region_id
where rt.route_id = :my_route
order by rs.stop_number
route_stops has columns (route_id, stop_id, stop_number); the PK is all the rows together; you could make this an index organised table.
Having a relational structure makes it easy to query from any viewpoint; eg if you want to print timetables for a specific bus stop, you easily could...
Failing that, if you really want to pack the route into a nested table (and you've realised that it can be inconvenient) then it's the M:M relationship that wants to be nested. The 'route-stop' table should be nested into the routes table, not the regions table. Essentially, the stop is a more or less permanent fixture; routes may change; you can regard the sequence of stops as a (list) attribute of the route (if the route is axed, the sequence of stops is axed too). When you change a route, you change the list of stops. You'd want to edit one row in routes, not every combination of region/route. Your proposed table means that a route crossing regions would have several rows in the 'regions' table - not very well normalised :-)
HTH, but let me know if you want more information on manipulating nested tables in a relational way
Regards Nigel

Similar Messages

  • I have a Windows copy of Photoshop Elements 11, but the serial number has been lost. I didn't buy the product and I am unable to find the box. As far as I know, it's never been used so has not been registered. Does anyone know how the serial number can be

    I have a Windows copy of Photoshop Elements 11, but the serial number has been lost. I didn't buy the product and I am unable to find the box. As far as I know, it's never been used so has not been registered. Does anyone know how the serial number can be recovered under these circumstances?

    If you never bought the product then you cannot get the serial number.

  • Good afternoon.I have a computer with W Vista 8, Windows office home and business 2013. I recently tried to install Photoshop Elements by CD with serial number but on the desktop appears the following message: error 1 (configuration problem) try to uninst

    What's error 1 in adobe photoshop elements configuration? I have a computer with W Vista 8, Windows office home and business 2013. I recently tried to install Photoshop Elements by CD with serial number but on the desktop appears the following message: error 1 (configuration problem) try to uninstall and reinstall. I have done this but the message continues to appear

    You haven't mentioned which version of PSE. If it is PSE 13, that requires a minimum of windows 7.

  • Maintain default cost element in controlling area Message number FI660

    Hi All,
    We found the Down Pay Request (doc. booked by F-47)  cannot be picked up by F110. In Job log the error shown as Maintain default cost element in controlling area.
    Long text error details.
    Maintain default cost element in controlling area
    Message number FI660
    CO down payment update is active in controlling area WAPC. You  must  therefore maintain a default cost element and a revenue element  for down payments.
    Maintain the default cost element for dow payment for controlling area in the project system implementation guide.
    Kindly advice.
    Note
    In the define dafault cost elemens for down payments in Project system-OKEP  the CE for vendor and cusotmer downpayemnt  is missing

    hi srinivas
    OKEP configuration is necessary
    if while creating down payment request you have not assigned cost element
    maintain cost elements there.
    regards
    rohit

  • I UPGRADED TO WIN 8, CAN'T FIND MY ELEMENTS 8 DISC OR REGISTRATION NUMBER. CAN YOU HELP PLEASE?

    UPGRADED TO WIN8, CANT FIND ELEMENTS 8 DISC OR REGISTRATION NUMBER. CAN YOU HELP PLEASE?

    if you follow all 7 steps you can dl a trial here:  http://prodesigntools.com/direct-download-links-for-lightroom-3-and-photoshop-elements-8.h tml
    and activate with your serial.
    if you have a problem dl'g, you didn't follow all 7 steps.

  • env-entry-mapping element is removed during deployment process

    I overwrite the variable value defined in ejb-jar.xml by the one defined in orion-ejb-jar.xml using <env-entry-mapping> element. But after my appliocation has deployed I don't find this element in the application orion-ejb-jar.xml. Oracle AS just removes this element from the descriptor!
    ejb-jar.xml:
    <env-entry>
    <env-entry-name>server</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>172.38.48.12</env-entry-value>
    </env-entry>
    orion-ejb-jar.xml:
    <session-deployment name="Inventory" max-instances="-1" location="Inventory">
    <env-entry-mapping name="server">dummy</env-entry-mapping>
    </session-deployment>
    Can anybode help?

    Avi!
    Of course, I had tried it before I wrote the question. I put the modified xml file into the application area. After that AS restarts OC4J instance. And then I find my xml without any changes I made! I tried to do the same thing from the AS console. The same!
    Leonid

  • A mapped elements relationship with other elements cannot be preserved

    Hi,
    I am trying to create an XML file from an XSD using excel macros and data from excel worksheet. The mapping takes place fine. However, when I try to save the mapped items into an XML file using SaveAsXML function, it gives me the following reason why the
    XML is not exportable:
    A mapped elements relationship with other elements cannot be preserved
    Could someone please help is resolving this issue?
    Thanks

    Preamble: I am not a specialist, on the contrary. I discovered xml a few days ago trying to submit returns based on two quite different compulsory xsd schemas established by local authorities. So this note has no other pretention than
    to try to help others starting from same level.
    The plus: I discovered I could do it (with limitations) from Excel 2010 by attaching the provided xsd and mapping the relevant fields to excel data cells. This is reasonably described on MS sites & elsewhere, although the MS tutorials
    do not focus on this particular objective, which is important as authorities are using more and more XML to expect returns.
    The minus: I stumbled across stupid issues (in fact pulling my hair...), which could be better highlighted in MS doc for the newbies like me, because at that stage of knowledge and on your own, all seems unsurmountable. When Excel gives
    the error messages, there is little indication on why and where the error occurs. My two common errors difficult to debug:
    1. Denormalized data error
    2. Relationship cannot be preserved error
    What I was doing wrong for the first xsd then even for the second by accident:
    1. In error, I was mapping an element occurring max once in the XSD schema to an element in an "Excel Table" (the “new” table formatting available in Excel 2010). I solved this by de-mapping the culprit element, converting the "Excel Table"
    to ordinary ranges using the button provided in the ribbon for this, and re-mapping. From there, (nearly) each time I was mapping a new element / attribute to a cell in the worksheet, I used the button "Verify map for Export" giving me debugging message soon
    enough before mapping the whole data set and finding it was wrong a bit late and not knowing exactly where it started to go wrong. Also, for the repeating component, I had set manually the Excel table for the whole recursive element beforehand as I found out
    that when using the dragging process, the results could be random (some attributes in the table, others in other tables resulting in errors type 2 relationship).
    2. Relationship error is a more nagging issue as it seems to relate to a structural limitation of this Excel 2010 export mechanism. Flattening a database with several depth levels (list of lists) is not trivial, so Microsoft stipulates
    a bit buried in notes while it should be in bold at the top that Excel (which version? also 2013?) "does not support recursive structures that are more than one level deep". Happily, while the xml schemas I had to follow where providing for several levels
    deep (3 in my case), I needed only one for both xml files.  So, I copied the “too complex” xsd schema, updated it manually to suppress 2 levels. I remapped and tested. The error messages had gone. I exported. Then, I had to simply add the
    previously deleted opening & closing tags manually using a free editor (Vim with thanks to that author).  
    But unless my understanding is wrong, which is quite possible, readers should understand that this documented limitation can become a structural stumbling block if they need absolutely recursivity with more than one level depth (list of lists). So, if
    I can do it in Access from a DB (I still need to find out how & forum guidance is more than welcomed), this will be my future way to explore.
    To finish, I validated the exported xml against the compulsory xsd schema using the online tool provided free by CoreFiling to ensure basic formatting mistakes had not been committed before submitting the returns for online validation
    by Authorities application. I have MS Visual Studio Express installed which may help as well but I don’t know how to use it for this.
    NB: I found also easier to copy (dragging top of the xsd tree) all the xsd elements /attributes in bulk from the xsd schema from the box on the right to a worksheet. While results would not be useable “as is” to map (it would most probably
    give errors), at least, it provides a good initial template with the right headings for all the elements / attributes facilitating restructuring (occurring once, elements part of a recursive table) then map properly and reasonably fast. Before doing this,
    I was copying manually the xml headings from the Word documentation provided by Authorities, which worked but was more cumbersome and risky.
    Conclusion
    I had never read about xml before (just heard often about it). It took me around 6-7 hours to learn some critical basics about it and about these specific xsd schemas. With a few trials & errors, I could use Excel 2010 to produce the
    xml files required for the two schemas I needed. The great advantage compared to an online submission of data to Authorities is that it a process easy to repeat quietly at work (or at home) and enabling to check peacefully and thoroughly the xml data files
    before submitting them.  If wrong submissions have been made, it enables automated corrections much easier as well. It is within reach for users with reasonable but not outstanding Excel / Xml knowledge but it requires some initial time investment.  
    Hope this saves time for others.
    acontrario
    Brussels

  • Where can I find a mapping of the Mac Powerbook version number (e.g., 3.1) to the dates (e.g., "late 2007") that Apple uses for indicating compatibilty with OS upgrades?

    Where can I find a mapping of the Mac Powerbook version number (e.g., 3.1) to the dates (e.g., "late 2007") that Apple uses for indicating compatibilty with OS upgrades?

    There were no PowerBooks made in 2007. By then Apple had switched over to Intel and they were making MacBook instead.
    If the MacBook is what you really want try http://en.wikipedia.org/wiki/MacBook
    Allan

  • Buy adobe photoshop elements 10 Itunes under order number MHMKW49V6Q the March 3, 2013 and is in German language and can not switch to English

    Buy adobe photoshop elements 10 Itunes under order number MHMKW49V6Q the March 3, 2013 and is in German language and can not switch to English

    The Adobe distributor for Croatia is:
      HSM Informatika
    Grada Mainza 19
    Zagreb 10000
    Croatia
    Tel: +38513908930
    Fax: +38513758850
    There is a download store for Eastern Europe:
    https://store2.adobe.com/cfusion/store/html/index.cfm?event=displayProduct&categoryOID=703 2501&store=OLS-EU

  • I bought adobe premiere elements 12 and my serial number doesn't work

    i bought adobe premiere elements 12 and my serial number doesn't work

    anthony2504
    Did you just purchase Premiere Elements 12 - online download or installation disc?
    Was the program ever installed by you a while back and are you trying to reinstall it now?
    Are you sure that you are working with the serial number and not a redemption code?
    http://helpx.adobe.com/x-productkb/global/redemption-code-help.html
    When working with downloads and installs, please work with antivirus and firewall(s) disabled.
    Please review and consider, and then we can decide what next.
    Thank you.
    ATR

  • Can i install my photoshop elements 10 using my serial number

    can i install my photoshop elements 10 using my serial number if i dont have a dvd drive on my computer?

    It depends on which region you are in?  I am also assuming you are trying to install the trial version using your serial number?  Finally I would also assume that your computer meets the minimum system requirements?

  • How can i download photoshop elements and premiere elements 10 using the serial number not the cd?

    How can i download photoshop elements and premiere elements 10 using the serial number not the cd?
    I tried downloading the trial elements 11 and entering the serial number but it wouldn't work, i cannot find a trial for elements 10.
    Thanks

    http://prodesigntools.com/photoshop-elements-10-direct-download-links-pse-premiere-pre.htm l
    Follow the instructions on that page carefully before you click the download link.

  • Just bought Elements 13. Input serial number (starting 1057), which is not recognised and the installation stalls here. Urgent help please...

    Just bought Elements 13. Input serial number (starting 1057), which is not recognised and the installation stalls here. Urgent help please...

    Maryrhire910 I am sorry that you are facing difficulty downloading and installing Photoshop Elements 12.  Are you downloading the installation files from Download Photoshop Elements products | 13, 12, 11, 10?  If so what specific error are you receiving?

  • I can't get past the "redemption" phase in Elements.  I enter the number I got from Amazone, where I downloaded the program, but Adobe tells me it's incorrect.  Help!

    I can't get past the "redemption" phase in Elements.  I entered the number I got from Amazon, from where I downloaded the program, but Adobe tells me the number is the wrong code.

    Hello,
    because you did purchase your product from Amazon, you didn't get a serial number, only a code with which you can request a serial number from Adobe. Please have a look at http://helpx.adobe.com/x-productkb/global/find-serial-number.html. (Start here: How did you purchase your product?)
    The following part, so I just see at least, ceased to exist on my Adobe website, everything takes place in the link from above. I leave it as an info yet, it might still fit for you. For this purpose, please click your way through to your Adobe Store and find the button "Get Serial Number". Fill in the form and after a while you will get the real serial number.
    Good luck!
    Hans-Günter

  • Classifier mapping to read Sender & Receiver  Identification Number from XML. How to handle in B2B Add on

    In current See burger tool, We have this functionality to read Sender and Receiver Identification number from the XML. Is there any way in b2b add on to do this.

    Hi,
    The classifier within the Seeburger context is being used to call your parent mapping, in case you want to dynamically determine your mapping, based on data in the UNB/UNH segment.
    Within the B2B add-on, there is no need to.
    Only use module localejbs/EdifactConverterModule in case you want to convert to or from EDI.
    You have a specific requirement or do you want to test something out?
    Kind regards,
    Dimitri

Maybe you are looking for