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-06-30T13:01:32+02:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>claims_orcid_2_OAF</TITLE>
14
                <CODE><![CDATA[
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(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''";
41
//apply xpath:"" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
42
apply xpath:"//*[local-name()='orcid-message']//orcid-work/journal-title" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
43
//apply xpath:"" if xpath:"string-length(.) > 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(.) > 0" oaf:dateAccepted = xpath:"normalize-space(.)"; else $varDummy = "''";
51

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

    
55
oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
56
oaf:hostedBy = set("''", @name = $varUnknownReponame; , @id = $varUnknownRepoid;);
57

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

    
61
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
62
about = xpath:"//about";
63
end
64
]]></CODE>
65
            </SCRIPT>
66
        </CONFIGURATION>
67
        <STATUS/>
68
        <SECURITY_PARAMETERS/>
69
    </BODY>
70
</RESOURCE_PROFILE>
(5-5/81)