1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="41080b4f-cfc7-4faf-8243-cabacaccc625_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6
|
<RESOURCE_URI value=""/>
|
7
|
<DATE_OF_CREATION value="2016-03-10T19:12:51+00:00"/>
|
8
|
</HEADER>
|
9
|
<BODY>
|
10
|
<CONFIGURATION>
|
11
|
<IMPORTED/>
|
12
|
<SCRIPT>
|
13
|
<TITLE>sesam_crossref2oaf</TITLE>
|
14
|
<CODE>declare_script "sesam_crossref2oaf";
|
15
|
declare_ns oaf = "http://namespace.openaire.eu/oaf";
|
16
|
declare_ns dri = "http://www.driver-repository.eu/namespace/dri";
|
17
|
declare_ns dr = "http://www.driver-repository.eu/namespace/dr";
|
18
|
declare_ns dc = "http://purl.org/dc/elements/1.1/";
|
19
|
declare_ns prov = "http://www.openarchives.org/OAI/2.0/provenance";
|
20
|
declare_ns cr = "http://www.crossref.org/qrschema/2.0";
|
21
|
$var0 = "''";
|
22
|
$var1 = "'corda_______::'";
|
23
|
$varDummy = "''";
|
24
|
$varUnknownRepoId = "'openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18'";
|
25
|
$varUnknownRepoName = "'Unknown Repository'";
|
26
|
static $varDatasourceid = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
|
27
|
static $varRepoid = xpath:"//dri:repositoryId";
|
28
|
static $varOfficialname = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//OFFICIAL_NAME"]);
|
29
|
dri:objIdentifier = xpath:"//dri:objIdentifier";
|
30
|
dri:repositoryId = $varRepoid;
|
31
|
//dri:repositoryId = xpath:"//dri:repositoryId";
|
32
|
dri:recordIdentifier = xpath:"//dri:recordIdentifier";
|
33
|
apply xpath:"//cr:crossref_result//cr:contributors/cr:contributor[@contributor_role='author']" if xpath:"true()" dc:creator = xpath:"concat(./cr:surname, ', ', ./cr:given_name)"; else $varDummy = "''";
|
34
|
if xpath:"//author and not(//cr:crossref_result//cr:contributors/cr:contributor[@contributor_role='author'])" dc:creator = xpath:"//author"; else $varDummy = "''";
|
35
|
dc:title = xpath:"//cr:article_title[normalize-space(.)]";
|
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:source = xpath:"//cr:series_title | //cr:journal_title";
|
40
|
//dc:contributor = xpath:"//dc:contributor";
|
41
|
//dc:description = xpath:"//dc:description";
|
42
|
$varHttpTest = "''";
|
43
|
// dc:identifier = xpath:"//url";
|
44
|
//apply xpath:"$varId" if xpath:"./value" dc:identifier = xpath:"concat('http://dx.doi.org/', ./value)"; else $varDummy = "''";
|
45
|
apply xpath:"//cr:doi" if xpath:". and not(//url)" dc:identifier = xpath:"concat('http://dx.doi.org/', .)"; else $varDummy = "''";
|
46
|
//if xpath:"//dc:identifier[starts-with(., 'http')]" $varHttpTest = "true"; else dc:identifier = skipRecord();
|
47
|
dr:dateOfCollection = xpath:"//dri:dateOfCollection";
|
48
|
static dr:dateOfTransformation = xpath:"current-dateTime()";
|
49
|
dc:type = xpath:"//cr:doi/@type";
|
50
|
//dc:language = Convert(xpath:"//dc:language", Languages);
|
51
|
dc:language = "eng";
|
52
|
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord();
|
53
|
dc:date = xpath:"//cr:year";
|
54
|
oaf:dateAccepted = Convert(xpath:"descendant-or-self::cr:year", DateISO8601, "yyyy-MM-dd", "min()");
|
55
|
//
|
56
|
oaf:projectid=xpath:"concat($var1, //projectId)";
|
57
|
//
|
58
|
static $varDsType = getValue(PROFILEFIELD, [xpath:"//dri:repositoryId", xpath:"//CONFIGURATION/DATASOURCE_TYPE"]);
|
59
|
//
|
60
|
apply xpath:"//cr:doi" if xpath:"." dr:CobjCategory = Convert(xpath:"normalize-space(./@type)", TextTypologies); else dc:type = xpath:".";
|
61
|
if xpath:"not(//cr:doi)" dr:CobjCategory = "0001"; else $varDummy = "''";
|
62
|
// if xpath:"//PUB_ACCESS_OPEN = 'true'" oaf:accessrights = "OPEN"; else oaf:accessrights = "CLOSED";
|
63
|
oaf:accessrights = "CLOSED";
|
64
|
//
|
65
|
$varISSN = xpath:"//cr:issn[@type='print'][1]";
|
66
|
$varEISSN = xpath:"//cr:issn[@type='electronic']";
|
67
|
$varVolume = xpath:"//cr:volume";
|
68
|
$varIssue = xpath:"//cr:issue";
|
69
|
$varStartPage = xpath:"//cr:first_page";
|
70
|
$varEndPage = xpath:"//cr:last_page";
|
71
|
oaf:journal = set(xpath:"//cr:journal_title | //cr:series_title", @vol = $varVolume;, @iss =$varIssue;, @sp= $varStartPage;, @ep= $varEndPage;, @issn=xpath:"replace($varISSN, '(\d{4})(\d{4}|\d{3}X)', '$1-$2')";, @eissn=xpath:"replace($varEISSN, '(\d{4})(\d{4}|\d{3}X)', '$1-$2')";);
|
72
|
//
|
73
|
static oaf:collectedFrom = set("''", @name = $varOfficialname; , @id = $varDatasourceid;);
|
74
|
static oaf:hostedBy = set("''", @name = $varUnknownRepoName; , @id = $varUnknownRepoId;);
|
75
|
//
|
76
|
// $varId = identifierExtract('["//PUB_PERMANENT_ID", "//PERIODIC_NUMBER", "//PUB_RELEVANT_PAGES", "//PERIODIC_TITLE", "//PUB_TITLE"]' , xpath:"./*[local-name()='record']" , '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+[^\).$])');
|
77
|
// oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
|
78
|
oaf:identifier = set(xpath:"//cr:doi", @identifierType = "doi";);
|
79
|
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
|
80
|
end</CODE>
|
81
|
</SCRIPT>
|
82
|
</CONFIGURATION>
|
83
|
<STATUS/>
|
84
|
<SECURITY_PARAMETERS/>
|
85
|
</BODY>
|
86
|
</RESOURCE_PROFILE>
|