Download presentation
Presentation is loading. Please wait.
Published byElfreda McDonald Modified over 9 years ago
1
Web Science & Technologies University of Koblenz ▪ Landau, Germany Advanced Data Modeling Steffen Staab
2
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 2 of 48 WeST Semantic Web Web Retrieval Interactive Web Multimedia Web Software Web Institut WeST – Who we are! GESIS Ext Advisor Board Int Advisor Board
3
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 3 of 48 WeST Organization Contact: Prof. Dr. Steffen Staab: staab@uni-koblenz.destaab@uni-koblenz.de Office hours: Wed, 10.45 Uhr - 11.45 Uhr Scheduling: via email to hissnauer@uni-koblenz.dehissnauer@uni-koblenz.de Teaching assistant: Gerd Gröner http://west.uni-koblenz.de/Teaching/ss11/adm11/
4
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 4 of 48 WeST For whom? Advanced Data Modeling Addressees: Master Inf/CV Diplom Hauptstudium Inf/CV Lecture INSS02 is Part of the „Schwerpunkt“ Data & Knowledge Engineering in the Master‘s Programme of Computer Science Bachelor students may elect advanced courses such as Advanced Data Modeling as „Wahl-/Wahlpflicht“
5
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 5 of 48 WeST Open Questions English vs German Tutorial slot Tuesday 12-14 or Friday 10-12 ? Bring your laptop tomorrow!
6
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 6 of 48 WeST Examination Tutorials: for improving understanding and getting hands on experience Hand in excercises 75% fulfillment: 1 grade level better (e.g. 1.7 -> 1.3) 90% fulfillment: 2 grade levels better (e.g. 2.0 -> 1.3) Probably oral, maybe written: between mid June and mid July. Your own responsibility to schedule an appointment via Mrs Hissnauer No later first examinations in Advanced Data Modeling no admission criteria, but do not expect to pass if you did not do the assignments
7
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 7 of 48 WeST Organizational Issues Monday: B016 Tuesday lecture: K208 Tuesday tutorial: G210 Mon April 18, 14-16, Lecture 1 Tue April 19, 10-12, Lecture 2 Tue April 19, 12-14, Tutorial 1 Mon April 25, Easter Monday Tue April 26, 10-12, Lecture 3 Tue April 26, 12-14, Tutorial 2 Mon May 2, Lecture 4 Tue May 3, 10-12, Lecture 5 Tue May 3, 12-14, Tutorial 3 Mon May 9, Lecture 6 Tue May 10, 10-12, Lecture 7 Tue May 10, 12-14, Tutorial 4 Mon May 16, Lecture 8 Tue May 17, 10-12, Lecture 9 Tue May 17, 12-14, Tutorial 5 Mon May 23, Tutorial 6 Tue May 24, 10-12, Lecture 10 Tue May 24, 12-14, Tutorial 7 Mon May 30, Lecture 11 Tue May 31, Lecture 12 Tue June 1, Tutorial 8 Mon June 7, - no lecture – Tue June 8, - no lecture - Tue June 8, Tutorial 9 June 11-19: Pentecost – no lectures Mon June 20, Lecture 13 Tue June 21, Lecture 14 Tue June 21, Tutorial 10
8
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 8 of 48 WeST Assumption Did you participate in Introduction to Databases? Did you participate in the Logics course?
9
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 9 of 48 WeST Structure of the lecture Logics for Data Engineering Relational data model; Deductive data model; Recursive definitions and their semantics Provenance queries Policy languages
10
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 10 of 48 WeST Why Logics for Data Engineering? Many current applications: Hidden part of advanced databases like Oracle, DB2,… Policy languages / Access control Ontologies & Semantic Web Software engineering: OCL Why? Generalization of other data models Relational Semi-structured (RDF, XML, OEM,…) Well-understood theory Yet still evolving….!
11
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 11 of 48 WeST Deductive Databases evolved during the 1980s, based on the ideas developed in relational databases and logic programming. developed with the aim of increasing the expressive power of relational query languages, and in particular in connection with the inability of the latter to express recursive queries.
12
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 12 of 48 WeST Query languages navigational (early DBMS); declarative (relational DBMS).
13
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 13 of 48 WeST Why logics? Logic tried to solve problems similar to those arising in foundations of databases: how to formalize the application world (language); How to express its properties (semantics, model theory); How to reason about these properties (proof theory).
14
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 14 of 48 WeST Why logics? Logic can handle in a uniform framework recursive definitions; integrity constraint; deduction, induction and abduction; Models for complex values...
15
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 15 of 48 WeST Informal overview of deductive databases Extensionally defined relations. Intensionally defined relations. Integrity constraints. Recursion. Complex values. Negation
16
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 16 of 48 WeST Extensionally defined relations Extensional definition: by explicit enumeration of all tuples in the relation. (”Maier”, ”Mozartstrasse”, 678); … (”Schmidt”, ”Raiffeisenstrasse”, 857); …
17
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 17 of 48 WeST Extensionally defined relation In deductive databases we use the language of first-order logic and represent this relation by a set of facts: entry(”Maier”, ”Mozartstrasse”, 678); … entry(”Schmidt”, ”Raiffeisenstrasse”, 857); …
18
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 18 of 48 WeST Extensional database The extensional database defines relations by sets of facts, for example hasHighestDegree(”Maier”, BSc); hasHighestDegree(”Schmidt”, MSc); … higherDegree(MSc,BSc); … Analogue of tables in relational databases.
19
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 19 of 48 WeST Intensionally defined relations. Rules Suppose we want to define a relation personWithHigherDegree among persons: Person A has higher degree than person B if the highest degree of A is higher than the highest degree of B.
20
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 20 of 48 WeST Intensionally defined relations. Rules Extensional definition personWithHigherDegree(”Schmidt”,”Maier”). personWithHigherDegree(”Maier”,”Kunz”). … is dangerous (too large, may become inconsistent after updates).
21
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 21 of 48 WeST Rephrase For each pair of people A, B, A has higher degree than B if the highest degree of A is DA and the highest degree of B is DB and DA is a higher degree than DB.
22
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 22 of 48 WeST Clause (rule) personWithHigherDegree(A,B) :- % head of the clause hasHighestDegree(A,DA),% body hasHighestDegree(B,DB), % of the higherDegree(DA,DB).% clause
23
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 23 of 48 WeST SQL SELECT D1.person, D2.person FROM hasHighestDegree D1, hasHighestDegree D2, higherDegree WHERE D1.degree = higherDegree.higher AND D2.degree = higherDegree.lower
24
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 24 of 48 WeST Relations The relation personWithHigherDegree holds between objects A, B if the relation hasHighestDegree holds between objects A, DA and the relation asHighestDegree holds between objects B, DB and the relation higherDegree holds between objects RA,RB.
25
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 25 of 48 WeST Variables For all objects A, B, DA, DB the relation personWithHigherDegree holds between objects A, B if the relation hasHighestDegree holds between objects A, DA and the relation asHighestDegree holds between objects B, DB and the relation higherDegree holds between objects RA,RB.
26
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 26 of 48 WeST Constants subordinate(O, president) :- officer(O). Here O is a variable, while president is a constant. How to say this syntactically? Different conventions: Possibility 1: All variables are explicitly quantified Possibility 2: Variables are implicitly quantified (universally or existentially – needs to be agreed by convention) Sets of variables and constants are defined as such
27
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 27 of 48 WeST Disjunction How to express every human is either a woman or a man? human(A) :- man(A). human(A) :- woman(A).
28
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 28 of 48 WeST Negation How to express that every doctor has the same qualification as Doctor No, with the exception of Doctor No himself? sameAs(A,A) :- Object(A). sameQualification(A,B) :- hasHighestDegree(A, D), hasHighestDegree(B, D), notSameAs(A,B). hasHighestDegree(DrNo, PhD).
29
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 29 of 48 WeST Negation Use negation: sameQualification(A,B) :- hasHighestDegree(A, D), hasHighestDegree(B, D), not SameAs(A,B). Negation is handled using the closed world assumption.
30
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 30 of 48 WeST Goals :- likes(X, Y), not likes(Y, X). :- sameQualification(drNo, Y).
31
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 31 of 48 WeST Recursion connected(StartPoint, EndPoint) :- arc(StartPoint, EndPoint). connected(StartPoint, EndPoint) :- arc(StartPoint, NextPoint), connected(NextPoint, EndPoint).
32
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 32 of 48 WeST Recursion StartPoint and EndPoint are connected if StartPoint and EndPoint are connected by an arc or there exists an intermediate point NextPoint such that StartPoint and NextPoint are connected by an arc and NextPoint and EndPoint are connected.
33
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 33 of 48 WeST Integrity constraints Each class has at least one lecturer: x (class(x) → y lecturer(y, x)). Each class has at most one lecturer: x(class(x) → y z(lecturer(y, x) lecturer(z, x) → y=z).
34
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 34 of 48 WeST Complex values route(StartPoint, EndPoint, [StartPoint, EndPoint]) :- arc(StartPoint, EndPoint). route(StartPoint, EndPoint, [StartPoint|Route]) :- arc(StartPoint, NextPoint), route(NextPoint, EndPoint, Route).
35
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 35 of 48 WeST Problems Combinations of following three features create problems with defining semantics of deductive databases and designing query answering algorithms for them: Negation; Recursion; Complex values. Restrictions may be required on the use of (combinations of) these features.
36
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 36 of 48 WeST SWI Prolog: http://www.swi-prolog.org/
37
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 37 of 48 WeST Soccer database % EXTENSIONAL DATABASE % Relation nextLeague describes the hierarchy of leagues in % UK nextLeague(league2, league1). nextLeague(league1, championship). nextLeague(championship, premier).
38
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 38 of 48 WeST % the list of clubs club(arsenal). club(watford). club(leedsU). club(miltonKeynesDons). % the list of leagues of clubs league(arsenal, premier). league(watford, championship). league(leedsU, league1). league(miltonKeynesDons, league2).
39
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 39 of 48 WeST % the list of players and where they are playing player(andy,arsenal). player(wim,watford). player(liam, leedsU). player(mike, miltonKeynesDons).
40
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 40 of 48 WeST % some players foul other players foul(andy,wim). foul(andy,bert). foul(andy,chris). foul(andy,dan). foul(wim, andy). foul(wim, dan).
41
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 41 of 48 WeST Soccer database % INTENSIONAL DATABASE % Relation nextLeagues describes the order on leagues % It is defined as the transitive closure of nextLeague higherLeague(LowerLeague, HigherLeague) :- nextLeague(LowerLeague, HigherLeague). higherLeague(LowerLeague, HigherLeague) :- nextLeague(LowerLeague, MiddleLeague), higherLeague(MiddleLeague, HigherLeague).
42
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 42 of 48 WeST % A higher-leagued club is a club who is in a higher league higherLeaguedClub(Higher, Lower) :- league(Higher, HigherLeague), league(Lower, LowerLeague), higherLeague(LowerLeague, HigherLeague).
43
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 43 of 48 WeST % likes is a relation among players. % (i) every player likes himself like(Player, Player) :- player(Player). % (ii) every player likes all players in higher-ranked clubs like(Lower, Higher) :- player(Lower, LowerClub), player(Higher, HigherClub), higherRankedClub(HigherClub, LowerClub).
44
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 44 of 48 WeST % (iii) a player likes a lower-ranked player when % players of the lower-ranked club % do not foul other players of his club likes(Higher, Lower) :- player(Higher, HigherClub), player(Lower,LowerClub), higherRankedClub(HigherClub, LowerClub), not hasPlayerWhoFoulsSomePlayerFrom(LowerClub, HigherClub).
45
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 45 of 48 WeST % an auxiliary relation: hasPlayerWhoFoulsSomePlayerFrom hasPlayerWhoFoulsSomePlayerFrom(Club1, Club2) :- player(Player1, Club1), player(Player2, Club2), foul(Player1, Player2).
46
Steffen Staab staab@uni-koblenz.de Advanced Data Modeling 46 of 48 WeST % INTEGRITY CONSTRAINTS % every club has a league 8 x(club(x) ! 9 y league(x, y)). % only premier league player may foul more than one player 8 p, c, z1, z2 (player(p,c) Æ foul(p, z1) Æ foul(p, z2) ! z1 = z2 Ç league(c, premier)).
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.