Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER
4
                value="102207dc-aaf5-41b7-a7c7-4fbc6bcb60b9_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
5
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
6
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
7
        <RESOURCE_URI value=""/>
8
        <DATE_OF_CREATION value="2015-02-27T17:15:30+00:00"/>
9
    </HEADER>
10
    <BODY>
11
        <CONFIGURATION>
12
            <SOURCE_METADATA_FORMAT name="dmf" layout="store" interpretation="cleaned"/>
13
            <SINK_METADATA_FORMAT name="dngf_hbase"/>
14
            <IMPORTED/>
15
            <SCRIPT>
16
                <TITLE>DLI2HBASE:dataset mapping to hbase</TITLE>
17
                <CODE>
18
                    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
19
                                    xmlns:dliut="eu.dnetlib.dli.DLIUtils" xmlns:oaf="http://namespace.dnet.eu/oaf"
20
                                    xmlns:dnet="eu.dnetlib.data.transform.xml.DmfToHbaseXsltFunctions"
21
                                    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
22
                                    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
23
                                    xmlns:exslt="http://exslt.org/common" xmlns:dc="http://purl.org/dc/elements/1.1/"
24
                                    version="1.0" extension-element-prefixes="exslt"
25
                                    exclude-result-prefixes="xsl oaf dr dri dnet exslt dliut">
26
                        <xsl:output omit-xml-declaration="yes" indent="yes"/>
27
                        <xsl:template match="/*">
28
                            <xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
29
                            <xsl:variable name="dateOfCollection" select="concat('', //dri:dateOfCollection)"/>
30
                            <xsl:variable name="dateoftransformation" select="concat('', //dr:dateOfTransformation)"/>
31
                            <xsl:variable name="trust" select="string('0.9')"/>
32
                            <xsl:variable name="provenance" select="string('sysimport:crosswalk:datasetarchive')"/>
33
                            <xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/>
34
                            <xsl:variable name="namespaceprefix">
35
                                <xsl:choose><!-- TODO check namespaceprefix length is 12 -->
36
                                    <xsl:when test="string-length(//*[local-name() = 'datasourceprefix']) &gt; 0">
37
                                        <xsl:choose>
38
                                            <xsl:when test="count(//*[local-name() = 'datasourceprefix']) &gt; 1">
39
                                                <xsl:value-of select="//*[local-name() = 'datasourceprefix'][1]"/>
40
                                            </xsl:when>
41
                                            <xsl:otherwise>
42
                                                <xsl:value-of select="//*[local-name() = 'datasourceprefix']"/>
43
                                            </xsl:otherwise>
44
                                        </xsl:choose>
45
                                    </xsl:when>
46
                                    <xsl:otherwise>
47
                                        <xsl:value-of select="unknown_____"/>
48
                                    </xsl:otherwise>
49
                                </xsl:choose>
50
                            </xsl:variable>
51
                            <xsl:choose>
52
                                <xsl:when test="count($metadata) = 0 or normalize-space(//oaf:skipRecord)= 'true'">
53
                                    <ROWS/>
54
                                </xsl:when>
55
                                <xsl:otherwise>
56
                                    <xsl:variable name="datasetId"
57
                                                  select="dnet:oafSimpleId('dataset', //dri:objIdentifier)"/>
58
                                    <xsl:if test="string-length($datasetId) &gt; 0">
59
                                        <xsl:variable name="originalids"
60
                                                      select="//*[local-name() = 'resource']/*[local-name()='identifier'] | //*[local-name() = 'resource']//*[local-name()='alternateIdentifier']"/>
61
                                        <xsl:variable name="creators" select="//*[local-name() = 'creator']"/>
62
                                        <xsl:variable name="titles" select="//*[local-name() = 'title']"/>
63
                                        <xsl:variable name="subjects" select="//*[local-name() = 'subject']"/>
64
                                        <xsl:variable name="publisher" select="//*[local-name() = 'publisher']"/>
65
                                        <xsl:variable name="descriptions" select="//*[local-name() = 'description']"/>
66
                                        <xsl:variable name="dates" select="//*[local-name() = 'date']"/>
67
                                        <xsl:variable name="dateaccepted" select="//oaf:dateAccepted"/>
68
                                        <xsl:variable name="resourceType"
69
                                                      select="//*[local-name() = 'resourceType']/@resourceTypeGeneral"/>
70
                                        <xsl:variable name="formats" select="//*[local-name() = 'format']"/>
71
                                        <xsl:variable name="sizes" select="//*[local-name() = 'size']"/>
