Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="43108eba-4b67-4d7a-8928-55ca09f1c8ff_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
		<RESOURCE_KIND value="TransformationRuleDSResources"/>
6
		<RESOURCE_URI value=""/>
7
		<DATE_OF_CREATION value="2015-02-27T17:15:30+00:00"/>
8
	</HEADER>
9
	<BODY>
10
		<CONFIGURATION>
11
			<SOURCE_METADATA_FORMAT name="pmf" layout="store" interpretation="cleaned"/>
12
			<SINK_METADATA_FORMAT name="dngf_hbase"/>
13
			<IMPORTED/>
14
			<SCRIPT>
15
				<TITLE>xslt_mapping_pmf2hbase</TITLE>
16
				<CODE>
17
					<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18
					                xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:dc="http://purl.org/dc/elements/1.1/"
19
					                xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:dr="http://www.driver-repository.eu/namespace/dr"
20
					                xmlns:dnet="eu.dnetlib.data.transform.xml.OafToHbaseXsltFunctions"
21
					                xmlns:exslt="http://exslt.org/common"
22
					                version="1.0" extension-element-prefixes="exslt"
23
					                exclude-result-prefixes="xsl oaf dr dri dnet exslt">
24

    
25
						<xsl:output omit-xml-declaration="yes" indent="yes"/>
26

    
27
						<xsl:param name="writeCoAuthors" select="false()"/>
28

    
29
						<xsl:template match="/*">
30
							<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
31
							<xsl:variable name="dateofcollection" select="//dr:dateOfCollection"/>
32
							<xsl:variable name="dateoftransformation" select="//dr:dateOfTransformation"/>
33

    
34
							<xsl:variable name="trust" select="string('0.9')"/>
35
							<xsl:variable name="provenance" select="string('sysimport:crosswalk:repository')"/>
36

    
37
							<xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/>
38
							<xsl:variable name="namespaceprefix">
39
								<xsl:choose>
40

    
41
									<!-- TODO check namespaceprefix length is 12 -->
42
									<xsl:when test="string-length(//oaf:datasourceprefix) &gt; 0">
43
										<xsl:value-of select="//oaf:datasourceprefix"/>
44
									</xsl:when>
45
									<xsl:otherwise>
46
										<xsl:value-of select="unknown_"/>
47
									</xsl:otherwise>
48
								</xsl:choose>
49
							</xsl:variable>
50

    
51
							<xsl:choose>
52
								<!-- 			<xsl:when test="count($metadata) = 0 or string-length($namespaceprefix) = 0"> -->
53
								<xsl:when test="count($metadata) = 0">
54
									<ROWS/>
55
								</xsl:when>
56
								<xsl:otherwise>
57

    
58
									<xsl:variable name="objIdentifier" select="//dri:objIdentifier"/>
59
									<xsl:variable name="publicationId" select="dnet:oafSimpleId('publication', //dri:objIdentifier)"/>
60

    
61
									<xsl:if test="string-length($publicationId) &gt; 0">
62

    
63
										<xsl:variable name="collectedfromid" select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/>
64
										<xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name"/>
65

    
66
										<xsl:variable name="hostedbyid" select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/>
67
										<xsl:variable name="hostedbyname" select="//oaf:hostedBy/@name"/>
68

    
69
										<xsl:variable name="originalidTest" select="/record/*[local-name() = 'header']/*[local-name() = 'recordIdentifier']"/>
70
										<xsl:variable name="originalid">
71
											<xsl:choose>
72
												<xsl:when test="contains($originalidTest, '::')">
73
													<xsl:value-of select="substring-after($originalidTest, '::')"/>
74
												</xsl:when>
75
												<xsl:otherwise>
76
													<xsl:value-of select="$originalidTest"/>
77
												</xsl:otherwise>
78
											</xsl:choose>
79
										</xsl:variable>
80

    
81
										<ROWS>
82
											<ROW>
83
												<xsl:attribute name="value"><xsl:value-of select="dnet:oafPublication($publicationId, $provenance, $trust, $about, $hostedbyid, $hostedbyname, $collectedfromid,
84
										              $collectedfromname, $originalid, $dateofcollection, $dateoftransformation, $metadata)"/></xsl:attribute>
85
											</ROW>
