1 |
46991
|
aenne.loeh
|
<RESOURCE_PROFILE>
|
2 |
|
|
<HEADER>
|
3 |
|
|
<RESOURCE_IDENTIFIER value="e545ed7a-a349-47e0-8387-c3bd9b1aab37_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4 |
|
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5 |
|
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6 |
|
|
<RESOURCE_URI value=""/>
|
7 |
|
|
<DATE_OF_CREATION value="2017-03-16T12:48:50+00:00"/>
|
8 |
|
|
</HEADER>
|
9 |
|
|
<BODY>
|
10 |
|
|
<CONFIGURATION>
|
11 |
|
|
<IMPORTED/>
|
12 |
|
|
<SCRIPT>
|
13 |
|
|
<TITLE>dc_cleaning_OPENAIREplus_CSIC</TITLE>
|
14 |
|
|
<CODE>declare_script "dc_cleaning_OpenAIREplus_CSIC";
|
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 xs = "http://www.w3.org/2001/XMLSchema";
|
21 |
|
|
//preprocess p1 = dblookup("select id, officialname, accessinfopackage from datasources where accessinfopackage is not null");
|
22 |
|
|
$var0 = "''";
|
23 |
|
|
$varFP7 = "'corda_______::'";
|
24 |
|
|
$varH2020 = "'corda__h2020::'";
|
25 |
|
|
$varFCT="'fct_________::'";
|
26 |
|
|
$varDummy = "''";
|
27 |
|
|
static $varDatasourceid = getValue(PROFILEFIELD, [xpath:"concat('collection(&apos;/db/DRIVER/RepositoryServiceResources&apos;)//RESOURCE_PROFILE[.//EXTRA_FIELDS/FIELD[key=&quot;NamespacePrefix&quot;][value=&quot;', //oaf:datasourceprefix, '&quot;]]')", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
|
28 |
|
|
static $varRepoid = xpath:"//dri:repositoryId";
|
29 |
|
|
static $varOfficialname = getValue(PROFILEFIELD, [xpath:"concat('collection(&apos;/db/DRIVER/RepositoryServiceResources&apos;)//RESOURCE_PROFILE[.//EXTRA_FIELDS/FIELD[key=&quot;NamespacePrefix&quot;][value=&quot;', //oaf:datasourceprefix, '&quot;]]')", xpath:"//CONFIGURATION/OFFICIAL_NAME"]);
|
30 |
|
|
dri:objIdentifier = xpath:"//dri:objIdentifier";
|
31 |
|
|
dri:repositoryId = $varRepoid;
|
32 |
|
|
dri:recordIdentifier = xpath:"//dri:recordIdentifier";
|
33 |
|
|
if xpath:"count(//dc:creator) = 0" dc:creator = skipRecord(); else $varDummy = "''";
|
34 |
|
|
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''";
|
35 |
|
|
if xpath:"//dc:title[string-length(.)> 0]" $varDummy = "''"; else dc:coverage = skipRecord();
|
36 |
|
|
dc:title = xpath:"//dc:title[string-length(.) > 0]/normalize-space(.)";
|
37 |
|
|
apply xpath:"//dc:subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
|
38 |
|
|
apply xpath:"//dc:publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
|
39 |
|
|
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
|
40 |
|
|
dc:contributor = xpath:"//dc:contributor";
|
41 |
|
|
dc:description = xpath:"//dc:description";
|
42 |
|
|
dc:format = xpath:"//dc:format";
|
43 |
|
|
$varHttpTest = "''";
|
44 |
|
|
if xpath:"//dc:identifier[starts-with(., 'http')] and (//dc:rights[starts-with(normalize-space(.), 'openAccess')] or //dc:relation[starts-with(normalize-space(.), 'info:eu-repo/grantAgreement')])" $varHttpTest = "true"; else dc:identifier = skipRecord();
|
45 |
|
|
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
|
46 |
|
|
dr:dateOfCollection = xpath:"//dri:dateOfCollection";
|
47 |
|
|
static dr:dateOfTransformation = xpath:"current-dateTime()";
|
48 |
|
|
dc:rights = xpath:"//dc:rights";
|
49 |
|
|
dc:type = xpath:"//dc:type";
|
50 |
|
|
dc:language = Convert(xpath:"//dc:language", Languages);
|
51 |
|
|
//dc:language = "eng";
|
52 |
|
|
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord();
|
53 |
|
|
dc:date = xpath:"//dc:date";
|
54 |
|
|
$varDateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()");
|
55 |
|
|
oaf:dateAccepted = $varDateAccepted;
|
56 |
|
|
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 = "''";
|
57 |
|
|
// FP7
|
58 |
|
|
// oaf:projectid = xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', 'i')]/concat($varFP7, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))";
|
59 |
|
|
oaf:projectid = xpath:"distinct-values(//dc:relation[matches(normalize-space(.), '(.*)(info:eu-repo/grantagreement[/]+ec/fp7/)(\d\d\d\d\d\d)(.*)', 'i')][year-from-date(xs:date(max(($varDateAccepted, '0001-01-01')))) gt 2006][contains(lower-case(.), 'info:eu-repo')]/concat($varFP7, replace(normalize-space(.), '(.*)(info:eu-repo/grantagreement[/]+ec/fp7/)(\d\d\d\d\d\d)(.*)', '$3', 'i')))";
|
60 |
|
|
// H2020
|
61 |
|
|
// oaf:projectid = xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', 'i')]/concat($varH2020, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))";
|
62 |
|
|
oaf:projectid = xpath:"distinct-values(//dc:relation[matches(normalize-space(.), '(.*)(info:eu-repo/grantagreement[/]+ec/h2020/)(\d\d\d\d\d\d)(.*)', 'i')][year-from-date(xs:date(max(($varDateAccepted, '0001-01-01')))) gt 2013][contains(lower-case(.), 'info:eu-repo')]/concat($varH2020, replace(normalize-space(.), '(.*)(info:eu-repo/grantagreement[/]+ec/h2020/)(\d\d\d\d\d\d)(.*)', '$3', 'i')))";
|
63 |
|
|
// FCT
|
64 |
|
|
oaf:projectid = xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/fct)/(.+)/(\d+)(.*)', 'i')]/concat($varFCT, replace(normalize-space(.), '(info:eu-repo/grantagreement/fct)/(.+)/(\d+)(.*)', '$3', 'i'))";
|
65 |
|
|
dc:relation = xpath:"//dc:relation";
|
66 |
|
|
//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(.)";
|
67 |
|
|
//
|
68 |
|
|
oaf:collectedDatasourceid = xpath:"$varDatasourceid";
|
69 |
|
|
//
|
70 |
|
|
dr:CobjCategory = Convert(xpath:"//dc:type", TextTypologies);
|
71 |
|
|
apply xpath:"//dc:rights" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/semantics')" oaf:accessrights = Convert(xpath:"normalize-space(.)", AccessRights); else $var0 = "''";
|
72 |
|
|
if xpath:"//dc:rights[starts-with(normalize-space(.), 'openAccess')]" oaf:accessrights = "OPEN"; else $var0 = "''";
|
73 |
|
|
if xpath:"//dc:rights[starts-with(normalize-space(.), 'closedAccess')]" oaf:accessrights = "CLOSED"; else $var0 = "''";
|
74 |
|
|
if xpath:"//dc:rights[starts-with(normalize-space(.), 'embargoedAccess')]" oaf:accessrights = "EMBARGO"; else $var0 = "''";
|
75 |
|
|
// if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN";
|
76 |
|
|
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''";
|
77 |
|
|
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights);
|
78 |
|
|
//
|
79 |
|
|
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
|
80 |
|
|
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
|
81 |
|
|
// temporarily ignoring FundRef-DOIs, since OpenAIRE assumes that DOIs refer to publications or datasets
|
82 |
|
|
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)');
|
83 |
|
|
oaf:identifier = set(xpath:"$varId//value[not(starts-with(., '10.13039'))]", @identifierType = "doi";);
|
84 |
|
|
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
|
85 |
|
|
end</CODE>
|
86 |
|
|
</SCRIPT>
|
87 |
|
|
</CONFIGURATION>
|
88 |
|
|
<STATUS/>
|
89 |
|
|
<SECURITY_PARAMETERS/>
|
90 |
|
|
</BODY>
|
91 |
|
|
</RESOURCE_PROFILE>
|