Revision 58519
Added by Alessia Bardi over 4 years ago
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/claims/claims_orcid_2_OAF.xml | ||
---|---|---|
19 | 19 |
declare_ns dc = "http://purl.org/dc/elements/1.1/"; |
20 | 20 |
declare_ns prov = "http://www.openarchives.org/OAI/2.0/provenance"; |
21 | 21 |
|
22 |
$var0 = "''"; |
|
23 |
$var1 = "'corda_______::'"; |
|
24 | 22 |
$varDummy = "''"; |
25 | 23 |
|
26 | 24 |
static $varDatasourceid = "'openaire____::orcid'"; |
... | ... | |
35 | 33 |
dri:dateOfCollection = xpath:"//dri:dateOfCollection"; |
36 | 34 |
static dr:dateOfTransformation = xpath:"current-dateTime()"; |
37 | 35 |
|
38 |
//TODO: authors are in the bibtex citation only: how can we get them out? |
|
39 |
//apply xpath:"" if xpath:"true()" dc:creator = xpath:"concat(./family, ', ', ./given)"; else $varDummy = "''"; |
|
40 |
apply xpath:"//*[local-name()='orcid-message']//orcid-work//work-title/title" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
41 |
//apply xpath:"" if xpath:"string-length(.) > 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
42 |
apply xpath:"//*[local-name()='orcid-message']//orcid-work/journal-title" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
43 |
//apply xpath:"" if xpath:"string-length(.) > 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
36 |
apply xpath:"//*[local-name() = 'contributor']/*[local-name()='credit-name']" if xpath:"string-length(.) > 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
44 | 37 |
|
45 |
apply xpath:"//orcid-work/url" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
|
|
38 |
apply xpath:"//*[local-name() = 'work']/*[local-name() = 'title']/*[local-name() = 'title']" if xpath:"string-length(.) > 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''";
|
|
46 | 39 |
|
47 |
//dc:language = Convert(xpath:"//dc:language", Languages);
|
|
40 |
apply xpath:"//*[local-name() = 'work']/*[local-name() = 'journal-title']" if xpath:"string-length(.) > 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
|
|
48 | 41 |
|
49 |
//TODO: how to include month and day when they exist? |
|
50 |
//apply xpath:"//orcid-work/publication-date/year" if xpath:"string-length(.) > 0" oaf:dateAccepted = xpath:"normalize-space(.)"; else $varDummy = "''"; |
|
42 |
apply xpath:"//*[local-name() = 'work']/*[local-name() = 'url']" if xpath:"starts-with(normalize-space(.), 'http')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)"; |
|
51 | 43 |
|
52 | 44 |
// first check whether //orcid-work/publication-date/year has apt length; then alternate year, month, day with '-', giving month, day standard length or dummy values before. |
53 |
apply xpath:"//*[local-name()='orcid-work']/*[local-name()='publication-date'][string-length(*[local-name()='year'])=4]" if xpath:"." oaf:dateAccepted = xpath:"string-join((*[local-name()='year'], substring(substring(concat('0',*[local-name()='month'],'1'),string-length(*[local-name()='month'])),1,2), substring(substring(concat('0',*[local-name()='day'],'1'),string-length(*[local-name()='day'])),1,2)), '-')"; else $varDummy = "''"; |
|
54 | 45 |
|
55 |
apply xpath:"//orcid-work/work-type" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dr:CobjCategory = "0001"; |
|
56 |
oaf:accessrights = "'UNKNOWN'"; |
|
46 |
apply xpath:"//*[local-name() = 'work']/*[local-name() = 'publication-date'][string-length(*[local-name()='year'])=4]" if xpath:"." oaf:dateAccepted = xpath:"string-join((*[local-name() = 'year'], substring(substring(concat('0',*[local-name() = 'month'],'1'),string-length(*[local-name() = 'month'])),1,2), substring(substring(concat('0',*[local-name() = 'day'],'1'),string-length(*[local-name() = 'day'])),1,2)), '-')"; else $varDummy = "''"; |
|
57 | 47 |
|
48 |
apply xpath:"//*[local-name() = 'work']/*[local-name() = 'type']" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(.)", TextTypologies); else dr:CobjCategory = "0001"; |
|
49 |
oaf:accessrights = "UNKNOWN"; |
|
50 |
|
|
58 | 51 |
oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;); |
59 | 52 |
oaf:hostedBy = set("''", @name = $varUnknownReponame; , @id = $varUnknownRepoid;); |
60 | 53 |
|
61 |
$varId = identifierExtract('["//orcid-work//work-external-indentifier/work-external-identifier-id", "//orcid-work/url"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'); |
|
62 |
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";); |
|
54 |
//TODO: I do not understand how to set the oaf:identifier for the DOIs |
|
63 | 55 |
|
64 | 56 |
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix"; |
65 | 57 |
about = xpath:"//about"; |
Also available in: Unified diff
Fixes #5355, at least in part (we could map other properties, like DOI, but I do not understand how to do it with the transformation script language)