XML Data Management XPath Exercises: Right or Wrong? Werner Nutt
Right or Wrong? 2.Return the titles of the recipes that have more than 500 calories. /../title … and what about style?
Right or Wrong? 3.Return the recipes for which at least 4 eggs are needed. //recipe[sum(descendant::ingredient >= 4] /title
Right or Wrong? 4. Which recipe has the highest number of calories? > and >
Right or Wrong? 4. Which recipe has the highest number of calories? <= and <= … what exactly does this query return?
Right or Wrong? 6. How many compound ingredients (i.e., ingredients with ingredients) are there in Ricotta Pie? count(//recipe[title="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)]
Right or Wrong? 10. Return the names of the ingredients of Zuppa Inglese. //recipe[title="Zuppa Inglese"]/ingredient
Right or Wrong? 12.Which recipes have an ingredient in common with Zuppa Inglese? //recipe[title!="Zuppa Inglese"] = //recipe[title="Zuppa Inglese"]
Right or Wrong? 14.Return the names of all elementary ingredients that occur in at least two recipes. //recipe///ingredient [count(.//ingredient) = 0 and = =
Right or Wrong? 14.Return the names of all elementary ingredients that occur in at least two recipes. //recipe[title!=preceding::title] =
Right or Wrong? 15.Return the titles of all recipes for which some form of egg is needed (like egg whites or egg yolk). /ancestor::recipe/title … 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?