1 |
33224
|
jochen.sch
|
<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 |
43549
|
aenne.loeh
|
<DATE_OF_CREATION value="2016-08-31T16:36:07+00:00"/>
|
8 |
33224
|
jochen.sch
|
</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 |
43549
|
aenne.loeh
|
$varFP7 = "'corda_______::'";
|
23 |
|
|
$varH2020 = "'corda__h2020::'";
|
24 |
33224
|
jochen.sch
|
$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 |
43549
|
aenne.loeh
|
// 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 |
33224
|
jochen.sch
|
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''";
|
33 |
43549
|
aenne.loeh
|
if xpath:"//dc:title[string-length(.)> 0]" $varDummy = "''"; else dc:coverage = skipRecord();
|
34 |
|
|
dc:title = xpath:"//dc:title[string-length(.) > 0]/normalize-space(.)";
|
35 |
33224
|
jochen.sch
|
apply xpath:"//dc:subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
|
36 |
|
|
apply xpath:"//dc:publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
|
37 |
|
|
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
|
38 |
|
|
dc:contributor = xpath:"//dc:contributor";
|
39 |
43549
|
aenne.loeh
|
// dc:description = xpath:"//dc:description/normalize-space(.)";
|
40 |
43557
|
aenne.loeh
|
// dc:description = xpath:"string-join(//dc:description/normalize-space(.), concat('; ',codepoints-to-string(10)))";
|
41 |
43549
|
aenne.loeh
|
dc:description = xpath:"string-join(//dc:description/normalize-space(.), '; ')";
|
42 |
|
|
dc:format = xpath:"//dc:format";
|
43 |
33224
|
jochen.sch
|
$varHttpTest = "''";
|
44 |
43549
|
aenne.loeh
|
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 |
33224
|
jochen.sch
|
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
|
47 |
43549
|
aenne.loeh
|
dr:dateOfCollection = xpath:"//dri:dateOfCollection";
|
48 |
|
|
static dr:dateOfTransformation = xpath:"current-dateTime()";
|
49 |
33224
|
jochen.sch
|
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 |
43549
|
aenne.loeh
|
$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 |
33224
|
jochen.sch
|
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 |
43549
|
aenne.loeh
|
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 |
33224
|
jochen.sch
|
//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 |
43549
|
aenne.loeh
|
oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')])", AccessRights);
|
69 |
33224
|
jochen.sch
|
//
|
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"/<>]*/[^\s"<>]+)');
|
74 |
|
|
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
|
75 |
43549
|
aenne.loeh
|
$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 |
33224
|
jochen.sch
|
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
|
78 |
|
|
end</CODE>
|
79 |
|
|
</SCRIPT>
|
80 |
|
|
</CONFIGURATION>
|
81 |
|
|
<STATUS/>
|
82 |
|
|
<SECURITY_PARAMETERS/>
|
83 |
|
|
</BODY>
|
84 |
|
|
</RESOURCE_PROFILE>
|