CSC 513 XQuery 1: XML business message transformation
Announcement
No announcement right now
Introduction
The goal of this project is use XQuery to transform/query XML file.
Description
The Business Message Standards (BMS) publication packages provide the necessary information to implement XML message and extensions as part of the GS1 System. The Order business message provides the ability for a buyer to order specified quantities of goods and services from a seller for a single shipment to or from a single location. The Deliver/Warehouse Shipping Order business message is needed to pass order information from a supplier (seller) to a warehouse. Typical messages are a request for shipment, a change to a shipment, a modification to a shipment, or the cancellation of a shipment.
INPUT: Input XML File, the HTML view of the XML file is Input HTML View.
The input XML file lists the necessary information about an order: The order identification is PO3352, and the order is placed on the 11th of March 2012 at 11:00 AM. The buyer orders 4 kinds of line items and each of them has its requested quantity, price, shipping address and so on.
Then the seller should request warehouse to ship the items according to the shipping address. Your task is to transform the Order business message into a Deliver/Warehouse Shipping Order message:
- Query the creationDateTime of original order, and insert an element called revisedCreationDateTime element whose value is 4 days later than the creation date of original order (2012-03-11), and it is confirmed by the seller.
- Create a warehouseShippingOrder element with the revisedcreationDateTime of 2012-03-15T11:00:00, which is obtained from step 1. Make it contain the necessary information showed in the Output XML File.
- Insert a warehouseShippingOrderIdentification element and its subelements before the element orderIdentification with the necessary information showed in the Output XML File.
- Query the dutyFeeTaxBasisAmount and dutyFeeTaxAmount of all the line items identified by the LineItemNumber (1 to 4) and get the result of totalMonetaryAmountExcludingTaxes and totalTaxAmount:
totalMonetaryAmountExcludingTaxes = the sum of dutyFeeTaxBasisAmount of all the line items; totalTaxAmount = the sum of dutyFeeTaxAmount of all the line items.
- Insert two elements called totalMonetaryAmountExcludingTaxes and totalTaxAmount after the element billTo with the values you get from step 3.
- Create an orderLogisticalInformation element which specifies the details of all the line items grouped by the shipping address. The details of all the orderLineItem are showed in Output XML File.
OUTPUT: A revised Output XML File after modifications described above. The HTML view of the output XML file is Output HTML View.
Requirement
- The input is well-formed XML; the output should be well-formed XML. The output XML should effect the change as described.
- You do not need to output the html file, the html file provided is to give you an illustrative view of the XML file.
- In your xq file, you should show the process of query the value of creationDateTime of the original order and then get the value of revisedCreationDateTime. Directly using the value without query will not get any points.
- You can directly use the necessary information showed in the Output XML File when inserting the warehouseShippingOrderIdentification element and its subelements.
- In your xq file, you should show the process of query the value of dutyFeeTaxBasisAmount and dutyFeeTaxAmount and then get the value of totalMonetaryAmountExcludingTaxes and totalTaxAmount. Directly using the value without query will not get any points.
- You should use the XQuery to show the group by process when creating the orderLogisticalInformation element.
- You should not output any elements or attributes not used in the Output XML File even though they might be used in the input file.
- For all the elements without any modifications but are used in the Output XML File, you should use the XPath expressions in the XQuery to get the elements, simply copying the code from the input file for those elements will lose points.
- In your output XML file, all the namespace declarations should be in the order: ordermessage element, however, the order of the namespace declarations is trivial.
- There might be some differences between the Output XML File and Output HTML View, you should write your query according to the Output XML File.
- You can ignore the space (including tabs) in the output file when writing the xquery.
Deliverable
- submit your xq file(s) to course locker
Links maybe useful