Written Exam

Knowledge Markup Techniques; 6 March 2001

Harold Boley; DFKI, Univ. Kaiserslautern


Family Name     First Name      Matriculation Number     Signature


a) Are the following markups well-formed XML elements (write "yes" or "no" directly behind them)?

<name>Fred</name>     <nom>Fred</nom>     <name>Fred</nom>
<name><name/>         <name/>             <name>Fred 4711</name>
<payroll><name>Fred Fry</payroll></name>     <name><name>Fred Fry</name></name>
<payroll><name>Fred Fry</name></payroll>     <p><a></a><n>FF</n><a/></p>

b) Consider this 'simple' XML element:

<payroll>
  <name>Ann Alf</name>
  <salary>Euro 65000</salary>
  <bonus>Euro 10000</bonus>
</payroll>
Also consider the following XML DTD:
<!ELEMENT payroll   (name, salary, bonus)>
<!ELEMENT name      (#PCDATA)>
<!ELEMENT salary    (#PCDATA)>
<!ELEMENT bonus     (#PCDATA)>
Draw the corresponding element (thin arcs) and document type trees (heavy arcs) next to the above element and DTD, respectively. Is the element valid w.r.t. the DTD (write in "yes" or "no" here)?

c) Consider this 'complex' XML element:

<payroll>
  <name>Bert Bird</name>
  <total>
    <salary>Euro 55000</salary>
    <bonus>Euro 8000</bonus>
  </total>
  <category>B</category>
</payroll>
Inductively complete its following XML DTD (write into the "..." lines):
<!ELEMENT payroll   (...., ....., ........)>
<!ELEMENT total     (......, .....)>
<!ELEMENT ....      (#PCDATA)>
<!ELEMENT ......    (#PCDATA)>
<!ELEMENT .....     (#PCDATA)>
<!ELEMENT ........  (#PCDATA)>

d) Complete the following XSLT template - by just filling in the seven versions of ". . ." - for the (XML-to-XML) transformation of the 'simple-payroll' form into the 'complex-payroll' form, assuming unknown categories map to the category A:

  <xsl:template match="payroll">
    <payroll>
      <. . .><xsl:value-of select=". . ."/></. . .>
      <. . .>
        .   .   .
        .   .   .
      </. . .>
      <category>A</category>
    </payroll>
  </xsl:template>
Would any 'inverse' transformation - of some given 'complex-payroll' form into a 'simple-payroll' form - lead to an irrecoverable information loss (write in "yes" or "no" here)?

e) This is simplified RDF metadata about two mathematics department pages:

<rdf:RDF>
  <rdf:Description about="http://www.mathematik.unitopia.de/students/381">
    <name>Cyndia Cherry</name>
    <major>algebraic geometry</major>
    <minor>computational algebra</minor>
    <minor>business informatics</minor>
    <advisor rdf:resource="http://www.mathematik.unitopia.de/staff/12"/>
  </rdf:Description>
  <rdf:Description about="http://www.mathematik.unitopia.de/staff/12">
    <name>Rosa Rice</name>
    <field>computational algebra</field>
    <advises rdf:resource="http://www.mathematik.unitopia.de/students/381"/>
    <advises rdf:resource="http://www.mathematik.unitopia.de/students/382"/>
  </rdf:Description>
</rdf:RDF>
Draw the directed labeled graph (DLG) that constitutes the RDF diagram of this XML element (use space below). Hint: URLs, going into ovals, and texts, going into rectangles, may be arbitrarily shortened, as long as they remain unique (e.g.: '.../students/381' or just '381'; 'ag', 'ca', and 'bi').