1 / 6

Is the cost of the 4 th juicer less than the cost of its following juicers?

Is the cost of the 4 th juicer less than the cost of its following juicers?. Incorrect. //juicer[4]/number(cost ) < //juicer[4]/following-sibling::juicer/ number(cost ). The XPath gives the right answer for this data:. 82.00 < (234.00, 639.99) (82.00 < 234.00) or (82.00 < 639.99)

oral
Download Presentation

Is the cost of the 4 th juicer less than the cost of its following juicers?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Is the cost of the 4th juicer less than the cost of its following juicers?

  2. Incorrect //juicer[4]/number(cost ) < //juicer[4]/following-sibling::juicer/number(cost ) The XPath gives the right answer for this data: 82.00 < (234.00, 639.99) (82.00 < 234.00) or (82.00 < 639.99) T or T T But it gives the wrong answer for this data: 82.00 < (72.00, 639.99) (82.00 < 72.00) or (82.00 < 639.99) F or T T

  3. Correct not(//juicer[4]/number(cost ) >= //juicer[4]/following-sibling::juicer/number(cost )) The XPath gives the right answer for this data: not(82.00 >= (234.00, 639.99)) not((82.00 >= 234.00) or (82.00 >= 639.99)) not(F or F) T And it gives the right answer for this data: not(82.00 >= (72.00, 639.99)) not((82.00 >= 72.00) or (82.00 >= 639.99)) not(T or F) F

  4. Guideline for using general comparison operators • If you want to do general comparison of sequences, don’t do this: A positive-operator B • Instead, do this: not (A negative-operator B) • Example, don’t do this: A < BInstead, do this: not(A >= B) • Example, don’t do this: A = BInstead, do this: not(A != B) • Example, don’t do this: A >= BInstead, do this: not(A < B) Where A and/or B are sequences

  5. Is 10 less than all the values in this sequence: (20, 30)? The overwhelming temptation is to write this XPath: 10 < (20, 30) The XPath works for this particular set of data, but change the data and it fails: 10 < (5, 30)Let’s see why: (10 < 5) or (10 < 30) F or T T Instead, use this XPath: not(10 >= (5, 30)) not((10 >= 5) or (10 >= 30)) not(F or T) F

  6. Is 10 equal to all the values in this sequence: (10, 10)? The overwhelming temptation is to write this XPath: 10 = (10, 10) The XPath works for this particular set of data, but change the data and it fails: 10 = (5, 10)Let’s see why: (10 = 5) or (10 = 10) F or T T Instead, use this XPath: not(10 != (5, 10)) not((10 != 5) or (10 != 10)) not(T or F) F

More Related