Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="3fe5fd31-1b14-427d-934b-5d5dba6cf5cc_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2016-03-10T19:09:16+00:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>dc_cleaning_OPENAIREplus_puma</TITLE>
14
                <CODE>declare_script "dc_cleaning_OpenAIREplus_compliant_puma";
15
                    declare_ns oaf = "http://namespace.openaire.eu/oaf";
16
                    declare_ns dri = "http://www.driver-repository.eu/namespace/dri";
17
                    declare_ns dr = "http://www.driver-repository.eu/namespace/dr";
18
                    declare_ns dc = "http://purl.org/dc/elements/1.1/";
19
                    declare_ns prov = "http://www.openarchives.org/OAI/2.0/provenance";
20
                    $var0 = "''";
21
                    $varFP7 = "'corda_______::'";
22
                    $varH2020 = "'corda__h2020::'";
23
                    $varFCT="'fct_________::'";
24
                    $varCorda = "'corda_______::'";
25
                    $varDummy = "''";
26
                    static $varDatasourceid = getValue(PROFILEFIELD, [xpath:"concat('collection(&amp;apos;/db/DRIVER/RepositoryServiceResources&amp;apos;)//RESOURCE_PROFILE[.//EXTRA_FIELDS/FIELD[key=&amp;quot;NamespacePrefix&amp;quot;][value=&amp;quot;', //oaf:datasourceprefix, '&amp;quot;]]')", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
27
                    static $varRepoid = xpath:"//dri:repositoryId";
28
                    static $varOfficialname = getValue(PROFILEFIELD, [xpath:"concat('collection(&amp;apos;/db/DRIVER/RepositoryServiceResources&amp;apos;)//RESOURCE_PROFILE[.//EXTRA_FIELDS/FIELD[key=&amp;quot;NamespacePrefix&amp;quot;][value=&amp;quot;', //oaf:datasourceprefix, '&amp;quot;]]')", xpath:"//CONFIGURATION/OFFICIAL_NAME"]);
29
                    dri:objIdentifier = xpath:"//dri:objIdentifier";
30
                    dri:repositoryId = $varRepoid;
31
                    dri:recordIdentifier = xpath:"//dri:recordIdentifier";
32
                    apply xpath:"//dc:creator" if xpath:"string-length(.) &gt; 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''";
33
                    if xpath:"//dc:title[string-length(.)&gt; 0]" $varDummy = "''"; else dc:coverage = skipRecord();
34
                    dc:title = xpath:"//dc:title[string-length(.) &gt; 0]/normalize-space(.)";
35
                    apply xpath:"//dc:subject" if xpath:"string-length(.) &gt; 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
36
                    apply xpath:"//dc:publisher" if xpath:"string-length(.) &gt; 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
37
                    apply xpath:"//dc:source" if xpath:"string-length(.) &gt; 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
38
                    dc:contributor = xpath:"//dc:contributor";
39
                    dc:description = xpath:"//dc:description";
40
                    dc:format = xpath:"//dc:format";
41
                    $varHttpTest = "''";
42
                    if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord();
43
                    //apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
44
                    //
45
                    if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']/preceding::dc:identifier[starts-with(., 'http')][ends-with(., '.pdf')]" dc:identifier = xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']/preceding::dc:identifier[starts-with(., 'http')][ends-with(., '.pdf')]"; else dc:identifier = xpath:"//dc:identifier[starts-with(., 'http')]";
46
                    //
47
                    dr:dateOfCollection = xpath:"//dri:dateOfCollection";
48
                    static dr:dateOfTransformation = xpath:"current-dateTime()";
49
                    dc:type = xpath:"//dc:type";
50
                    dc:language = Convert(xpath:"//dc:language", Languages);
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
                    // FP7
56
                    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'))";
57
                    // H2020
58
                    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'))";
59
                    // FCT
60
                    oaf:projectid = xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/fct)/(.+)/(\d+)(.*)', 'i')]/concat($varFCT, replace(normalize-space(.), '(info:eu-repo/grantagreement/fct)/(.+)/(\d+)(.*)', '$3', 'i'))";
61
                    dc:relation = xpath:"//dc:relation";
62
                    //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(.)";
63
                    //
64
                    oaf:collectedDatasourceid = xpath:"$varDatasourceid";
65
                    //
66
                    dr:CobjCategory = Convert(xpath:"//dc:type", TextTypologies);
67
                    dc:rights = xpath:"//dc:rights";
68
                    if xpath:"not(//dc:rights[text()='info:eu-repo/semantics/openAccess'])" oaf:accessrights = Convert(xpath:"//dc:rights", AccessRights); else oaf:accessrights = "OPEN";
69
                    // 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:".";
70
                    // if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else 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
                    // $varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/&amp;lt;&amp;gt;]*/[^\s"&amp;lt;&amp;gt;]+)');
78
                    $varId = identifierExtract('["//dc:relation[starts-with(normalize-space(.), \"info:eu-repo/semantics/altIdentifier/doi/\")]"]' , xpath:"./*[local-name()='record']" , '(?!info:eu-repo/semantics/altIdentifier/doi/)(10.*)');
79
                    oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
80
                    oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
81
                    end</CODE>
82
            </SCRIPT>
83
        </CONFIGURATION>
84
        <STATUS/>
85
        <SECURITY_PARAMETERS/>
86
    </BODY>
87
</RESOURCE_PROFILE>
(38-38/56)