Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="2e189df5-0985-444d-aa51-702f2a62176b_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2020-12-12T15:09:52+00:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>dc_cleaning_OPENAIREplus_erc</TITLE>
14
                <CODE>declare_script "dc_cleaning_OpenAIREplus_erc";
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
                    declare_ns cr = "http://www.crossref.org/qrschema/2.0";
21
                    declare_ns ac="org.apache.commons.lang.StringEscapeUtils";
22
                    $var0 = "''";
23
                    $var1 = "'corda_______::'";
24
                    $varDummy = "''";
25
                    $varUnknownRepoId = "'openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18'";
26
                    $varUnknownRepoName = "'Unknown Repository'";
27
                    $varCrossRefAuthor = xpath:"//cr:crossref_result//cr:contributors/cr:contributor[@contributor_role='author']";
28
                    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"]);
29
                    static $varRepoid = xpath:"//dri:repositoryId";
30
                    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"]);
31
                    dri:objIdentifier = xpath:"//dri:objIdentifier";
32
                    dri:repositoryId = $varRepoid;
33
                    dri:recordIdentifier = xpath:"//dri:recordIdentifier";
34
                    apply xpath:"//cr:crossref_result//cr:contributors/cr:contributor[@contributor_role='author']" if xpath:"true()" dc:creator = xpath:"concat(./cr:surname, ', ', ./cr:given_name)"; else $varDummy = "''";
35
                    if xpath:"contains(//PUB_AUTHORS, '; ') and contains(//PUB_AUTHORS, ' / ') and not($varCrossRefAuthor)" dc:creator = xpath:"tokenize(ac:unescapeJava(//PUB_AUTHORS), '\s*;\s*|\s*/\s*')"; else $varDummy = "''";
36
                    if xpath:"not(contains(//PUB_AUTHORS, '; ')) and contains(//PUB_AUTHORS, ' / ') and not($varCrossRefAuthor)" dc:creator = xpath:"//PUB_AUTHORS/normalize-space(ac:unescapeJava(.))"; else $varDummy = "''";
37
                    if xpath:"contains(//PUB_AUTHORS, ';') and not(contains(//PUB_AUTHORS, ' / ')) and not($varCrossRefAuthor)" dc:creator = xpath:"tokenize(ac:unescapeJava(//PUB_AUTHORS), '\s*;\s*')"; else $varDummy = "''";
38
                    if xpath:"contains(//PUB_AUTHORS, '., ') and not($varCrossRefAuthor)" dc:creator = xpath:"tokenize(ac:unescapeJava(//PUB_AUTHORS), '\s*\.\s*, and |\s*\.,\s*')"; else $varDummy = "''";
39
                    if xpath:"contains(//PUB_AUTHORS, ', and ') and not(contains(//PUB_AUTHORS, '., ')) and not($varCrossRefAuthor)" dc:creator = xpath:"tokenize(ac:unescapeJava(//PUB_AUTHORS), '\s*, and\s*|\s*,\s*')"; else $varDummy = "''";
40
                    // Monga, Mattia and Sicari, Sabrina
41
                    if xpath:"contains(//PUB_AUTHORS, ' and ') and not(contains(//PUB_AUTHORS, ', and ')) and not($varCrossRefAuthor)" dc:creator = xpath:"tokenize(ac:unescapeJava(//PUB_AUTHORS), '\s+and\s+')"; else $varDummy = "''";
42
                    if xpath:"contains(//PUB_AUTHORS, ',') and not(contains(//PUB_AUTHORS, ' and ') or contains(//PUB_AUTHORS, '., ') or contains(//PUB_AUTHORS, ' / ')) and not($varCrossRefAuthor)" dc:creator = xpath:"tokenize(ac:unescapeJava(//PUB_AUTHORS), '\s*,\s*')"; else $varDummy = "''";
43
                    // Dykstra, P. A.  // Schuler B, Hofmann H.
44
                    //
45
                    // if xpath:"count(tokenize(., ',')) &lt; 3 and contains(//PUB_AUTHORS, ', ') and not(contains(//PUB_AUTHORS, ' and ') or contains(//PUB_AUTHORS, '., ') or contains(//PUB_AUTHORS, ' / ')) and not($varCrossRefAuthor)" dc:creator = xpath:"//PUB_AUTHORS/normalize-space(.)"; else $varDummy = "''";
46
                    //
47
                    // Leticia Sabsay
48
                    if xpath:"not(contains(//PUB_AUTHORS, ',')) and not(contains(//PUB_AUTHORS, '(')) and not(contains(//PUB_AUTHORS, ' and ')) and not(contains(//PUB_AUTHORS, '; ') or contains(//PUB_AUTHORS, ';')) and not($varCrossRefAuthor)" dc:creator = xpath:"//PUB_AUTHORS/normalize-space(ac:unescapeJava(.))"; else $varDummy = "''";
49
                    // if xpath:"not(contains(//PUB_AUTHORS, ',')) and not(contains(//PUB_AUTHORS, '(')) and not(contains(//PUB_AUTHORS, ' and ')) and not(contains(//PUB_AUTHORS, '; ') or contains(//PUB_AUTHORS, ';')) and not($varCrossRefAuthor)" dc:creator = xpath:"//PUB_AUTHORS/concat(tokenize(., '\s')[last()], ', ', normalize-space( replace(normalize-space(), tokenize(., '\s')[last()], '') ))"; else $varDummy = "''";
50
                    // if xpath:"not(contains(//PUB_AUTHORS, ' ')) and not(contains(//PUB_AUTHORS, ',')) and not(contains(//PUB_AUTHORS, '(')) and not(contains(//PUB_AUTHORS, ' and ')) and not(contains(//PUB_AUTHORS, '; ')) and not($varCrossRefAuthor)" dc:creator = xpath:"//PUB_AUTHORS/normalize-space(.)"; else $varDummy = "''";