86

    
87
											<xsl:for-each select="//*[local-name()='projectid']">
88

    
89
												<xsl:variable name="projectId" select="dnet:oafSplitId('project', normalize-space(.))"/>
90

    
91
												<xsl:if test="string-length($projectId) &gt; 0">
92
													<ROW>
93
														<xsl:attribute name="value"><xsl:value-of select="dnet:rel($publicationId, 'publication', $projectId, 'project', 'isProducedBy', 'publication_project', $provenance, $trust, $about)"/></xsl:attribute>
94
													</ROW>
95
													<ROW>
96
														<xsl:attribute name="value"><xsl:value-of select="dnet:rel($projectId, 'project', $publicationId, 'publication', 'produces', 'publication_project', $provenance, $trust, $about)"/></xsl:attribute>
97
													</ROW>
98
												</xsl:if>
99
											</xsl:for-each>
100

    
101
											<xsl:for-each select="//*[local-name()='relatedDataset']">
102

    
103
												<!-- relatedDataset ids must be in the openaire format  -->
104
												<xsl:variable name="datasetId" select="dnet:oafSimpleId('dataset', normalize-space(./@id))"/>
105

    
106
												<xsl:if test="string-length($datasetId) &gt; 0">
107
													<ROW>
108
														<xsl:attribute name="value"><xsl:value-of select="dnet:rel($publicationId, 'publication', $datasetId, 'dataset', 'isRelatedTo', 'publication_dataset', $provenance, $trust, $about)"/></xsl:attribute>
109
													</ROW>
110
													<ROW>
111
														<xsl:attribute name="value"><xsl:value-of select="dnet:rel($datasetId, 'dataset', $publicationId, 'publication', 'isRelatedTo', 'publication_dataset', $provenance, $trust, $about)"/></xsl:attribute>
112
													</ROW>
113
												</xsl:if>
114
											</xsl:for-each>
115

    
116
											<xsl:for-each select="//*[local-name()='creator']">
117

    
118
												<xsl:if test="string-length(normalize-space(.)) &gt; 0">
119
													<xsl:variable name="originalPersonId">
120
														<xsl:choose>
121
															<xsl:when test="string-length(@nameIdentifier) &gt; 0">
122
																<xsl:value-of select="normalize-space(@nameIdentifier)"/>
123
															</xsl:when>
124
															<xsl:otherwise>
125
																<xsl:value-of select="concat($originalid, '::', normalize-space(.))"/>
126
															</xsl:otherwise>
127
														</xsl:choose>
128
													</xsl:variable>
129

    
130
													<xsl:variable name="personId" select="dnet:oafId('person', $namespaceprefix, $originalPersonId)"/>
131
													<xsl:variable name="position" select="position()"/>
132

    
133
													<xsl:if test="string-length($personId) &gt; 0">
134
														<ROW>
135
															<xsl:attribute name="value">
136
																<xsl:value-of select="dnet:person($personId, $about, $provenance, $trust, $collectedfromid, $collectedfromname,
137
								                                    $originalPersonId, $dateofcollection, $dateoftransformation, normalize-space(.), @nameIdentifier, @nameIdentifierScheme)"/>
138
															</xsl:attribute>
139
														</ROW>
140
														<ROW>
141
															<xsl:attribute name="value">
142
																<xsl:value-of select="dnet:authorship($personId, $publicationId, $position, 'isAuthorOf', 'person_publication', $provenance, $trust, $about)"/>
143
															</xsl:attribute>
144
														</ROW>
145
														<ROW>
146
															<xsl:attribute name="value">
147
																<xsl:value-of select="dnet:authorship($publicationId, $personId, $position, 'hasAuthor', 'person_publication', $provenance, $trust, $about)"/>
148
															</xsl:attribute>
149
														</ROW>
150
													</xsl:if>
151
												</xsl:if>
152
											</xsl:for-each>
153
										</ROWS>
154
									</xsl:if>
155
								</xsl:otherwise>
156
							</xsl:choose>
157
						</xsl:template>
158
					</xsl:stylesheet>
159
				</CODE>
160
			</SCRIPT>
161
		</CONFIGURATION>
162
		<STATUS/>
163
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
164
	</BODY>
165
</RESOURCE_PROFILE>
(62-62/73)