Revision 52389
Added by Alessia Bardi almost 6 years ago
modules/dnet-openaireplus-workflows/branches/solr7/src/main/resources/eu/dnetlib/patch-db/incrementalTransformation_migration.xqueries | ||
---|---|---|
1 |
#0. READ EVERYTHING BEFORE RUNNING ANY XUPDATE |
|
2 |
#1. Take all transformation workflows and change the arc to select the currently non existing node "selectIncrementalTransformation" |
|
3 |
|
|
4 |
for $x in collection('/db/DRIVER/WorkflowDSResources/WorkflowDSResourceType') |
|
5 |
let $arc := $x[.//WORKFLOW_NAME='transform']/RESOURCE_PROFILE/BODY/CONFIGURATION/NODE[./@type='SetProviderInfo' and ./@isStart='true']/ARCS/ARC[./@to ='fetchOriginals'] |
|
6 |
return update value $arc/@to with 'selectIncrementalTransformation' |
|
7 |
|
|
8 |
#2. Now we add the missing node just after the start node |
|
9 |
|
|
10 |
for $x in collection('/db/DRIVER/WorkflowDSResources/WorkflowDSResourceType') |
|
11 |
let $startnode := $x[.//WORKFLOW_NAME='transform']/RESOURCE_PROFILE/BODY/CONFIGURATION/NODE[./@type='SetProviderInfo' and ./@isStart='true'] |
|
12 |
return update insert |
|
13 |
<NODE name="selectIncrementalTransformation" type="IncrementalTransformation"> |
|
14 |
<DESCRIPTION>Decide REFRESH/INCREMENTAL transformation</DESCRIPTION> |
|
15 |
<PARAMETERS> |
|
16 |
<PARAM required="true" type="string" name="operationType" managedBy="user" function="validValues(['REFRESH','INCREMENTAL'])">INCREMENTAL</PARAM> |
|
17 |
</PARAMETERS> |
|
18 |
<ARCS> |
|
19 |
<ARC to="fetchOriginals"/> |
|
20 |
</ARCS> |
|
21 |
</NODE> |
|
22 |
following $startnode |
|
23 |
|
|
24 |
|
|
25 |
In case there are nodes with the wrong parameter name (transformationType instead of operationType), do not worry. |
|
26 |
It is a left over from previous migration and you can fix it running this xquery: |
|
27 |
|
|
28 |
for $x in collection('/db/DRIVER/WorkflowDSResources/WorkflowDSResourceType') |
|
29 |
let $transNode := $x[.//WORKFLOW_NAME='transform']/RESOURCE_PROFILE/BODY/CONFIGURATION/NODE[./@type='IncrementalTransformation'] |
|
30 |
let $param := $transNode/PARAMETERS/PARAM[@name='transformationType'] |
|
31 |
return update value $param/@name with 'operationType' |
|
32 |
|
|
33 |
|
|
34 |
NOTE: if there are already incremental workflows, the xupdate in #2. will screw them up |
|
35 |
creating a duplicate IncrementalTransformation node that must be deleted. |
|
36 |
You can look for this workflows with the following xquery: |
|
37 |
|
|
38 |
for $x in collection('/db/DRIVER/WorkflowDSResources/WorkflowDSResourceType') |
|
39 |
where (count($x[.//NODE/@name='selectIncrementalTransformation']) > 1) return $x |
Also available in: Unified diff
Instructtions to migrate to incremental transformation