- From: <mmurata@trl.ibm.co.jp>
- Date: Fri, 06 Jul 2001 11:09:41 +0900 (LMT)
- To: www-xml-query-comments@w3.org
- cc: atozawa@trl.ibm.co.jp, mmurata@trl.ibm.co.jp
Dear colleagues, Tozawa-san at IBM Tokyo Research Lab and I have read "XML Query Use Cases" (W3C) and quickly constructed output DTDs for sample queries in this document. We have not tried to construct the tightest DTDs, but I believe that our DTDs are very reasonable. Note: Not wearing the IBM hat, I will translate them to RELAX NG soon. Cheers, MURATA Makoto (FAMILY Given) *Currently visiting IBM Tokyo Research Lab -------------------------------------------------------------------- Section 1.1 Q1 Output DTD <!ELEMENT bib (book*)> <!ELEMENT book (title)> <!ATTLIST book year CDATA #IMPLIED> <!ELEMENT title (#PCDATA)> Q2 <!ELEMENT results (result*)> <!ELEMENT result (title, author)> <!ELEMENT title (#PCDATA)> <!ELEMENT author (last,first)> <!ELEMENT last (#PCDATA)> <!ELEMENT first (#PCDATA)> Q3 <!ELEMENT results (result*)> <!ELEMENT result (title, author+)> <!ELEMENT title (#PCDATA)> <!ELEMENT author (last,first)> <!ELEMENT last (#PCDATA)> <!ELEMENT first (#PCDATA)> Q4 <!ELEMENT results (result*)> <!ELEMENT result (author, title+)> <!ELEMENT title (#PCDATA)> <!ELEMENT author (last,first)> <!ELEMENT last (#PCDATA)> <!ELEMENT first (#PCDATA)> Q5 <!ELEMENT books-with-prices (book-with-price*)> <!ELEMENT books-with-price (title, price-amazon, price-bn)> <!ELEMENT title (#PCDATA)> <!ELEMENT price-amazon (#PCDATA)> <!ELEMENT price-bn (#PCDATA)> Q6 <!ELEMENT bib (book*)> <!ELEMENT book (title,author, (author | et-al)?> <!ELEMENT title (#PCDATA)> <!ELEMENT author (last,first)> <!ELEMENT last (#PCDATA)> <!ELEMENT first (#PCDATA)> <!ELEMENT et-al EMTPY> Q7 <!ELEMENT bib (book*) <!ELEMENT book (title)> <!ATTLIST book year CDATA #REQUIRED> <!ELEMENT title (#PCDATA)> Q8 <!-- Hedges rather than trees --> <!ELEMENT book (book)> <!ELEMENT book (title, author)> <!ELEMENT title (#PCDATA)> <!ELEMENT author (last,first)> <!ELEMENT last (#PCDATA)> <!ELEMENT first (#PCDATA)> Q9 <!ELEMENT results (title*)> <!ELEMENT title (#PCDATA)> Q10 <!ELEMENT results (minprice*)> <!ELEMENT minprice (price) <!ATTLIST minprice title CDATA #REQUIRED> <!ELEMENT price (#PCDATA)> Q11 <!ELEMENT bib (book*, reference*)> <!ELEMENT book (title, author)> <!ELEMENT reference (title, org)> <!ELEMENT org (#PCDATA)> <!ELEMENT title (#PCDATA)> <!ELEMENT author (last,first)> <!ELEMENT last (#PCDATA)> <!ELEMENT first (#PCDATA)> Q12 <!ELEMENT bib (book-pair*)> <!ELEMENT book-pair (title, title)> <!ELEMENT title (#PCDATA)> Section 1.2 Q1 <!ELEMENT toc (section+)> <!ELEMENT section (title, section*)> <!ATTLIST section id ID #IMPLIED difficulty CDATA #IMPLIED> <!ELEMENT title (#PCDATA)> Q2 <!ELEMENT figlist (figure*)> <!ELEMENT figure <!ELEMENT figure (title)> <!ATTLIST figure width CDATA #REQUIRED height CDATA #REQUIRED > Q3 <!-- a hedge (section_count, figure_count) --> <!ELEMENT section_count (#PCDATA)> <!ELEMENT figure_count (#PCDATA)> Q4 <!ELEMENT top_section_count (#PCDATA)> Q5 <!ELEMENT section_list (section*)> <!ELEMENT section (EMPTY)> <!ATTLIST section title CDATA #REQUIRED figcount CDATA #REQUIRED > Q6 <!ELEMENT toc (section*)> <!ELEMENT section (title, figcount, section*)> <!ATTLIST section id ID #IMPLIED difficulty CDATA #IMPLIED> <!ELEMENT title (#PCDATA)> <!ELEMENT figcount (#PCDATA)> Section 1.3 Q1 <!ELEMENT instrument (#PCDATA)> Q2 <!-- hedges rather than trees --> <!ELEMENT instrument (#PCDATA)> Q3 <!-- hedges rather than trees --> <!ELEMENT instrument (#PCDATA)> Q4 <!ELEMENT section (section.title, section.content)> <!ELEMENT section.title (#PCDATA )> <!ELEMENT section.content (#PCDATA | anesthesia | prep | incision | action | observation )*> <!-- Mixed content models of XML 1.0 cannot capture the requirement. --> <!ELEMENT anesthesia (#PCDATA)> <!ELEMENT prep ( (#PCDATA | action)* )> <!ELEMENT incision ( (#PCDATA | geography | instrument)* )> <!ELEMENT action ( (#PCDATA | instrument )* )> <!ELEMENT observation (#PCDATA)> <!ELEMENT geography (#PCDATA)> <!ELEMENT instrument (#PCDATA)> Q5 <!-- (#PCDATA | anesthesia | prep | action | observation )* --> <!ELEMENT anesthesia (#PCDATA)> <!ELEMENT prep ( (#PCDATA | action)* )> <!ELEMENT incision ( (#PCDATA | geography | instrument)* )> <!ELEMENT action ( (#PCDATA | instrument )* )> <!ELEMENT observation (#PCDATA)> <!ELEMENT geography (#PCDATA)> <!ELEMENT instrument (#PCDATA)> Section 1.4 Q1 <!ELEMENT result (item_tuple*)> <!ELEMENT item_tuple (itemno, description)> <!ELEMENT itemno (#PCDATA)> <!ELEMENT description (#PCDATA)> Q2 <!ELEMENT result (item_tuple*)> <!ELEMENT item_tuple (itemno, description)> <!ELEMENT itemno (#PCDATA)> <!ELEMENT description (#PCDATA)> <!ELEMENT high_bid (bid)> <!ELEMENT bid (#PCDATA)> Q3 <!ELEMENT result (warning*)> <!ELEMENT warning (name, rating, description, reserve_price)> <!ELEMENT name (#PCDATA)> <!ELEMENT rating (#PCDATA)> <!ELEMENT reserve_price (#PCDATA)> Q4 <!ELEMENT result (no_bid_item*)> <!ELEMENT no_bid_item (itemno, description)> <!ELEMENT itemno (#PCDATA)> <!ELEMENT description (#PCDATA)> Q5 <!ELEMENT result (jones_bike*)> <!ELEMENT jones_bike (itemno, description, high_bid, high_bidder)> <!ELEMENT itemno (#PCDATA)> <!ELEMENT description (#PCDATA)> <!ELEMENT high_bid (bid)> <!ELEMENT bid (#PCDATA)> <!ELEMENT high_bidder (#PCDATA)> Q6 <!ELEMENT result (successful_item*)> <!ELEMENT successful_item (itemno, description, reserve_price, high_bid)> <!ELEMENT itemno (#PCDATA)> <!ELEMENT description (#PCDATA)> <!ELEMENT high_bid (bid)> <!ELEMENT bid (#PCDATA)> Q7 <!ELEMENT high_bid (bid)> <!ELEMENT bid (#PCDATA)> Q8 <!ELEMENT item_count (#PCDATA)> Q9 <!ELEMENT result (monthly_report*)> <!ELEMENT monthly_report (month, item_count)> <!ELEMENT month (#PCDATA)> <!ELEMENT item_count (#PCDATA)> Q10 <!ELEMENT result (high_bid*)> <!ELEMENT high_bid (itemno, bid, bidder)> <!ELEMENT itemno (#PCDATA)> <!ELEMENT bid (#PCDATA)> <!ELEMENT bidder (#PCDATA)> Q11 <!ELEMENT result (expensive_item*)> <!ELEMENT expensive_item (itemno, description, high_bid)> <!ELEMENT itemno (#PCDATA)> <!ELEMENT description (#PCDATA)> <!ELEMENT high_bid (bid)> <!ELEMENT bid (#PCDATA)> Q12 <!ELEMENT result (popular_item*)> <!ELEMENT popular_item (itemno, description, bid_count)> <!ELEMENT itemno (#PCDATA)> <!ELEMENT description (#PCDATA)> <!ELEMENT bid_count (#PCDATA)> Q13 <!ELEMENT result (bidder*)> <!ELEMENT bidder (userid, name, bidcount, avgbid) <!ELEMENT userid (#PCDATA)> <!ELEMENT name (#PCDATA)> <!ELEMENT bidcount (#PCDATA)> <!ELEMENT avgbid (#PCDATA)> Q14 <!ELEMENT result (popular_item*)> <!ELEMENT popular_item (itemno, avgbid)> <!ELEMENT itemno (#PCDATA)> <!ELEMENT avgbid (#PCDATA)> Q15 <!ELEMENT result (big_spender*)> <!ELEMENT big_spender (#PCDATA)> Q16 <!ELEMENT result (user*)> <!ELEMENT user (userid, name, status)> <!ELEMENT userid (#PCDATA)> <!ELEMENT name (#PCDATA)> <!ELEMENT status (#PCDATA)> <!-- either inactive or active --> Q17 <!ELEMENT frequent_bidder (name*)> <!ELEMENT name (#PCDATA)> Q18 <!ELEMENT result (user*)> <!ELEMENT user (name, bid_on_item*)> <!ELEMENT name (#PCDATA)> <!ELEMENT bid_on_item (#PCDATA)> Section 1.5 For Q1-5, Q8a <!ELEMENT xref EMPTY> <!ATTLIST xref xrefid CDATA #IMPLIED> <!-- IDREF reference may be broken --> <!ELEMENT emph (#PCDATA | emph)*> Q1-3. <!ELEMENT result (para*)> <!ELEMENT para (#PCDATA | emph | xref)*> <!ATTLIST para security (u | c | s | ts) #IMPLIED> Q4. <!ELEMENT result (para?)> <!ELEMENT para (#PCDATA | emph | xref)*> <!ATTLIST para security (u | c | s | ts) #IMPLIED> Q5. <!ELEMENT result (para?)> <!ELEMENT para (#PCDATA | emph | xref)*> <!ATTLIST para security #FIXED "c"> <!-- security should be "c" --> Q6,7. <!ELEMENT result (#PCDATA)> Q8a. Q8b. <!ELEMENT result (section*)> <!ELEMENT section (tiltle, intro?, topic*)> <!ELEMNT topic (title, para | graphic)+> <!ATTLIST topic shorttitle CDATA #IMPLIED topicid ID #IMPLIED> <!ELEMENT intro (para | graphic)*> <!ELEMENT graphic EMPTY> <!ATTLIST graphic graphname ENTITY #REQUIRED> <!ELEMENT title (#PCDATA | emph)*> <!ELEMENT para (#PCDATA | emph | xref)*> <!ATTLIST para security (u | c | s | ts) #IMPLIED> Q9. <!ELEMENT result (topic*)> <!ELEMNT topic (title, para | graphic)+> <!ATTLIST topic shorttitle CDATA #IMPLIED topicid ID #REQUIRED> <!-- we need topicid --> <!ELEMENT intro (para | graphic)*> <!ELEMENT graphic EMPTY> <!ATTLIST graphic graphname ENTITY #REQUIRED> <!ELEMENT title (#PCDATA | emph)*> <!ELEMENT para (#PCDATA | emph | xref)*> <!ATTLIST para security (u | c | s | ts) #IMPLIED> Q10. <!ELEMENT result (title?)> <!ELEMENT title (#PCDATA | emph)*> Section 1.6 Q1. <!-- a top level is title* --> <!ELEMENT title (#PCDATA)> Q2 <!-- a top level is news_item* --> <!ELEMENT news_item (title, date)> <!ELEMENT title (#PCDATA)> <!ELEMENT date (#PCDATA)> Q3. <!-- a top level is title* --> <!ELEMENT title (#PCDATA)> Q4, Q6. <!-- a top level is news_item* --> <!ELEMENT news_item (title, content, date, author?, news_agent)> <!ELEMENT title (#PCDATA)> <!ELEMENT content (par | figure)+ > <!ELEMENT date (#PCDATA)> <!ELEMENT author (#PCDATA)> <!ELEMENT news_agent (#PCDATA)> <!ELEMENT par (#PCDATA | quote | footnote)*> <!ELEMENT quote (#PCDATA)> <!ELEMENT footnote (#PCDATA)> <!ELEMENT figure (title, image)> <!ELEMENT image EMPTY> <!ATTLIST image source CDATA #REQUIRED > Q5. <!-- a top level is item_summary* --> <!ELEMENT item_summary (#PCDATA) > Section 1.7 Since the input schema is not shown in the current version of XML Query Use Cases, we use an input schema as below: <!ELEMENT ma:Auction (ma:AuctionHomepage, ma:Schedule, ma:Price, ma:TradingPartners, ma:Details)> <!-- namespace declarations --> <!ATTLIST ma:Auction xmlns:ma CDATA #FIXED "http://www.example.com/AuctionWatch" xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink" xmlns:anyzone CDATA #FIXED "http://www.example.com/auctioneers#anyzone" xmlns:eachbay CDATA #FIXED "http://www.example.com/auctioneers#eachbay" xmlns:yabadoo CDATA #FIXED "http://www.example.com/auctioneers#yabadoo" xmlns:dt CDATA #FIXED "http://www.w3.org/1999/XMLSchema-datatypes" xmlns:music CDATA #FIXED "http://www.example.org/music/records" > <!ELEMENT ma:AuctionWatchList (ma:Auction*)> <!ELEMENT ma:AuctionHomepage EMPTY> <!ATTLIST ma:AuctionHomepage xlink:type (simple) #FIXED "simple" xlink:href CDATA #REQUIRED xlink:role CDATA #IMPLIED > <!ELEMENT ma:Schedule (ma:Open, ma:Close)> <!ELEMENT ma:Open (#PCDATA)> <!ELEMENT ma:Close (#PCDATA)> <!ATTLIST ma:Open dt:type (timeInstant) #FiXED "timeInstant"> <!ATTLIST ma:Close dt:type (timeInstant) #FiXED "timeInstant"> <!ELEMENT ma:Price (ma:Start, ma:Current, ma:Number_of_Bids)> <!ELEMENT ma:Start (#PCDATA)> <!ELEMENT ma:Current (#PCDATA)> <!ELEMENT ma:Number_of_Bids (#PCDATA)> <!ATTLIST ma:Start ma:currency (USD) #FIXED "USD"> <!ATTLIST ma:Current ma:currency (USD) #FIXED "USD"> <!ELEMENT ma:TradingPartners (ma:High_Bidder, ma:Seller)> <!ENTITY % eachbay.info "eachbay:ID, eachbay:PositiveComments, eachbay:NeutralComments, eachbay:NegativeComments"> <!ENTITY % yabadoo.info "yabadoo:ID, yabadoo:PositiveComments, yabadoo:NeutralComments, yabadoo:NegativeComments"> <!ENTITY % anyzone.info "anyzone:ID, anyzone:Member_Since, anyzone:Rating"> <!ELEMENT ma:High_Bidder ((%eachbay_info; | %yabadoo.info; | %anyzone.info;), ma:MemberInfoPage)> <!ELEMENT ma:Seller ((%eachbay_info; | %yabadoo.info; | %anyzone.info;), ma:MemberInfoPage)> <!ELEMENT eachbay:ID (#PCDATA)> <!ELEMENT eachbay:PositiveComments (#PCDATA)> <!ELEMENT eachbay:NeutralComments (#PCDATA)> <!ELEMENT eachbay:NegativeComments (#PCDATA)> <!ELEMENT yabadoo:ID (#PCDATA)> <!ELEMENT yabadoo:PositiveComments (#PCDATA)> <!ELEMENT yabadoo:NeutralComments (#PCDATA)> <!ELEMENT yabadoo:NegativeComments (#PCDATA)> <!ELEMENT anyzone:ID (#PCDATA)> <!ELEMENT anyzone:Member_Since (#PCDATA)> <!ELEMENT anyzone:Rating (#PCDATA)> <!ELEMENT ma:MemberInfoPage EMPTY> <!ATTLIST ma:MemberInfoPage xlink:type (simple) #FIXED "simple" xlink:href CDATA #REQUIRED xlink:role CDATA #IMPLIED> <!ELEMENT ma:Details (music:record)> <!ELEMENT music:record (music:artist, music:title, music:recorded, music:label, ma:remark*)> <!ELEMENT music:artist (#PCDATA)> <!ELEMENT music:title (#PCDATA)> <!ELEMENT music:recorded (#PCDATA)> <!ELEMENT music:label (#PCDATA)> <!ELEMENT music:remark (#PCDATA)> <!ATTLIST music:remark xml:lang CDATA #IMPLIED> Q1. <!ELEMENT Q1 (#PCDATA)> Q2. <!ELEMENT Q2 (music:title*)> <!ATTLIST Q2 xmlns:music CDATA #FIXED "http://www.example.org/music/records" > <!ELEMENT music:title (#PCDATA)> Q3. <!ELEMENT Q3 (ma:Open, ma:Close)*> <!ATTLIST Q3 xmlns:ma CDATA #FIXED "http://www.example.com/AuctionWatch" > <!ELEMENT ma:Open (#PCDATA)> <!ELEMENT ma:Close (#PCDATA)> <!ATTLIST ma:Open dt:type (timeInstant) #FiXED "timeInstant"> <!ATTLIST ma:Close dt:type (timeInstant) #FiXED "timeInstant"> Q4. <!ELEMENT Q4 (#PCDATA)> Q5. <!ELEMENT Q5 (music:record*)> <!ATTLIST Q5 xmlns:music CDATA #FIXED "http://www.example.org/music/records" > <!ELEMENT music:record (music:artist, music:title, music:recorded, music:label, ma:remark*)> <!ELEMENT music:artist (#PCDATA)> <!ELEMENT music:title (#PCDATA)> <!ELEMENT music:recorded (#PCDATA)> <!ELEMENT music:label (#PCDATA)> <!ELEMENT music:remark (#PCDATA)> <!ATTLIST music:remark xml:lang (de) #FIXED "de"> <!-- de only --> Q6. <!ELEMENT Q6 (ma:Close*)> <!ATTLIST Q6 xmlns:ma CDATA #FIXED "http://www.example.com/AuctionWatch" > <!ELEMENT ma:Close (#PCDATA)> <!ATTLIST ma:Close dt:type (timeInstant) #FiXED "timeInstant"> Q7. <!ELEMENT Q7 (ma:AuctionHomepage*)> <!ATTLIST Q7 xmlns:ma CDATA #FIXED "http://www.example.com/AuctionWatch" > <!ELEMENT ma:AuctionHomepage EMPTY> <!ATTLIST ma:AuctionHomepage xlink:type (simple) #FIXED "simple" xlink:href CDATA #REQUIRED xlink:role CDATA #IMPLIED > Q8. <!ELEMENT Q8 (ma:High_Bidder | ma:Seller)*> <!-- 0 negative comments cannot be captured --> <!ATTLIST Q8 xmlns:ma CDATA #FIXED "http://www.example.com/AuctionWatch" xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink" xmlns:anyzone CDATA #FIXED "http://www.example.com/auctioneers#anyzone" xmlns:eachbay CDATA #FIXED "http://www.example.com/auctioneers#eachbay" xmlns:yabadoo CDATA #FIXED "http://www.example.com/auctioneers#yabadoo" > <!ENTITY % eachbay.info "eachbay:ID, eachbay:PositiveComments, eachbay:NeutralComments, eachbay:NegativeComments"> <!ENTITY % yabadoo.info "yabadoo:ID, yabadoo:PositiveComments, yabadoo:NeutralComments, yabadoo:NegativeComments"> <!ENTITY % anyzone.info "anyzone:ID, anyzone:Member_Since, anyzone:Rating"> <!ELEMENT ma:High_Bidder ((%eachbay_info; | %yabadoo.info; | %anyzone.info;), ma:MemberInfoPage)> <!ELEMENT ma:Seller ((%eachbay_info; | %yabadoo.info; | %anyzone.info;), ma:MemberInfoPage)> <!ELEMENT ma:MemberInfoPage EMPTY> <!ATTLIST ma:MemberInfoPage xlink:type (simple) #FIXED "simple" xlink:href CDATA #REQUIRED xlink:role CDATA #IMPLIED> <!ELEMENT eachbay:ID (#PCDATA)> <!ELEMENT eachbay:PositiveComments (#PCDATA)> <!ELEMENT eachbay:NeutralComments (#PCDATA)> <!ELEMENT eachbay:NegativeComments (#PCDATA)> <!ELEMENT yabadoo:ID (#PCDATA)> <!ELEMENT yabadoo:PositiveComments (#PCDATA)> <!ELEMENT yabadoo:NeutralComments (#PCDATA)> <!ELEMENT yabadoo:NegativeComments (#PCDATA)> <!ELEMENT anyzone:ID (#PCDATA)> <!ELEMENT anyzone:Member_Since (#PCDATA)> <!ELEMENT anyzone:Rating (#PCDATA)> Section 1.8 -- output DTD is already given Section 1.9 <!ELEMENT census (person*)> <!ELEMENT person (person*)> <!ATTLIST person name ID #REQUIRED spouse IDREF #IMPLIED job CDATA #IMPLIED> Q1. <!ELEMENT result (person?)> <!-- at most one --> <!ELEMENT person EMPTY> <!ATTLIST person name ID #REQUIRED spouse CDATA #REQUIRED job CDATA #IMPLIED> Q2-3, 6, 9 <!ELEMENT result (person)*> <!ELEMENT person EMPTY> <!ATTLIST person name ID #REQUIRED spouse CDATA #IMPLIED job CDATA #IMPLIED> Q4. <!ELEMENT result (person)*> <!ELEMENT person EMPTY> <!ATTLIST person name ID #REQUIRED spouse CDATA #IMPLIED job CDATA #REQUIRED> <!-- person has a job --> Q5. <!ELEMENT result (match)*> <!ELEMENT match EMPTY> <!ATTLIST match parent CDATA #REQUIRED child CDATA #REQUIRED job CDATA #REQUIRED> <!-- parent and child duplicately appear --> Q7. <!ELEMENT result (grandparent)*> <!ELEMENT grandparent EMPTY> <!ATTLIST grandparent name CDATA #REQUIRED grandchild CDATA #REQUIRED> <!-- grandparent and grandchild duplicately appear --> Q8. <!ELEMENT result (person?, person?)> <!-- at most two persons --> <!ELEMENT person EMPTY> <!ATTLIST person name ID #REQUIRED spouse CDATA #IMPLIED job CDATA #IMPLIED> Q10. <!ELEMENT result (person*)> <!ELEMENT person EMPTY> <!ATTLIST person name ID #REQUIRED job CDATA #IMPLIED> <!-- no spouse --> Q11. <!ELEMENT result (descendant*)> <!ELEMENT descendant (#PCDATA)> <!ATTLIST married (Yes | No) #REQUIRED kids CDATA #REQUIRED> <!-- returns Yes or No and a number of kids -->
Received on Thursday, 5 July 2001 22:10:59 UTC