1 / 16

CS144 Discussion Week 3 DTD/ XPath /Normalization

CS144 Discussion Week 3 DTD/ XPath /Normalization. Young Cha Oct. 18, 2013. Project 1: Grading. Will be released after this discussion section You should appeal within the appeal period Appeal period will be 3 working days How to appeal? We will take care of your appeals in a batch

nadine
Download Presentation

CS144 Discussion Week 3 DTD/ XPath /Normalization

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS144 Discussion Week 3DTD/XPath/Normalization Young Cha Oct. 18, 2013

  2. Project 1: Grading • Will be released after this discussion section • You should appeal within the appeal period • Appeal period will be 3 working days • How to appeal? • We will take care of your appeals in a batch • Grading rules • -10pts for each output error • -5pts for internal error • Our automated grader got improved! • Deducted only once for each part (HTML, SQL, Java) • Avg. 70  90 • We may deduct more from next submission For p1: ~ 6pm Wed (10/23) Private post in Piazza (w/ project1 & appeal tags)

  3. Project 1: SHA1 Sum Mismatch • Your SHA1 sum should match with the one produced by the sha1sum command in VM • Leading 0 error • 1 byte difference in checksum value • fd852df5478eb7eb9410ee911bb364adf487fb0 – wrong • fd852df5478eb7eb9410ee9101bb364adf487fb0 – correct

  4. DTD: Example 1 • *, +, ? • #PCDATA vs. CDATA • Default value • Order for Elements vs. Attributes

  5. DTD: Example 2 • ID • IDREF(S)

  6. XML Schema: Example • targeNamespace • minOccurs/maxOccurs • sequence

  7. XPath: Example Queries 1 • Our XPath Lab works w/ Chrome & FF • Should click Evaluate (result doesn’t change for wrong query) • /AAA • //CCC • /AAA/BBB • /AAA/BBB/* • /AAA/BBB[1] • /AAA/BBB[last()] • /AAA/BBB/@aaa • /AAA/BBB[@aaa] • /AAA/BBB[@aaa=‘111’] • /AAA/BBB[CCC] • /AAA/BBB[./CCC]

  8. XPath: Example Queries 2 • /AAA/BBB[.//CCC > 30] • //*[CCC > 20] • //*[. > 20] • //DDD[.//CCC > 20]/EEE • //CCC | //BBB

  9. XQuery: XPath & More • - from • - where • - order by • - select • FLWOR syntax • for • let • where • order by • return • XPath syntax works in XQuery(XPath is a subset of XQuery) * Examples are from http://w3schools.com

  10. XQuery: XPath & More • XQuery + HTML (like PHP) • Conditional statement • Let statement

  11. Normalization: Redundancy

  12. Normalization: BCNF Decomposition For any R in the schema If (X  Y holds on R AND X  Y is non-trivial AND X does not contain a key), then 1) Compute X+ (X+: closure of X) 2) Decompose R into R1(X+) and R2(X, Z) // X becomes common attributes // Z: all attributes in R except X+ Repeat until no more decomposition

  13. Normalization: Question 1 BC is minimal.

  14. Normalization: Question 2

  15. Normalization: Project 2 Q&A You may assume that those values are correct • Number_of_Bids == actual # of bids? Currently? • Seller/Bidder are Users? • Multiple bids on the same item at the same time? • Can a user bid on different items at the same time? • List all completely nontrivial functional dependencies that hold on each relation, excluding those that effectively specify keys. Yes You may assume that these are not the case For F:X  Y, list F only if X doesn’t contain a key

  16. Normalization: Project 2 Q&A It’s optional • Foreign key constraints • Are Name and Description unique? • Are null values allowed? • Do we need Category ID? No. You may find James’ answer helpful when you debug your code Yes. For efficiency you may allow null values It’s up to your design

More Related