290 likes | 411 Vues
This document presents XML schema definitions and data examples for flights and car rentals. The flights schema includes details about flight entities such as airline, departure, and arrival locations. For car rentals, the schema defines rental entities featuring company names, pick-up, and drop-off locations. Additionally, it outlines a query schema for XMLApe that allows for creating structured queries with sources, selections, and joins. These examples serve as a practical illustration for understanding XML data structures in transportation contexts.
E N D
XMLApe Architecture XMLApe Data Source XMLApe GUI XMLApe Engine XMLApe Data Source Figure 1
EXAMPLE - Flights Schema <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xmlape.cc.gatech.edu/myflights" xmlns="http://xmlape.cc.gatech.edu/myflights" elementFormDefault="qualified"> <xsd:element name="flights"> <xsd:complexType> <xsd:sequence> <xsd:element ref="flight" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="flight" type="flightType"/> <xsd:complexType name="flightType"> <xsd:sequence> <xsd:element name="airline" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="from" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="to" type="xsd:string" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:schema> Figure 2
EXAMPLE - Flights Data <?xml version="1.0"?> <flights xmlns="http://xmlape.cc.gatech.edu/myflights" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlape.cc.gatech.edu/myflights myflights.xsd"> <flight> <airline>Delta</airline> <from>Atlanta</from> <to>Detroit</to> </flight> <flight> <airline>Delta</airline> <from>Detroit</from> <to>Atlanta</to> </flight> <flight> <airline>USAirways</airline> <from>New York</from> <to>Los Angeles</to> </flight> </flights> Figure 3
EXAMPLE - Car Rentals Schema <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xmlape.cc.gatech.edu/myrental" xmlns="http://xmlape.cc.gatech.edu/myrental" elementFormDefault="qualified"> <xsd:element name="rentals"> <xsd:complexType> <xsd:sequence> <xsd:element ref="rental" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="rental" type="rentalType"/> <xsd:complexType name="rentalType"> <xsd:sequence> <xsd:element name="company" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="from" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="to" type="xsd:string" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:schema> Figure 4
EXAMPLE - Car Rentals data <?xml version="1.0"?> <rentals xmlns="http://xmlape.cc.gatech.edu/myrental" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlape.cc.gatech.edu/myrental myrental.xsd"> <rental> <company>Avis</company> <from>Atlanta</from> <to>Atlanta</to> </rental> <rental> <company>Dollar</company> <from>Atlanta</from> <to>Athens</to> </rental> <rental> <company>Thrifty</company> <from>New York</from> <to>Hartford</to> </rental> </rentals> Figure 5
TRAIN CAR RENTAL EVENT FLIGHT HOTEL CRUISE URL: Start screen with s-buttons and empty XMLApe Query Form Figure 6
Query Schema <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xmlape.cc.gtri.gatech.edu/query" xmlns="http://xmlape.cc.gtri.gatech.edu/query" elementFormDefault="qualified"> <xsd:element name="query" type="queryType" /> <xsd:complexType name="queryType"> <xsd:sequence> <xsd:element name="source" type="sourceType" minOccurs="0" maxOccurs="unbounded" /> <xsd:element name="select" type="selectType" minOccurs="0" maxOccurs="unbounded" /> <xsd:element name="join" type="joinType" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="sourceType"> <xsd:sequence> <xsd:element name="location" type="xsd:anyURI" minOccurs="1" maxOccurs="1" /> <xsd:element name="alias" type="xsd:string" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> Figure 7
Query Schema (cont.) <xsd:complexType name="selectType"> <xsd:sequence> <xsd:element name="schemaRef" type="schemaRefType" minOccurs="1" maxOccurs="1"/> <xsd:element name="value" type="xsd:string" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="joinType"> <xsd:sequence> <xsd:element name="schemaRef" type="schemaRefType" minOccurs="2" maxOccurs="unbounded" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="schemaRefType"> <xsd:sequence> <xsd:element name="alias" type="xsd:string" minOccurs="1" maxOccurs="1"/> <!-- change the type to specify XPath when we get a grip on that --> <xsd:element name="field" type="xsd:string" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:schema> Figure 8
Empty Query Document <?xml version="1.0" encoding="UTF-8"?> <query xmlns="http://xmlape.cc.gtri.gatech.edu/query" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://xmlape.cc.gtri.gatech.edu/query query.xsd"> </query> Figure 9
Empty Query Result Schema <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="query1_results" xmlns="query1_results" elementFormDefault="qualified"> <xsd:element name="results"> <xsd:complexType> <xsd:sequence> <xsd:element ref="result" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="result" type="resultType"/> <xsd:complexType name="resultType"> <xsd:sequence> </xsd:sequence> </xsd:complexType> </xsd:schema> Figure 10
Empty Query Result Data <?xml version="1.0"?> <results xmlns="query1_results" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="query1_results query1_results.xsd"> </results> Figure 11
TRAIN AIRLINE FROM TO FLIGHT RENTAL EVENT FLIGHT HOTEL CRUISE URL: XMLApe Query Form generated by the GUI from the XML schema in Figure 2 Figure 12
TRAIN AIRLINE COMPANY TO FROM AIRLINE TO FROM FROM TO FLIGHT FLIGHT RENTAL EVENT FLIGHT HOTEL CRUISE URL: RENTAL XMLApe Query Form; two FLIGHT schemas, Figure 2, and one RENTAL schema, Figure 4 Figure 13
3-source Query Document after Figure 13; no selections; no joins <?xml version="1.0" encoding="UTF-8"?> <query xmlns="http://xmlape.cc.gtri.gatech.edu/query" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://xmlape.cc.gtri.gatech.edu/query query.xsd"> <source> <!-- datasource for 'myflights.xsd' schema --> <location>http://xmlape.cc.gatech.edu/myflights.datasource</location> <alias>myflights1</alias> </source> <source> <!-- datasource for 'myflights.xsd' schema --> <location>http://xmlape.cc.gatech.edu/myflights.datasource</location> <alias>myflights2</alias> </source> <source> <!-- datasource for 'myrental.xsd' schema --> <location>http://xmlape.cc.gatech.edu/myrental.datasource</location> <alias>myrental1</alias> </source> </query> Figure 14
Result Schema for 3-source query; no selections; no joins <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="query2_results" xmlns="query2_results" xmlns:myrental="http://xmlape.cc.gatech.edu/myrental" xmlns:myflights="http://xmlape.cc.gatech.edu/myflights" elementFormDefault="qualified"> <xsd:import namespace="http://xmlape.cc.gatech.edu/myrental" schemaLocation="myrental.xsd"/> <xsd:import namespace="http://xmlape.cc.gatech.edu/myflights" schemaLocation="myflights.xsd"/> <xsd:element name="results"> <xsd:complexType> <xsd:sequence> <xsd:element ref="result" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="result" type="resultType"/> <xsd:complexType name="resultType"> <xsd:sequence> <xsd:element name="myflights1" type="myflights:flightType" minOccurs="1" maxOccurs="1"/> <xsd:element name="myflights2" type="myflights:flightType" minOccurs="1" maxOccurs="1"/> <xsd:element name="myrental1" type="myrental:rentalType" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:schema> Figure 15
Result Data for 3-source query;no selections; no joins <?xml version="1.0"?> <results xmlns="query2_results" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:myrental="http://xmlape.cc.gatech.edu/myrental" xmlns:myflights="http://xmlape.cc.gatech.edu/myflights" xsi:schemaLocation="query2_results query2_results.xsd"> <result> <myflights1> <myflights:airline>Delta</myflights:airline> <myflights:from>Atlanta</myflights:from> <myflights:to>Detroit</myflights:to> </myflights1> <myflights2> <myflights:airline>Delta</myflights:airline> <myflights:from>Atlanta</myflights:from> <myflights:to>Detroit</myflights:to> </myflights2> <myrental1> <myrental:company>Avis</myrental:company> <myrental:from>Atlanta</myrental:from> <myrental:to>Atlanta</myrental:to> </myrental1> </result> Figure 16
Result Data for 3-source query;no selections; no joins (cont.) 25 more <result>’s ……. and, finally, the last one: <result> <myflights1> <myflights:airline>USAirways</myflights:airline> <myflights:from>New York</myflights:from> <myflights:to>Los Angeles</myflights:to> </myflights1> <myflights2> <myflights:airline>USAirways</myflights:airline> <myflights:from>New York</myflights:from> <myflights:to>Los Angeles</myflights:to> </myflights2> <myrental1> <myrental:company>Thrifty</myrental:company> <myrental:from>New York</myrental:from> <myrental:to>Hartford</myrental:to> </myrental1> </result> </results> Figure 17
TRAIN COMPANY TO AIRLINE AIRLINE FLIGHT CAR FROM Detroit EVENT TO FLIGHT HOTEL FLIGHT CRUISE FROM URL: RENTAL FROM TO Query w/selections and joins in the XMLApe Query Form Surprise vacation: Leaving Detroit flying somewhere. Picking up a rental from that place and returning it to the same place. Leaving that place flying somewhere else. Figure 18
Query Document w/selections and joins corresponding to Figure 18 <?xml version="1.0" encoding="UTF-8"?> <query xmlns="http://xmlape.cc.gtri.gatech.edu/query" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://xmlape.cc.gtri.gatech.edu/query query.xsd"> <source> <!-- datasource for 'myflights.xsd' schema --> <location>http://xmlape.cc.gatech.edu/myflights.datasource</location> <alias>myflights1</alias> </source> <source> <!-- datasource for 'myflights.xsd' schema --> <location>http://xmlape.cc.gatech.edu/myflights.datasource</location> <alias>myflights2</alias> </source> <source> <!-- datasource for 'myrental.xsd' schema --> <location>http://xmlape.cc.gatech.edu/myrental.datasource</location> <alias>myrental1</alias> </source> Figure 19
Query Document w/selections and joins (cont.)corresponding to Figure 18 <select> <schemaRef> <alias>myflights1</alias> <field>"XPath expression: flightType:from"</field> </schemaRef> <value>Detroit</value> </select> <join> <schemaRef> <alias>myflights1</alias> <field>"XPath expression: flightType:to"</field> </schemaRef> <schemaRef> <alias>myflights2</alias> <field>"XPath expression: flightType:from"</field> </schemaRef> <schemaRef> <alias>myrental1</alias> <field>"XPath expression: myRental:from"</field> </schemaRef> <schemaRef> <alias>myrental1</alias> <field>"XPath expression: myRental:to"</field> </schemaRef> </join> </query> Figure 20
Schema for Result of query in Figure 19-20 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="query3_results" xmlns="query3_results" xmlns:myrental="http://xmlape.cc.gatech.edu/myrental" xmlns:myflights="http://xmlape.cc.gatech.edu/myflights" elementFormDefault="qualified"> <xsd:import namespace="http://xmlape.cc.gatech.edu/myrental" schemaLocation="myrental.xsd"/> <xsd:import namespace="http://xmlape.cc.gatech.edu/myflights" schemaLocation="myflights.xsd"/> <xsd:element name="results"> <xsd:complexType> <xsd:sequence> <xsd:element ref="result" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="result" type="resultType"/> <xsd:complexType name="resultType"> <xsd:sequence> <xsd:element name="myflights1" type="myflights:flightType" minOccurs="1" maxOccurs="1"/> <xsd:element name="myflights2" type="myflights:flightType" minOccurs="1" maxOccurs="1"/> <xsd:element name="myrental1" type="myrental:rentalType" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:schema> Figure 21
Result Data for query in Figure 19-20 <?xml version="1.0"?> <results xmlns="query3_results" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:myrental="http://xmlape.cc.gatech.edu/myrental" xmlns:myflights="http://xmlape.cc.gatech.edu/myflights" xsi:schemaLocation="query3_results query3_results.xsd"> <result> <myflights1> <myflights:airline>Delta</myflights:airline> <myflights:from>Detroit</myflights:from> <myflights:to>Atlanta</myflights:to> </myflights1> <myflights2> <myflights:airline>Delta</myflights:airline> <myflights:from>Atlanta</myflights:from> <myflights:to>Detroit</myflights:to> </myflights2> <myrental1> <myrental:company>Avis</myrental:company> <myrental:from>Atlanta</myrental:from> <myrental:to>Atlanta</myrental:to> </myrental1> </result> </results> Figure 22
Engine: Query Document breakdown (1 of 3) from Figure 19-20 <?xml version="1.0" encoding="UTF-8"?> <query xmlns="http://xmlape.cc.gtri.gatech.edu/query" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://xmlape.cc.gtri.gatech.edu/query query.xsd"> <source> <!-- datasource for 'myflights.xsd' schema --> <location>http://xmlape.cc.gatech.edu/myflights.datasource</location> <alias>myflights1</alias> </source> <select> <schemaRef> <alias>myflights1</alias> <field>"XPath expression: flightType:from"</field> </schemaRef> <value>Detroit</value> </select> </query> Figure 23
Engine: Result Data for query in Figure 23 <?xml version="1.0"?> <flights xmlns="http://xmlape.cc.gatech.edu/myflights" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlape.cc.gatech.edu/myflights myflights.xsd"> <flight> <airline>Delta</airline> <from>Detroit</from> <to>Atlanta</to> </flight> </flights> Figure 24
Engine: Query Document breakdown (2 of 3) from Figure 19-20 <?xml version="1.0" encoding="UTF-8"?> <query xmlns="http://xmlape.cc.gtri.gatech.edu/query" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://xmlape.cc.gtri.gatech.edu/query query.xsd"> <source> <!-- datasource for 'myflights.xsd' schema --> <location>http://xmlape.cc.gatech.edu/myflights.datasource</location> <alias>myflights2</alias> </source> </query> Figure 25
Engine: Result Data for query in Figure 25 <?xml version="1.0"?> <flights xmlns="http://xmlape.cc.gatech.edu/myflights" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlape.cc.gatech.edu/myflights myflights.xsd"> <flight> <airline>Delta</airline> <from>Atlanta</from> <to>Detroit</to> </flight> <flight> <airline>Delta</airline> <from>Detroit</from> <to>Atlanta</to> </flight> <flight> <airline>USAirways</airline> <from>New York</from> <to>Los Angeles</to> </flight> </flights> Figure 26
Engine: Query Document breakdown (3 of 3) from Figure 19-20 <?xml version="1.0" encoding="UTF-8"?> <query xmlns="http://xmlape.cc.gtri.gatech.edu/query" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://xmlape.cc.gtri.gatech.edu/query query.xsd"> <source> <!-- datasource for 'myrental.xsd' schema --> <location>http://xmlape.cc.gatech.edu/myrental.datasource</location> <alias>myrental1</alias> </source> <join> <schemaRef> <alias>myrental1</alias> <field>"XPath expression: myRental:from"</field> </schemaRef> <schemaRef> <alias>myrental1</alias> <field>"XPath expression: myRental:to"</field> </schemaRef> </join> </query> Figure 27
Engine: Result Data for query in Figure 27 <?xml version="1.0"?> <rentals xmlns="http://xmlape.cc.gatech.edu/myrental" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlape.cc.gatech.edu/myrental myrental.xsd"> <rental> <company>Avis</company> <from>Atlanta</from> <to>Atlanta</to> </rental> </rentals> Figure 28
Engine: Join Results from Figure 24-26-28 to get Result in Figure 22 <?xml version="1.0"?> <results xmlns="query3_results" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:myrental="http://xmlape.cc.gatech.edu/myrental" xmlns:myflights="http://xmlape.cc.gatech.edu/myflights" xsi:schemaLocation="query3_results query3_results.xsd"> <result> <myflights1> <myflights:airline>Delta</myflights:airline> <myflights:from>Detroit</myflights:from> <myflights:to>Atlanta</myflights:to> </myflights1> <myflights2> <myflights:airline>Delta</myflights:airline> <myflights:from>Atlanta</myflights:from> <myflights:to>Detroit</myflights:to> </myflights2> <myrental1> <myrental:company>Avis</myrental:company> <myrental:from>Atlanta</myrental:from> <myrental:to>Atlanta</myrental:to> </myrental1> </result> </results> Figure 29