From c670e0583e5468646ab42903c95a80662d96cc89 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Sat, 6 Feb 2021 22:41:59 +0100 Subject: databases: add xml exercise --- Year_2/Databases/verbale.dtd | 15 +++++++++ Year_2/Databases/verbale.xml | 67 +++++++++++++++++++++++++++++++++++++ Year_2/Databases/verbale_ex1.xquery | 18 ++++++++++ 3 files changed, 100 insertions(+) create mode 100644 Year_2/Databases/verbale.dtd create mode 100644 Year_2/Databases/verbale.xml create mode 100644 Year_2/Databases/verbale_ex1.xquery (limited to 'Year_2') diff --git a/Year_2/Databases/verbale.dtd b/Year_2/Databases/verbale.dtd new file mode 100644 index 0000000..c64e107 --- /dev/null +++ b/Year_2/Databases/verbale.dtd @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/Year_2/Databases/verbale.xml b/Year_2/Databases/verbale.xml new file mode 100644 index 0000000..3bc67a7 --- /dev/null +++ b/Year_2/Databases/verbale.xml @@ -0,0 +1,67 @@ + + + + + + Filippo + Maria + Rossi + + + Data Mining + Ferro + 30 + + 01/04/04 + + + + + Gregorio + Cantone + + + Reti di Calcolatori + Riccobene + 18 + 02/07/04 + + + + + Marco + Bianchi + + + Reti di Calcolatori + Riccobene + 30 + + 02/07/04 + + + + + Marco + Neri + + + Algoritmi + Cantone + 18 + 01/07/04 + + + + + Marco + Neri + + + Reti di Calcolatori + Riccobene + 30 + 02/07/04 + + + diff --git a/Year_2/Databases/verbale_ex1.xquery b/Year_2/Databases/verbale_ex1.xquery new file mode 100644 index 0000000..2be6f06 --- /dev/null +++ b/Year_2/Databases/verbale_ex1.xquery @@ -0,0 +1,18 @@ + +{ +let $f := doc("verbale.xml") +for $verbale in $f//verbale +where $verbale/studente[@cdl="667"] and $verbale/esame/materia/text()="Reti di Calcolatori" +return + + { + $verbale/esame/voto/text() + } + + {if ($verbale/esame/lode) then ( + Y + ) else () } + + +} + -- cgit v1.2.3-18-g5258