Presentation is loading. Please wait.

Presentation is loading. Please wait.

603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 27 A First Course in Database Systems.

Similar presentations


Presentation on theme: "603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 27 A First Course in Database Systems."— Presentation transcript:

1 603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 27 A First Course in Database Systems

2 Deductive Databases Recursive Programming in Datalog: 1.FollowOn(x,y)  SequelOf(x,y) 2.FollowOn(x,y)  SequelOf(x,z) AND FollowOn(z,y) Rule1 is the basis; it tells us that every sequel is a follow-on. Rule 2 says that every follow-on of a sequel of movie x is also a follow-on of x. If z is a sequel of x, and we have found that y is a follow-on of z, then y is a follow-on of x.

3 Deductive Databases Recursive Programming in Datalog: SF DEN DAL CHI NY A Map of Some Airline Flights UA 930-1230 AA 900-1430 UA 1400-1700 UA 1500-1800 AA 1530-1730 AA 1500-1930 AA 1900-2200 UA 1830-2130

4 Deductive Databases Recursive Programming in Datalog: airline from to departs arrives UASFDEN9301230 AASFDAL9001430 UADENCHI15001800 UADENDAL14001700 AADALCHI15301730 AADALNY15001930 AACHINY19002200 UACHINY18302130 Tuples in Relation Flights!

5 Deductive Databases Recursive Programming in Datalog: extension database A predicate whose relation is stored in the database is called an extension database (EDB) intensional database A predicate for which the corresponding relation is defined by logical rules is called an intensional database (IDB)

6 Deductive Databases Recursive Programming in Datalog: Many examples of the use of recursion can be found in the study of paths in a graph. The previous slide shows a graph representing some flights of two hypothetical airlines - Untried Airlines(UA), and Arcane Airlines (AA) -- among the cities of San Francisco, Denver, Dallas, Chicago, and New York.

7 Deductive Databases Recursive Programming in Datalog: Flights are represented by and EDB relation: Flights(airline, from, to, departs, arrives) The tuples in the relations are shown in the previous table

8 Deductive Databases Recursive Programming in Datalog: The simplest recursive question we can ask is: “For what pairs of cities (x, y) is it possible to get from city x to city y by taking one or more flights?” The following two rules describe a relation Reaches(x,y) that contains exactly these pairs of cities: 1.Reaches(x,y)  Flights(a,x,y,d,r) 2.Reaches(x,y)  Reaches(x,z) AND Reaches(z,y)

9 Deductive Databases Recursive Programming in Datalog: 1.Reaches(x,y)  Flights(a,x,y,d,r) The first rule says that Reaches contains those pairs of cities for which there is a direct flight from the first to the second; The airline a, departure time d, and arrival time r are arbitrary in this rule.

10 The Deductive Databases Recursive Programming in Datalog: 2.Reaches(x,y)  Reaches(x,z) AND Reaches(z,y) The second rule says that if you can reach from city x to city z and you can reach from z to y, then you can reach from x to y. To evaluate the relation Reaches, we begin by using Rule (1)

11 Deductive Databases Recursive Programming in Datalog: To evaluate the relation Reaches, we begin by using Rule (1) 1.Reaches(x,y)  Flights(a,x,y,d,r) we get (SF, DEN), (SF, DAL), (DEN,CHI) (DEN,DAL), (DAL,CHI), (DAL, NY), and (CHI, NY) => seven pairs represented by arcs in graph

12 Deductive Databases Recursive Programming in Datalog: In the next round we apply recursive Rule (2) 2.Reaches(x,y)  Reaches(x,z) AND Reaches(z,y) to put together pairs of arcs such that the head of one is the tail of the next. This yields additional pairs (SF,CHI), (DEN, NY), and (SF,NY)

13 Deductive Databases Recursive Programming in Datalog: The third round combines all one- and two-arc pairs together to form paths of length up to four arcs. Here we get no new pairs. The relation Reaches thus consists of the ten pairs (x,y) such that y is reachable from x in the diagram

14 Deductive Databases Recursive Programming in Datalog: A more complicated definition of when two flights can be combined into a longer sequence of flights is to require that the second leaves an airport at least an hour after the first arrives at that airport. Now we can use IDB predicate, which we can call Connects(x,y,d,r).

15 Deductive Databases Recursive Programming in Datalog: Connects(x,y,d,r) says that we can take one or more flights, starting at city x at time d and arriving at city y at time r. The rules for Connects are: 1. Connects(x,y,d,r)  Flights(a,x,y,d,r) 2. Connects(x,y,d,r)  Connects(a,z,y,d,t1) AND Connects(z,y,t2,r) AND t1 <= t2 - 100

16 Rough Set Theory and Databases Rough Set Information System: Q UAD a1 a2 d x1. Xn

17 Rough Set Theory and Databases Rough Set Information System: The information system is a database-like system This information system is a new tool to deal with knowledge acquisition under uncertainty This information system is called Rough Set Theory

18 Rough Set Information System: Rough Set Information System The main advantage of Rough Set Theory is that it does not need any preliminary or additional information about the data- like probability in Statistics like basic probability number in D-S Theory of Evidence like grade of membership or the value of possibility in fuzzy set theory

19 Rough Set Information System Rough Set Theory : Rough set theory has successfully implemented in knowledge-based systems - in medicine - in industry - etc.

20 Rough Set Information System Rough Set Theory: The information systems represents what is called “instance space” in learning from examples The concept of a rough set is a mathematical tool to deal with -uncertain and imprecise data Rough Set Theory offers a new insight and efficient algorithm

21 Rough Set Information System Rough Set Theory: In rough set theory each imprecise concept is replaced by a pair of precise concepts - lower approximations and upper approximations

22 Deductive Databases Next Lecture Rough Set Theory and Database


Download ppt "603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 27 A First Course in Database Systems."

Similar presentations


Ads by Google