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
//TODO: ask UNIBI how to skip records whose objIdentifier is not compliant to the regex ^\w{12}::\w{32}$
32
//tmp check on string length
33
if xpath:"string-length(//objIdentifier) != 46" dri:objIdentifier = skipRecord(); else $varDummy = "''";
34
dri:objIdentifier = xpath:"//objIdentifier";
35
dri:recordIdentifier = xpath:"//dri:recordIdentifier";
36
dri:dateOfCollection = xpath:"//dri:dateOfCollection";
37
static dr:dateOfTransformation = xpath:"current-dateTime()";
38

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

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

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

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

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

    
69
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
70
about = xpath:"//about";
71

    
72

    
73
end
74
]]></CODE>
75
            </SCRIPT>
76
        </CONFIGURATION>
77
        <STATUS/>
78
        <SECURITY_PARAMETERS/>
79
    </BODY>
80
</RESOURCE_PROFILE>
(1-1/84)