Projects

AtlasML

AtlasML is a markup language for describing cities and the highways that connect them. Create an AtlasML document that describes the major cities in the Bay Area and the Interstates that connect them.

Version 2.0 of AtlasML simply describes the mileage between cities. Create another document that describes the major cities of the Bay Area and the approximate mileage between them. Consider using TableML.

FamilyML

FamilyML is to be a markup language for representing families. A FamilyML document will consist of elements representing the members of a family. It will also contain information showing the following relationships:

X is the parent of Y
X is the spouse of Y
X is male
X is female

How would you represent the Simpsons in your FamilyML? (Simpsons = Abe, Homer, Marge, Maggie, Bart, and Lisa)

Write and test a DTD for FamilyML.

Write and test a schema for FamilyML.

Write an XSLT style sheet that represents a family as a table. Each family member corresponds to a row and column in the table. The row X column Y entry of the table is the relationship between family member X and family member Y. The possible relationships are:

son, daughter, sister, brother, wife, husband, father, mother, grandfather, grandmother, grandson, granddaughter, and self

Another approach to representing families is to use XLink. How would you represent the Simpsons using XLink?

How would you represent the Simpsons using RDF?

Recipe ML

RecipeML is an XML language for representing cookbooks. A cookbook consists of many recipes. A recipe consists of

1. The name of the dish
2. a brief description of the dish
3. a list of ingredients (including amounts) that will be needed
4. a list of the steps

Write a DTD for RecipeML

Write a schema for RecipeML

Create a cookbook consisting of at least three recipes.

ResumeML

Here's resume.dtd, which specifies the grammar for ResumeML, a markup language for resumes:

