Commit e8586763 authored by Dr. Martin Goik's avatar Dr. Martin Goik

Sda1 exam summer '16

parent 0e983402
-- TODO: Create your schema
DROP TABLE IF EXISTS XYZ;
...
CREATE TABLE XYZ (
);
...
-- TODO:
-- Add INSERT statements as a proof of concept being able
-- to harbour data as in Schema/sampledata.xml.
INSERT INTO XYZ (x, y, z) VALUES (...);
...
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified"
vc:minVersion="1.1">
<!--
TODO: Implement this schama according to the exercise description.
Sample document instances in SchemaTest may be validated by executing
the Junit test class de.hdm_stuttgart.mi.sda1.exam.xsd.SchemaTest
-->
<xs:element name="movieDb">
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<movieDb xsi:noNamespaceSchemaLocation="movie.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<persons>
<person id="rAltmann" birthYear="1925">
<name>Robert Altman</name>
</person>
<person id="aMacDowell" birthYear="1958">
<name>Andie MacDowell</name>
</person>
<person id="sKubrick" birthYear="1928" img="kubrick.jpg">
<name>Stanley Kubrick</name>
</person>
<person id="mModine" birthYear="1959">
<name>Matthew Modine</name>
<biography>The youngest of seven, Matthew was born ...</biography>
</person>
<person id="rLeeEremy" birthYear="1944">
<name>R. Lee Ermey</name>
</person>
</persons>
<movies>
<movie id = "18113" year="1987" director="sKubrick" rating="8.3">
<title>Full Metal Jacket</title>
<cast>
<actor ref="mModine" isStar="true"/>
<actor ref="rLeeEremy"/>
</cast>
</movie>
<movie rating="7.7" id="4342" year="1993" director="rAltmann">
<title>Short Cuts</title>
<cast>
<actor ref="aMacDowell"/>
<actor ref="mModine" isStar="false"/>
</cast>
</movie>
</movies>
</movieDb>
\ No newline at end of file
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="sKubrick" birthYear="1928" img="kubrick.jpg">
<name>Stanley Kubrick</name>
</person>
</persons>
<movies>
<movie id="1" year="1987" director="sKubrick" rating="8.3">
<title>Full Metal Jacket</title>
<cast>
<!-- Error: Absence of required attribute 'ref' -->
<actor/>
<!-- Error: No matching <person id="stanleyKubrick" ..> record. -->
<actor ref="stanleyKubrick"/>
</cast>
</movie>
</movies>
</movieDb>
<?xmlTest
points = "1"
expectedToBeValid = "false"
preconditionValid = "personRef.xml" ?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<!-- No person database duplicate! -->
<persons/>
<persons/>
<!-- No movie database duplicate! -->
<movies/>
<movies/>
</movieDb>
<!-- Subsequent lines contain only processing instructions irrelevant to instance's validity -->
<?xmlTest
points = "1"
expectedToBeValid = "false"
preconditionValid = "base_valid.xml" ?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons/>
<movies/>
</movieDb>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="sKubrick" birthYear="1928" img="kubrick.jpg">
<name>Stanley Kubrick</name>
</person>
</persons>
<movies>
<movie id="1" year="1987" director="stanleyKubrick" rating="8.3">
<title>Full Metal Jacket</title>
<cast>
<actor ref="sKubrick"/><!-- Fake reference to keep it simple and syntactically correct -->
</cast>
</movie>
</movies>
</movieDb>
<?xmlTest
points = "1"
expectedToBeValid = "false"
preconditionValid = "personRef.xml" ?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<!-- Missing required attributes id and birthYear -->
<person >
<name>K. Ill Me</name>
</person>
</persons>
<movies/>
</movieDb>
<?xmlTest
points = "1"
expectedToBeValid = "false" ?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="sKubrick" birthYear="1928">
<name>Stanley Kubrick</name>
</person>
</persons>
<movies>
<!-- Error: Missing required attributes -->
<movie >
<title>Full Metal Jacket</title>
<cast>
<actor ref="sKubrick"/>
</cast>
</movie>
<movie id="1" year="1987" director="sKubrick" rating="8.3">
<title>Full Metal Jacket</title>
<!-- Error: <cast> is missing -->
</movie>
<movie id="2" year="1987" director="sKubrick" rating="8.3">
<title>Full Metal Jacket</title>
<!-- Error: <cast> cannot be empty -->
<cast/>
</movie>
<movie id="3" year="1987" director="sKubrick" rating="8.3">
<title>Full Metal Jacket</title>
<!-- Error: <cast> must appear exactly once.-->
<cast>
<actor ref="sKubrick"/>
</cast>
<cast>
<actor ref="sKubrick"/>
</cast>
</movie>
</movies>
</movieDb>
<?xmlTest
points = "1"
expectedToBeValid = "false"
preconditionValid = "movie_valid.xml" ?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="sKubrick" birthYear="1928">
<name>Stanley Kubrick</name>
</person>
</persons>
<movies>
<movie id="1" year="1987" director="sKubrick" rating="8.3">
<title>Full Metal Jacket</title>
<cast>
<actor ref="sKubrick"/>
</cast>
</movie>
</movies>
</movieDb>
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="sKubrick" birthYear="1928">
<!-- Error: No name given. -->
</person>
</persons>
<movies/>
</movieDb>
<?xmlTest
points = "1"
expectedToBeValid = "false"
preconditionValid = "name_valid.xml" ?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="sKubrick" birthYear="1928">
<name>Stanley Kubrick</name>
</person>
</persons>
<movies/>
</movieDb>
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="mModine" birthYear="1959">
<name>Matthew Modine</name>
<biography>The youngest of seven, Matthew was born ...</biography>
</person>
</persons>
<movies/>
</movieDb>
<?xmlTest
points = "1"
expectedToBeValid = "true" ?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<!-- id value must not contain spaces -->
<person id="s Kubrick" birthYear="1928">
<name>Stanley Kubrick</name>
</person>
</persons>
<movies/>
</movieDb>
<?xmlTest
points = "1"
expectedToBeValid = "false"
preconditionValid = "name_valid.xml" ?>
\ No newline at end of file
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="sKubrick" birthYear="1928" img="kubrick.jpg">
<name>Stanley Kubrick</name>
</person>
<person id="rLeeEremy" birthYear="1944">
<name>R. Lee Ermey</name>
</person>
</persons>
<movies>
<movie id="1" year="1987" director="sKubrick" rating="8.3">
<title>Full Metal Jacket</title>
<cast>
<actor ref="sKubrick"/>
<actor ref="rLeeEremy" isStar="true"/>
</cast>
</movie>
</movies>
</movieDb>
\ No newline at end of file
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="sKubrick" birthYear="1928" img="kubrick.jpg">
<name>Stanley Kubrick</name>
</person>
<person id="rLeeEremy" birthYear="1944">
<name>R. Lee Ermey</name>
</person>
</persons>
<movies>
<movie id="1" year="1987" director="sKubrick" rating="8.3">
<title>Full Metal Jacket</title>
<cast>
<!-- Missing required attribute @ref -->
<actor/>
<actor ref="rLeeEremy"/>
</cast>
</movie>
</movies>
</movieDb>
<?xmlTest
points = "1"
expectedToBeValid = "false"
preconditionValid = "personRef.xml" ?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<!-- Error: Missing required attributes id and birthYear -->
<person >
<name>Some Person</name>
</person>
<!-- Error: Missing required attribute birthYear -->
<person id="x">
<name>Some Person</name>
</person>
<!-- Error: Missing required attribute id. -->
<person birthYear="1984">
<name>Some Person</name>
</person>
</persons>
<movies/>
</movieDb>
<?xmlTest
points = "1"
expectedToBeValid = "false"
preconditionValid = "name_valid.xml" ?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="sKubrick" birthYear="1928">
<name>Stanley Kubrick</name>
</person>
</persons>
<movies>
<!-- Error: Absence of required attribute 'rating'. -->
<movie id="1" year="1987" director="sKubrick">
<title>Movie 1</title>
<cast><actor ref="sKubrick"/></cast>
</movie>
<!-- Error: Attribute 'rating' has got upper bound of 9.9 -->
<movie id="2" rating="10" year="1987" director="sKubrick">
<title>Movie 1</title>
<cast><actor ref="sKubrick"/></cast>
</movie>
<!-- Error: Only one decimal place allowed for attribute 'rating'. -->
<movie id="3" rating="8.35" year="1987" director="sKubrick">
<title>Movie 2</title>
<cast><actor ref="sKubrick"/></cast>
</movie>
<!-- Error: No negative values allowed for attribute 'rating'. -->
<movie id="4" rating="-1" year="1987" director="sKubrick">
<title>Movie 3</title>
<cast><actor ref="sKubrick"/></cast>
</movie>
</movies>
</movieDb>
<?xmlTest
points = "1"
expectedToBeValid = "false"
preconditionValid = "rating_valid.xml" ?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="sKubrick" birthYear="1928">
<name>Stanley Kubrick</name>
</person>
</persons>
<movies>
<movie id="1" year="1987" director="sKubrick" rating="0.0">
<title>Movie 1</title>
<cast><actor ref="sKubrick"/></cast>
</movie>
<movie id="2" year="1987" director="sKubrick" rating="9.9">
<title>Movie 2</title>
<cast><actor ref="sKubrick"/></cast>
</movie>
<movie id="3" year="1987" director="sKubrick" rating="8.3">
<title>Movie 3</title>
<cast><actor ref="sKubrick"/></cast>
</movie>
</movies>
</movieDb>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="sKubrick" birthYear="1928" img="kubrick.jpg">
<name>Stanley Kubrick</name>
</person>
<person id="rLeeEremy" birthYear="1944">
<name>R. Lee Ermey</name>
</person>
</persons>
<movies>
<movie id="1" year="1987" director="sKubrick" rating="8.3">
<title>Full Metal Jacket</title>
<cast>
<actor ref="rLeeEremy"/>
<actor ref="sKubrick"/>
<!-- Error: Duplicate actor reference. -->
<actor ref="rLeeEremy"/>
</cast>
</movie>
</movies>
</movieDb>
<?xmlTest
points = "1"
expectedToBeValid = "false"
preconditionValid = "personRef.xml" ?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="sKubrick" birthYear="1928">
<name>Stanley Kubrick</name>
</person>
<!-- Error: A second person having @id value 'sKubrick' -->
<person id="sKubrick" birthYear="1000">
<name>Sean Kubrick</name>
</person>
</persons>
<movies/>
</movieDb>
<?xmlTest
points = "1"
expectedToBeValid = "false"
preconditionValid = "base_valid.xml" ?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<person id="stanleyKubrick" birthYear="1928">
<name>Stanley Kubrick</name>
</person>
<person id="seanKubrick" birthYear="1000">
<name>Sean Kubrick</name>
</person>
</persons>
<movies/>
</movieDb>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<movieDb
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/movie.xsd">
<persons>
<!-- Error: Only year specification allowed -->
<person id="sKubrick" birthYear="04/03/1982">
<name>Stanley Kubrick</name>
</person>
<!-- Error: no year zero specification allowed -->
<person id="mModine" birthYear="0">
<name>Matthew Modine</name>
<biography>The youngest of seven, Matthew was born ...</biography>
</person>
<!-- Error: Only year specification until 2100 allowed -->
<person id="rLeeEremy" birthYear="2101">
<name>R. Lee Ermey</name>
</person>
</persons>
<movies/>
</movieDb>
<?xmlTest
points = "1"
expectedToBeValid = "false"
preconditionValid = "name_valid.xml" ?>
\ No newline at end of file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.hdm-stuttgart.mi.sda1</groupId>
<artifactId>sda1_2016summer</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>sda1_2016summer</name>
<url>http://freedocs.mi.hdm-stuttgart.de</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>hdm-mi-internal-maven-repo</id>
<url>https://maven.mi.hdm-stuttgart.de/artifacts</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.opengis.cite.xerces</groupId>
<artifactId>xercesImpl-xsd11</artifactId>
<version>2.12-beta-r1667115</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.36</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>