Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="f4cee5d0-ef24-4ad9-a539-5ebf61e45236_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2017-07-18T18:23:35+02:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>claims_orcid_2_OAF</TITLE>
14
                <CODE>
15
                    declare_script "claims_orcid_2_OAF";
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

    
22
                    $varDummy = "''";
23

    
24
                    static $varDatasourceid = "'openaire____::orcid'";
25
                    static $varOfficialname = "'ORCID'";
26

    
27
                    static $varUnknownRepoid = "'openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18'";
28
                    static $varUnknownReponame = "'Unknown Repository'";
29

    
30
                    if xpath:"not(matches(//objIdentifier, '^[\w_]{12}::\w{32}$'))" dri:objIdentifier = skipRecord(); else $varDummy = "''";
31
                    dri:objIdentifier = xpath:"//objIdentifier";
32
                    dri:recordIdentifier = xpath:"//dri:recordIdentifier";
33
                    dri:dateOfCollection = xpath:"//dri:dateOfCollection";
34
                    static dr:dateOfTransformation = xpath:"current-dateTime()";
35

    
36
                    apply xpath:"//*[local-name() = 'contributor']/*[local-name()='credit-name']" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''";
37

    
38
                    apply xpath:"//*[local-name() = 'work']/*[local-name() = 'title']/*[local-name() = 'title']" if xpath:"string-length(.) &gt; 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''";
39

    
40
                    apply xpath:"//*[local-name() = 'work']/*[local-name() = 'journal-title']" if xpath:"string-length(.) &gt; 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
41

    
42
                    apply xpath:"//*[local-name() = 'work']/*[local-name() = 'url']" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
43

    
44
                    // first check whether //orcid-work/publication-date/year has apt length; then alternate year, month, day with '-', giving month, day standard length or dummy values before.
45

    
46
                    apply xpath:"//*[local-name() = 'work']/*[local-name() = 'publication-date'][string-length(*[local-name()='year'])=4]" if xpath:"." oaf:dateAccepted = xpath:"string-join((*[local-name() = 'year'], substring(substring(concat('0',*[local-name() = 'month'],'1'),string-length(*[local-name() = 'month'])),1,2), substring(substring(concat('0',*[local-name() = 'day'],'1'),string-length(*[local-name() = 'day'])),1,2)), '-')"; else $varDummy = "''";
47

    
48
                    apply xpath:"//*[local-name() = 'work']/*[local-name() = 'type']" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dr:CobjCategory = "0001";
49
                    oaf:accessrights = "UNKNOWN";
50

    
51
                    oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
52
                    oaf:hostedBy = set("''", @name = $varUnknownReponame; , @id = $varUnknownRepoid;);
53

    
54
                    //Thanks Jochen: #5355
55
                    $varId = identifierExtract('["//*[local-name() = \"work\"]//*[local-name() = \"external-ids\"]//*[local-name() =\"external-id-value\"]", "//*[local-name() = \"work\"]/*[local-name()=\"url\"]"]' , xpath:"./*[local-name()='record']/*[local-name()='metadata']" , '(10[.][0-9]{4,}[^\s"/&lt;&gt;]*/[^\s"&lt;&gt;]+)');
56
                    oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
57

    
58
                    oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
59
                    about = xpath:"//about";
60
                    end
61
                </CODE>
62
            </SCRIPT>
63
        </CONFIGURATION>
64
        <STATUS/>
65
        <SECURITY_PARAMETERS/>
66
    </BODY>
67
</RESOURCE_PROFILE>
(5-5/5)