Project

General

Profile

« Previous | Next » 

Revision 34740

transformation script for dlib magazine

View differences:

modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_compliant_dlib.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<RESOURCE_PROFILE>
3
    <HEADER>
4
        <RESOURCE_IDENTIFIER value="99a3948a-ed80-4fdd-83c2-ea021b0fc069_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
5
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
6
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
7
        <RESOURCE_URI value=""/>
8
        <DATE_OF_CREATION value="2015-02-23T15:32:50+00:00"/>
9
    </HEADER>
10
    <BODY>
11
        <CONFIGURATION>
12
            <IMPORTED/>
13
            <SCRIPT>
14
                <TITLE>dc_cleaning_OPENAIREplus_compliant_dlib</TITLE>
15
                <CODE>declare_script "dc_cleaning_OpenAIREplus_compliant_dlib";
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
static $varDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
25
static $varRepoid = xpath:"//dri:repositoryId";
26
static $varOfficialname = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//OFFICIAL_NAME"]);
27
dri:objIdentifier = xpath:"//dri:objIdentifier";
28
dri:repositoryId = $varRepoid;
29
//dri:repositoryId = xpath:"//dri:repositoryId";
30
dri:recordIdentifier = xpath:"//dri:recordIdentifier";
31
if xpath:"count(//dlib-meta0.1//creator) = 0" dc:creator = skipRecord(); else $varDummy = "''";
32
//apply xpath:"//dc:creator" if xpath:"string-length(.) &gt; 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''";
33
apply xpath:"//dlib-meta0.1//creator" if xpath:"string-length(.) &gt; 0" dc:creator = Convert(xpath:".", Person); else $varDummy = "''";
34
apply xpath:"//dlib-meta0.1/title" if xpath:"string-length(.) &gt; 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''";
35
apply xpath:"//dc:subject" if xpath:"string-length(.) &gt; 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
36
apply xpath:"//dlib-meta0.1//publisher" if xpath:"string-length(.) &gt; 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
37
apply xpath:"//dc:source" if xpath:"string-length(.) &gt; 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
38
dc:contributor = xpath:"//dc:contributor";
39
dc:description = xpath:"//dc:description";
40
$varHttpTest = "''";
41
if xpath:"//dlib-meta0.1//identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord();
42
apply xpath:"//dlib-meta0.1//identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
43
static dr:dateOfCollection = getValue(CURRENTDATE, []);
44
// dc:type = xpath:"//dc:type";
45
dc:language = Convert(xpath:"//dlib-meta0.1/language", Languages);
46
//dc:language = "eng";
47
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord();
48
dc:date = xpath:"//dlib-meta0.1/date[@date-type='publication']";
49
oaf:dateAccepted = xpath:"concat(replace(//date[@date-type='publication'], '\D', ''), '-01', '-01')";
50
//  Convert(xpath:"//date[@date-type='publication']", DateISO8601, "yyyy-MM-dd", "min()");
51
//
52
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]);
53
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
54
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
55
//
56
apply xpath:"//dlib-meta0.1//type[@resource-type='work']" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:".";
57
dc:rights = xpath:"//dlib-meta0.1/rights";
58
oaf:accessrights = "OPEN";
59
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''";
60
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights);
61
//
62
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
63
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
64
//
65
// $varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/&lt;&gt;]*/[^\s"&lt;&gt;]+)');
66
oaf:identifier = set(xpath:"//dlib-meta0.1/identifier[@uri-type='DOI']", @identifierType = "doi";);
67
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
68
oaf:journal = set(xpath:"//dlib-meta0.1//serial-name", @eissn = xpath:"//dlib-meta0.1//issn";);
69
end</CODE>
70
            </SCRIPT>
71
        </CONFIGURATION>
72
        <STATUS/>
73
        <SECURITY_PARAMETERS/>
74
    </BODY>
75
</RESOURCE_PROFILE>

Also available in: Unified diff