1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<RESOURCE_PROFILE>
|
3
|
<HEADER>
|
4
|
<RESOURCE_IDENTIFIER value="4d0ec267-2750-4a87-852d-90f61525a6e0_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
5
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
6
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
7
|
<RESOURCE_URI value=""/>
|
8
|
<DATE_OF_CREATION value="2014-04-28T07:49:19+00:00"/>
|
9
|
</HEADER>
|
10
|
<BODY>
|
11
|
<CONFIGURATION>
|
12
|
<IMPORTED/>
|
13
|
<SCRIPT>
|
14
|
<TITLE>dc_cleaning_OPENAIREplus_compliant_epic</TITLE>
|
15
|
<CODE><![CDATA[
|
16
|
declare_script "dc_cleaning_OpenAIREplus_compliant_epic";
|
17
|
declare_ns oaf = "http://namespace.openaire.eu/oaf";
|
18
|
declare_ns dri = "http://www.driver-repository.eu/namespace/dri";
|
19
|
declare_ns dr = "http://www.driver-repository.eu/namespace/dr";
|
20
|
declare_ns dc = "http://purl.org/dc/elements/1.1/";
|
21
|
declare_ns prov = "http://www.openarchives.org/OAI/2.0/provenance";
|
22
|
//preprocess p1 = dblookup("select id, officialname, accessinfopackage from datasources where accessinfopackage is not null");
|
23
|
$var0 = "''";
|
24
|
$var1 = "'corda_______::'";
|
25
|
$varDummy = "''";
|
26
|
static $varDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
|
27
|
static $varRepoid = xpath:"//dri:repositoryId";
|
28
|
static $varOfficialname = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//OFFICIAL_NAME"]);
|
29
|
dri:objIdentifier = xpath:"//dri:objIdentifier";
|
30
|
dri:repositoryId = $varRepoid;
|
31
|
//dri:repositoryId = xpath:"//dri:repositoryId";
|
32
|
dri:recordIdentifier = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/");
|
33
|
// this is too restrictive, should test for dc:contributor as well
|
34
|
if xpath:"count(//dc:creator) = 0" dc:creator = skipRecord(); else $varDummy = "''";
|
35
|
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''";
|
36
|
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''";
|
37
|
apply xpath:"//dc:subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
|
38
|
apply xpath:"//dc:publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
|
39
|
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
|
40
|
dc:contributor = xpath:"//dc:contributor";
|
41
|
dc:description = xpath:"//dc:description";
|
42
|
$varHttpTest = "''";
|
43
|
if xpath:"//dc:identifier[starts-with(., 'http')] or count(//dc:relation[starts-with(normalize-space(.), 'info:eu-repo/grantAgreement')]) > 0" $varHttpTest = "true"; else dc:identifier = skipRecord();
|
44
|
//if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord();
|
45
|
dc:identifier = xpath:"//dc:relation[starts-with(normalize-space(.), 'http')]";
|
46
|
apply xpath:"//dc:identifier" if xpath:"string-length(.) > 0" dr:CobjIdentifier = xpath:"normalize-space(.)"; else $varDummy = "''";
|
47
|
// apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
|
48
|
static dr:dateOfCollection = getValue(CURRENTDATE, []);
|
49
|
// dc:type = xpath:"//dc:type";
|
50
|
dc:language = Convert(xpath:"//dc:language", Languages);
|
51
|
//dc:language = "eng";
|
52
|
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord();
|
53
|
dc:date = xpath:"//dc:date";
|
54
|
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()");
|
55
|
apply xpath:"//dc:date" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/date')" oaf:embargoenddate = RegExpr(xpath:"normalize-space(.)", $var0, "s/^(.*info:eu-repo\/date\/embargoEnd\/)//gmi"); else $var0 = "''";
|
56
|
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6 and not(contains(normalize-space(.), '/12345'))" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gmi"); else dc:relation = xpath:"normalize-space(.)";
|
57
|
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gmi"); else dc:relation = xpath:"normalize-space(.)";
|
58
|
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gmi"); else dc:relation = xpath:"normalize-space(.)";
|
59
|
//comment-js-09-10-2012 apply xpath:"//dc:rights" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/semantics')" dc:rights = empty; else dc:rights = xpath:"normalize-space(.)";
|
60
|
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
|
61
|
//
|
62
|
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]);
|
63
|
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
|
64
|
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
|
65
|
//
|
66
|
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:".";
|
67
|
apply xpath:"//dc:rights" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/semantics')" oaf:accessrights = Convert(xpath:"normalize-space(.)", AccessRights); else dc:rights = xpath:".";
|
68
|
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN";
|
69
|
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''";
|
70
|
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights);
|
71
|
//
|
72
|
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
|
73
|
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
|
74
|
//
|
75
|
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)');
|
76
|
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
|
77
|
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
|
78
|
end
|
79
|
]]></CODE>
|
80
|
</SCRIPT>
|
81
|
</CONFIGURATION>
|
82
|
<STATUS/>
|
83
|
<SECURITY_PARAMETERS/>
|
84
|
</BODY>
|
85
|
</RESOURCE_PROFILE>
|