Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="6c9b4eea-45fc-4017-9fdb-8818afcd80ea_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2016-07-13T11:51:55+00:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>dc_cleaning_OPENAIREplus_compliant_handle</TITLE>
14
                <CODE>declare_script "dc_cleaning_OpenAIREplus_compliant_handle";
15
declare_ns oaf = "http://namespace.openaire.eu/oaf";
16
declare_ns dri = "http://www.driver-repository.eu/namespace/dri";
17
declare_ns dr = "http://www.driver-repository.eu/namespace/dr";
18
declare_ns dc = "http://purl.org/dc/elements/1.1/";
19
declare_ns prov = "http://www.openarchives.org/OAI/2.0/provenance";
20
$var0 = "''";
21
$varFP7 = "'corda_______::'";
22
$varH2020 = "'corda__h2020::'";
23
$varFCT="'fct_________::'";
24
$varDummy = "''";
25
static $varDatasourceid = getValue(PROFILEFIELD, [xpath:"concat('collection(&amp;apos;/db/DRIVER/RepositoryServiceResources&amp;apos;)//RESOURCE_PROFILE[.//EXTRA_FIELDS/FIELD[key=&amp;quot;NamespacePrefix&amp;quot;][value=&amp;quot;', //oaf:datasourceprefix, '&amp;quot;]]')", xpath:"//EXTRA_FIELDS/FIELD[key='OpenAireDataSourceId']/value"]);
26
static $varRepoid = xpath:"//dri:repositoryId";
27
static $varOfficialname = getValue(PROFILEFIELD, [xpath:"concat('collection(&amp;apos;/db/DRIVER/RepositoryServiceResources&amp;apos;)//RESOURCE_PROFILE[.//EXTRA_FIELDS/FIELD[key=&amp;quot;NamespacePrefix&amp;quot;][value=&amp;quot;', //oaf:datasourceprefix, '&amp;quot;]]')", xpath:"//CONFIGURATION/OFFICIAL_NAME"]);
28
dri:objIdentifier = xpath:"//dri:objIdentifier";
29
dri:repositoryId = $varRepoid;
30
dri:recordIdentifier = xpath:"//dri:recordIdentifier";
31
apply xpath:"//dc:creator" if xpath:"string-length(.) &gt; 0" dc:creator = xpath:"normalize-space(.)"; else $varDummy = "''";
32
if xpath:"//dc:title[string-length(.)&gt; 0]" $varDummy = "''"; else dc:coverage = skipRecord();
33
apply xpath:"//dc:title" if xpath:"string-length(.) &gt; 0" dc:title = xpath:"normalize-space(.)"; else $varDummy = "''";
34
apply xpath:"//dc:subject" if xpath:"string-length(.) &gt; 0" dc:subject = xpath:"normalize-space(.)"; else $varDummy = "''";
35
apply xpath:"//dc:publisher" if xpath:"string-length(.) &gt; 0" dc:publisher = xpath:"normalize-space(.)"; else $varDummy = "''";
36
apply xpath:"//dc:source" if xpath:"string-length(.) &gt; 0" dc:source = xpath:"normalize-space(.)"; else $varDummy = "''";
37
dc:contributor = xpath:"//dc:contributor";
38
dc:description = xpath:"string-join(//dc:description[concat(normalize-space(.), '')], codepoints-to-string(10))";
39
$varHttpTest = "''";
40
if xpath:"//dc:identifier[starts-with(., 'http://hdl.handle') or starts-with(., 'https://hdl.handle')][not(starts-with(., 'http://hdl.handle.net/123456789') or starts-with(., 'https://hdl.handle.net/123456789'))]" $varHttpTest = "true"; else dc:identifier = skipRecord();
41
apply xpath:"//dc:identifier" if xpath:"starts-with(normalize-space(.), 'http://hdl.handle') or starts-with(., 'https://hdl.handle')" dc:identifier = xpath:"normalize-space(.)"; else dr:CobjIdentifier = xpath:"normalize-space(.)";
42
dr:dateOfCollection = xpath:"//dri:dateOfCollection";
43
static dr:dateOfTransformation = xpath:"current-dateTime()";
44
dc:type = xpath:"//dc:type";
45
dc:format = xpath:"//dc:format";
46
dc:date = xpath:"//dc:date";
47
dc:language = Convert(xpath:"//dc:language", Languages);
48
//dc:language = "eng";
49
//if xpath:"//dc:rights[text()='info:eu-repo/semantics/openAccess']" dc:publisher = xpath:"//dc:publisher"; else dc:publisher = skipRecord();
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\/)//gmi"); else $var0 = "''";
52
// FP7
53
oaf:projectid = xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', 'i')]/concat($varFP7, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))";
54
// H2020
55
oaf:projectid = xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', 'i')]/concat($varH2020, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))";
56
// FCT
57
oaf:projectid = xpath:"//dc:relation[matches(normalize-space(.), '(info:eu-repo/grantagreement/fct)/(.+)/(\d+)(.*)', 'i')]/concat($varFCT, replace(normalize-space(.), '(info:eu-repo/grantagreement/fct)/(.+)/(\d+)(.*)', '$3', 'i'))";
58
dc:relation = xpath:"//dc:relation";
59
// apply xpath:"//dc:relation" if xpath:"matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', 'i')" oaf:projectid = xpath:"concat($var1, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"; else dc:relation = xpath:"normalize-space(.)";
60
//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(.)";
61
//
62
oaf:collectedDatasourceid = xpath:"$varDatasourceid";   
63
//
64
dr:CobjCategory = Convert(xpath:"//dc:type", TextTypologies);
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"/&lt;&gt;]*/[^\s"&lt;&gt;]+)');
74
$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '\b(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?!["&amp;&lt;&gt;])\S)+)\b');
75
//$varId = identifierExtract('["//dc:identifier", "//dc:relation"]' , xpath:"./*[local-name()='record']" , '\b(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?!["&amp;'&lt;&gt;])\S)+)\b');
76
// 1st param: list of xpath expresssions to be applied on the metadata in json syntax; 2nd param: xpath expression for the metadata record; 3rd param reg expr that matches with a negative lookahead for the first group and extracts digits of the second group
77
$varPmId = identifierExtract('["//dc:relation[starts-with(normalize-space(.), \"info:eu-repo/semantics/altIdentifier/pmid/\")]"]' , xpath:"./*[local-name()='record']" , '(?!info:eu-repo/semantics/altIdentifier/pmid/)(\d+)');
78
// $varUrn = xpath:"substring-after(//dc:relation[starts-with(normalize-space(.), 'info:eu-repo/semantics/altIdentifier/urn/')], 'info:eu-repo/semantics/altIdentifier/urn/')";
79
$varUrn = identifierExtract('["//dc:relation[starts-with(normalize-space(.), \"info:eu-repo/semantics/altIdentifier/urn/\")]"]' , xpath:"./*[local-name()='record']" , '(?!info:eu-repo/semantics/altIdentifier/urn/)(urn:nbn:.*)');
80
oaf:identifier = set(xpath:"$varId//value", @identifierType = "doi";);
81
oaf:identifier = set(xpath:"$varPmId//value", @identifierType = "pmid";);
82
oaf:identifier = set(xpath:"$varUrn//value", @identifierType = "urn";);
83
oaf:datasourceprefix = xpath:"//oaf:datasourceprefix";
84
// specific to NORA (Norwegian Research Archive)
85
apply xpath:"//dc:identifier[starts-with(., 'Fulltext')]" if xpath:"contains(., 'http')" oaf:fulltext = xpath:"substring-after(., 'Fulltext ')"; else $varDummy = "''";
86
end</CODE>
87
            </SCRIPT>
88
        </CONFIGURATION>
89
        <STATUS/>
90
        <SECURITY_PARAMETERS/>
91
    </BODY>
92
</RESOURCE_PROFILE>
(47-47/56)