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-06-30T13:01:32+02:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>claims_crossref_2_OAF</TITLE>
14
                <CODE><![CDATA[
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
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:"//message/items/author" if xpath:"true()" dc:creator =  xpath:"concat(./family, ', ', ./given)"; else $varDummy = "''";
37
apply xpath:"//message/items/title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''";
38
apply xpath:"//message/items/publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
39
apply xpath:"//message/items/source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
40
apply xpath:"//message/items/container-title" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
41
apply xpath:"//message/items/subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
42

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

    
46
//message/items/type
47
//dc:language = Convert(xpath:"//dc:language", Languages);
48
//TODO: ask UNIBI how to do for dates
49
//<issued>
50
         // <date-parts>
51
           // <array>2014</array>
52
           // <array>1</array>
53
           // <array>28</array>
54
          //</date-parts>
55
       // </issued>
56
//oaf:dateAccepted = Convert(xpath:"//message/items/issued/date-parts/array", DateISO8601, "yyyy-MM-dd", "min()");
57
apply xpath:"//message/items/type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dr:CobjCategory = "0001";
58
oaf:accessrights = "'UNKNOWN'";
59

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

    
63
$varId = identifierExtract('["//message/items/DOI", "//message/items/URL"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)');
64
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
65

    
66
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
67
about = xpath:"//about";
68
end
69
]]></CODE>
70
            </SCRIPT>
71
        </CONFIGURATION>
72
        <STATUS/>
73
        <SECURITY_PARAMETERS/>
74
    </BODY>
75
</RESOURCE_PROFILE>
(1-1/82)