72
                                        <xsl:variable name="rights" select="//oaf:accessrights"/>
73
                                        <xsl:variable name="version" select="//*[local-name() = 'version']"/>
74
                                        <xsl:variable name="language" select="//oaf:language"/>
75
                                        <xsl:variable name="cobjcategory" select="//dr:CobjCategory"/>
76
                                        <xsl:variable name="contributor"
77
                                                      select="//*[local-name() = 'creator']/*[local-name() = 'creatorName']"/>
78
                                        <xsl:variable name="pid"
79
                                                      select="//*[local-name()='resource']/*[local-name()='identifier']/text()"/>
80
                                        <xsl:variable name="pidType"
81
                                                      select="//*[local-name()='resource']/*[local-name()='identifier']/@identifierType"/>
82
                                        <xsl:variable name="aboutNode" select="//oaf:about"/>
83
                                        <xsl:variable name="pids"
84
                                                      select="//*[local-name() = 'resource']//*[local-name()='identifier'or local-name()='alternateIdentifier']"/>
85
                                        <xsl:variable name="hostedBy"
86
                                                      select="//*[local-name() = 'resource']//*[local-name()='hostedBy']"/>
87
                                        <ROWS>
88
                                            <ROW>
89
                                                <xsl:attribute name="value">
90
                                                    <xsl:value-of
91
                                                            select="dnet:dliDataset($datasetId, $about, $titles, $subjects, $publisher, $descriptions, $dates, $dateaccepted, $resourceType, $formats, $sizes, $language, $cobjcategory, $contributor, $rights, $pids, $provenance, $aboutNode, $originalids, $dateOfCollection, $dateoftransformation, $trust, $hostedBy)"/>
92
                                                </xsl:attribute>
93
                                            </ROW><!--PUBLICATION RELATIONS-->
94
                                            <xsl:for-each
95
                                                    select="//*[normalize-space(local-name())='relatedIdentifier' and normalize-space(./@entityType)='publication']">
96
                                                <xsl:variable name="relationSemantic" select="./@relationType"/>
97
                                                <xsl:variable name="inverseRelationSemantic"
98
                                                              select="./@inverseRelationType"/>
99
                                                <xsl:variable name="licenseURL"
100
                                                              select="./@license"/><!-- relatedDataset ids must be in the openaire format -->
101
                                                <xsl:variable name="publicationId">
102
                                                    <xsl:choose>
103
                                                        <xsl:when test="./@relatedIdentifierType = 'dnet'">
104
                                                            <xsl:value-of select="concat('50|' , . )"/>
105
                                                        </xsl:when>
106
                                                        <xsl:otherwise>
107
                                                            <xsl:value-of
108
                                                                    select="dnet:createDNetEntityIdentifier(./@relatedIdentifierType, ., $namespaceprefix, 'dataset')"/>
109
                                                        </xsl:otherwise>
110
                                                    </xsl:choose>
111
                                                </xsl:variable>
112
                                                <xsl:if test="string-length($datasetId) &gt; 0">
113
                                                    <ROW>
114
                                                        <xsl:attribute name="value">
115
                                                            <xsl:value-of
116
                                                                    select="dnet:createRel($publicationId, $datasetId, $inverseRelationSemantic, 'publication_dataset', $provenance, $trust, $licenseURL, $about,$hostedBy)"/>
117
                                                        </xsl:attribute>
118
                                                    </ROW>
119
                                                    <ROW>
120
                                                        <xsl:attribute name="value">
121
                                                            <xsl:value-of
122
                                                                    select="dnet:createRel($datasetId, $publicationId, $relationSemantic, 'publication_dataset', $provenance, $trust, $licenseURL, $about,$hostedBy)"/>
123
                                                        </xsl:attribute>
124
                                                    </ROW>
125
                                                    <ROW>
126
                                                        <xsl:attribute name="value">
127
                                                            <xsl:value-of
128
                                                                    select="dnet:createSimpleEntity(./@relatedIdentifierType, normalize-space(.), $namespaceprefix, $about, 'publication', 'incomplete')"/>
129
                                                        </xsl:attribute>
130
                                                    </ROW>
131
                                                </xsl:if>
132
                                            </xsl:for-each><!--DATASET RELATIONS-->
133
                                            <xsl:for-each
134
                                                    select="//*[normalize-space(local-name())='relatedIdentifier' and normalize-space(./@entityType)='dataset']">
135
                                                <xsl:variable name="relationSemantic" select="./@relationType"/>
