XML Data Management XPath Exercises: Right or Wrong? Werner Nutt
Right or Wrong? 1.How many calories are in Linguine alla Pescatora? /recipes/recipe[title/text()= "Linguine alla Pescatora"] … and what about style?
Right or Wrong? 4. Which recipe has the highest number of calories? > | > /title … and what about style?
Right or Wrong? 4. Which recipe has the highest number of calories? <= and <= and <= … and what about style?
Right or Wrong? 6. How many compound ingredients (i.e., ingredients with ingredients) are there in Ricotta Pie? count(/recipes/recipe[title/text() = "Ricotta Pie"] /.//ingredient[./ingredient]) … and what about style?
Right or Wrong? 8. Which recipes have an ingredient whose preparation needs more steps than are needed for the recipe itself (i.e., top level steps)? //recipe[count(ingredient/preparation/step) > count(preparation/step)] … and what about style?
Right or Wrong? 8. Which recipes have an ingredient whose preparation needs more steps than are needed for the recipe itself (i.e., top level steps)? /recipes/recipe [.//ingredient [count(preparation/step) > count(./ancestor::*[name()='recipe'][1] /preparation/step)]] … and what about style?
Right or Wrong? 13. Return the ingredients of recipes other than Zuppa Inglese that these recipes have in common with Zuppa Inglese. //recipe[title != "Zuppa Inglese" = //recipe[title="Zuppa Inglese”]//ingredient or ] //ingredient … and what about style?
Right or Wrong? 17. Return the names of those ingredients that are mentioned in a preparation step of their recipe. //ingredient[//preparation/step
Right or Wrong? 17. Return the names of those ingredients that are mentioned in a preparation step of their recipe.
Right or Wrong? 17. Return the names of those ingredients that are mentioned in a preparation step of their recipe. Could we write a query that asks for an occurrence of the ingredient name in any preparation step of the recipe?