Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="1074f048-1342-4280-b49a-2197bbdbc9a5_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2017-07-18T18:16:55+02:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>claims_crossref_2_OAF</TITLE>
14
                <CODE>
15
                    declare_script "claims_crossref_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
                    $var0 = "''";
22
                    $var1 = "'corda_______::'";
23
                    $varDummy = "''";
24

    
25
                    static $varDatasourceid = "'openaire____::crossref'";
26
                    static $varOfficialname = "'Crossref'";
27

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

    
31
                    if xpath:"not(matches(//objIdentifier, '^[\w_]{12}::\w{32}$'))" dri:objIdentifier = skipRecord(); else $varDummy = "''";
32

    
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
                    apply xpath:"//message/items/author" if xpath:"true()" dc:creator =  xpath:"concat(./family, ', ', ./given)"; else $varDummy = "''";
39
                    apply xpath:"//message/items/title" if xpath:"string-length(.) &gt; 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''";
40
                    apply xpath:"//message/items/publisher" if xpath:"string-length(.) &gt; 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
41
                    apply xpath:"//message/items/source" if xpath:"string-length(.) &gt; 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
42
                    apply xpath:"//message/items/container-title" if xpath:"string-length(.) &gt; 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
43
                    apply xpath:"//message/items/subject" if xpath:"string-length(.) &gt; 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
44

    
45
                    $varHttpTest = "''";
46
                    apply xpath:"//message/items/URL" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
47

    
48
                    // first check whether //issued/date-parts contains at most 3 (array) fields, with apt lengths; then alternate the values with '-', giving month/day standard length or dummy values before.
49
                    apply xpath:"//*[local-name()='issued']/*[local-name()='date-parts'][max((count(*),3))=3 and string-length(*[1])=4 and max((subsequence(*/string-length(),2,2),2))=2]" if xpath:"." oaf:dateAccepted = xpath:"string-join((*[1], substring(substring(concat('0',*[2],'1'),string-length(*[2])),1,2), substring(substring(concat('0',*[3],'1'),string-length(*[3])),1,2)), '-')"; else $varDummy = "''";
50

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

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

    
57
                    $varId = identifierExtract('["//message/items/DOI", "//message/items/URL"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/&lt;&gt;]*/[^\s"&lt;&gt;]+)');
58
                    oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
59

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