<?xml version="1.0" encoding="UTF-8"?>
<RESOURCE_PROFILE>
	<HEADER>
		<RESOURCE_IDENTIFIER value="a7b42c65-2e7f-413f-8e68-5eef9d93059b_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl"/>
		<RESOURCE_TYPE value="WorkflowDSResourceType"/>
		<RESOURCE_KIND value="WorkflowDSResources"/>
		<RESOURCE_URI value=""/>
		<DATE_OF_CREATION value="2018-01-12T17:00:00.0Z"/>
	</HEADER>
	<BODY>
		<WORKFLOW_NAME>CLARIN: Aggregate Metadata (X3M)</WORKFLOW_NAME>
		<WORKFLOW_DESCRIPTION>Collect, transform with X3M, and export metadata for CLARIN</WORKFLOW_DESCRIPTION>
		<WORKFLOW_INFO>
			<FIELD name="Action">Aggregate Metadata</FIELD>
			<FIELD name="Datasource class">Content Provider</FIELD>
		</WORKFLOW_INFO>
		<WORKFLOW_FAMILY>REPO_HI</WORKFLOW_FAMILY>
		<WORKFLOW_PRIORITY>20</WORKFLOW_PRIORITY>
		<CONFIGURATION status="EXECUTABLE" start="MANUAL">
			<PARAMETERS/>
			<WORKFLOW>
				<NODE name="VerifyDatasource" type="VerifyDatasource" isStart="true">
					<DESCRIPTION>Verify if DS is pending</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="expectedInterfaceTypologyPrefixes" value="dnet:repository::clarin"/>
						<PARAM name="expectedCompliancePrefixes" value="metadata,native"/>
					</PARAMETERS>
					<ARCS>
						<ARC to="registerAggregationWf"/>
						<ARC to="validateDs" name="validateDs"/>
					</ARCS>
				</NODE>
				<NODE name="validateDs" type="ValidateDatasource">
					<DESCRIPTION>Validate DS</DESCRIPTION>
					<PARAMETERS/>
					<ARCS>
						<ARC to="registerAggregationWf"/>
					</ARCS>
				</NODE>
				<NODE name="registerAggregationWf" type="RegisterClarinWorkflowFromTemplate">
					<DESCRIPTION>Create Workflow</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="wfName" value="Aggregate Metadata (X3M)"/>
						<PARAM name="wfTemplate" value="/eu/dnetlib/ariadneplus/workflows/repo-hi/CLARIN_aggregation_wf.xml.st"/>
						<PARAM name="description" value="Collect, transform with X3M, and export metadata"/>
					</PARAMETERS>
					<ARCS>
						<ARC to="createNative"/>
						<ARC to="createTransformed"/>
						<ARC to="prepareCreateIndex"/>
					</ARCS>
				</NODE>
				<NODE name="createNative" type="CreateMDStore">
					<DESCRIPTION>Create native store</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="format" value="GMF"/>
						<PARAM name="interpretation" value="native"/>
						<PARAM name="layout" value="store"/>
						<PARAM name="outputPrefix" value="harv_"/>
					</PARAMETERS>
					<ARCS>
						<ARC to="updateParameters"/>
					</ARCS>
				</NODE>
				<NODE name="createTransformed" type="CreateMDStore">
					<DESCRIPTION>Create CIDOC store</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="format" value="CIDOC"/>
						<PARAM name="interpretation" value="cleaned"/>
						<PARAM name="layout" value="store"/>
						<PARAM name="outputPrefix" value="clean_"/>
					</PARAMETERS>
					<ARCS>
						<ARC to="updateParameters"/>
					</ARCS>
				</NODE>
				<NODE name="prepareCreateIndex" type="PrepareCreateIndex">
					<DESCRIPTION>Prepare create index</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="format" value="CIDOC"/>
						<PARAM name="interpretation" value="transformed"/>
						<PARAM name="layout" value="index"/>
					</PARAMETERS>
					<ARCS>
						<ARC to="createIndex"/>
					</ARCS>
				</NODE>
				<NODE name="createIndex" type="CreateIndex">
					<DESCRIPTION>Create index</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="outputPrefix" value="index_"/>
					</PARAMETERS>
					<ARCS>
						<ARC to="updateParameters"/>
					</ARCS>
				</NODE>
				<NODE name="updateParameters" type="UpdateWfParameters" isJoin="true">
					<DESCRIPTION>Update Workflow Parameters</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="envParams">
							<MAP>
								<ENTRY key="collMdstoreId" value="harv_id"/>
								<ENTRY key="cleanMdstoreId" value="clean_id"/>
								<ENTRY key="indexId" value="index_id"/>
							</MAP>
						</PARAM>
					</PARAMETERS>
					<ARCS>
						<ARC to="registerPublishingWf"/>
					</ARCS>
				</NODE>
				<NODE name="registerPublishingWf" type="RegisterWorkflowFromTemplate">
					<DESCRIPTION>Create Workflow</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="wfName" value="Publish"/>
						<PARAM name="wfTemplate" value="/eu/dnetlib/ariadneplus/workflows/repo-hi/NEW_publish_wf.xml.st"/>
						<PARAM name="description" value="Publish metadata records"/>
					</PARAMETERS>
					<ARCS>
						<!--<ARC to="prepareCreatePublicIndex"/>-->
						<ARC to="registerUnpublishingWf"/>
					</ARCS>
				</NODE>
				<!--
				<NODE name="prepareCreatePublicIndex" type="PrepareCreateIndex">
					<DESCRIPTION>Prepare create index</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="format" value="CIDOC"/>
						<PARAM name="interpretation" value="public"/>
						<PARAM name="layout" value="index"/>
					</PARAMETERS>
					<ARCS>
						<ARC to="createPublicIndex"/>
					</ARCS>
				</NODE>
				<NODE name="createPublicIndex" type="CreateIndex">
					<DESCRIPTION>Create index</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="outputPrefix" value="index_"/>
					</PARAMETERS>
					<ARCS>
						<ARC to="updatePublishParameters"/>
					</ARCS>
				</NODE>
				<NODE name="updatePublishParameters" type="UpdateWfParameters" isJoin="true">
					<DESCRIPTION>Update Workflow Parameters</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="envParams">
							<MAP>
								<ENTRY key="cleanMdstoreId" value="clean_id"/>
								<ENTRY key="indexId" value="index_id"/>
							</MAP>
						</PARAM>
					</PARAMETERS>
					<ARCS>
						<ARC to="registerUnpublishingWf"/>
					</ARCS>
				</NODE>
				-->
				<NODE name="registerUnpublishingWf" type="RegisterWorkflowFromTemplate">
					<DESCRIPTION>Create Workflow</DESCRIPTION>
					<PARAMETERS>
						<PARAM name="wfName" value="Unpublish"/>
						<PARAM name="wfTemplate" value="/eu/dnetlib/ariadneplus/workflows/repo-hi/unpublish_wf.xml.st"/>
						<PARAM name="description" value="Unpublish metadata records"/>
					</PARAMETERS>
					<ARCS>
						<ARC to="success"/>
					</ARCS>
				</NODE>
			</WORKFLOW>
		</CONFIGURATION>
		<NOTIFICATIONS/>
		<SCHEDULING enabled="false">
			<CRON>9 9 9 ? * *</CRON>
			<MININTERVAL>10080</MININTERVAL>
		</SCHEDULING>
		<STATUS/>
	</BODY>
</RESOURCE_PROFILE>
