Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="ba70f93a-9309-40f5-8988-6018baf2b3e1_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2016-08-31T16:36:07+00:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>dc_cleaning_OPENAIREplus_compliant_hal</TITLE>
14
                <CODE>declare_script "dc_cleaning_OpenAIREplus_compliant_hal";
15
declare_ns oaf = "http://namespace.openaire.eu/oaf";
16
declare_ns dri = "http://www.driver-repository.eu/namespace/dri";
17
declare_ns dr = "http://www.driver-repository.eu/namespace/dr";
18
declare_ns dc = "http://purl.org/dc/elements/1.1/";
19
declare_ns prov = "http://www.openarchives.org/OAI/2.0/provenance";
20
declare_ns oai = "http://www.openarchives.org/OAI/2.0/";
21
$var0 = "''";
22
$varFP7 = "'corda_______::'";
23
$varH2020 = "'corda__h2020::'";
24
$varDummy = "''";
25
static $varDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
26
static $varRepoid = xpath:"//dri:repositoryId";
27
static $varOfficialname = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//OFFICIAL_NAME"]);
28
dri:objIdentifier = xpath:"//dri:objIdentifier";
29
dri:repositoryId = $varRepoid;
30
dri:recordIdentifier = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/");
31
// apply xpath:"//dc:contributor[starts-with(., 'European Project')]" if xpath:"string-length(replace(., '.*(\d{6,6}).*', '$1')) = 6" oaf:projectid = xpath:"concat($var1, replace(., '.*(\d{6,6}).*', '$1'))"; else $varDummy = "''";
32
apply xpath:"//dc:creator" if xpath:"string-length(.) &gt; 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''";
33
if xpath:"//dc:title[string-length(.)&gt; 0]" $varDummy = "''"; else dc:coverage = skipRecord();
34
dc:title = xpath:"//dc:title[string-length(.) &gt; 0]/normalize-space(.)";
35
apply xpath:"//dc:subject" if xpath:"string-length(.) &gt; 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
36
apply xpath:"//dc: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/normalize-space(.)";
40
//  dc:description = xpath:"string-join(//dc:description/normalize-space(.), concat('; ',codepoints-to-string(10)))";
41
dc:description = xpath:"string-join(//dc:description/normalize-space(.), '; ')";
42
dc:format = xpath:"//dc:format";
43
$varHttpTest = "''";
44
oaf:fulltext = xpath:"//dc:identifier[ends-with(., 'document') or ends-with(., 'pdf')]";
45
if xpath:"//dc:identifier[ends-with(., 'document') or ends-with(., 'pdf')] or //dc:relation[starts-with(lower-case(normalize-space(.)), 'info:eu-repo/grantagreement')] or //dc:rights[starts-with(lower-case(normalize-space(.)), 'open') or contains(lower-case(normalize-space(.)), 'openaccess')] or //dc:accessRights[contains(lower-case(normalize-space(.)), 'openaccess')]" $var0 = "''"; else dc:coverage = skipRecord();
46
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
47
dr:dateOfCollection = xpath:"//dri:dateOfCollection";
48
static dr:dateOfTransformation = xpath:"current-dateTime()";
49
dc:type = xpath:"//dc:type";
50
dc:format = xpath:"//dc:format";
51
dc:date = xpath:"//dc:date";
52
dc:language = Convert(xpath:"//dc:language", Languages);
53
$varDate = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()");
54
if xpath:"starts-with($varDate, '00')" oaf:dateAccepted = $varDummy; else oaf:dateAccepted = $varDate;
55
apply xpath:"//dc:date" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/date')" oaf:embargoenddate = RegExpr(xpath:"normalize-space(.)", $var0, "s/^(.*info:eu-repo\/date\/embargoEnd\/)//gmi"); else $var0 = "''";
56
apply xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', 'i')]" if xpath:"true()" oaf:projectid = xpath:"concat($varFP7, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"; else $var0 = "''";
57
apply xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', 'i')]" if xpath:"true()" oaf:projectid = xpath:"concat($varH2020, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"; else $var0 = "''";
58
dc:relation = xpath:"//dc:relation";
59
//comment-js-09-10-2012 apply xpath:"//dc:rights" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/semantics')" dc:rights = empty; else dc:rights = xpath:"normalize-space(.)";
60
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
61
//
62
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]);
63
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
64
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
65
//
66
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:".";
67
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''";
68
oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')])", AccessRights);
69
//
70
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
71
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
72
//
73
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/&lt;&gt;]*/[^\s"&lt;&gt;]+)');
74
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
75
$varPmId = identifierExtract('["//dc:identifier[starts-with(normalize-space(.), \"PUBMED :\")]"]' , xpath:"./*[local-name()='record']" , '(?!PUBMED : )(\d+)');
76
oaf:identifier = set(xpath:"$varPmId//value", @identifierType = "pmid";);
77
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
78
end</CODE>
79
            </SCRIPT>
80
        </CONFIGURATION>
81
        <STATUS/>
82
        <SECURITY_PARAMETERS/>
83
    </BODY>
84
</RESOURCE_PROFILE>
(55-55/85)