<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://namespace.openaire.eu/oaf"
	targetNamespace="http://namespace.openaire.eu/oaf" elementFormDefault="unqualified">

	<xs:annotation>
		<xs:documentation>This schema describes elements and properties of OpenAIRE+ entities of
			type project </xs:documentation>
	</xs:annotation>

	<xs:include schemaLocation="oaf-common-0.3.xsd"/>

	<xs:element name="project">
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element name="code" type="xs:string">
					<xs:annotation>
						<xs:documentation>Project code. Typically the grant agreement identifier.
						</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="acronym" type="xs:string"/>
				<xs:element name="title" type="xs:string"/>
				<xs:element name="startdate" type="xs:string"/>
				<xs:element name="enddate" type="xs:string"/>
				<xs:element name="callidentifier" type="xs:string">
					<xs:annotation>
						<xs:documentation> Identifier of the call for proposal. Available only for
							EC funded projects. </xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="ecsc39" type="boolOrEmptyType">
					<xs:annotation>
						<xs:documentation>True if the project has the special clause 39. Available
							only for EC FP7 funded projects. </xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="ecarticle29_3" type="boolOrEmptyType">
					<xs:annotation>
						<xs:documentation>True if the project is under the EC Open Data Pilot. Available
							only for EC H2020 funded projects. </xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="oamandatepublications" type="xs:boolean">
					<xs:annotation>
						<xs:documentation>True if the project's funding mandates the availability of project's publications in Open Access.</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="contracttype" type="optionalClassedSchemedElement">
					<xs:annotation>
						<xs:documentation> Type of the contract. <p> Allowed values depend on the
								actual funder. Currently supported funders and corresponding
								contract types are: <table>
									<tr>
										<th>Funder</th>
										<th>Funder id</th>
										<th>Contract types</th>
									</tr>
									<tr>
										<td>FP7</td>
										<td>corda_______::FP7</td>
										<td>$vocabulariesURL$/ec:FP7contractTypes</td>
									</tr>
									<tr>
										<td>Wellcome Trust</td>
										<td>wt::WT</td>
										<td>$vocabulariesURL$/wt:contractTypes</td>
									</tr>
								</table>
							</p>
						</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="subjects" type="optionalClassedSchemedElement">
					<xs:annotation>
						<xs:documentation>EC H2020 subjects.</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="fundingtree" type="fundingTreeType"/>

				<xs:element name="websiteurl" type="xs:string"/>
				<xs:element name="keywords" type="xs:string"/>
				<xs:element name="duration" type="xs:string"/>

				<xs:element name="originalId" type="xs:string"/>
				<xs:element name="collectedfrom" type="namedIdElement">
					<xs:annotation>
						<xs:documentation>Identifier and name of the datasource from which this
							project has been collected from. </xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="pid" type="optionalClassedSchemedElement"/>
				<xs:element name="datainfo" type="datainfoType"/>
				<xs:element name="rels" type="relsType">
					<xs:annotation>
						<xs:documentation>Relationships to other entities. </xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="children">
					<xs:complexType mixed="true"/>
				</xs:element>
			</xs:choice>
		</xs:complexType>
	</xs:element>

	<!-- to be removed, and replaced by ContextType -->
	<xs:complexType name="fundingTreeType">
		<xs:sequence>
			<xs:element name="funder" type="funderType"/>
			<xs:choice maxOccurs="unbounded">
				<!-- Three-tier funding hierarchies -->
				<xs:element name="funding_level_2" type="fundingType"/>
				<!-- Two-tier funding hierarchies -->
				<xs:element name="funding_level_1" type="fundingType"/>
				<!-- No funding hierarchy -->
				<xs:element name="funding_level_0" type="fundingType"/>
			</xs:choice>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="fundingType">
		<xs:all>
			<xs:element name="id" type="xs:string"/>
			<xs:element name="description" type="xs:string"/>
			<xs:element name="name" type="xs:string"/>
			<xs:element name="class" type="xs:string"/>
			<xs:element name="parent" type="fundingParentType">
				<xs:annotation>
					<xs:documentation>Parent funding. If the current funding is a Scientific Area,
						then the parent is a Funding Stream. If the current funding is a Funding
						Stream, then the parent is the Funder. </xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:all>
	</xs:complexType>

	<xs:complexType name="fundingParentType">
		<xs:choice minOccurs="0">
			<xs:element name="funding_level_1" type="fundingType"/>
			<xs:element name="funding_level_0" type="fundingType"/>
		</xs:choice>
	</xs:complexType>

	<xs:complexType name="funderType">
		<xs:all>
			<xs:element name="id" type="xs:string"/>
			<xs:element name="shortname" type="xs:string"/>
			<xs:element name="name" type="xs:string"/>
			<xs:element name="jurisdiction" type="xs:string"/>
		</xs:all>
	</xs:complexType>
</xs:schema>