<!ELEMENT resume (name, education, employment, interests)>
<!ELEMENT name (#PCDATA)>
<!ATTLIST name title CDATA #IMPLIED>
<!ELEMENT education (school*)>
<!ELEMENT employment (job*)>
<!ELEMENT interests (interest+)>

<!ELEMENT school (name, period, degree?, major?)>
<!ELEMENT period (start, end)>
<!ELEMENT start (#PCDATA)>
<!ELEMENT end (#PCDATA)>
<!ELEMENT degree (#PCDATA)>
<!ELEMENT major (#PCDATA)>

<!ELEMENT job (employer, title?, period, responsibilities)>
<!ELEMENT employer (start, end)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT responsibilities (#PCDATA)>

<!ELEMENT interest (#PCDATA)>
<!ATTLIST interest category CDATA #IMPLIED>

Write resume.xml, your fantasy resume in ResumeML.

Create a home page for yourself. Use XSLT instructions to extract information from resume.xml. For example, here's my home page:

ExpML

ExpML is a markup language for simple arithmetic expressions. For example an expression such as

4 + (5 * 3)

can be expressed in ExpML as

<expression>
   <operator> add </operator>
   <number> 4 </number>
   <expression>
      <operator> mult </operator>
      <number> 5 </number>
      <number> 3 </number>
   </expression>
</expression>

Here's a simple grammar for arithmetic expressions:

<Exp> ::= <Exp> <Op> <Exp> | <Number>
<Op> ::= add | mult | sub | div

1. How would you represent the following expressions in ExpML:

(2 * 3) + (4 * 5)
2 * (3 + (4 * 5))
((2 * 3) + 4) * 5

2. Write a DTD for ExpML.

3. Write a Schema for ExpML.

4. Create a style sheet that uses recursive templates to print and evaluate these types of XML documents:

Processing Hierarchies

The organizational structure of a university is a typical hierarchy:

A university has a provost and many colleges.
A college has a dean and many schools and departments.
A school has many departments
A department has many groups and many faculty members
A group has many faculty members
A faculty member has a rank (assistant, associate, or full professor) and may be a department chair.

We can represent the organizational hierarchy of a university as an XML file (see org.xml).

1. Write an XSLT stule sheet called org1.xsl that displays organizational hierarchies Displaying a Hierarchy using Lists and Headings (project1.xsl)

For example, applying project1.xsl to org.xml produces result.html:

2. Mapping a Hierarchy to a Table. Create result2.html.

3. Mapping Hierarchies to Different Hierarchies

The staff of a university consists of a provost, a list of deans, a list of full professors, a list of associate professors, and a list of assistant professors. A dean consists of a name and a college. A professor (of any rank) consists of a name, department, and college. See result3.xml.

Polynomials

How would you represent a polynomial such as:

4x2y3 + 2xy2 - 5y + 12

as an XML file?

Write a DTD for polynomials.

Write a Schema for polynomials.

Matrices

How would you represent N x M matrices as XML documents?

NewsML

Assume newsletters for your fan club are stored in XML documents that instantiate the NewsML language. Here's an example:

<newsletter issue = "23" month = "May" year = "2003">
   <article>
      <title> Big Freak Out on Detroit Avenue </title>
      <by> Flakey Foont </by>
      <photo> freakout.JPG </photo> <!-- photo optional -->
      <text>
         This morning Bill Ding freaked out while having an  
         existential crisis on the 200 block of Detroit Avenue.
         Onlookers were sickened.
      </text>
   </article>
   <!-- more articles go here -->
</newsletter>

1. Write a DTD for NewsML.

2. Write a schema for NewsML

3. Write a style sheet to render newsletters. Here's a sample output:

Notice that the output is a table with caption "My Fanclub Newsletter". The first row contains the date and issue number. After that there are three styles of rows:

1. A row containing two columns, each column containing an article without a photograph.

2. A row containing two columns, the first column is an article, the second column containing the accompanying photograph.

3. A row containing one column consisting of a single article without an accompanying photograph. This style of row is generally used when there is only one article left or when an odd numbered article has no photograph, but the following article does.

Affiliation

An enterprise consists of many organizations. An organization may have zero or more subsidiary organizations and zero or one parent organizations within the enterprise. Every organization has a type (such as regiment, department, team, etc.).

Enterprise 1: The San Francisco 49ers are in the Western division of the National Football Conference (NFC). The Oakland Raiders are in the Western division of the American Football Conference (AFC). Both the NFC and AFC are subsidiaries of the National Football League (NFL).

Enterprise 2: The Department of Mathematics and the Department of Physics are subsidiaries of the College of Science, which is a subsidiary of the University of Antarctica.

Design a language called OrgML for representing the affiliations between organizations in an enterprise.

How would represent Enterprises 1 and 2 in OrgML?

Write a DTD for OrgML.
Write a schema for OrgML.

How could you represent Enterprises 1 and 2 using XLink?

How could you represent Enterprises 1 and 2 using RDF?

An enterprise has rules that describe its affiliations. For example, the affiliation rules for Enterprise 2 are:

Departments are subsidiaries of Colleges
Colleges are subsidiaries of Universities

We can think of facts such as:

The Department of Mathematics is a subsidiary of the College of Science.
The College of Science is a subsidiary of the University of Antarctica.

as instances of our rules.

Redesign OrgML so that it contains two types of elements: organizations and affiliation facts. The type of a fact is a rule.

Create an RDF document that describes the

Accountability

People and organizations play roles within an enterprise. Every role is accountable to 0 or 1 superior role. Every role has zero or more subordinate roles that are responsible to it. Every role has a type (such as captain, manager, patient, customer).

Enterprise 1: At Star Fleet Academy Captains Janeway and Picard are the subordinates of Admiral Pike. Ensign LaForge is a subordinate of Captain Picard.

Design a language called RoleML for representing the accountability relationships between roles in an enterprise.

How would represent Enterprise 1 in RoleML?

Write a DTD for RoleML.
Write a schema for RoleML.

How could you represent Enterprise 1 using XLink?

How could you represent Enterprise 1 using RDF?

Measurement and Categorization

An observer makes an observation of a subject. Observers and subjects are roles played by actors. Actors can be persons or organizations. The observation includes the date and phenomenon observed. There are two types of observations: measurements and categorizations. A measurement includes a quantity. A quantity is a number together with a unit (miles, seconds, dollars). A categorization includes a category.

1.      Scenario: Nurse Jones makes three observations of patient Smith:

temperature = 37 degrees celisius, time = 8:00 PM
blood type = A, time = 7:30 PM
liver function = A, time = 7:45 PM

Create an XML schema for making observations. Represent the above scenario as an XML document.

InvoiceML

Invoice ML is a language for representing invoices. Here’s an example:

<?xml version = "1.0"?>

<invoice date = "2003-08-15">

   <!-- Mel's Sporting Goods -->

   <line-item quantity = "2" upc = "ID234">
      <description> catcher's mit </description>
      <price currency = "usd"> 250.53 </price>
   </line-item>
  
   <line-item quantity = "5" upc = "ID911">
      <description> baseball bat </description>
      <price currency = "usd"> 38.22 </price>
   </line-item>
  
   <line-item quantity = "1" upc = "ID1890">
      <description> catcher's mask </description>
      <price currency = "usd"> 45.00 </price>
   </line-item>
  
  
</invoice>

i.                     Write a DTD for InvoiceML

ii.                   Write a schema for InvoiceML

iii.                  Write a stylesheet that transforms invoices into HTML documents of the form: