1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="0fdf0d77-548d-480b-90d0-c6524c40b6c2_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6
|
<RESOURCE_URI value=""/>
|
7
|
<DATE_OF_CREATION value="2016-03-08T16:41:51+00:00"/>
|
8
|
</HEADER>
|
9
|
<BODY>
|
10
|
<CONFIGURATION>
|
11
|
<IMPORTED/>
|
12
|
<SCRIPT>
|
13
|
<TITLE>oaf_transformation_fp7_pubdb</TITLE>
|
14
|
<CODE>declare_script "oaf_transformation_fp7_pubdb";
|
15
|
declare_ns oaf = "http://namespace.openaire.eu/oaf";
|
16
|
declare_ns dr = "http://www.driver-repository.eu/namespace/dr";
|
17
|
declare_ns dri = "http://www.driver-repository.eu/namespace/dri";
|
18
|
declare_ns dc = "http://purl.org/dc/elements/1.1/";
|
19
|
declare_ns prov = "http://www.openarchives.org/OAI/2.0/provenance";
|
20
|
// +++ variables +++
|
21
|
static $varDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
|
22
|
static $varOfficialname = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//OFFICIAL_NAME"]);
|
23
|
$varUnknownRepoId = "'openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18'";
|
24
|
$varUnknownRepoName = "'Unknown Repository'";
|
25
|
// +++ header section +++
|
26
|
dri:objIdentifier = xpath:"//dri:objIdentifier";
|
27
|
dri:recordIdentifier = xpath:"//dri:recordIdentifier";
|
28
|
// dri:repositoryId
|
29
|
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
|
30
|
dr:dateOfCollection = xpath:"//dri:dateOfCollection";
|
31
|
static dr:dateOfTransformation = xpath:"current-dateTime()";
|
32
|
// +++ metadata section +++
|
33
|
dc:language = "eng";
|
34
|
// dc:language = Convert(xpath:"//csvRecord/column[@name='LA']", Languages);
|
35
|
if xpath:"//csvRecord/column[@name='PUBTITLE'][string-length(.) = 0] and not(//journal_metadata or //book_series_metadata or //book_metadata)" dc:title = skipRecord(); else varDummy = "''";
|
36
|
if xpath:"not(//journal_metadata or //book_series_metadata or //book_metadata) and //column[@name='PUBDATE'][starts-with(., '1')]" dc:type = skipRecord(); else varDummy = "''";
|
37
|
if xpath:"//doi_record//journal_metadata and //csvRecord/column[@name='PUBTITLE'][.='None']" dc:title = xpath:"//journal_article//title"; else dc:title = xpath:"//csvRecord/column[@name='PUBTITLE']";
|
38
|
$varQuot = xpath:"codepoints-to-string((34))";
|
39
|
if xpath:"//csvRecord/column[@name='AUTHORSCOUNT'][.='0'] and not(//doi_record//journal_metadata)" dc:creator = skipRecord(); else varDummy = "''";
|
40
|
// old $varAuthors = xpath:"replace(substring-before(substring-after(//csvRecord/column[@name='AUTHORS']/text(), concat($varQuot, '[', $varQuot, $varQuot)), concat($varQuot, $varQuot, ']', $varQuot)), concat($varQuot, $varQuot, ',', $varQuot, $varQuot), ';')";
|
41
|
$varAuthors = xpath:"replace(substring-before(substring-after(//csvRecord/column[@name='AUTHORS']/text(), concat('[', $varQuot)), concat($varQuot, ']')), concat($varQuot, ',', $varQuot), ';')";
|
42
|
apply xpath:"//doi_record//contributors/person_name[@contributor_role='author']" if xpath:"true()" dc:creator = xpath:"concat(./surname, ', ', ./given_name)"; else $varDummy = "''";
|
43
|
if xpath:"not(//doi_record//contributors/person_name[@contributor_role='author'])" dc:creator = xpath:"tokenize($varAuthors, ';')"; else $varDummy = "''";
|
44
|
$varIssn = xpath:"replace(//csvRecord/column[@name='JOURNALISSN'], '(\d{4})(\d{4}|\d{3}X)', '$1-$2')";
|
45
|
$varJournalTitle = xpath:"//journal_metadata/full_title";
|
46
|
$varJournalVol = xpath:"//journal_volume/volume";
|
47
|
$varJournalIss = xpath:"//journal_issue/issue";
|
48
|
$varSp = xpath:"//journal_article/pages/first_page";
|
49
|
$varEp = xpath:"//journal_article/pages/last_page";
|
50
|
oaf:journal = set($varJournalTitle, @issn = $varIssn;, @vol = $varJournalVol;, @iss = $varJournalIss;, @sp = $varSp;, @ep = $varEp;);
|
51
|
if xpath:"//doi_record//book_series_metadata or //doi_record//book_metadata" dr:CobjCategory = "0013"; else dr:CobjCategory = "0001";
|
52
|
// subjects must be ignored
|
53
|
// dc:subject = xpath:"//csvRecord/column[@name='ID']";
|
54
|
// abstract must be ignored
|
55
|
// dc:description = xpath:"//csvRecord/column[@name='AB']";
|
56
|
if xpath:"//doi_record//publisher/publisher_name" dc:publisher = xpath:"//publisher/publisher_name"; else dc:publisher = xpath:"//csvRecord/column[@name='PUBLISHER'][not(.='None')]";
|
57
|
if xpath:"//doi_record//book_series_metadata or //book_metadata" dc:source = xpath:"//book_series_metadata/series_metadata/titles/title | //book_metadata/titles/title"; else $varDummy = "''";
|
58
|
$varYear = xpath:"number('9999')";
|
59
|
if xpath:"//publication_date/year" $varYear = xpath:"max(//publication_date/year)"; else $varDummy = "''";
|
60
|
if xpath:"//doi_record//journal_metadata/full_title" dc:source = xpath:"concat(//journal_metadata/full_title, '; Vol ', //journal_volume/volume)"; else $varDummy = "''";
|
61
|
dc:date = xpath:"//column[@name='PUBDATE']";
|
62
|
// $varDate = Convert(xpath:"descendant-or-self::column[@name='PUBDATE']", DateISO8601, "yyyy-MM-dd", "min()");
|
63
|
// if xpath:"starts-with($varDate, '00')" oaf:dateAccepted = xpath:"replace($varDate, '(00)(\d\d)', '20$2$3')"; else oaf:dateAccepted = $varDate;
|
64
|
// if xpath:"//journal_article/publication_date[@media_type='online'][1]/day" $varDayOnline = xpath:"//journal_article/publication_date[@media_type='online'][1]/day"; else $varDayOnline = xpath:"number('01')";
|
65
|
// if xpath:"//journal_article/publication_date[@media_type='online'][1]/month" $varMonthOnline = xpath:"//journal_article/publication_date[@media_type='online'][1]/month"; else $varMonthOnline = xpath:"number('01')";
|
66
|
// if xpath:"//journal_article/publication_date[@media_type='print'][1]/day" $varDayPrint = xpath:"//journal_article/publication_date[@media_type='print'][1]/day"; else $varDayPrint = xpath:"number('01')";
|
67
|
// if xpath:"//journal_article/publication_date[@media_type='print'][1]/month" $varMonthPrint = xpath:"//journal_article/publication_date[@media_type='print'][1]/month"; else $varMonthPrint = xpath:"number('01')";
|
68
|
// if xpath:"//journal_article/publication_date[@media_type='online']" oaf:dateAccepted = xpath:"concat(//journal_article/publication_date[@media_type='online'][1]/year, '-', format-number($varMonthOnline, '00'), '-', format-number($varDayOnline, '00'))"; else $varDummy = "''";
|
69
|
// if xpath:"not(//journal_article/publication_date[@media_type='online']) and //journal_article/publication_date[@media_type='print']" oaf:dateAccepted = xpath:"concat(//journal_article/publication_date[@media_type='print'][1]/year, '-', format-number($varMonthPrint, '00'), '-', '01')"; else $varDummy = "''";
|
70
|
// if xpath:"//book_metadata/publication_date" oaf:dateAccepted = xpath:"concat(//book_metadata/publication_date/year, '-', //book_metadata/publication_date/month, '-', '01')"; else $varDummy = "''";
|
71
|
if xpath:"//publication_date/year" oaf:dateAccepted = xpath:"concat(max(//publication_date/year), '-', '01', '-', '01')"; else $varDummy = "''";
|
72
|
//if xpath:"//column[@name='PUBDATE']/starts-with(., '00)" $varDate = xpath:"replace(//column[@name='PUBDATE'], '(00\d\d)', '20$2$3')"; else $varDate = xpath:"//column[@name='PUBDATE']";
|
73
|
//oaf:dateAccepted = Convert(xpath:"descendant-or-self::column[@name='PUBDATE']/replace(., '(00\d\d)', '20$2$3')", DateISO8601, "yyyy-MM-dd", "min()");
|
74
|
// if xpath:"//column[@name='PUBDATE']/starts-with(., '00)" oaf:dateAccepted = Convert(xpath:"replace(descendant-or-self::column[@name='PUBDATE'], '(00\d\d)', '20$2$3')", DateISO8601, "yyyy-MM-dd", "min()"); else oaf:dateAccepted = Convert(xpath:"descendant-or-self::column[@name='PUBDATE']", DateISO8601, "yyyy-MM-dd", "min()");
|
75
|
$varDoi = xpath:"concat('http://dx.doi.org/', normalize-space(//csvRecord/column[@name='ST_DOI']))";
|
76
|
if xpath:"string-length(//csvRecord/column[@name='ST_DOI']) gt 0" dc:identifier = $varDoi; else $varDummy = "''";
|
77
|
// dc:description = skipRecord();
|
78
|
$varCordaNs = "'corda_______::'";
|
79
|
if xpath:"//csvRecord/column[@name='CD_PROJ_ID'] and $varYear gt 2006" oaf:projectid = xpath:"concat($varCordaNs, //csvRecord/column[@name='CD_PROJ_ID'])"; else $varDummy = "''";
|
80
|
if xpath:"//csvRecord/column[@name='CD_PROJ_ID'] and string($varYear) eq ''" oaf:projectid = xpath:"concat($varCordaNs, //csvRecord/column[@name='CD_PROJ_ID'])"; else $varDummy = "''";
|
81
|
if xpath:"//csvRecord/column[@name='OA'][text()='Y'] or //doi_record[@owner='10.3390' or @owner='10.1590' or @owner='10.3906' or @owner='10.2147' or @owner='10.5772' or @owner='10.1186' or @owner='10.5194' or @owner='10.1155' or @owner='10.3389' or @owner='10.3410' or @owner='10.4081' or @owner='10.2174' or @owner='10.1088' or @owner='10.3402' or @owner='10.1136' or @owner='10.1371'] or matches($varIssn, '1600-5368') or //doi[starts-with(., '10.1038/srep') or starts-with(., '10.1038/tp') or starts-with(., '10.1038/mtna') or starts-with(., '10.1038/cddis') or starts-with(., '10.3762/bjoc') or starts-with(lower-case(.), '10.7448/ias') or starts-with(., '10.1177/14703203') or starts-with(., '10.14573/altex') or starts-with(., '10.5415/apallergy') or starts-with(., '10.4414/smw') or starts-with(., '10.1289/ehp') or starts-with(., '10.1093/jrr') or starts-with(., '10.1007/s13148') or starts-with(lower-case(.), '10.2471/blt') or starts-with(lower-case(.), '10.1042/an') or starts-with(lower-case(.), '10.1016/j.recesp') or starts-with(lower-case(.), '10.1111/acel') or starts-with(., '10.1111/j.1750-2659') or starts-with(lower-case(.), '10.1093/database') or starts-with(., '10.1038/msb') or starts-with(lower-case(.), '10.1364/oe.') or starts-with(lower-case(.), '10.1364/boe.') or starts-with(., '10.1093/gbe/') or starts-with(., '10.1093/nar') or starts-with(., '10.1002/emmm.') or starts-with(lower-case(.), '10.5463/dcid.') or starts-with(lower-case(.), '10.1128/mbio.') or starts-with(., '10.1177/20417314')] or //doi_record//license_ref[@applies_to='vor']" oaf:accessrights = "OPEN"; else oaf:accessrights = "CLOSED";
|
82
|
oaf:identifier = set(xpath:"//csvRecord/column[@name='ST_DOI']", @identifierType = "doi";);
|
83
|
//oaf:hostedBy = set("''", @name="Unknown Repository";, @id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18";);
|
84
|
//if xpath:"//csvRecord/column[@name='DI'][starts-with(., '10.')]" oaf:collectedFrom = set("''", @name="Crossref";, @id="openaire____::crossref";); else oaf:collectedFrom = set("''", @name="Web Crawl";, @id="openaire____::webcrawl";);
|
85
|
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
|
86
|
static oaf:hostedBy = set("''", @name = $varUnknownRepoName; , @id = $varUnknownRepoId;);
|
87
|
oaf:license = xpath:"//license_ref[@applies_to='vor']";
|
88
|
end</CODE>
|
89
|
</SCRIPT>
|
90
|
</CONFIGURATION>
|
91
|
<STATUS/>
|
92
|
<SECURITY_PARAMETERS/>
|
93
|
</BODY>
|
94
|
</RESOURCE_PROFILE>
|