\documentclass{bschlangaul-aufgabe} \bLadePakete{relationale-algebra} \begin{document} \bAufgabenMetadaten{ Titel = {Aufgabe 4}, Thematik = {Game of Thrones}, Referenz = 66116-2019-H.T1-TA2-A4, RelativerPfad = Examen/66116/2019/09/Thema-1/Teilaufgabe-2/Aufgabe-4.tex, ZitatSchluessel = examen:66116:2019:09, BearbeitungsStand = unbekannt, Korrektheit = unbekannt, Ueberprueft = {unbekannt}, Stichwoerter = {Relationale Algebra}, EinzelpruefungsNr = 66116, Jahr = 2019, Monat = 09, ThemaNr = 1, TeilaufgabeNr = 2, AufgabeNr = 4, } \let\t=\text Übertragen Sie die folgenden Ausdrücke in die relationale Algebra. Beschreiben Sie diese Ausdrücke umgangssprachlich, bevor Sie die Umformung durchführen. Das Schema der Datenbank entspricht dem Schema aus Aufgabe 3.\index{Relationale Algebra} \footcite{examen:66116:2019:09} \begin{enumerate} %% % 1. %% \item $\{ f \, | \, f \in \t{Figur} \land \neg \exists g \in \t{gehört\_zu}(f.\t{Id} = g.\t{Id})\}$ \begin{bAntwort} Gesucht sind alle Figuren, die keiner Familie angehören. \begin{displaymath} \t{Figur} - \pi_{\t{Id}, \t{Name}, \t{Schwertkunst}, \t{Lebendig}, \t{Titel}}(\t{Figur} \bowtie \t{gehört\_zu}) \end{displaymath} \end{bAntwort} %% % 2. %% \item $\{ f \, | \, f \in \t{Figur} \land \exists l \in \t{lebt}(l.\t{Id} = f.\t{Id}) \land \exists f_2 \in \t{Festung}(l.\t{Festung} = f.\t{Name}) \land \exists b \in \t{besetzt}(f_2.\t{Name} = b.\t{Festung}) \land \exists f_3 \in \t{Familie}(b.\t{Familie} = f_3.Id) \land f_3.\t{Name} = \t{Stark}) \}$ \begin{bAntwort} In der Angabe steht $\t{lebt}(l.\t{Id} = c.\t{Id})$ wurde abgeändert in $\t{lebt}(l.\t{Id} = \textbf{f}.\t{Id})$ Außerdem kommt $f$ mehrmals vor. Wir wandeln $f_2$ in $f_3$ um und führen ein neues $f_2$ ein. Diese schließende Klammer muss weg: $\t{Familie}(b.\t{Familie} = f_3.Id\textbf{)}$ Übersichtlicher geschrieben \begin{align*} \{ f \, | \, & f & \in & \, \t{Figur} \land \\ & \exists l & \in & \, \t{lebt}(l.\t{Id} = f.\t{Id}) \land \\ & \exists f_2 & \in & \, \t{Festung}(l.\t{Festung} = f.\t{Name})\land \\ & \exists b & \in & \, \t{besetzt}(f_2.\t{Name} = b.\t{Festung}) \land \\ & \exists f_3 & \in & \,\t{Familie}(b.\t{Familie} = f_3.Id \land f_3.\t{Name} = \t{Stark})\\ \} \end{align*} Gesucht sind alle Figuren, die in einer von der Familie „Stark“ besetzten Festung leben. \end{bAntwort} \end{enumerate} \end{document}