Use the attribute as a set of data and analysis of these data

Hello world
I present below a challenge (a little) with the use of attributes in XQuery. Consider the following XML document:

< showroom >
< car id = "1" >
< name > Clio < / name >
< family > Renault < / family >
< / car >
...
< id car = "n" >
< name > Q5 < / name >
Audi > family < < / family >
< / car >
< / showroom >

Each customer of the showroom is identified by a unique Id (for example, 1,2,3,...). Then, I want to add some data to my XML document that must represent, for each car, all of the IDs of all the customers who have rented this car.
The desired XML document might look like this:

< showroom >
< car id = "1" >
< name > Clio < / name >
< family > Renault < / family >
+ * < history > * +.
+ * < client id = "2" / > * +.
+ * < client id = "23" / > * +.
+ * < / history > * +.
< / car >
...
< id car = "n" >
< name > Q5 < / name >
Audi > family < < / family >
+ * < history > * +.
+ * < client id = "56" / > * +.
+ * < / history > * +.
< / car >
< / showroom >

However, using elements to represent the historic location, size of the document will increase considerably.
As I only use IDs of the IEN, y at - it a way to represent historical data using only the attributes? +.
In the following document, id of the IEN are represented, as a whole, through the +@history+attribute:
< showroom >
< car id = '1' history = '2.23' >
< name > Clio < / name >
< family > Renault < / family >
< / car >
...
< id car = history of "n" = "56" >
< name > Q5 < / name >
Audi > family < < / family >
< / car >
< / showroom >

However, y at - there no way to check if a given id = 'x' car was rented by a customer Id = 'y'? +.
Does anyone know how to represent historical data (sequence of identity of customers), using only the attributes and how to search for a given id of customer as explained above?
Please suggest. I appreciate your help.

OK, I thought that you already have a document that stores the relationship between customers and cars.

Here is an example that will insert or update the attribute of history:

let $carId := 3
let $clientId := 56
return
 copy $doc := fn:doc("c:\dev\xml\showroom.xml")
 modify (
  for $i in $doc/showroom/car
  where $i/@id = $carId
  return if (exists($i/@history))
          then replace value of node $i/@history with concat($i/@history,",",$clientId)
          else insert node attribute history {$clientId} into $i
 )
 return $doc

However, if we are reasoning in terms of standardization, it is better to have these relationships stored as separate elements, be it in the showroom or another XML document. Then you could simply perform a join or use a nested FLWOR expression to retrieve historical data.

To check if the attribute contains a given customer id:

let $carId := "3"
let $clientId := "56"
let $doc := fn:doc("c:\dev\xml\showroom.xml")
return fn:exists(fn:tokenize($doc/showroom/car[@id=$carId]/@history, ",")[.=$clientId])

She will return a Boolean value.

Published by: odie_63 on March 8, 2012 20:19

Tags: Oracle Development

