Revision 29081
Added by Jochen Schirrwagen over 10 years ago
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_pensoft.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="7a0f18a4-7015-45ec-a9e5-1c7368889d7f_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-02-28T12:14:22+01:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_pensoft</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_pensoft"; |
|
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 |
static $varHostedByPrefix = "'openaire____::issn'"; |
|
24 |
$varDummy = "''"; |
|
25 |
$varHostedByName = RegExpr(xpath:"//dc:source", $var0, "s/(\s+)(\d+)(.*)$//gm"); |
|
26 |
$varHostedByIdTemp = RegExpr(xpath:"//dc:relation[last()]", $var0, "s/^(.*)(\/)|(-)//gm"); |
|
27 |
$varHostedById = xpath:"concat($varHostedByPrefix, $varHostedByIdTemp)"; |
|
28 |
static $varDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
29 |
static $varRepoid = xpath:"//dri:repositoryId"; |
|
30 |
static $varOfficialname = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//OFFICIAL_NAME"]); |
|
31 |
dri:objIdentifier = xpath:"//dri:objIdentifier"; |
|
32 |
dri:repositoryId = $varRepoid; |
|
33 |
dri:recordIdentifier = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
34 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
35 |
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
36 |
apply xpath:"//dc:subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
37 |
apply xpath:"//dc:publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
38 |
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
39 |
dc:contributor = xpath:"//dc:contributor"; |
|
40 |
dc:description = xpath:"//dc:description"; |
|
41 |
$varHttpTest = "''"; |
|
42 |
if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
43 |
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
44 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
45 |
// dc:type = xpath:"//dc:type"; |
|
46 |
dc:language = Convert(xpath:"//dc:language", Languages); |
|
47 |
dc:date = xpath:"//dc:date"; |
|
48 |
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()"); |
|
49 |
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\/)//gm"); else $var0 = "''"; |
|
50 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
51 |
//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(.)"; |
|
52 |
// |
|
53 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
54 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
55 |
// oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
56 |
// |
|
57 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
58 |
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:"."; |
|
59 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
60 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
61 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
62 |
// |
|
63 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
64 |
static oaf:hostedBy = set("''", @name = $varHostedByName; , @id = $varHostedById;); |
|
65 |
// |
|
66 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
67 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
68 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
69 |
end |
|
70 |
]]></CODE> |
|
71 |
</SCRIPT> |
|
72 |
</CONFIGURATION> |
|
73 |
<STATUS/> |
|
74 |
<SECURITY_PARAMETERS/> |
|
75 |
</BODY> |
|
76 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_compliant_creator_comma.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="bc13c7ee-869f-4b76-81a8-2ee6ffcb81fa_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2014-04-09T08:05:59+00:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_compliant_creator_comma</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_compliant_creator_comma"; |
|
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 = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
31 |
if xpath:"count(//dc:creator) = 0" dc:creator = skipRecord(); else $varDummy = "''"; |
|
32 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"concat(substring-before(normalize-space(.), ' '), ', ', substring-after(normalize-space(.), ' '))"; else $varDummy = "''"; |
|
33 |
apply xpath:"//dc:contributor" if xpath:"string-length(.) > 0" dc:contributor = xpath:"concat(substring-before(normalize-space(.), ' '), ', ', substring-after(normalize-space(.), ' '))"; else $varDummy = "''"; |
|
34 |
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
35 |
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:description = xpath:"//dc:description"; |
|
39 |
$varHttpTest = "''"; |
|
40 |
if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
41 |
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
42 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
43 |
// dc:type = xpath:"//dc:type"; |
|
44 |
dc:language = Convert(xpath:"//dc:language", Languages); |
|
45 |
//dc:language = "eng"; |
|
46 |
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord(); |
|
47 |
dc:date = xpath:"//dc:date"; |
|
48 |
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()"); |
|
49 |
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\/)//gm"); else $var0 = "''"; |
|
50 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6 and not(contains(normalize-space(.), '/12345'))" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
51 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
52 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
53 |
//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(.)"; |
|
54 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
55 |
// |
|
56 |
// |
|
57 |
// |
|
58 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
59 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
60 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
61 |
// |
|
62 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
63 |
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:"."; |
|
64 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
65 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
66 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
67 |
// |
|
68 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
69 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
70 |
// |
|
71 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
72 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
73 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
74 |
end |
|
75 |
]]></CODE> |
|
76 |
</SCRIPT> |
|
77 |
</CONFIGURATION> |
|
78 |
<STATUS/> |
|
79 |
<SECURITY_PARAMETERS/> |
|
80 |
</BODY> |
|
81 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_compliant_nemertes.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="a02ac18a-c8a4-483f-8934-5ab3f5776bf7_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-12-07T12:51:19+00:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_compliant_nemertes</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_compliant_nemertes"; |
|
16 |
// nemertes specific rulescript to fix url in dc:identifier |
|
17 |
declare_ns oaf = "http://namespace.openaire.eu/oaf"; |
|
18 |
declare_ns dri = "http://www.driver-repository.eu/namespace/dri"; |
|
19 |
declare_ns dr = "http://www.driver-repository.eu/namespace/dr"; |
|
20 |
declare_ns dc = "http://purl.org/dc/elements/1.1/"; |
|
21 |
declare_ns prov = "http://www.openarchives.org/OAI/2.0/provenance"; |
|
22 |
$var0 = "''"; |
|
23 |
$var1 = "'corda_______::'"; |
|
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:repositoryId = xpath:"//dri:repositoryId"; |
|
31 |
dri:recordIdentifier = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
32 |
if xpath:"count(//dc:creator) = 0" dc:creator = skipRecord(); else $varDummy = "''"; |
|
33 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
34 |
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
35 |
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 |
dc:description = xpath:"//dc:description"; |
|
40 |
$varHttpTest = "''"; |
|
41 |
if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
42 |
//$varHttpIdentifier = xpath:"//dc:identifier[starts-with(., 'http')][1]"; |
|
43 |
apply xpath:"//dc:identifier" if xpath:"contains(.,'dspace/handle/123456789')" dc:identifier = xpath:"concat('http://hdl.handle.net/10889/', substring-after(., '123456789/'))"; else varDummy = "''"; |
|
44 |
// dc:identifier = xpath:"normalize-space(.)"; |
|
45 |
apply xpath:"//dc:identifier[not(contains(.,'dspace/handle/123456789'))]" if xpath:"starts-with(.,'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
46 |
// apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" $varDummy = "''"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
47 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
48 |
// dc:type = xpath:"//dc:type"; |
|
49 |
dc:language = Convert(xpath:"//dc:language", Languages); |
|
50 |
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord(); |
|
51 |
dc:date = xpath:"//dc:date"; |
|
52 |
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()"); |
|
53 |
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\/)//gm"); else $var0 = "''"; |
|
54 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
55 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
56 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
57 |
//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(.)"; |
|
58 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
59 |
// |
|
60 |
// |
|
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 |
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:"."; |
|
68 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
69 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
70 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
71 |
// |
|
72 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
73 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
74 |
// |
|
75 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
76 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
77 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
78 |
end |
|
79 |
]]></CODE> |
|
80 |
</SCRIPT> |
|
81 |
</CONFIGURATION> |
|
82 |
<STATUS/> |
|
83 |
<SECURITY_PARAMETERS/> |
|
84 |
</BODY> |
|
85 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_ora.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="4a574346-7e18-411e-b28c-15ea03814ee0_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-02-28T12:14:22+01:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_ora</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_ora"; |
|
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 |
//preprocess p1 = dblookup("select id, officialname, accessinfopackage from datasources where accessinfopackage is not null"); |
|
22 |
$var0 = "''"; |
|
23 |
$var1 = "'corda_______::'"; |
|
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:repositoryId = xpath:"//dri:repositoryId"; |
|
31 |
dri:recordIdentifier = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
32 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" 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 |
$varHttpTest = "''"; |
|
40 |
if xpath:"//dc:identifier[starts-with(., 'urn:uuid:')]" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
41 |
$varuuid = RegExpr(xpath:"normalize-space(//dc:identifier[starts-with(., 'urn:uuid:')])", $var0, "s/^(.*urn:uuid:)//gm"); |
|
42 |
$varhostprefix = "'http://ora.ox.ac.uk/objects/uuid:'"; |
|
43 |
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'urn:uuid:')" dc:identifier = xpath:"concat($varhostprefix,$varuuid)"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
44 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
45 |
// dc:type = xpath:"//dc:type"; |
|
46 |
dc:language = Convert(xpath:"//dc:language", Languages); |
|
47 |
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord(); |
|
48 |
dc:date = xpath:"//dc:date"; |
|
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\/)//gm"); else $var0 = "''"; |
|
51 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
52 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
53 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
54 |
//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(.)"; |
|
55 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
56 |
// |
|
57 |
// |
|
58 |
// |
|
59 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
60 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
61 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
62 |
// |
|
63 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
64 |
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:"."; |
|
65 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "RESTRICTED"; |
|
66 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
67 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
68 |
// |
|
69 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
70 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
71 |
// |
|
72 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
73 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
74 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
75 |
end |
|
76 |
]]></CODE> |
|
77 |
</SCRIPT> |
|
78 |
</CONFIGURATION> |
|
79 |
<STATUS/> |
|
80 |
<SECURITY_PARAMETERS/> |
|
81 |
</BODY> |
|
82 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_compliant_ucl.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="52dfa952-2943-4d76-b964-981425a4c7f0_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-02-28T12:14:22+01:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_compliant_ucl</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_compliant_ucl"; |
|
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 = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
31 |
//apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
32 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = Convert(xpath:".", Person); 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 |
$varHttpTest = "''"; |
|
40 |
if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
41 |
dc:identifier = xpath:"//dc:identifier[last()]"; |
|
42 |
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http') and position()!=last()" 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:"//dc:language", Languages); |
|
46 |
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord(); |
|
47 |
dc:date = xpath:"//dc:date"; |
|
48 |
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()"); |
|
49 |
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\/)//gm"); else $var0 = "''"; |
|
50 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
51 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
52 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
53 |
//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(.)"; |
|
54 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
55 |
// |
|
56 |
// |
|
57 |
// |
|
58 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
59 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
60 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
61 |
// |
|
62 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
63 |
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:"."; |
|
64 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
65 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
66 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
67 |
// |
|
68 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
69 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
70 |
// |
|
71 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
72 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
73 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
74 |
end |
|
75 |
]]></CODE> |
|
76 |
</SCRIPT> |
|
77 |
</CONFIGURATION> |
|
78 |
<STATUS/> |
|
79 |
<SECURITY_PARAMETERS/> |
|
80 |
</BODY> |
|
81 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_compliant_dcidentifier_last.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<RESOURCE_PROFILE> |
|
3 |
<HEADER> |
|
4 |
<RESOURCE_IDENTIFIER value="50cbbb8f-b9d4-486d-9895-a80ca7b963b9_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
5 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
6 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
7 |
<RESOURCE_URI value=""/> |
|
8 |
<DATE_OF_CREATION value="2013-02-28T12:14:22+01:00"/> |
|
9 |
</HEADER> |
|
10 |
<BODY> |
|
11 |
<CONFIGURATION> |
|
12 |
<IMPORTED/> |
|
13 |
<SCRIPT> |
|
14 |
<TITLE>dc_cleaning_OPENAIREplus_compliant_dcidentifier_last</TITLE> |
|
15 |
<CODE><![CDATA[ |
|
16 |
declare_script "dc_cleaning_OpenAIREplus_compliant_dcidentifier_last"; |
|
17 |
declare_ns oaf = "http://namespace.openaire.eu/oaf"; |
|
18 |
declare_ns dri = "http://www.driver-repository.eu/namespace/dri"; |
|
19 |
declare_ns dr = "http://www.driver-repository.eu/namespace/dr"; |
|
20 |
declare_ns dc = "http://purl.org/dc/elements/1.1/"; |
|
21 |
declare_ns prov = "http://www.openarchives.org/OAI/2.0/provenance"; |
|
22 |
$var0 = "''"; |
|
23 |
$var1 = "'corda_______::'"; |
|
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 |
// this can be made easier |
|
31 |
dri:recordIdentifier = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
32 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" 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 |
$varHttpTest = "''"; |
|
40 |
if xpath:"//dc:identifier[last()][starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
41 |
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http') and position()=last()" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
42 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
43 |
// dc:type = xpath:"//dc:type"; |
|
44 |
dc:language = Convert(xpath:"//dc:language", Languages); |
|
45 |
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord(); |
|
46 |
dc:date = xpath:"//dc:date"; |
|
47 |
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()"); |
|
48 |
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\/)//gm"); else $var0 = "''"; |
|
49 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
50 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
51 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
52 |
//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(.)"; |
|
53 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
54 |
// |
|
55 |
// |
|
56 |
// |
|
57 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
58 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
59 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
60 |
// |
|
61 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
62 |
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:"."; |
|
63 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
64 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
65 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
66 |
// |
|
67 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
68 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
69 |
// |
|
70 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
71 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
72 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
73 |
end |
|
74 |
]]></CODE> |
|
75 |
</SCRIPT> |
|
76 |
</CONFIGURATION> |
|
77 |
<STATUS/> |
|
78 |
<SECURITY_PARAMETERS/> |
|
79 |
</BODY> |
|
80 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_compliant_skipTestRecords.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="e9a05808-f08a-4f75-9c22-b4f1d7b54f95_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-02-28T12:14:22+01:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_compliant_skipTestRecords</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_compliant_skipTestRecords"; |
|
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 = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
31 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
32 |
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
33 |
apply xpath:"//dc:subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
34 |
apply xpath:"//dc:publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
35 |
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
36 |
dc:contributor = xpath:"//dc:contributor"; |
|
37 |
dc:description = xpath:"//dc:description"; |
|
38 |
$varHttpTest = "''"; |
|
39 |
if xpath:"//dc:relation[starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/12345')]" dc:relation = skipRecord(); else $varDummy = "''"; |
|
40 |
if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
41 |
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
42 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
43 |
// dc:type = xpath:"//dc:type"; |
|
44 |
dc:language = Convert(xpath:"//dc:language", Languages); |
|
45 |
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord(); |
|
46 |
dc:date = xpath:"//dc:date"; |
|
47 |
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()"); |
|
48 |
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\/)//gm"); else $var0 = "''"; |
|
49 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
50 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
51 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
52 |
//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(.)"; |
|
53 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
54 |
// |
|
55 |
// |
|
56 |
// |
|
57 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
58 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
59 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
60 |
// |
|
61 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
62 |
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:"."; |
|
63 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
64 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
65 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
66 |
// |
|
67 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
68 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
69 |
// |
|
70 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
71 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
72 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
73 |
end |
|
74 |
]]></CODE> |
|
75 |
</SCRIPT> |
|
76 |
</CONFIGURATION> |
|
77 |
<STATUS/> |
|
78 |
<SECURITY_PARAMETERS/> |
|
79 |
</BODY> |
|
80 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_dc_relation.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="c0fb3b80-8466-466c-89b1-a5d1e3d60910_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-02-28T12:14:22+01:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_dc_relation</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_dc_relation"; |
|
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 |
//preprocess p1 = dblookup("select id, officialname, accessinfopackage from datasources where accessinfopackage is not null"); |
|
22 |
$var0 = "''"; |
|
23 |
$var1 = "'corda_______::'"; |
|
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:repositoryId = xpath:"//dri:repositoryId"; |
|
31 |
dri:recordIdentifier = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
32 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" 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 |
$varHttpTest = "''"; |
|
40 |
if xpath:"//dc:relation[starts-with(., 'http')]" $varHttpTest = "true"; else dc:relation = skipRecord(); |
|
41 |
apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
42 |
apply xpath:"//dc:identifier" if xpath:"string-length(.) > 0" dr:CobjIdentifier = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
43 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
44 |
// dc:type = xpath:"//dc:type"; |
|
45 |
if xpath:"count(//dc:language) > 0" dc:language = Convert(xpath:"//dc:language", Languages); else dc:language = "eng"; |
|
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:"//dc:date"; |
|
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\/)//gm"); else $var0 = "''"; |
|
51 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
52 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
53 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
54 |
//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(.)"; |
|
55 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
56 |
// |
|
57 |
// |
|
58 |
// |
|
59 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
60 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
61 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
62 |
// |
|
63 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
64 |
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:"."; |
|
65 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
66 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
67 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
68 |
// |
|
69 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
70 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
71 |
// |
|
72 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
73 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
74 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
75 |
end |
|
76 |
]]></CODE> |
|
77 |
</SCRIPT> |
|
78 |
</CONFIGURATION> |
|
79 |
<STATUS/> |
|
80 |
<SECURITY_PARAMETERS/> |
|
81 |
</BODY> |
|
82 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_od______1581.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="36517292-69af-4793-9769-6985cddccfff_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-02-28T12:14:22+01:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_od______1581</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_od______1581"; |
|
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 = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
31 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
32 |
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
33 |
apply xpath:"//dc:subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
34 |
apply xpath:"//dc:publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
35 |
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
36 |
dc:contributor = xpath:"//dc:contributor"; |
|
37 |
dc:description = xpath:"//dc:description"; |
|
38 |
$varHttpTest = "''"; |
|
39 |
if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
40 |
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
41 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
42 |
// dc:type = xpath:"//dc:type"; |
|
43 |
dc:language = Convert(xpath:"//dc:language", Languages); |
|
44 |
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord(); |
|
45 |
dc:date = xpath:"//dc:date"; |
|
46 |
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()"); |
|
47 |
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\/)//gm"); else $var0 = "''"; |
|
48 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
49 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
50 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
51 |
//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(.)"; |
|
52 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
53 |
// |
|
54 |
// |
|
55 |
// |
|
56 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
57 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
58 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
59 |
// |
|
60 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
61 |
//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:"."; |
|
62 |
if xpath:"//dc:rights[text() = 'open']" oaf:accessrights = "OPEN"; else oaf:accessrights = "CLOSED"; |
|
63 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
64 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
65 |
// |
|
66 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
67 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
68 |
// |
|
69 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
70 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
71 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
72 |
end |
|
73 |
]]></CODE> |
|
74 |
</SCRIPT> |
|
75 |
</CONFIGURATION> |
|
76 |
<STATUS/> |
|
77 |
<SECURITY_PARAMETERS/> |
|
78 |
</BODY> |
|
79 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_compliant_doaj.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="1fa784c6-0fc3-489f-80b7-3c404b5d9d2c_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-02-28T12:14:22+01:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_compliant_doaj</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_compliant_doaj"; |
|
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 |
// $varUnknownRepoId = "'openaire____::55045bd2a65019fd8e6741a755395c8c'"; |
|
25 |
$varUnknownRepoId = "'openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18'"; |
|
26 |
$varUnknownRepoName = "'Unknown Repository'"; |
|
27 |
static $varDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
28 |
static $varRepoid = xpath:"//dri:repositoryId"; |
|
29 |
static $varOfficialname = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//OFFICIAL_NAME"]); |
|
30 |
dri:objIdentifier = xpath:"//dri:objIdentifier"; |
|
31 |
dri:repositoryId = $varRepoid; |
|
32 |
//dri:repositoryId = xpath:"//dri:repositoryId"; |
|
33 |
dri:recordIdentifier = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
34 |
if xpath:"//dc:creator[string-length(normalize-space(.)) > 0][contains(., 'CDATA')][starts-with(normalize-space(.), '(')][starts-with(normalize-space(.), '.')]" dc:creator = skipRecord(); else $varDummy = "''"; |
|
35 |
//apply xpath:"//dc:creator" if xpath:"string-length(normalize-space(.)) > 0 and not(contains(., 'CDATA')) and not(starts-with(normalize-space(.), '.')) and not(starts-with(normalize-space(.), '('))" dc:creator = Convert(xpath:".", Person); else $varDummy = "''"; |
|
36 |
if xpath:"count(//dc:creator) = 0" dc:creator = skipRecord(); else $varDummy = "''"; |
|
37 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
38 |
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
39 |
apply xpath:"//dc:subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
40 |
apply xpath:"//dc:publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
41 |
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
42 |
dc:contributor = xpath:"//dc:contributor"; |
|
43 |
dc:description = xpath:"//dc:description"; |
|
44 |
$varHttpTest = "''"; |
|
45 |
if xpath:"//dc:relation[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
46 |
apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
47 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
48 |
// dc:type = xpath:"//dc:type"; |
|
49 |
dc:language = Convert(xpath:"//dc:language", Languages); |
|
50 |
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord(); |
|
51 |
dc:date = xpath:"//dc:date"; |
|
52 |
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()"); |
|
53 |
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\/)//gm"); else $var0 = "''"; |
|
54 |
//apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
55 |
//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(.)"; |
|
56 |
// |
|
57 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
58 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
59 |
oaf:collectedDatasourceid = $varDatasourceid; |
|
60 |
// |
|
61 |
// apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
62 |
dr:CobjCategory = "0001"; |
|
63 |
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:"."; |
|
64 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
65 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
66 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
67 |
// |
|
68 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
69 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
70 |
// |
|
71 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
72 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
73 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
74 |
end |
|
75 |
]]></CODE> |
|
76 |
</SCRIPT> |
|
77 |
</CONFIGURATION> |
|
78 |
<STATUS/> |
|
79 |
<SECURITY_PARAMETERS/> |
|
80 |
</BODY> |
|
81 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_puma.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="3fe5fd31-1b14-427d-934b-5d5dba6cf5cc_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-02-28T12:14:22+01:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_puma</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_puma"; |
|
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 = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
31 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
32 |
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
33 |
apply xpath:"//dc:subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
34 |
apply xpath:"//dc:publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
35 |
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
36 |
dc:contributor = xpath:"//dc:contributor"; |
|
37 |
dc:description = xpath:"//dc:description"; |
|
38 |
$varHttpTest = "''"; |
|
39 |
if xpath:"//dc:relation[starts-with(., 'http')]" $varHttpTest = "true"; else dc:relation = skipRecord(); |
|
40 |
apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
41 |
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dr:CobjIdentifier = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
42 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
43 |
// dc:type = xpath:"//dc:type"; |
|
44 |
if xpath:"count(//dc:language) > 0" dc:language = Convert(xpath:"//dc:language", Languages); else dc:language = "eng"; |
|
45 |
//dc:language = "eng"; |
|
46 |
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord(); |
|
47 |
dc:date = xpath:"//dc:date"; |
|
48 |
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()"); |
|
49 |
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\/)//gm"); else $var0 = "''"; |
|
50 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
51 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
52 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
53 |
//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(.)"; |
|
54 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
55 |
// |
|
56 |
// |
|
57 |
// |
|
58 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
59 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
60 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
61 |
// |
|
62 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
63 |
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:"."; |
|
64 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
65 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
66 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
67 |
// |
|
68 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
69 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
70 |
// |
|
71 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
72 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
73 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
74 |
end |
|
75 |
]]></CODE> |
|
76 |
</SCRIPT> |
|
77 |
</CONFIGURATION> |
|
78 |
<STATUS/> |
|
79 |
<SECURITY_PARAMETERS/> |
|
80 |
</BODY> |
|
81 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_compliant_scientificreports.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="93547998-a573-4f8a-bce3-a8f9cb32acbd_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-12-11T10:51:43+00:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_compliant_scientificreports</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_compliant_scientificreports"; |
|
16 |
// make DOIs to URLs |
|
17 |
declare_ns oaf = "http://namespace.openaire.eu/oaf"; |
|
18 |
declare_ns dri = "http://www.driver-repository.eu/namespace/dri"; |
|
19 |
declare_ns dr = "http://www.driver-repository.eu/namespace/dr"; |
|
20 |
declare_ns dc = "http://purl.org/dc/elements/1.1/"; |
|
21 |
declare_ns prov = "http://www.openarchives.org/OAI/2.0/provenance"; |
|
22 |
$var0 = "''"; |
|
23 |
$var1 = "'corda_______::'"; |
|
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:repositoryId = xpath:"//dri:repositoryId"; |
|
31 |
dri:recordIdentifier = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
32 |
if xpath:"count(//dc:creator) = 0" dc:creator = skipRecord(); else $varDummy = "''"; |
|
33 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
34 |
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
35 |
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 |
dc:description = xpath:"//dc:description"; |
|
40 |
$varHttpTest = "''"; |
|
41 |
if xpath:"//dc:identifier[starts-with(., 'doi:')]" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
42 |
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'doi:')" dc:identifier = xpath:"concat('http://dx.doi.org/', substring-after(normalize-space(.), 'doi:'))"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
43 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
44 |
// dc:type = xpath:"//dc:type"; |
|
45 |
dc:language = Convert(xpath:"//dc: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:"//dc:date"; |
|
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\/)//gm"); else $var0 = "''"; |
|
51 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
52 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
53 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
54 |
//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(.)"; |
|
55 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
56 |
// |
|
57 |
// |
|
58 |
// |
|
59 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
60 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
61 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
62 |
// |
|
63 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
64 |
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:"."; |
|
65 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
66 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
67 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
68 |
// |
|
69 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
70 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
71 |
// |
|
72 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
73 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
74 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
75 |
end |
|
76 |
]]></CODE> |
|
77 |
</SCRIPT> |
|
78 |
</CONFIGURATION> |
|
79 |
<STATUS/> |
|
80 |
<SECURITY_PARAMETERS/> |
|
81 |
</BODY> |
|
82 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_compliant_fraunhofer.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="3ff02e38-f3d2-4ecc-9d45-7100256c979d_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2014-04-29T03:51:40+00:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_compliant_fraunhofer</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_compliant_fraunhofer"; |
|
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 = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
31 |
if xpath:"count(//dc:creator) = 0" dc:creator = skipRecord(); else $varDummy = "''"; |
|
32 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" 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 |
$varHttpTest = "''"; |
|
40 |
if xpath:"//dc:rights[starts-with(., 'openAccess')] or count(//dc:relation[starts-with(normalize-space(.), 'info:eu-repo/grantAgreement')]) > 0" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
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 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
44 |
// dc:type = xpath:"//dc:type"; |
|
45 |
dc:language = Convert(xpath:"//dc: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:"//dc:date"; |
|
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\/)//gm"); else $var0 = "''"; |
|
51 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6 and not(contains(normalize-space(.), '/12345'))" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
52 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
53 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
54 |
//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(.)"; |
|
55 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
56 |
// |
|
57 |
// |
|
58 |
// |
|
59 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
60 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
61 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
62 |
// |
|
63 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
64 |
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:"."; |
|
65 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
66 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
67 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
68 |
// |
|
69 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
70 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
71 |
// |
|
72 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
73 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
74 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
75 |
end |
|
76 |
]]></CODE> |
|
77 |
</SCRIPT> |
|
78 |
</CONFIGURATION> |
|
79 |
<STATUS/> |
|
80 |
<SECURITY_PARAMETERS/> |
|
81 |
</BODY> |
|
82 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAREplus.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="d8bf1473-4af6-4c18-8b27-fb59759908ed_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-02-28T12:14:22+01:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAREplus</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus"; |
|
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 = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
31 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
32 |
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
33 |
apply xpath:"//dc:subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
34 |
apply xpath:"//dc:publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
35 |
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
36 |
dc:contributor = xpath:"//dc:contributor"; |
|
37 |
dc:description = xpath:"//dc:description"; |
|
38 |
$varHttpTest = "''"; |
|
39 |
if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
40 |
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
41 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
42 |
// dc:type = xpath:"//dc:type"; |
|
43 |
dc:language = Convert(xpath:"//dc:language", Languages); |
|
44 |
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord(); |
|
45 |
dc:date = xpath:"//dc:date"; |
|
46 |
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()"); |
|
47 |
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\/)//gm"); else $var0 = "''"; |
|
48 |
apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 5" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
49 |
//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(.)"; |
|
50 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
51 |
// |
|
52 |
// |
|
53 |
// |
|
54 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
55 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
56 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
57 |
// |
|
58 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
59 |
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:"."; |
|
60 |
oaf:accessrights = "OPEN"; |
|
61 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
62 |
// |
|
63 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
64 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
65 |
// |
|
66 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
67 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
68 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
69 |
end |
|
70 |
]]></CODE> |
|
71 |
</SCRIPT> |
|
72 |
</CONFIGURATION> |
|
73 |
<STATUS/> |
|
74 |
<SECURITY_PARAMETERS/> |
|
75 |
</BODY> |
|
76 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_compliant_1299.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="044e8e7c-0861-42d5-9b4a-15252faa446e_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-11-29T10:05:49+00:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_compliant_1299</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_compliant_1299"; |
|
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 = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
31 |
if xpath:"count(//dc:creator) = 0 or //dc:creator[starts-with(., '?????')]" dc:creator = skipRecord(); else $varDummy = "''"; |
|
32 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
33 |
// if xpath:"//dc:title[starts-with(., '?????')]" dc:title = skipRecord(); else $varDummy = "''"; |
|
34 |
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
35 |
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 |
dc:description = xpath:"//dc:description"; |
|
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 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
44 |
// dc:type = xpath:"//dc:type"; |
|
45 |
dc:language = Convert(xpath:"//dc:language", Languages); |
|
46 |
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord(); |
|
47 |
dc:date = xpath:"//dc:date"; |
|
48 |
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()"); |
|
49 |
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\/)//gm"); else $var0 = "''"; |
|
50 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
51 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
52 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
53 |
//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(.)"; |
|
54 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
55 |
// |
|
56 |
// |
|
57 |
// |
|
58 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
59 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
60 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
61 |
// |
|
62 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
63 |
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:"."; |
|
64 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
65 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
66 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
67 |
// |
|
68 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
69 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
70 |
// |
|
71 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
72 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
73 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
74 |
end |
|
75 |
]]></CODE> |
|
76 |
</SCRIPT> |
|
77 |
</CONFIGURATION> |
|
78 |
<STATUS/> |
|
79 |
<SECURITY_PARAMETERS/> |
|
80 |
</BODY> |
|
81 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_compliant_dcrelation_last.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="351c08cd-08a7-4a7b-b629-80b828553164_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-02-28T12:14:22+01:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_compliant_dcrelation_last</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_compliant_dcrelation_last"; |
|
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 = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
31 |
if xpath:"count(//dc:creator) = 0" dc:creator = skipRecord(); else $varDummy = "''"; |
|
32 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" 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 |
$varHttpTest = "''"; |
|
40 |
$varHttpLinks = xpath:"//dc:relation[starts-with(., 'http')]"; |
|
41 |
if xpath:"count($varHttpLinks) > 0" $varHttpTest = "true"; else dc:identifier = skipRecord(); |
|
42 |
dc:identifier = xpath:"$varHttpLinks[last()][normalize-space(.)]"; |
|
43 |
dr:CobjIdentifier = xpath:"//dc:identifier[normalize-space(.)]"; |
|
44 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'http') and position=last()" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
45 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
46 |
// dc:type = xpath:"//dc:type"; |
|
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 |
dc:date = xpath:"//dc:date"; |
|
50 |
oaf:dateAccepted = Convert(xpath:"descendant-or-self::dc:date", DateISO8601, "yyyy-MM-dd", "min()"); |
|
51 |
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\/)//gm"); else $var0 = "''"; |
|
52 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
53 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
54 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
55 |
//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(.)"; |
|
56 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
57 |
// |
|
58 |
// |
|
59 |
// |
|
60 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
61 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
62 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
63 |
// |
|
64 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
65 |
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:"."; |
|
66 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
67 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
68 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", 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"/<>]*/[^\s"<>]+)'); |
|
74 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
75 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
76 |
end |
|
77 |
]]></CODE> |
|
78 |
</SCRIPT> |
|
79 |
</CONFIGURATION> |
|
80 |
<STATUS/> |
|
81 |
<SECURITY_PARAMETERS/> |
|
82 |
</BODY> |
|
83 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_compliant_od_1222.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="5d3132a4-e067-4716-9fa3-5e163c85638b_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2014-05-27T16:13:39+00:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_compliant_od_1222</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_compliant_od_1222"; |
|
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 = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
31 |
if xpath:"//dc:type[starts-with(., 'Sound')] or //dc:type[starts-with(., 'Map')]" dc:type = skipRecord(); else $varDummy = "''"; |
|
32 |
if xpath:"count(//dc:creator) = 0" dc:creator = skipRecord(); else $varDummy = "''"; |
|
33 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
34 |
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
35 |
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 |
dc:description = xpath:"//dc:description"; |
|
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 |
static dr:dateOfCollection = getValue(CURRENTDATE, []); |
|
44 |
// dc:type = xpath:"//dc:type"; |
|
45 |
dc:language = Convert(xpath:"//dc: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:"//dc:date"; |
|
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\/)//gm"); else $var0 = "''"; |
|
51 |
apply xpath:"//dc:relation" if xpath:"string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6 and not(contains(normalize-space(.), '/12345'))" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
52 |
//apply xpath:"//dc:relation" if xpath:"string-length(translate(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7','')) = 6" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
53 |
//apply xpath:"//dc:relation" if xpath:"starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7')" oaf:projectid = RegExpr(xpath:"normalize-space(.)", $var1, "s/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm"); else dc:relation = xpath:"normalize-space(.)"; |
|
54 |
//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(.)"; |
|
55 |
// static oaf:datasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
56 |
// |
|
57 |
// |
|
58 |
// |
|
59 |
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]); |
|
60 |
//if xpath:"$varDsType='aggregator'" oaf:hostingDatasourceid = xpath:"//prov:baseURL"; else oaf:hostingDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
61 |
oaf:collectedDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]); |
|
62 |
// |
|
63 |
apply xpath:"//dc:type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dc:type = xpath:"."; |
|
64 |
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:"."; |
|
65 |
if xpath:"//dc:rights[starts-with(normalize-space(.), 'info:eu-repo/semantics')]" $var0 = "''"; else oaf:accessrights = "OPEN"; |
|
66 |
//if xpath:"count(//dc:rights) = 0" oaf:accessrights = "OPEN"; else $var0 = "''"; |
|
67 |
// oaf:accessrights = Convert(xpath:"normalize-space(//dc:rights)", AccessRights); |
|
68 |
// |
|
69 |
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
70 |
static oaf:hostedBy = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
|
71 |
// |
|
72 |
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
73 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
74 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
|
75 |
end |
|
76 |
]]></CODE> |
|
77 |
</SCRIPT> |
|
78 |
</CONFIGURATION> |
|
79 |
<STATUS/> |
|
80 |
<SECURITY_PARAMETERS/> |
|
81 |
</BODY> |
|
82 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/dc2oaf_cleaning_OPENAIREplus_compliant_phaidra | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="d152b8be-723d-42f5-8a13-e9de7d66a2b8_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2013-11-27T00:21:15+00:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<IMPORTED/> |
|
12 |
<SCRIPT> |
|
13 |
<TITLE>dc_cleaning_OPENAIREplus_compliant_phaidra</TITLE> |
|
14 |
<CODE><![CDATA[ |
|
15 |
declare_script "dc_cleaning_OpenAIREplus_compliant_phaidra"; |
|
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 = RegExpr(xpath:"//dri:recordIdentifier", $var0, "s/^(.*)(::)/$2/"); |
|
31 |
apply xpath:"//dc:creator" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
32 |
apply xpath:"//dc:title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
33 |
apply xpath:"//dc:subject" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
34 |
apply xpath:"//dc:publisher" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
35 |
apply xpath:"//dc:source" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
36 |
dc:contributor = xpath:"//dc:contributor"; |
|
37 |
dc:description = xpath:"//dc:description"; |
Also available in: Unified diff
set of modified transformationrules from skalny for the new beta