XML Data Management XPath Exercises: Right or Wrong? - PowerPoint PPT Presentation

About This Presentation
Title:

XML Data Management XPath Exercises: Right or Wrong?

Description:

XML Data Management XPath Exercises: Right or Wrong? Werner Nutt Right or Wrong? Return the titles of the recipes that have more than 500 calories. – PowerPoint PPT presentation

Number of Views:69
Avg rating:3.0/5.0
Slides: 16
Provided by: Preferr275
Category:

less

Transcript and Presenter's Notes

Title: XML Data Management XPath Exercises: Right or Wrong?


1
XML Data Management XPath Exercises Right or
Wrong?
  • Werner Nutt

2
Right or Wrong?
  • Return the titles of the recipes that have more
    than 500 calories.
  • //recipes/recipe/nutrition_at_caloriesgt500
  • /../title
  • and what about style?

3
Right or Wrong?
  • Return the recipes for which at least 4 eggs are
    needed.
  • //recipesum(descendantingredient
  • contains(_at_name,"egg")
  • /_at_amount) gt 4
  • /title

4
Right or Wrong?
  • 4. Which recipe has the highest number of
    calories?
  • //recipenutrition/_at_calories
  • gt precedingnutrition/_at_calories
  • and nutrition/_at_calories
  • gt followingnutrition/_at_calories

5
Right or Wrong?
  • 4. Which recipe has the highest number of
    calories?
  • //recipenot(nutrition/_at_calories lt
    precedingrecipe/nutrition/_at_calories)
  • and
  • not(nutrition/_at_calories lt
    followingrecipe/nutrition/_at_calories)
  • what exactly does this query
    return?

6
Right or Wrong?
  • 6. How many compound ingredients (i.e.,
    ingredients with ingredients) are there in
    Ricotta Pie?
  • count(//recipetitle"Ricotta Pie"
    /ingredient/ingredient/..)
  • and what about style?

7
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)?
  • //recipecount(ingredient/preparation/step)
    gt
  • count(preparation/step)

8
Right or Wrong?
  • Return the names of the ingredients of Zuppa
    Inglese.
  • //recipetitle"Zuppa Inglese"/ingredient

9
Right or Wrong?
  • Which recipes have an ingredient in common with
    Zuppa Inglese?
  • //recipetitle!"Zuppa Inglese"
  • .//ingredient/_at_name
  • //recipetitle"Zuppa Inglese"
  • /ingredient/_at_name

10
Right or Wrong?
  • Return the names of all elementary ingredients
    that occur in at least two recipes.
  • //recipe///ingredient
  • count(.//ingredient) 0
  • and
  • (_at_name precedingingredient/_at_na
    me
  • or
  • _at_name followingingredient/_at_
    name)
  • /_at_name

11
Right or Wrong?
  • Return the names of all elementary ingredients
    that occur in at least two recipes.
  • //recipetitle!precedingtitle
  • ingredient/_at_name
  • //recipe/ingredient/_at_name
  • /ingredient/_at_name

12
Right or Wrong?
  • Return the titles of all recipes for which some
    form of egg is needed (like egg whites or egg
    yolk).
  • //ingredient_at_namecontains(.,'egg')
  • /ancestorrecipe/title
  • and what about style?

13
Right or Wrong?
  • 17. Return the names of those ingredients that
    are mentioned in a preparation step of their
    recipe.
  • //ingredient//preparation/step
    contains(text(),_at_name)

14
Right or Wrong?
  • 17. Return the names of those ingredients that
    are mentioned in a preparation step of their
    recipe.
  • //ingredientcontains(ancestorrecipe//step,
    _at_name)
  • /_at_name

15
Right or Wrong?
  • 17. Return the names of those ingredients that
    are mentioned in a preparation step of their
    recipe.
  • //ingredientcontains(ancestorrecipe/preparatio
    n, _at_name)
  • /_at_name
  • Could we write a query that asks for an
    occurrence of the ingredient name
  • in any preparation step of the recipe?
Write a Comment
User Comments (0)
About PowerShow.com