Similar Questions

  • Find the median of a set of data

    I have a table that looks like this:

    Range

    Set of data: range values

    Data set b: range values

    0.00 - 0.99

    35

    67

    1.00 - 1.99

    35

    40

    2.00 - 2.99

    49

    54

    3.00 - 3.99

    41

    45

    4.00 - 4.99

    36

    38

    5.00 - 5.99

    31

    34

    6.00 - 6.99

    22

    29

    7.00 - 7.99

    30

    20

    8.00 - 8.99

    24

    16

    9.00 - 9.99

    16

    11

    10.00 - 10.99

    15

    10

    11.00 - 11.99

    12

    5

    12.00 - 12.99

    11

    1

    13.00 - 13.99

    5

    2

    14.00 - 14.99

    5

    1

    15.00 - 15.99

    2

    0

    16.00 - 16.99

    1

    0

    17.00 - 17.99

    2

    0

    18.00 - 18.99

    1

    0

    How can I find the median interval for each set of data (A and B)?

    Thanks for your help!

    Median and range are two different things from what I remember. Can you please send a link to a Web site that could describe what a "median line"?

    Median is the average of a set of data (even counting data sets usually take the average < average > the values of two intermediate points)

    Range is simply the max - min.

    Jason

  • Can you use the color picker when setting gradients in Illustrator?

    I am able to set up a custom in Illustrator without any problem gradient, but I wanted to know if there is a way to use the color picker when setting your custom colors or if you are limited to a narrow bar of color (which has all the colors but feels harder to use for me)?

    Click color to change in the Panel degraded stop / palette. Then, double-click on the fill area at the bottom of your tool palette/Panel. Who should bring up the color picker and color you choose apply until stop in the gradient you had clicked.

    Alternatively, double-click the area fill with nothing selected to bring up the color picker. Choose your desired color, and then drag the color from the fill box to the Swatches palette/Panel to create a new shade. Later, with the gradient panel/palette active, you can drag samples directly on the steps of color to change your gradient.

  • Use the listbox control to select several channels and display on the chart

    Hello everyone!

    I have a problem using the ListBox selection mode 1 or mode items. I have 6 channels of data, and I have a 2D chart. I am able to reterieve the signal names in the list box, but I want to be able to choose one or more signals to display on the chart. I used the table to index my 2D data are connected and then the output of the index table is connected to the graph. I had to use the listbox control as an index for the table to index and display the data in the index selected for display on the chart. I used lisbox as the value property nodes, the line active and all but not able to display signals on the graph. I have attached a code example to show you what exactly I'm looking.

    Any suggestions will help a lot.


  • I want that my users who log on to the virtual remote desktop to use the one I put in this image and not their local keyboard

    Original title: the remote keyboard language

    Hello

    I connect to a remote virtual desktop. My local computer uses a different keyboard language than the remote.

    I want that my users who connect to the virtual remote control to use the one I have set myself in this picture and not their local since keyboard only supports us that we provide in the virtual, not on their local machine.

    I've tried the "Reg" IgnoreRemoteKeyboardLayout key, but I've been the opposite. Who closes?

    Is their a way to force the RDP to use the remote keyboard and not local?

    Thank you

    Hello

    Thanks for posting your query in Microsoft Community.

    I understand you have questions using the remote keyboard on the Windows computer. So, please follow the link below to post your query in the Technet forums, because they have more expertise on this issue.

    TechNet forums

    http://social.technet.Microsoft.com/forums/Windows/en-us/home?Forum=w7itpronetworking

    I hope this helps.

    Thank you

  • When I use the selection tool to move vector points and fold the edges, I see that the change in metal frame.

    When I use the selection tool to move vector points and fold the edges, I see that the change in metal frame.  Once I commit by letting go of the mouse button, the object changes.  It presents a preview just with a wire frame. I would like to see the preview to change on the solid object.  Is there a setting somewhere?

    I really hope I'm explaining this to people to understand .

    Thank you

    Ed

    Hi Ed,

    You use a previous version of Flash Pro that displays this behavior.

    Live the overview of forms while editing got added in Flash Pro CC (and above). You can try the latest version of Flash Pro (CC 2014) see how it works.

  • When I try to use the webcam with Skype it blocks Skype and said "Skype has stopped working, windows is checking for a solution."

    Original title: lifecam 3000 and Skype does not?

    Hello, I tried the two 5.5 beta and 5.3. When I try to use the webcam with Skype it blocks Skype and says "Skype has stopped working windows is checking for a solution." I have windows update connection bars 4/5 drivers and my computer ==> http://www.newegg.com/Product/Product.aspx?Item=N82E16883103361 help is appreciated, thanks

    Hello, I had just fixed yesterday. I deleted the drivers and programs that accompanies it, it ends up being the lifecam software that comes with it interfering with Skype, thanks to all who help :)

  • Lightroom cannot use the catalog because it is not writable and cannot be opened

    My catalog is on an external hard drive and I lost the connection, resulting in an error message "Lightroom can't use the catalog because it is not writable and cannot be opened" to come.

    There was no lock file to delete, and I deleted the log file. All write permissions have been verified on the hard disk, catalog and subfolders and I leave and I always get this error message.

    How can I get rid of this message and gain access to my catalog again?

    I'm on windows and not Mac. Thank you for your time, but I have already contacted Adobe via a chat service and the catalog has been corrupted. They fixed. Thanks again for your time.

  • I start using adobe lightroom and photoshop with trial version and today I decided to use the creative photography of Cloud (one year) and after the purchase, I received email to confirm that, but my adobe lightroom and photoshop always demo how can I sol

    I start using adobe lightroom and photoshop with trial version and today I decided to use the creative photography of Cloud (one year) and after the purchase, I received email to confirm that, but my adobe lightroom and photoshop always demo how can I solve this problem

    Troubleshooting FAQ: What should I do if I have a subscription, but my application acts as if I had a trial?

    [moved from the download, installation, commissioning creative cloud download &install]

  • I bought a disc of Lightroom6 for Mac. Can I use the license even om my two ibooks and iMacs at the same time? Given that the macbook air doesn't have a hard drive, is it possible to copy on a USB drive?

    I bought a disc of Lightroom6 for Mac. Can I use the license even om my two ibooks and iMacs at the same time? Given that the macbook air doesn't have a hard drive, is it possible to copy on a USB drive?

    You have two activations and no more. If you need to register a third party, you will need to purchase another package. Yes, the installers can be copied to any media that you consider appropriate.

    Mylenium

  • why I use the new cc photoshop cannot open, have and pdf

    why I use the new cc photoshop cannot open have and pdf.

    and more slow then former execution

    According to your records, you bought the CC for photography program under the same ID from Adobe Photoshop.

    It gives you access to use Photoshop & light room.

    Concerning

    Stéphane

  • I just downloaded Creative Suite 6 on my new MacBook and not only the interface seems a bit different but I noticed that the oil paint filter is not available.  I used the same discs on my office iMac and the filter still works there.

    I just downloaded Creative Suite 6 on my new MacBook and not only the interface seems a bit different but I noticed that the oil paint filter is not available.  I used the same discs on my office iMac and the filter still works there.  I use it often and would appreciate any help to recover!

    Please download and install Photoshop CS6 from the following link: download Creative Suite 6 applications

  • Hello, is it possible to use the creative cloud on a chromebook? And how should I "install"? Thank you!

    Hello, is it possible to use the creative cloud on a chromebook? And how should I "install"? Thank you!

    No.... Mac or Windows only

    Well well, with the exception of a few mobile applications which I don't use

  • Can I use the images I buy here to edit and design t-shirts for sale?

    Can I use the images I buy here to edit and design t-shirts for sale or would I need a special permit?

    This was taken up in Section 3.4 of the http://wwwimages.adobe.com/content/dam/Adobe/en/legal/servicetou/Adobe_Stock_Terms_en_US-2 0150313_hpc.pdf

    ~ David

  • [ADF, JDev12.1.3] (How to set values for the attributes 1) to create a file and 2) committing to the database?

    Hallo,

    in my tables and forms (created from VO istances) there are some areas for which, insert and update, I calculate and set the value programmatically when a record is created or updated.

    In some cases, I put the necessary values using the 'CreateWithParams' in the workflow diagram...

    In some other ones, I associate an action, a bean, a created button drag-and - drop operation 'CreateWithParams' of the istance VO...

      public String cwpButton_action() {
        BindingContainer bindings = getBindings();
        OperationBinding operationBinding = bindings.getOperationBinding("CreateWithParams");
        // here I calculate and set the needed params
        // ...
        Object result = operationBinding.execute();
        if (!operationBinding.getErrors().isEmpty()) {
          return null;
        }
        return null;
      }
    

    And is ok if I can calculate the values for the attributes before a new record is created.

    But the approach that I have used to define the attributes (for new and updated records) whose value should be caluclated after the user has filled in the fields, before committing to the database?

    Thank you

    Federico

    Federico,

    Let me first tell you that our code is activity masking errors (the cache instead of working on them).

    1. If (! operationBinding.getErrors () .isEmpty ()) {}
    2. Returns a null value.
    3. }
    4. Returns a null value.

    This means that you do not check the errors at all. You must at least print a log with the error message, you receive, if you get one!

    To solve your problem, you override the method prepareForDML() of the entity or entities in question. You can calculate and set the necessary attributes until they get engaged in the doDML(). Do not use doDML() because it is too late in the life cycle.

    Timo

