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

    
37
apply xpath:"//message/items/author" if xpath:"true()" dc:creator =  xpath:"concat(./family, ', ', ./given)"; else $varDummy = "''";
38
apply xpath:"//message/items/title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''";
39
apply xpath:"//message/items/publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
40
apply xpath:"//message/items/source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
41
apply xpath:"//message/items/container-title" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
42
apply xpath:"//message/items/subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
43

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

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

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

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

    
67
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
68
about = xpath:"//about";
69

    
70

    
71
end
72
]]></CODE>
73
            </SCRIPT>
74
        </CONFIGURATION>
75
        <STATUS/>
76
        <SECURITY_PARAMETERS/>
77
    </BODY>
78
</RESOURCE_PROFILE>
(3-3/83)