<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
           elementFormDefault="qualified">

	<xs:import namespace="http://www.w3.org/XML/1998/namespace"/>

    <!--
     ! root element 
     !-->
	<xs:element name="dataset">
		<xs:complexType>
			<xs:sequence>
                <!-- 
                 ! a production with all "metadata" for an event or a 
                 ! sequence of events 
                 !-->
				<xs:element ref="production" maxOccurs="unbounded"/>
			</xs:sequence>

            <!-- the number of results returned by a search -->
			<xs:attribute name="numResults" type="xs:integer" default="0"/>
		</xs:complexType>
	</xs:element>

	<xs:element name="category"> <!-- a category -->
		<xs:complexType mixed="true">
			<xs:attribute name="systemShortname"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="event"> <!-- an event -->
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="title" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="location" minOccurs="0"/> 

                <!-- the category of this event -->
				<xs:element ref="category" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="institution" minOccurs="0" maxOccurs="unbounded"/>

	            <!-- all texts connected to this event -->
   			    <xs:element ref="mediaText" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="person" minOccurs="0" maxOccurs="unbounded"/> <!-- the persons (e.g. ensemble) of this event -->
				<xs:element ref="picture" minOccurs="0" maxOccurs="unbounded"/> <!-- all images of this event -->
				<xs:element ref="price" minOccurs="0"/> <!-- the price information of this event -->
				<xs:element ref="sponsor" minOccurs="0" maxOccurs="unbounded"/> <!-- the sponsor information of this event -->
				<xs:element ref="statusId" minOccurs="0" maxOccurs="unbounded"/> <!-- the stati of this event (e.g. premiere) -->
			</xs:sequence>
			<xs:attribute name="foreignId"/> <!-- the database id of this event in the database of the importer -->
			<xs:attribute name="id" type="xs:integer"/> <!-- the cb-event database id -->
			<xs:attribute name="cityId" default="0"/> <!-- the id of the city from the culturebase database -->
			<xs:attribute name="keywords"/> <!-- the keywords -->
			<xs:attribute name="takingPlace" type="xs:integer" default="1"/> <!-- describing if the event takes place -->
			<xs:attribute name="datetime" use="required"/> <!-- the datetime information of this event, has to be in "yyyy-mm-dd hh:ss" format -->
			<xs:attribute name="duration" type="xs:integer" default="0"/> <!-- describing if the event takes place -->
			<xs:attribute name="subCategoryId"/>
			<xs:attribute name="url"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="institution"> <!-- an institution related to an event -->
		<xs:complexType mixed="true">
			<xs:choice minOccurs="0" maxOccurs="0"/>
			<xs:attribute name="relation" type="xs:integer" use="required"/> <!-- stored in table organisation_category -->
			<xs:attribute name="isId"  use="required"/> <!-- boolean to describe if the data in this element is a database id or freetext -->
			<xs:attribute name="position"/> <!-- position of the institution -->
			<xs:attribute name="foreignId" type="xs:integer" default="0"/> <!-- the database id of the text in the database of the importer -->
		</xs:complexType>
	</xs:element>
	<xs:element name="location"> <!-- a location where an event can take place -->
		<xs:complexType mixed="true">
			<xs:choice minOccurs="0" maxOccurs="0"/>
			<xs:attribute name="isId" type="xs:integer"/> <!-- boolean to describe if the data of this element is a database id or a freetext -->
			<xs:attribute name="foreignId" type="xs:integer" default="0"/> <!-- the database id of the text in the database of the importer -->
		</xs:complexType>
	</xs:element>
	<xs:element name="mediaText"> <!-- a text with additional information -->
		<xs:complexType mixed="true">
			<xs:sequence>
				<xs:element ref="text" maxOccurs="unbounded"/> <!-- a text element to provide multilanguage support -->
			</xs:sequence>
			<xs:attribute name="relation" type="xs:integer" use="required"/> <!-- the relation of the text to an object -->
			<xs:attribute name="position" type="xs:integer"/> <!-- the position of the text -->
			<xs:attribute name="foreignId"/> <!-- the database id of the text in the database of the importer -->
			<xs:attribute name="id" type="xs:integer"/> <!-- the id of the entry in the media database of culturebase -->
		</xs:complexType>
	</xs:element>
	<xs:element name="person"> <!-- a person related to an event -->
		<xs:complexType mixed="true">
			<xs:sequence>
				<xs:element ref="mediaText" minOccurs="0"/> <!-- a freetext describing the role (for example) -->
			</xs:sequence>
			<xs:attribute name="personId" type="xs:integer" default="0"/> <!-- the id of the person in the culturebase database (excluding personFreetext) -->
			<xs:attribute name="personFreetext"/> <!-- the persons name as freetext (excluding personId) -->
			<xs:attribute name="position" type="xs:integer" default="0"/> <!-- the order position of this person -->
			<xs:attribute name="roleId"/> <!-- the id of the role of this person in the culturebase database -->
			<xs:attribute name="foreignId" type="xs:integer" default="0"/> <!-- the database id of the text in the database of the importer -->
		</xs:complexType>
	</xs:element>
	<xs:element name="picture"> <!-- an image (JPG, GIF, ...) related to an event -->
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="title" minOccurs="0" maxOccurs="unbounded"/> <!-- the title of the picture (multilanguage) -->
				<xs:element ref="mediaText" minOccurs="0" maxOccurs="unbounded"/> <!-- a text related to the image (description or subtitle) the relation id of the mediaText element has to be 7 for description and 6 for subtitle -->
			</xs:sequence>
			<xs:attribute name="copyright"/> <!-- the copyright information -->
			<xs:attribute name="foreignId"/> <!-- the database id of this image in the database of the importer -->
			<xs:attribute name="id" type="xs:integer"/> <!-- the database id in the media database -->
			<xs:attribute name="photographer"/> <!-- the photographer/artist/creator of this picture -->
			<xs:attribute name="position" type="xs:integer"/> <!-- the position of the picture -->
			<xs:attribute name="url" type="xs:string"/> <!-- the complete url of the picture (including http://...) -->
			<xs:attribute name="publishType" type="xs:integer" default="0"/> <!-- the complete url of the picture (including http://...) -->
		</xs:complexType>
	</xs:element>
	<xs:element name="price"> <!-- the price information for an event -->
		<xs:complexType mixed="true">
			<xs:choice minOccurs="0" maxOccurs="0"/>
			<xs:attribute name="minPrice" type="xs:string"/> <!-- the minimum price -->
			<xs:attribute name="maxPrice" type="xs:string"/> <!-- the maximum price -->
			<xs:attribute name="url" type="xs:string"/> <!-- the ticketing link/url -->
		</xs:complexType>
	</xs:element>
	<xs:element name="production"> <!-- a production containing all "metadata" for an event or sequence of events -->
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="title" maxOccurs="unbounded" />
				<!-- the title of the production -->
				<xs:element ref="location" /><!-- the (default) location where the event takes place -->
				<xs:element ref="category" minOccurs="0"
					maxOccurs="unbounded" /><!-- the category of this event -->
				<xs:element ref="statusId" minOccurs="0"
					maxOccurs="unbounded" /><!-- the stati of this event (e.g. premiere) -->
				<xs:element ref="person" minOccurs="0"
					maxOccurs="unbounded" /><!-- the default persons/ensemble of this event -->
				<xs:element ref="mediaText" minOccurs="0"
					maxOccurs="unbounded" /><!-- the default texts for this event -->
				<xs:element ref="institution" minOccurs="0"
					maxOccurs="unbounded" />
				<xs:element ref="picture" minOccurs="0"
					maxOccurs="unbounded" />
				<xs:element ref="sponsor" minOccurs="0"
					maxOccurs="unbounded" />
				<xs:element ref="event" minOccurs="0"
					maxOccurs="unbounded" />
			</xs:sequence>
			<xs:attribute name="cityId" default="0" />
			<xs:attribute name="foreignId" /><!-- the database id of this production (event) in the database of the importer -->
			<xs:attribute name="id" type="xs:integer" />
			<!-- the id in the culturebase database -->
			<xs:attribute name="keywords" /><!-- the keywords -->
			<xs:attribute name="productionType" use="required" />
			<!-- the type of the event (single, series or framwork -->
			<xs:attribute name="subCategoryId" use="required" />
			<xs:attribute name="productionStart" />
			<xs:attribute name="productionEnd" />
			<xs:attribute name="url" />
			<xs:attribute name="city" type="xs:string"></xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:element name="sponsor"> <!-- a sponsor of an event -->
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="title" maxOccurs="unbounded"/> <!-- the name/title of the sponsor -->
				<xs:element ref="mediaText" minOccurs="0" maxOccurs="1"/> <!-- text with additional information/description of the sponsor -->
			</xs:sequence>
			<xs:attribute name="linkUrl"/> <!-- the url of the website of the sponsor (picture gets linked with this)-->
			<xs:attribute name="pictureUrl" use="required"/> <!-- the url of the picture of this sponsor -->
		</xs:complexType>
	</xs:element>
	<xs:element name="statusId"> <!-- id describing the status of an event (e.g. premiere) -->
		<xs:complexType mixed="true">
			<xs:choice minOccurs="0" maxOccurs="0"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="text"> <!-- a text with additional information and multilangage support  -->
		<xs:complexType mixed="true">
			<xs:attribute name="languageId" type="xs:integer" default="1"/> <!-- id describing the language of the text (1=DE, 2=EN, ...) -->
			<xs:attribute name="author" type="xs:string"/> <!-- the author of the text -->
			<xs:attribute name="copyright" type="xs:string"/> <!-- the copyright information of the text -->
		</xs:complexType>
	</xs:element>
	<xs:element name="title"> <!-- a title of an event or picture -->
		<xs:complexType mixed="true">
			<xs:choice minOccurs="0" maxOccurs="0"/>
			<xs:attribute name="languageId" type="xs:integer" default="1"/> <!-- id describing the language of the text (1=DE, 2=EN, ...) -->
		</xs:complexType>
	</xs:element>
</xs:schema>