51
                    //
52
                    // if xpath:"contains(//PUB_AUTHORS, '(') and not(contains(//PUB_AUTHORS, ',')) and not(contains(//PUB_AUTHORS, ' and ')) and not(contains(//PUB_AUTHORS, '; ')) and not($varCrossRefAuthor)" dc:creator = xpath:"//PUB_AUTHORS/normalize-space(substring-before(., '('))"; else $varDummy = "''";
53
                    //dc:title = xpath:"ac:unescapeJava(//PUB_TITLE/normalize-space(.))";
54
                    dc:title = xpath:"//PUB_TITLE/normalize-space(.)";
55
                    //apply xpath:"//dc:subject" if xpath:"string-length(.) &gt; 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
56
                    //apply xpath:"//dc:publisher" if xpath:"string-length(.) &gt; 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
57
                    dc:source = xpath:"//cr:series_title | //cr:journal_title";
58
                    //dc:contributor = xpath:"//dc:contributor";
59
                    //dc:description = xpath:"//dc:description";
60
                    $varHttpTest = "''";
61
                    apply xpath:"//cr:doi" if xpath:". and not(//url)" dc:identifier = xpath:"concat('http://dx.doi.org/', .)"; else $varDummy = "''";
62
                    dr:dateOfCollection = xpath:"//dri:dateOfCollection";
63
                    //dc:type = xpath:"//cr:doi/@type";
64
                    //dc:language = Convert(xpath:"//dc:language", Languages);
65
                    dc:language = "eng";
66
                    //if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord();
67
                    dc:date = xpath:"//PUB_DATE_PUBLICATION";
68
                    oaf:dateAccepted = Convert(xpath:"descendant-or-self::PUB_DATE_PUBLICATION", DateISO8601, "yyyy-MM-dd", "min()");
69
                    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 = "''";
70

    
71
                    $varValidationDate = xpath:"//dri:dateOfCollection";
72
                    //apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = set(RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gmi"), @validationDate=xpath:"$varValidationDate";); else dc:relation = xpath:"normalize-space(.)";
73
                    oaf:projectid=set(xpath:"concat($var1, //PROJECT_ID)", @validationDate=xpath:"$varValidationDate";);
74

    
75
                    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(.)";
76

    
77
                    //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(.)";
78
                    //
79
                    //oaf:projectid=xpath:"concat($var1, //PROJECT_ID)";
80
                    //
81
                    //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(.)";
82
                    //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(.)";
83
                    //
84
                    //
85
                    oaf:collectedDatasourceid = xpath:"$varDatasourceid";
86
                    //
87
                    //apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:".";
88
                    //apply xpath:"//cr:doi" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(./@type)", TextTypologies); else dc:type = xpath:".";
89
                    //if xpath:"not(//cr:doi)" dr:CobjCategory = "0001"; else $varDummy = "''";
90
                    $varCobjCatDefault = xpath:"//oaf:datasourceprefix[not(//cr:doi)]/'0001'";
91
                    $varCobjCatExplicit = Convert(xpath:"normalize-space(//cr:doi/@type)", TextTypologies);
92
                    $varCobjCategory = xpath:"($varCobjCatDefault, $varCobjCatExplicit)[1]";
93
                    $varSuperType = Convert(xpath:"normalize-space($varCobjCategory)", SuperTypes);
94
                    dr:CobjCategory = set($varCobjCategory, @type = $varSuperType;);
95
                    dc:type = xpath:"//cr:doi/@type";
96
                    //
97
                    if xpath:"//PUB_ACCESS_OPEN = 'true'" oaf:accessrights = "OPEN"; else oaf:accessrights = "RESTRICTED";
98
                    //
99
                    $varISSN = "''";
100
                    if xpath:"starts-with(//PUB_PERMANENT_ID, 'ISSN ')" $varISSN = xpath:"normalize-space(substring-after(//PUB_PERMANENT_ID, 'ISSN '))"; else $varDummy = "''";
101
                    if xpath:"//cr:issn[@type='print'][1]" $varISSN = xpath:"replace(//cr:issn[@type='print'][1], '(\d{4})(.*)(\d{4}|\d{3}X)', '$1-$3')"; else $varDummy = "''";
102
                    $varEISSN = xpath:"//cr:issn[@type='electronic']";
103
                    $varJournal = "''";
104
                    if xpath:"//cr:journal_title | //cr:series_title" $varJournal = xpath:"//cr:journal_title | //cr:series_title"; else $varJournal = xpath:"ac:unescapeJava(//PERIODIC_TITLE)";
105
                    oaf:journal = set($varJournal, @issn=$varISSN;);
106
                    //
107
                    static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
108
                    // static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
109
                    static oaf:hostedBy = set("''", @name="Unknown Repository";, @id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18";);
110
                    //
111
                    // $varId = identifierExtract('["//PUB_PERMANENT_ID", "//PERIODIC_NUMBER", "//PUB_RELEVANT_PAGES", "//PERIODIC_TITLE", "//PUB_TITLE"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/&lt;&gt;]*/[^\s"&lt;&gt;]+[^\).$])');
112
                    // oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
113
                    oaf:identifier = set(xpath:"//cr:doi", @identifierType = "doi";);
114
                    oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
115
                    end</CODE>
116
            </SCRIPT>
117
        </CONFIGURATION>
118
        <STATUS/>
119
        <SECURITY_PARAMETERS/>
120
    </BODY>
121
</RESOURCE_PROFILE>
(43-43/61)