136
                                                <xsl:variable name="inverseRelationSemantic"
137
                                                              select="./@inverseRelationType"/>
138
                                                <xsl:variable name="licenseURL"
139
                                                              select="./@license"/><!-- relatedDataset ids must be in the openaire format -->
140
                                                <xsl:variable name="relDatasetId">
141
                                                    <xsl:choose>
142
                                                        <xsl:when test="./@relatedIdentifierType = 'dnet'">
143
                                                            <xsl:value-of select="concat('60|' , . )"/>
144
                                                        </xsl:when>
145
                                                        <xsl:otherwise>
146
                                                            <xsl:value-of
147
                                                                    select="dnet:createDNetEntityIdentifier(./@relatedIdentifierType, ., $namespaceprefix, 'dataset')"/>
148
                                                        </xsl:otherwise>
149
                                                    </xsl:choose>
150
                                                </xsl:variable>
151
                                                <xsl:if test="string-length($datasetId) &gt; 0">
152
                                                    <ROW>
153
                                                        <xsl:attribute name="value">
154
                                                            <xsl:value-of
155
                                                                    select="dnet:createRel($relDatasetId, $datasetId, $inverseRelationSemantic, 'dataset_dataset', $provenance, $trust, $licenseURL, $about,$hostedBy)"/>
156
                                                        </xsl:attribute>
157
                                                    </ROW>
158
                                                    <ROW>
159
                                                        <xsl:attribute name="value">
160
                                                            <xsl:value-of
161
                                                                    select="dnet:createRel($datasetId, $relDatasetId, $relationSemantic, 'dataset_dataset', $provenance, $trust, $licenseURL, $about, $hostedBy)"/>
162
                                                        </xsl:attribute>
163
                                                    </ROW>
164
                                                    <ROW>
165
                                                        <xsl:attribute name="value">
166
                                                            <xsl:value-of
167
                                                                    select="dnet:createEntity(./@relatedIdentifierType, normalize-space(.), $namespaceprefix, 'dataset', $about, 'incomplete')"/>
168
                                                        </xsl:attribute>
169
                                                    </ROW>
170
                                                </xsl:if>
171
                                            </xsl:for-each><!--UNKOWN RELATIONS-->
172
                                            <xsl:for-each
173
                                                    select="//*[normalize-space(local-name())='relatedIdentifier' and (normalize-space(./@entityType)='unknown' or not(./@entityType))]">
174
                                                <xsl:variable name="relationSemantic" select="./@relationType"/>
175
                                                <xsl:variable name="inverseRelationSemantic"
176
                                                              select="./@inverseRelationType"/>
177
                                                <xsl:variable name="licenseURL" select="./@license"/>
178
                                                <xsl:variable name="enityId"
179
                                                              select="dnet:createDNetEntityIdentifier(./@relatedIdentifierType, ., $namespaceprefix, 'unknown')"/>
180
                                                <xsl:if test="string-length(dliut:fixPID(normalize-space(.))) &gt; 0 ">
181
                                                    <ROW>
182
                                                        <xsl:attribute name="value">
183
                                                            <xsl:value-of
184
                                                                    select="dnet:createEntity(./@relatedIdentifierType, ., $namespaceprefix, $about, 'incomplete')"/>
185
                                                        </xsl:attribute>
186
                                                    </ROW>
187
                                                    <ROW>
188
                                                        <xsl:attribute name="value">
189
                                                            <xsl:value-of
190
                                                                    select="dnet:createRel($datasetId, $enityId, $relationSemantic, 'dataset_unknown', $provenance, $trust, $licenseURL, $about,$hostedBy)"/>
191
                                                        </xsl:attribute>
192
                                                    </ROW>
193
                                                    <ROW>
194
                                                        <xsl:attribute name="value">
195
                                                            <xsl:value-of
196
                                                                    select="dnet:createRel($enityId, $datasetId, $inverseRelationSemantic, 'dataset_unknown', $provenance, $trust, $licenseURL, $about,$hostedBy)"/>
197
                                                        </xsl:attribute>
198
                                                    </ROW>
199
                                                </xsl:if>
200
                                            </xsl:for-each>
201
                                        </ROWS>
202
                                    </xsl:if>
203
                                </xsl:otherwise>
204
                            </xsl:choose>
205
                        </xsl:template>
206
                    </xsl:stylesheet>
207
                </CODE>
208
            </SCRIPT>
209
        </CONFIGURATION>
210
        <STATUS/>
211
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
212
    </BODY>
213
</RESOURCE_PROFILE>
(1-1/3)