<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.2.xsd" />

	<xs:element name="project">
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element name="code" type="inferenceExtendedStringType">
					<xs:annotation>
						<xs:documentation>Project code. Typically the grant
							agreement
							identifier.
						</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="acronym" type="inferenceExtendedStringType" />
				<xs:element name="title" type="inferenceExtendedStringType" />
				<xs:element name="startdate" type="inferenceExtendedStringType" />
				<xs:element name="enddate" type="inferenceExtendedStringType" />
				<xs:element name="callidentifier" type="inferenceExtendedStringType">
					<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="inferenceExtendedBooleanType">
					<xs:annotation>
						<xs:documentation>True if the project has the special clause 39.
							Available only for EC funded projects.
						</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="fundingtree" type="fundingTreeType">
					<xs:annotation>
						<xs:documentation>
							The funding tree contains information about the funding of this
							project. For EC funded projects the tree has the following form:
							<ul>
								<li>Scientific Area</li>
								<ul>
									<li>Funding Stream</li>
									<ul>
										<li>Funder</li>
									</ul>
								</ul>
							</ul>
							For UK funded projects the tree has the following form:
							<ul>
								<li>Funding Stream</li>
								<ul>
									<li>Funder</li>
								</ul>
							</ul>
						</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="websiteurl" type="inferenceExtendedStringType" />
				<xs:element name="keywords" type="inferenceExtendedStringType" />
				<xs:element name="duration" type="inferenceExtendedStringType" />

				<xs:element name="originalId" type="inferenceExtendedStringType" />
				<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:choice maxOccurs="unbounded">
			<xs:element name="funding_level_2" type="fundingType"
				minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>Leaf of the funding tree for FP7 projects. This
						element does not exist
						for WT funded projects.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
			<!-- WT hierarchy starts from funding_level_1, not 2 -->
			<xs:element name="funding_level_1" type="fundingType"
				minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>Leaf of the funding tree for WT projects.
					</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:choice>
	</xs:complexType>

	<xs:complexType name="fundingType">
		<xs:sequence>
			<xs:element name="id" type="xs:string" />
			<xs:element name="description" type="xs:string" />
			<xs:element name="name" 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:element name="class" type="xs:string" />
		</xs:sequence>
	</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:schema>
