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
                    $var0 = "''";
23
                    $var1 = "'corda_______::'";
24
                    $varDummy = "''";
25

    
26
                    static $varDatasourceid = "'openaire____::orcid'";
27
                    static $varOfficialname = "'ORCID'";
28

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

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

    
38
                    //TODO: authors are in the bibtex citation only: how can we get them out?
39
                    //apply xpath:"" if xpath:"true()" dc:creator =  xpath:"concat(./family, ', ', ./given)"; else $varDummy = "''";
40
                    apply xpath:"//*[local-name()='orcid-message']//orcid-work//work-title/title" if xpath:"string-length(.) &gt; 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''";
41
                    //apply xpath:"" if xpath:"string-length(.) &gt; 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
42
                    apply xpath:"//*[local-name()='orcid-message']//orcid-work/journal-title" if xpath:"string-length(.) &gt; 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
43
                    //apply xpath:"" if xpath:"string-length(.) &gt; 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
44

    
45
                    apply xpath:"//orcid-work/url" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
46

    
47
                    //dc:language = Convert(xpath:"//dc:language", Languages);
48

    
49
                    //TODO: how to include month and day when they exist?
50
                    //apply xpath:"//orcid-work/publication-date/year" if xpath:"string-length(.) &gt; 0" oaf:dateAccepted = xpath:"normalize-space(.)"; else $varDummy = "''";
51

    
52
                    // 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.
53
                    apply xpath:"//*[local-name()='orcid-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 = "''";
54

    
55
                    apply xpath:"//orcid-work/work-type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dr:CobjCategory = "0001";
56
                    oaf:accessrights = "'UNKNOWN'";
57

    
58
                    oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
59
                    oaf:hostedBy = set("''", @name = $varUnknownReponame; , @id = $varUnknownRepoid;);
60

    
61
                    $varId = identifierExtract('["//orcid-work//work-external-indentifier/work-external-identifier-id", "//orcid-work/url"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/&lt;&gt;]*/[^\s"&lt;&gt;]+)');
62
                    oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
63

    
64
                    oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
65
                    about = xpath:"//about";
66
                    end
67
                </CODE>
68
            </SCRIPT>
69
        </CONFIGURATION>
70
        <STATUS/>
71
        <SECURITY_PARAMETERS/>
72
    </BODY>
73
</RESOURCE_PROFILE>
(5-5/5)