Revision 48220
Added by Alessia Bardi over 7 years ago
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/claimrels_2_hbase.xsl | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="775d4a1c-67f5-473d-a838-ab22d5c5231d_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="dbmf" layout="store" interpretation="cleaned"/> |
|
12 |
<SINK_METADATA_FORMAT name="oaf_hbase"/> |
|
13 |
<IMPORTED/> |
|
14 |
<SCRIPT> |
|
15 |
<TITLE>xslt_mapping_claimRels2hbase</TITLE> |
|
16 |
<CODE> |
|
17 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
18 |
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr="http://www.driver-repository.eu/namespace/dr" |
|
19 |
xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaa="http://namespace.openaire.eu/oaa" |
|
20 |
xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:dnet="eu.dnetlib.data.transform.xml.DbmfToHbaseXsltFunctions" |
|
21 |
xmlns:exslt="http://exslt.org/common" |
|
22 |
xmlns:action="http://namespace.openaire.eu/action" version="1.0" |
|
23 |
extension-element-prefixes="exslt" |
|
24 |
exclude-result-prefixes="xsl dc dr dri oaa oaf dnet exslt"> |
|
25 |
|
|
26 |
<xsl:output omit-xml-declaration="yes" indent="yes"/> |
|
27 |
|
|
28 |
<xsl:template match="/*"> |
|
29 |
|
|
30 |
<xsl:variable name="provenance"> |
|
31 |
<xsl:value-of select="//FIELD[@name = 'provenance']"/> |
|
32 |
</xsl:variable> |
|
33 |
<xsl:variable name="trust">0.9</xsl:variable> |
|
34 |
|
|
35 |
<xsl:choose> |
|
36 |
<xsl:when test="count(//RELATION) = 0"> |
|
37 |
<ROWS/> |
|
38 |
</xsl:when> |
|
39 |
<xsl:otherwise> |
|
40 |
<ROWS> |
|
41 |
<xsl:for-each select="//RELATION"> |
|
42 |
<xsl:choose> |
|
43 |
<xsl:when test="./@type = 'resultProject'"> |
|
44 |
<xsl:variable name="resultId" select="./@source"/> |
|
45 |
<xsl:variable name="projectId"> |
|
46 |
<xsl:choose> |
|
47 |
<xsl:when test="starts-with(@target, '40|')"> |
|
48 |
<xsl:value-of select="./@target"/> |
|
49 |
</xsl:when> |
|
50 |
<xsl:otherwise> |
|
51 |
<xsl:value-of select="dnet:oafSplitId('project', normalize-space(@target))"/> |
|
52 |
</xsl:otherwise> |
|
53 |
</xsl:choose> |
|
54 |
</xsl:variable> |
|
55 |
|
|
56 |
<ROW key="{$resultId}" columnFamily="resultProject_outcome_isProducedBy"> |
|
57 |
<QUALIFIER name="{$projectId}" type="base64"> |
|
58 |
<xsl:value-of |
|
59 |
select="dnet:rel($resultId, $projectId, 'resultProject', 'outcome', 'isProducedBy', $provenance, $trust)"/> |
|
60 |
</QUALIFIER> |
|
61 |
</ROW> |
|
62 |
<ROW key="{$projectId}" columnFamily="resultProject_outcome_produces"> |
|
63 |
<QUALIFIER name="{$resultId}" type="base64"> |
|
64 |
<xsl:value-of |
|
65 |
select="dnet:rel($projectId, $resultId, 'resultProject', 'outcome', 'produces', $provenance, $trust)"/> |
|
66 |
</QUALIFIER> |
|
67 |
</ROW> |
|
68 |
</xsl:when> |
|
69 |
<xsl:when test="./@type = 'resultResult_publicationdataset_isRelatedTo'"> |
|
70 |
<xsl:variable name="source" select="./@source"/> |
|
71 |
<xsl:variable name="target" select="./@target"/> |
|
72 |
|
|
73 |
<ROW key="{$source}" columnFamily="resultResult_publicationDataset_isRelatedTo"> |
|
74 |
<QUALIFIER name="{$target}" type="base64"> |
|
75 |
<xsl:value-of |
|
76 |
select="dnet:rel($source, $target, 'resultResult', 'publicationDataset', 'isRelatedTo', $provenance, $trust)"/> |
|
77 |
</QUALIFIER> |
|
78 |
</ROW> |
|
79 |
<ROW key="{$target}" columnFamily="resultResult_publicationDataset_isRelatedTo"> |
|
80 |
<QUALIFIER name="{$source}" type="base64"> |
|
81 |
<xsl:value-of |
|
82 |
select="dnet:rel($target, $source, 'resultResult', 'publicationDataset', 'isRelatedTo', $provenance, $trust)"/> |
|
83 |
</QUALIFIER> |
|
84 |
</ROW> |
|
85 |
</xsl:when> |
|
86 |
</xsl:choose> |
|
87 |
</xsl:for-each> |
|
88 |
</ROWS> |
|
89 |
</xsl:otherwise> |
|
90 |
</xsl:choose> |
|
91 |
</xsl:template> |
|
92 |
</xsl:stylesheet> |
|
93 |
</CODE> |
|
94 |
</SCRIPT> |
|
95 |
</CONFIGURATION> |
|
96 |
<STATUS/> |
|
97 |
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS> |
|
98 |
</BODY> |
|
99 |
</RESOURCE_PROFILE> |
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/claimUpdates_2_hbase.xsl | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="515444fa-b6af-4164-bf52-30e53b916a90_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="oaf" layout="store" interpretation="cleaned"/> |
|
12 |
<SINK_METADATA_FORMAT name="oaf_hbase"/> |
|
13 |
<IMPORTED/> |
|
14 |
<SCRIPT> |
|
15 |
<TITLE>xslt_mapping_claimUpdates2hbase</TITLE> |
|
16 |
<CODE> |
|
17 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
18 |
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr="http://www.driver-repository.eu/namespace/dr" |
|
19 |
xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaa="http://namespace.openaire.eu/oaa" |
|
20 |
xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:dnet="eu.dnetlib.data.transform.xml.OafToHbaseXsltFunctions" |
|
21 |
xmlns:date="java.lang.System" |
|
22 |
xmlns:exslt="http://exslt.org/common" |
|
23 |
version="1.0" |
|
24 |
extension-element-prefixes="exslt" |
|
25 |
exclude-result-prefixes="xsl dc dr dri oaa oaf dnet exslt date"> |
|
26 |
|
|
27 |
|
|
28 |
<xsl:output omit-xml-declaration="yes" indent="yes"/> |
|
29 |
|
|
30 |
<xsl:param name="trust" select="string('0.9')"/> |
|
31 |
<xsl:param name="provenance" select="string('UNKNOWN')"/> |
|
32 |
<xsl:param name="namespaceprefix" select="string('unknown_____')"/> |
|
33 |
|
|
34 |
<xsl:template match="/*"> |
|
35 |
<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/> |
|
36 |
<xsl:variable name="dateofcollection" select="//dr:dateOfCollection"/> |
|
37 |
<xsl:variable name="dateoftransformation" select="//dr:dateOfTransformation"/> |
|
38 |
|
|
39 |
<xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/> |
|
40 |
<xsl:variable name="collectedDatasourceid"> |
|
41 |
<xsl:choose> |
|
42 |
<xsl:when test="string-length(//oaf:collectedDatasourceid) > 0"> |
|
43 |
<xsl:value-of select="//oaf:collectedDatasourceid"/> |
|
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"> |
|
53 |
<ROWS/> |
|
54 |
</xsl:when> |
|
55 |
<xsl:otherwise> |
|
56 |
|
|
57 |
<xsl:variable name="objidentifier" select="//record/*[local-name() = 'header']/*[local-name() = 'objIdentifier']"/> |
|
58 |
|
|
59 |
<xsl:variable name="resultId" select="dnet:oafSimpleId('result', $objidentifier)"/> |
|
60 |
|
|
61 |
<xsl:variable name="hostedbyid" select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/> |
|
62 |
<xsl:variable name="hostedbyname" select="//oaf:hostedBy/@name"/> |
|
63 |
|
|
64 |
<xsl:variable name="collectedfromid" select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/> |
|
65 |
<xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name"/> |
|
66 |
|
|
67 |
<xsl:variable name="result" |
|
68 |
select="dnet:oafResultUpdate($resultId, $provenance, $trust, $metadata, $hostedbyid, $hostedbyname)"/> |
|
69 |
|
|
70 |
<ROWS> |
|
71 |
<ROW key="{$resultId}" columnFamily="result"> |
|
72 |
<QUALIFIER name="{concat('update_', date:nanoTime())}" type="base64"> |
|
73 |
<xsl:value-of select="$result"/> |
|
74 |
</QUALIFIER> |
|
75 |
</ROW> |
|
76 |
</ROWS> |
|
77 |
</xsl:otherwise> |
|
78 |
</xsl:choose> |
|
79 |
</xsl:template> |
|
80 |
|
|
81 |
</xsl:stylesheet> |
|
82 |
</CODE> |
|
83 |
</SCRIPT> |
|
84 |
</CONFIGURATION> |
|
85 |
<STATUS/> |
|
86 |
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS> |
|
87 |
</BODY> |
|
88 |
</RESOURCE_PROFILE> |
Also available in: Unified diff
Removed unused transformation