Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="b844840b-4efa-40a1-a1ce-90b4b63972c2_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_compliant</TITLE>
14
                <CODE><![CDATA[
15
declare_script "dc_cleaning_OpenAIREplus_compliant";
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
$varFP7 = "'corda_______::'";
23
$varH2020 = "'corda__h2020::'";
24
$varDummy = "''";
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:recordIdentifier = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/");
31
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0 and not(contains(., 'US National Cancer Institute'))" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''";
32
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''";
33
apply xpath:"//dc:subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
34
apply xpath:"//dc:publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
35
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
36
dc:contributor = xpath:"//dc:contributor";
37
dc:description = xpath:"//dc:description";
38
$varHttpTest = "''";
39
if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord();
40
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
41
static dr:dateOfCollection = getValue(CURRENTDATE, []);
42
dc:type = xpath:"//dc:type";
43
dc:format = xpath:"//dc:format";
44
dc:date = xpath:"//dc:date";
45
dc:language = Convert(xpath:"//dc:language", Languages);
46
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord();
47
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()");
48
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 = "''";
49
// FP7
50
oaf:projectid = xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', 'i')]/concat($varFP7, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))";
51
// H2020
52
oaf:projectid = xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', 'i')]/concat($varH2020, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))";
53
dc:relation = xpath:"//dc:relation";
54
//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(.)";
55
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
56
//
57
//
58
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]);
59
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
60
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
61
//
62
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:".";
63
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:".";
64
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN";
65
//
66
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
67
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
68
//
69
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)');
70
// 1st param: list of xpath expresssions to be applied on the metadata in json syntax; 2nd param: xpath expression for the metadata record; 3rd param reg expr that matches with a negative lookahead for the first group and extracts digits of the second group
71
$varPmId = identifierExtract('["//dc:relation[starts-with(normalize-space(.), \"info:eu-repo/semantics/altIdentifier/pmid/\")]"]' , xpath:"./*[local-name()='record']" , '(?!info:eu-repo/semantics/altIdentifier/pmid/)(\d+)');
72
$varUrn = identifierExtract('["//dc:relation[starts-with(normalize-space(.), \"info:eu-repo/semantics/altIdentifier/urn/\")]"]' , xpath:"./*[local-name()='record']" , '(?!info:eu-repo/semantics/altIdentifier/urn/)(urn:nbn:.*)');
73
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
74
oaf:identifier = set(xpath:"$varPmId//value", @identifierType = "pmid";);
75
oaf:identifier = set(xpath:"$varUrn//value", @identifierType = "urn";);
76
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
77
end
78
]]></CODE>
79
            </SCRIPT>
80
        </CONFIGURATION>
81
        <STATUS/>
82
        <SECURITY_PARAMETERS/>
83
    </BODY>
84
</RESOURCE_PROFILE>
(5-5/56)