Project

General

Profile

« Previous | Next » 

Revision 52131

Updated new claim transformation with UNIBI's contribution on date management (see #2973#note-11)

View differences:

claims_orcid_2_OAF.xml
4 4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5 5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6 6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2017-06-30T13:01:32+02:00"/>
7
        <DATE_OF_CREATION value="2017-07-18T18:23:35+02:00"/>
8 8
    </HEADER>
9 9
    <BODY>
10 10
        <CONFIGURATION>
11 11
            <IMPORTED/>
12 12
            <SCRIPT>
13 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";
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 21

  
22
$var0 = "''";
23
$var1 = "'corda_______::'";
24
$varDummy = "''";
22
                    $var0 = "''";
23
                    $var1 = "'corda_______::'";
24
                    $varDummy = "''";
25 25

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

  
29
static $varUnknownRepoid = "'openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18'";
30
static $varUnknownReponame = "'Unknown Repository'";
29
                    static $varUnknownRepoid = "'openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18'";
30
                    static $varUnknownReponame = "'Unknown Repository'";
31 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()";
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 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 = "''";
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 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(.)";
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 46

  
47
//dc:language = Convert(xpath:"//dc:language", Languages);
47
                    //dc:language = Convert(xpath:"//dc:language", Languages);
48 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 = "''";
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 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'";
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 54

  
55
oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
56
oaf:hostedBy = set("''", @name = $varUnknownReponame; , @id = $varUnknownRepoid;);
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 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";);
58
                    oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
59
                    oaf:hostedBy = set("''", @name = $varUnknownReponame; , @id = $varUnknownRepoid;);
60 60

  
61
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
62
about = xpath:"//about";
63
end
64
]]></CODE>
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>
65 68
            </SCRIPT>
66 69
        </CONFIGURATION>
67 70
        <STATUS/>
68 71
        <SECURITY_PARAMETERS/>
69 72
    </BODY>
70
</RESOURCE_PROFILE>
73
</RESOURCE_PROFILE>

Also available in: Unified diff