160 likes | 271 Views
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
E N D
CS144 Discussion Week 3DTD/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 • 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)
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
DTD: Example 1 • *, +, ? • #PCDATA vs. CDATA • Default value • Order for Elements vs. Attributes
DTD: Example 2 • ID • IDREF(S)
XML Schema: Example • targeNamespace • minOccurs/maxOccurs • sequence
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]
XPath: Example Queries 2 • /AAA/BBB[.//CCC > 30] • //*[CCC > 20] • //*[. > 20] • //DDD[.//CCC > 20]/EEE • //CCC | //BBB
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
XQuery: XPath & More • XQuery + HTML (like PHP) • Conditional statement • Let statement
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
Normalization: Question 1 BC is minimal.
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
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