Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
	xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr="http://www.driver-repository.eu/namespace/dr"
4
	xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaa="http://namespace.openaire.eu/oaa"
5
	xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:dnet="eu.dnetlib.data.transform.xml.OafToHbaseXsltFunctions"
6
	xmlns:exslt="http://exslt.org/common"
7
	xmlns:action="http://namespace.openaire.eu/action" version="1.0"
8
	extension-element-prefixes="exslt"
9
	exclude-result-prefixes="xsl dc dr dri oaa oaf dnet exslt">
10

    
11
	<xsl:output omit-xml-declaration="yes" indent="yes" />
12

    
13
	<xsl:param name="trust" select="string('0.9')" />
14
	<xsl:param name="provenance" select="string('UNKNOWN')" />
15

    
16
	<xsl:template match="/*">
17

    
18
		<xsl:choose>
19
			<xsl:when test="count(//RELATION) = 0">
20
				<ACTIONS />
21
			</xsl:when>
22
			<xsl:otherwise>
23
				<ACTIONS>
24
					<xsl:for-each select="//RELATION">
25
						<xsl:choose>
26
							<xsl:when test="./@type = 'resultProject'">
27
								<xsl:variable name="resultId" select="./@source" />
28
								<xsl:variable name="projectId">
29
									<xsl:choose>
30
										<xsl:when test="starts-with(@target, '40|')">
31
											<xsl:value-of select="./@target" />
32
										</xsl:when>
33
										<xsl:otherwise>
34
											<xsl:value-of select="dnet:oafSplitId('project', normalize-space(@target))"/>
35
										</xsl:otherwise>
36
									</xsl:choose>
37
								</xsl:variable>
38

    
39
								<ACTION targetKey="{$resultId}" targetColumnFamily="resultProject_outcome_isProducedBy" targetColumn="{$projectId}">
40
									<xsl:value-of select="dnet:rel($resultId, $projectId, 'resultProject', 'outcome', 'isProducedBy', $provenance, $trust)" />
41
								</ACTION>
42
								<ACTION targetKey="{$projectId}" targetColumnFamily="resultProject_outcome_produces" targetColumn="{$resultId}">
43
									<xsl:value-of select="dnet:rel($projectId, $resultId, 'resultProject', 'outcome', 'produces', $provenance, $trust)" />
44
								</ACTION>
45
							</xsl:when>
46
							
47
							<!-- TODO: check this block, it caused problems:
48
									Cannot convert argument/return type in call to method 'eu.dnetlib.actionmanager.actions.infopackage.DMFInfoPackageToHbaseXsltFunctions.oafPersonResultFromInfoPackage(node-set, node-set, result-tree, reference, reference)'
49
									FATAL ERROR:  'Could not compile stylesheet'
50
							
51
							<xsl:when test="./@type = 'personResult'">
52
								<xsl:variable name="personId" select="./@source" />
53
								<xsl:variable name="resultId" select="./@target" />
54
								
55
								<xsl:variable name="pos">
56
									<xsl:choose>
57
										<xsl:when test="@position"><xsl:value-of select="@position"/></xsl:when>
58
										<xsl:otherwise>1000</xsl:otherwise>
59
									</xsl:choose>
60
								</xsl:variable>
61

    
62
								<ACTION targetKey="{$personId}" targetColumnFamily="personResult" targetColumn="{$resultId}">
63
									<xsl:value-of select="dnet:oafPersonResultFromInfoPackage($personId, $resultId, $pos, $provenance, $trust)" />
64
								</ACTION>
65
								<ACTION targetKey="{$resultId}" targetColumnFamily="personResult" targetColumn="{$personId}">
66
									<xsl:value-of select="dnet:oafPersonResultFromInfoPackage($resultId, $personId, $pos, $provenance, $trust)" />
67
								</ACTION>
68
							</xsl:when>
69
							-->
70
						</xsl:choose>
71
					</xsl:for-each>
72
				</ACTIONS>
73
			</xsl:otherwise>
74
		</xsl:choose>
75
	</xsl:template>
76

    
77
</xsl:stylesheet>
(4-4/4)