Maybe you are looking for

  • What is the best way to move from an Intel iMac a iMac 4K

    I have an iMac 21 "4 k new in a few days and I wonder what the best what's the best way to migrate my old iMac to the new? Configuration wizard migration wizard or any transfer via time machine, then for the new iMac?

  • HP 15 laptop: I need 3D controller driver

    I need a controller driver 3d video. Driver video controller 3D ID: PCI\VEN_10DE & DEV_1140 & SUBSYS_2337103C & REV_A1PCI\VEN_10DE & DEV_1140 & SUBSYS_2337103CPCI\VEN_10DE & DEV_1140 & CC_030200PCI\VEN_10DE & DEV_1140 & CC_0302

  • Stock browser and Chrome issues

    I have two problems with browsers in my A1000-F. 1. in the stock browser, sites like MSN.com do not make completely and lead to rinsed text and photos. 2. Chrome, all sites are fragile when scrolling. I know these are problems of fragmentation are at

  • Network ScanGear can't access IR2530

    Hello! Network ScanGear can't access IR2530. I ping the device, but also using Remote UI. But when I run Scangear with specification IP of IR2530, it says: this device is disabled or no valid IP address or host name (but see it's DNS name, and it is

  • A55 and PCIe video card installation

    Work with a 8705-DHU and try to install a video card into the PCIe slot to allow the use of two monitors.  The idea is to attach a monitor to the on-board and the new card for a second monitor, and then expand office.  I got the second card installed