Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="e63b5bd2-6a52-4a39-ada9-ed4b3f073176_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2013-02-28T12:14:22+01:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>dc_cleaning_OPENAIREplus_pmc</TITLE>
14
                <CODE><![CDATA[
15
declare_script "dc_cleaning_OpenAIREplus_pmc";
16
declare_ns oaf = "http://namespace.openaire.eu/oaf";
17
declare_ns dri = "http://www.driver-repository.eu/namespace/dri";
18
declare_ns dr = "http://www.driver-repository.eu/namespace/dr";
19
declare_ns dc = "http://purl.org/dc/elements/1.1/";
20
declare_ns prov = "http://www.openarchives.org/OAI/2.0/provenance";
21
$var0 = "''";
22
$var1 = "'corda_______::'";
23
$varDummy = "''";
24
// $varPmc = Convert(xpath:"substring-after(//dc:identifier, '=')", PMC);
25
static $varDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
26
static $varRepoid = xpath:"//dri:repositoryId";
27
static $varOfficialname = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//OFFICIAL_NAME"]);
28
dri:objIdentifier = xpath:"//dri:objIdentifier";
29
dri:repositoryId = $varRepoid;
30
//dri:repositoryId = xpath:"//dri:repositoryId";
31
dri:recordIdentifier = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/");
32
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = Convert(xpath:".", Person); else $varDummy = "''";
33
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''";
34
apply xpath:"//dc:subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
35
apply xpath:"//dc:publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
36
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
37
dc:contributor = xpath:"//dc:contributor";
38
dc:description = xpath:"//dc:description";
39
$varHttpTest = "''";
40
$varHttpTest = "''";
41
if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord();
42
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
43
//$varUrl = xpath:"concat('http://europepmc.org/articles/', $varPmc)";
44
//if xpath:"string-length($varPmc) &gt; 0" dc:identifier = $varUrl; else dc:identifier = xpath:"//dc:identifier";
45
//if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord();
46
//apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
47
static dr:dateOfCollection = getValue(CURRENTDATE, []);
48
// dc:type = xpath:"//dc:type";
49
dc:language = Convert(xpath:"//dc:language", Languages);
50
//dc:language = "eng";
51
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord();
52
dc:date = xpath:"//dc:date";
53
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()");
54
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 = "''";
55
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(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(.)";
56
//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(.)";
57
//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(.)";
58
//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(.)";
59
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
60
//
61
//
62
//
63
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]);
64
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
65
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
66
//
67
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:".";
68
//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:".";
69
//if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN";
70
oaf:accessrights = "OPEN";
71
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''";
72
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights);
73
//
74
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
75
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
76
//
77
$varDOI = RegExpr(xpath:"//dc:identifier[starts-with(., 'doi:')]", $var0, "s/^(.*doi: )//gmi");
78
$varPMC = RegExpr(xpath:"//dc:identifier[starts-with(., 'PMC:')]", $var0, "s/^(.*PMC: )//gmi");
79
$varPMID = RegExpr(xpath:"//dc:identifier[starts-with(., 'PMID:')]", $var0, "s/^(.*PMID: )//gmi");
80
$varIND = RegExpr(xpath:"//dc:identifier[starts-with(., 'IND:')]", $var0, "s/^(.*IND: )//gmi");
81
oaf:identifier = set($varPMC, @identifierType = "pmc";);
82
oaf:identifier = set($varDOI, @identifierType = "doi";);
83
oaf:identifier = set($varPMID, @identifierType = "pmid";);
84
oaf:identifier = set($varIND, @identifierType = "ind";);
85
//oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
86
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
87
end
88
]]></CODE>
89
            </SCRIPT>
90
        </CONFIGURATION>
91
        <STATUS/>
92
        <SECURITY_PARAMETERS/>
93
    </BODY>
94
</RESOURCE_PROFILE>
(37-37/56)