Lecture examinations

Preparations

Download and unzip the above file exam.zip. Then:

  1. Import the resulting Exam Project into your IDEA IDE by choosing »File --> Open...« subsequently selecting the Exam/pom.xml file.

  2. Also import Exam into your Oxygenxml IDE using »Project« --> »Open Project« subsequently selecting the Exam/sda1.xpr file.

Description

Caution

IntelliJ IDEA is partly broken with respect to XML Schema flagging the subsequent instance as invalid: Use Oxygenxml instead!

Consider a company's departments, employees and projects:

<company xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="company.xsd" >
  <departments>    
    <department>
      <name>Headquarter</name>
      <member nickname = "jb">Jim Beam</member>
      
      <department> <!-- Sub department of »Headquarter« -->
        <name>GUI Development</name>
        <member nickname="eg">Eve Gardener</member>
        <member nickname="pt">Pete Townsend</member>
      </department>
     
      <department> <!-- Another sub department of »Headquarter« -->
        <name>Database Development</name>
        <member nickname="ls">Laura Stern</member>
      </department>
      
      <department>
        <name>New stuff</name>
        <!-- No members yet -->
      </department>
    </department>  
  </departments>
  
  <projects>
    <project slug="GUIGen" visibility="public"> 
      <name>GUI Generator</name>
      <developers>
        <developer member="eg" role="manager"/>
        <developer member="jb" role="guest"/>
      </developers>
    </project>
    
    <project slug="dbSchemaGen" visibility="internal"> 
      <name>Database Schema Generator</name>
      <developers>
        <developer member="pt" role="developer"/>
      </developers>
    </project>
    
    <project slug="aBook" visibility="private"> 
      <name>Address Book</name>
      <developers>
        <developer member="jb" role="manager"/>
      </developers>
    </project>
  </projects>
</company>

The following data integrity rules shall apply:

  1. A <company> database contains <departments> and <projects>.

  2. <departments> have an arbitrary number of <department> children.

  3. <department> entries consist of a <name>, an arbitrary number of <member> children followed by an arbitrary number of sub- <department> entries allowing for nested departments. <name> must be unique among all departments.

  4. Each <member> has got a @nickname attribute being unique among all departments.

  5. <projects> consists of an arbitrary number of <project> entries.

  6. Each <project> has got

    • a <name>

    • a <developers> child

    • a required @slug attribute carrying a shortened project's name of minimum length 5 not containing whitespace characters. The @slug attribute values are unique among all projects.

    • a required @visibility attribute

    • having exactly one value from {"public", "internal", "private"}.

  7. Each <developers> child contains an arbitrary set of <developer> entries.

  8. Each <developer> has got two mandatory attributes:

    1. @member referencing a corresponding <member nickname="..."> entry.

    2. @role having exactly one value from {"manager", "guest", "developer"}.

    Within the same <developers> parent element all @member attribute values are unique. Each @member value references a corresponding <member nickname="..."> element.

Tasks

Complete your schema's implementation in Schema/company.xsd using the Oxygenxml IDE. Hints:

  1. Junit execution of de.hdm_stuttgart.mi.sda1.test.ex1.SchemaTest from within IntelliJ executes all unit tests based on files residing in your project's folder SchemaTest. Some of these files e.g. SchemaTest/0105invalid_missingDepartments.xml contain comment hints regarding expected errors with respect to the intended Schema/company.xsd:

     ... <!-- <departments/> is missing -->...

    Clicking on file names within test failure reports will open e.g. SchemaTest/0105invalid_missingDepartments.xml in IDEA. However opening the same file in Oxygenxml manually may save time due to better XML support. IDEA' s schema support is partly broken.

  2. Never touch your project's unit tests in the SchemaTest folder: The automated tests may end up throwing meaningless exceptions.

  3. Edit Schema/company.xsd only by small steps executing the tests immediately. Schema changes may cause already working tests to fail again. In case of spoiling your schema undo is your friend.

Tip

  • XPath uses the dot (.) for selecting an element's content e.g. "food" in <cat>food</cat> .

  • The Text content and attributes slide is your friend.

  • Consider the list of predefined data types near the page's bottom.

  • Use <xs:selector xpath=".//department/member"> for constructing <xs:key ...> constraints on nested <department> elements.

  • Prefer XSD standard types rather than defining own types by restriction.

  • XSD Restrictions/Facets may be helpful.

Project upload

Export your project by hitting »File« --> »Export to Zip File« in IDEA creating an e.g. solution-1.zip file. Then enter your ILIAS browser, hit the choose file button selecting solution-1.zip and subsequently click upload. Do not forget to advance to the next question hitting the »save+next« button for actually saving your upload. Common pitfalls:

  • Do not select the wrong archive! In particular avoid choosing the original exam.zip skeleton.

  • After uploading and hitting »save+next« check for solution_1.zip being visible in the examination system.

  • You may upload multiple versions i.e. solution_2.zip etc. . Only your least uploaded archive will become subject to marking.

Caveats
  • When approaching examination ending time check your input for completeness.

  • Projects residing just on your local workstation cannot be recovered after exam termination.