Presentation is loading. Please wait.

Presentation is loading. Please wait.

Principles of the Semantic Web DB or KRDB? Alon Halevy.

Similar presentations


Presentation on theme: "Principles of the Semantic Web DB or KRDB? Alon Halevy."— Presentation transcript:

1 Principles of the Semantic Web DB or KRDB? Alon Halevy

2 2 Agenda A spectrum of representation and query formalisms: –From relational databases to description logics and beyond. Questions: –What can we represent? –What can we query? –How much will it cost? –Can we actually use this stuff?

3 3 Why Do We Care? Need to represent data and knowledge on the semantic web. Need to query. Need to map between different representations of data/knowledge. People are confused, very religious about these issues.

4 Perspectives from the Structure Chasm Authoring Creating a schemaWriting text Querying keywords Someone else ’ s schema Data sharing EasyCommittees & standards

5 5 Specifics The relational model, a few query languages –Representing real data Horn rules, the DB view and the KR view. XML: shattering the myth of no semantics. Description Logics: a logic of descriptions. One shameless plug for my past work.

6 6 Recalling First-Order Logic A KB is a set of well-formed formulas  X (Person(X)  Mortal(X))  X (Student(X)  Smart(X)) Person(a) v Dog(a)  X (Student(x)  (x=Aristotle)) Interpretation: a mapping from terms to the universe of discourse. Model: any interpretation that satisfies the formulas. Key idea: infer implicit facts from the explicit ones.

7 7 Example Inferences The KB:  X (Person(X)  Mortal(X))  X (Student(X)  Smart(X)) Person(a) v Dog(a)  X (Student(x)  (x=Oren)) – Mortal(a)? don’t know. – Smart(Oren)? Yes. – Mortal(a) v Mortal(a)? Yes –  X (Person(x)  not Mortal(x))? No

8 8 The Relational Data Model PNamePriceCategoryManufacturer Gizmo$19.99GadgetsGizmoWorks Powergizmo$29.99GadgetsGizmoWorks SingleTouch$149.99PhotographyCanon MultiTouch$203.99HouseholdHitachi Product Attribute names Table name Tuples or rows

9 9 No’s No negation No disjunction Ambiguous support for incomplete information The database represents a single model. Hence, inference is just model checking.

10 10 Integrity Constraints Very specific forms of logical formulae. Enforced (maybe) by the database system: –Functional dependencies: A B –Foreign key constraints: every tuple in the Purchase table must refer to a product in the Product table. –Multi-valued dependencies. –Tuple-generating dependencies, etc. etc.

11 11 Inference: Type 1 (Querying) Product (pname, price, category, manufacturer) Company (cname, stockPrice, country) Find all countries that manufacture some product in the ‘Gadgets’ category. SELECT country FROM Product, Company WHERE manufacturer=cname AND category=‘Gadgets’ Q(c) :- Product(w,y,’Gadgets’,x), Company(x,p,c)

12 12 Query Language Features Fundamental question: what queries can I express with my language? Start with selection, projection, and join. + union and negation (= relational completeness) To deal with real data: –Grouping and aggregation –Dealing with duplicates –Outer joins

13 13 Inference Type 2: Query Containment Question: is the result of Q1 always a subset of Q2? Q 1 (A,B) :- cites(A,B), cites(B,A), sameTopic(A,B) Q 2 (C,D) :- cites(C,C1), cites(D,D1) Inference on a very specific type of formula. Only finite models are considered.

14 14 Complexity Results Galore For select-project-equi-join: NP-Complete Add comparisons (e.g, <): Pi^p_2 complete. Add negation: –Level 0: still Pi^p_2 complete. –Level 2: undecidable –Level 1: Sagiv and Ullman know but don’t want to tell Allow at most 2 occurrences of every predicate name: polynomial. A lot of papers.

15 15 Last Week Recap The relational model: ground facts + UNA + CWA. Integrity constraints: expressing more knowledge. Inference Type 1: querying (= model checking). –Note: polynomial time is not good enough. Inference Type 2: query containment –Type 2.5: answering queries using views. –Both are an inference problem of a particular type of formula in first-order logic over finite models.

