Revision 57856
Added by Aenne Loehden almost 5 years ago
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc_cleaning_OPENAIREplus_compliant_ojs_fulltext.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="b0a90bb1-c313-4b70-bab2-930d2e8105a6_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2019-10-23T15:19:29+00:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_compliant_ojs_fulltext</TITLE> |
|
14 |
<CODE>declare_script "dc_cleaning_OpenAIREplus_compliant_ojs_fulltext"; |
|
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 |
$var0 = "''"; |
|
21 |
$varFP7 = "'corda_______::'"; |
|
22 |
$varH2020 = "'corda__h2020::'"; |
|
23 |
$varRSF = "'rsf_________::'"; |
|
24 |
$varDummy = "''"; |
|
25 |
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"]); |
|
26 |
static $varRepoid = xpath:"//dri:repositoryId"; |
|
27 |
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"]); |
|
28 |
dri:objIdentifier = xpath:"//dri:objIdentifier"; |
|
29 |
dri:repositoryId = $varRepoid; |
|
30 |
dri:recordIdentifier = xpath:"//dri:recordIdentifier"; |
|
31 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0 and contains(., ';')" dc:creator = xpath:"substring-before(normalize-space(.), ';')"; else $varDummy = "''"; |
|
32 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0 and not(contains(., ';'))" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
33 |
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
34 |
apply xpath:"//dc:subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
35 |
apply xpath:"//dc:publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
36 |
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
37 |
dc:contributor = xpath:"//dc:contributor"; |
|
38 |
dc:description = xpath:"//dc:description"; |
|
39 |
dc:format = xpath:"//dc:format"; |
|
40 |
$varHttpTest = "''"; |
|
41 |
if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
42 |
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
43 |
dr:dateOfCollection = xpath:"//dri:dateOfCollection"; |
|
44 |
static dr:dateOfTransformation = xpath:"current-dateTime()"; |
|
45 |
//dc:type = xpath:"//dc:type"; |
|
46 |
dc:date = xpath:"//dc:date"; |
|
47 |
dc:language = Convert(xpath:"//dc:language", Languages); |
|
48 |
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord(); |
|
49 |
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()"); |
|
50 |
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 = "''"; |
|
51 |
// FP7 |
|
52 |
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'))"; |
|
53 |
// H2020 |
|
54 |
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'))"; |
|
55 |
// RSF |
|
56 |
oaf:projectid = xpath:"(//dc:relation, //dc:contributor)[matches(normalize-space(.), 'info:eu-repo/grantagreement/rsf//([^/]*)(/.*)?', 'i')]/concat($varRSF, replace(normalize-space(.), 'info:eu-repo/grantagreement/rsf//([^/]*)(/.*)?', '$1', 'i'))"; |
|
57 |
dc:relation = xpath:"//dc:relation"; |
|
58 |
//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(.)"; |
|
59 |
// |
|
60 |
// |
|
61 |
oaf:collectedDatasourceid = xpath:"$varDatasourceid"; |
|
62 |
// |
|
63 |
//if xpath:"count(//dc:type[string-length() > 0]) = 0" dr:CobjCategory = "0001"; else dr:CobjCategory = Convert(xpath:"//dc:type", TextTypologies); |
|
64 |
$varCobjCatExplicit = Convert(xpath:"//dc:type[string-length() > 0]", TextTypologies); |
|
65 |
$varCobjCatDefault = xpath:"//dc:type[count(//dc:type[string-length() > 0]) = 0]/'0001'"; |
|
66 |
$varCobjCategory = xpath:"max(($varCobjCatExplicit, $varCobjCatDefault))"; |
|
67 |
$varSuperType = Convert(xpath:"normalize-space($varCobjCategory)", SuperTypes); |
|
68 |
dr:CobjCategory = set($varCobjCategory, @type = $varSuperType;); |
|
69 |
dc:type = xpath:"//dc:type"; |
|
70 |
// |
|
71 |
apply xpath:"//dc:rights" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/semantics')" oaf:accessrights = Convert(xpath:"normalize-space(.)", AccessRights); else dc:rights = xpath:"."; |
|
72 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
73 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
74 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
75 |
oaf:license = xpath:"//dc:rights[starts-with(., 'http')]"; |
|
76 |
// |
|
77 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
78 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
79 |
// |
|
80 |
//$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
81 |
//oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
82 |
$varIdIdf = identifierExtract('["//dc:identifier"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
83 |
$varIdRel = identifierExtract('["//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
84 |
$varCountCsic = xpath:"count(//dri:recordIdentifier[not(contains(., '.csic.es:article/')) and not(contains(., 'ojs.sbir.upct.es:article/'))])"; |
|
85 |
$varCountDoi = xpath:"count($varIdRel//value)"; |
|
86 |
$varId = xpath:"$varIdIdf//value, subsequence($varIdRel//value,1,$varCountCsic*$varCountDoi)"; |
|
87 |
oaf:identifier = set(xpath:"$varId", @identifierType = "doi";); |
|
88 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
89 |
oaf:journal = set($varOfficialname, @issn = xpath:"replace(substring(//oaf:datasourceprefix, 5), '(\d{4})(\d{4}|\d{3}X)', '$1-$2')";); |
|
90 |
oaf:fulltext = xpath:"replace(//dc:relation[starts-with(., 'http')][count(//dc:format[.='application/pdf']/preceding-sibling::dc:format)+1], 'article/view', 'article/download')"; |
|
91 |
end</CODE> |
|
92 |
</SCRIPT> |
|
93 |
</CONFIGURATION> |
|
94 |
<STATUS/> |
|
95 |
<SECURITY_PARAMETERS/> |
|
96 |
</BODY> |
|
97 |
</RESOURCE_PROFILE> |
Also available in: Unified diff
adapt funding recognition to Logiko-filosofskie studii