diff options
Diffstat (limited to 'Year_2')
-rw-r--r-- | Year_2/Databases/verbale.dtd | 15 | ||||
-rw-r--r-- | Year_2/Databases/verbale.xml | 67 | ||||
-rw-r--r-- | Year_2/Databases/verbale_ex1.xquery | 18 |
3 files changed, 100 insertions, 0 deletions
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 @@ +<!ELEMENT verbali (verbale)*> +<!ELEMENT verbale (studente, esame)> +<!ELEMENT studente (nome+, cognome+)> +<!ELEMENT nome (#PCDATA)> +<!ELEMENT cognome (#PCDATA)> +<!ATTLIST studente + cdl CDATA #REQUIRED + matr CDATA #REQUIRED +> +<!ELEMENT esame (materia, docente, voto, lode?, data)> +<!ELEMENT materia (#PCDATA)> +<!ELEMENT docente (#PCDATA)> +<!ELEMENT voto (#PCDATA)> +<!ELEMENT lode (#PCDATA)> +<!ELEMENT data (#PCDATA)> 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 @@ +<?xml version="1.0"?> +<!DOCTYPE verbali SYSTEM "verbale.dtd"> +<verbali> + <verbale> + <studente cdl="667" matr="123456"> + <nome>Filippo</nome> + <nome>Maria</nome> + <cognome>Rossi</cognome> + </studente> + <esame> + <materia>Data Mining</materia> + <docente>Ferro</docente> + <voto>30</voto> + <lode>Sì</lode> + <data>01/04/04</data> + </esame> + </verbale> + <verbale> + <studente cdl="667" matr="554312"> + <nome>Gregorio</nome> + <cognome>Cantone</cognome> + </studente> + <esame> + <materia>Reti di Calcolatori</materia> + <docente>Riccobene</docente> + <voto>18</voto> + <data>02/07/04</data> + </esame> + </verbale> + <verbale> + <studente cdl="667" matr="658312"> + <nome>Marco</nome> + <cognome>Bianchi</cognome> + </studente> + <esame> + <materia>Reti di Calcolatori</materia> + <docente>Riccobene</docente> + <voto>30</voto> + <lode>Sì</lode> + <data>02/07/04</data> + </esame> + </verbale> + <verbale> + <studente cdl="123" matr="654312"> + <nome>Marco</nome> + <cognome>Neri</cognome> + </studente> + <esame> + <materia>Algoritmi</materia> + <docente>Cantone</docente> + <voto>18</voto> + <data>01/07/04</data> + </esame> + </verbale> + <verbale> + <studente cdl="667" matr="954312"> + <nome>Marco</nome> + <cognome>Neri</cognome> + </studente> + <esame> + <materia>Reti di Calcolatori</materia> + <docente>Riccobene</docente> + <voto>30</voto> + <data>02/07/04</data> + </esame> + </verbale> +</verbali> 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 @@ +<ex1> +{ +let $f := doc("verbale.xml") +for $verbale in $f//verbale +where $verbale/studente[@cdl="667"] and $verbale/esame/materia/text()="Reti di Calcolatori" +return <voto> + <valore> + { + $verbale/esame/voto/text() + } + </valore> + {if ($verbale/esame/lode) then ( + <lode>Y</lode> + ) else () } + </voto> + +} +</ex1> |