Assignment Two

Due Monday 17 February

It's important for us to understand and be able to work with XML for several reasons. First, XML was designed as an expressive language to store and exchange semi-structured data. As such, it is an alternative to RDF and other semantic web languages. Second, semantic web languages rely on many components of (or associated with) XML such as unicode, URIs, XML namespaces and Xsd datatypes. Finally, the XML serialization for RDF was the first one developed and first serialization for RDF and continues to be widely used.

You are asked to develop an XML representation for the UMBC course offerings. See a sam ple of computer science courses from the UMBC Spring 2014 schedule for the data that is associated with courses. Specifically

  • design an appropriate XML representation and express it using an XML Schema (not a DTD)
  • use your XML representation to encode the data for CMSC 203, 331 and 691 from the Spring 2014 schedule.
  • Develop a simple XSLT transformation to render this as HTML.
You will find the material in chapter two of the Semantic Web Primer helpful.

(1) Designing your representation

Your first job is to produce the XML Schema for your representation, giving it the name schedule.xsd

Even this simple problem can result in a complex representation. You don't need to do this. You can make the following simplifying assumptions:

  • Courses meet in the same room and at the same time on each day that it meets.
  • Courses have only one instructor

You can find the standard XML data types in the W3C's XML Schema Part 2: Datatypes document. Feel free to use the xs:string data type freely. Of course, if you want, you can use other data types (e.g., xs:gYear, xs:time, xs:nonNegativeInteger) but my advice is to keep it simple. be sure to add appropriate comments to help a person reading your schema understand it and how it is to be used.

Here's a sketch of the elements you might use. You can choose your own set of elements and your own names.


A schedule has
   a year (e.g., 2014) 
   a semester (e.g., Spring)
   one or more courses.

a course has 
 a program identifier (e.g., CMSC) 
 a number (e.g., 202, 691)
 a title (e.g., Computer Science II for Majors)
 a credits (e.g., 4)
 a grading method (e.g., REG/P-F/AUD)
 an optional registration constraint (e.g., PermReq)
 one or more sections.

A section has
 an instructor (e.g., R. Chang)
 a scheduleNumber (e.g., 1532)
 a sectionNumber (e.g., 0101)
 a room (e.g., LH8)
 a days (e.g., TuThr)
 a startTime (e.g., 10:00am)
 an endTime (e.g., 11:15am

(2) An example data file

The second step is to use your schema file to create an example XML data file for a part of the Spring 2014 Schedule. In particular, encode data for CMSC 203, 331 and 691 from the current course schedule. Name this file spring2014.xml. Your XML file should reference the xsl transform and also the xml schema file. Referencing the schema file in your xml document requires addinng two things to the root element:

  • A declaration of the XML Schama instance namespace, e.g., xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  • A link to your schema file using the XML Schama instance schemaLocation property, e.g., xsi:schemaLocation="http://umbc.edu/~finin/schedule.xsd"

See the expense report example and note how expenses.xml links to its xsd schema file and xsl transform file.

(3) An XSLT transformation file

The third step is to use XSLT to create a transform that will convert your xml file into HTML. Name this file schedule.xsl.

(4) What to hand in

We've not yet settled on a way to have you submit your work (e.g., git, cvs, submit). However, you will have to provide three files:

  • schedule.xsd - the schma file for a university schedule
  • spring2014.xml - your data for the courses 203, 331 and 691
  • schedule.xsl - the xsl transform file.

Tools you can use

You can develop your files using simple tools like emacs or eclipse. Both have packages to support XML: gnu emacs as nxml mode and Eclipse has severa, (e.g. Rinzo). Thre are a number of good commercial XML editors and most have a way you can evaluate the product for long enough to do this assignment. For example, you might check out XMLSpy or oXygen. You might also look the Wikipedia page comparing XML editors or at this list of XML editors from O'Reilly.