16 16 Beyond Containment Answering Queries Using Views Given a query Q and a set of view definitions V 1,…,V n : Is it possible to answer Q using only the V’s? V 1 (A,B) :- cites(A,B), cites(B,A) V 2 (C,D) :- sameTopic(C,D), cites(C,C1), cites(D,D1) Query: q(x,y) :- sameTopic(x,y), cites(x,y), cites(y,x) Query rewriting: q’(X,Y) :- V 1 (X,Y), V 2 (X,Y)

17 17 Didn’t We Say 590 Semantic Web? Assume a virtual schema of the WWW, e.g., –Course(number, university, title, prof, quarter) Every data source on the web contains the answer to a view over the virtual schema: UW database: SELECT number, title, prof FROM Course WHERE univ=‘UW’ AND quarter=‘2/02’ Stanford database: SELECT number, title, prof, quarter FROM Course WHERE univ=‘Stanford’ User query: find all professors who teach “database systems”

18 18 Horn Rules / Datalog Easy for KR people. Hard for database people. Add recursion to the query language: –Path (x,y) :- edge(x,y) –Path (x,y) :- Path(x,z), Path(z,y) DB people consider least fixed point semantics. { edge(a,b), Path(a,b), Path(b,c), Path(a,c)}: –Is a model for KR folks, not DB folks. Recursion is not expressible in first-order logic.

19 19 More on Datalog Many clever algorithms for evaluating datalog queries: –They have fancy names: e.g., magic sets Query containment: undecidable, unless you constrain the queries (ask Surajit) Some ideas made it into SQL and relational systems: –Magic sets (useful even without recursion) –Linear recursion in SQL-3

20 20 XML <db> <book> <title>Complete Guide to DB2</title> <author>Chamberlin</author> </book> < > <title>Transaction Processing</title> <author>Bernstein</author> < >Newcomer</author> </book> <publisher> <name>Morgan Kaufman</name> <state>CA</state> </publisher> </db>

21 21 XML: Issues Data model: edge-labeled graph (/tree): –The tags can be viewed as binary relations Features: –The schema is embedded in the data. –Can have a predefined schema (XML Schema) –Nesting can be arbitrary. –Can be irregular (e.g., different formats for elements) –Order of elements may be important.

22 22 Querying XML XPath, XQuery, XSLT. XQuery is based on XPath, XML-QL, SQL. Query languages features: –Path expressions –The Return clause: creates the output XML document. –Standard query language bells and whistles. –Not in XQuery: tag variables – bind variables to schema elements. Query containment: ask Dan and Gerome.

23 23 Knowledge Representation McCarthy suggested some form of first-order logic. Semantic networks – popular on the east coast. Evolved into: –Frame-based systems –Description logics (a.k.a. terminological logics).

24 24 Description Logics A subset of first-order logic with a German syntax. No variables. Allows only: –Unary relations (Concepts): Person, Happy –Binary relations (Roles, attributes): childOf A DL Knowledge base: –Abox of ground facts: Person(sue), Happy(bob) –Tbox of definitions.

25 25 Concept Descriptions Built using a set of constructs: C, D  A |Primitives Konzept T |Top Konzept  |Bottom Konzept C é D|Durchschnitt C U D|Vereinigung  C|Komplement  R.C|Rollenquantifikation/Werterestriktion  R.C |Rollenquant./Existentielle Restriktion

26 26 Concept Descriptions Built using a set of constructs: C, D  A |Primitive concepts T |Top concept  |Bottom concept C é D|Intersection C U D|Union  C|Complement  R.C|Universal restriction  R.C |Existential restriction  (> n R) | number restriction

27 27 TBox Assertions Concept introduction: –Person  Mammal Concept definition: –Parent = Person é (> 0 child) –HappyParent = Parent é (  child.Smart) Inclusion assertions: –Parent é (  child. (= name Karina))  HappyParent –Person é (> 5 child) é HappyParent  

28 28 Reasoning in DLs. Note: you can assert view facts – HappyParent(bob) –You don’t know who the children are, but you know they’re smart. Classification: C(a)? Consistency: is C necessarily an empty concept? Subsumption: C1  C2? Theoretically, everything boils down to subsumption. Complexity depends on set of constructors allowed.

29 29 DLs vs. Horn rules Horn rules can handle any variable pattern –DL’s can handle only specific patterns. DL’s can do subsumption with negation, number restrictions, and various other features. They can be combined but decidability is subtle (see CARIN, [Levy and Rousset, 1996]).


Download ppt "Principles of the Semantic Web DB or KRDB? Alon Halevy."

Similar presentations


Ads by Google