Semantic Web In-Class Assignment 2: xml & Related Technologies



Download 77.53 Kb.
Date31.01.2017
Size77.53 Kb.
#14013
Semantic Web - In-Class Assignment 2: XML & Related Technologies


  1. (1p) For the XML developed in the last lab, make a XSL document to transform the document into a XHTML strict page (courses.html) with this format:

Save your document to ex1.xsl



  1. (1p) Sort the above data according to the course name. Make an XSL (ex2.xsl) for that.

  2. (2p) Display the schedule for your group, but in a tabular form, like in the example below:

Make an XSL (ex3.xsl) for that.



4. (2p) Consider the dataset orders.xml (see Annex 1). Write XPath expressions for the following queries.

1. Customers who have the title Marketing Manager.

2. Customers whose name contains Yoshi.

3. The highest, lowest and average freight costs.

4. Orders that have not yet been sent (attribute shippedDate is missing for shipInfo)

5. The first order (in document order), for each customer.

6. Orders made by Greal in April 1998.

7. Orders made by a customer based in California.

8. The countries of delivery (or states for America).
Check the results in Oxygen.


  1. (1p) Practice XPath on http://learn.onion.net/language=en/35426/w3c-xpath

Examples:

Task name

Solution

Attribute selection

document/attribute::name

Conditional element selection

//linkList[@name='A']/document

Merging character strings

concat(concat(/person/lastName/text(),', '),/person/firstName/text())

Filtering by attribute value

//job[@priority='critical' or @priority='high']

Filtering by numeric values

/persons//person[@age<35]

Limiting number

/persons/person[position()<4]

Filtering by character conditions

/persons//*[starts-with(@firstName,'H')]

Filtering by text length

/persons//*[string-length(@firstName)<6]

Rounding up and down and adding

sum(//number[round(text())=34])

To get the 1p, you have to solve at least 10 XPath expressions and put them in an excel file, like in the examples. The first 10 are solved.


6. (4p) Interrogate the below XML (which models a bookstore) via XQuery to display:

1.1. the titles of all Books sorted by Price; (1p)

1.2. the books written by Stevens; (1p)

1.3.the number of books written by Stevens; (1p)

1.4. the number of books written by each author. (1p)




TCP/IP Illustrated
Stevens

Addison-Wesley


65.95




Principles of Databases
Abiteboul

Addison-Wesley


35.89




Advanced Programming in the Unix environment
Stevens

Addison-Wesley


65.95




Data <a href="/what-is-a-web-api.html">on the Web</a>
Abiteboul
Buneman
Suciu

Morgan Kaufmann Publishers


39.95




The Economics of Technology and Content for Digital TV

Gerbarg
CITI

Kluwer Academic Publishers


129.95






Annex 1: orders.xml





Great Lakes Food Market
Howard Snyder
Marketing Manager

(503) 555-7555


(503) 555-7552




2732 Baker Blvd.

Eugene
OR

97403


USA



Hungry Coyote Import Store
Yoshi Latimer
Sales Representative

(503) 555-6874



(503) 555-2376

City Center Plaza 516 Main St.

Elgin
OR

97827


USA





GREAL
6
1997-05-06T00:00:00
1997-05-20T00:00:00

2
3.35
Great Lakes Food Market
52 Rue Broca8
Paris

75005
France



GREAL
3
1997-09-25T00:00:00
1997-10-23T00:00:00

6
76.13
Great Lakes Food Market
Via Senzanme, 40
Bologna
8535
Italy



GREAL
4
1998-01-06T00:00:00
1998-02-03T00:00:00

2
719.78
Great Lakes Food Market
2732 Baker Blvd.
Eugene
OR
97403
USA



GREAL
3
1998-03-09T00:00:00
1998-04-06T00:00:00

2
33.68
Great Lakes Food Market
2732 Baker Blvd.
Eugene
OR
97403
USA



HUNGC
3
1996-12-06T00:00:00
1997-01-03T00:00:00

2
20.12
Hungry Coyote Import Store
City Center Plaza 516 Main St.
Elgin
OR
97827
USA



HUNGC
4
1997-07-16T00:00:00
1997-08-13T00:00:00

1
45.13
Hungry Coyote Import Store
City Center Plaza 516 Main St.
Elgin
OR
97827
USA





Download 77.53 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2024
send message

    Main page