xform_59to60.xsl 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?xml version="1.0"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: fmmd
  5. (C) Copyright IBM Corp. 2003, 2013
  6. US Government Users Restricted Rights - Use, duplication or disclosure
  7. restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <!--
  10. ===============================================================================
  11. Model Upgrade 59 to 60 Notes:
  12. This is an XSLT transformation from a Blacksea schema version 59 model to a Blacksea
  13. schema version 60 model
  14. This Upgrade is required to accomodate the following Model Schema changes made in Blacksea:
  15. * new shortcut property treatAs
  16. In FM a shortcut to a query subject or dimension can mean one of two things to RQP.
  17. If a query subject shortcut is in the same folder as the target query subject then it implies that
  18. the shortcut will be represented as an alias table in the generated sql. If the query subject
  19. shortcut and target query subject are in different folders then the shortcut is treated as a
  20. real shortcut and no alias table is generated in the resultant sql.
  21. While the rules governing this behavior are pretty simple it is very obscure from the point of
  22. view of an FM modeler. It is also considered somewhat limiting since we rely on the location
  23. of the shortcut to control the use of an alias table. In BlackSea this behavior will be made
  24. more apparent and selectable by the FM modeler.
  25. Shortcut objects will have a new optional property called treatAs with two possible
  26. values: alias and reference.
  27. alias - shortcut will be treated as an alias table in the generated sql
  28. reference - (default)shortcut will be treated as a simple reference to the target object.
  29. Blaring models will be upgrade by adding the governor shortcutProcessing = automatic. This
  30. will retain the old Blaring shortcut behaviour. New models will not have the governor added
  31. and therefore implies shortcut processing is explict. An upgrade summary message will be
  32. displayed after upgrade informing the user that the governor has been set to retain the
  33. old shortcut behaviour and should be reviewed using verify model. (Same thing we did for
  34. the data type/metadata callback governor upgrade)
  35. ===============================================================================
  36. -->
  37. <xsl:stylesheet xmlns="http://www.developer.cognos.com/schemas/bmt/60/0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fmfunc="http://www.developer.cognos.com/bmt" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="fmfunc xalan">
  38. <xsl:include href="fmmd_generalTemplates.xsl"/>
  39. <xsl:strip-space elements="*"/>
  40. <xsl:output encoding="utf-8" method="xml" indent="no"/>
  41. <!-- ============================================================================== -->
  42. <!-- Step 1: Insert the new governor "shortcutProcessing = automatic".
  43. -->
  44. <!-- Template: Insert the new governor -->
  45. <xsl:template match="/*[local-name()='project']/*[local-name()='parameterMaps']/*[local-name()='parameterMap' and *[local-name() = 'name' and . = '_governor']]/*[local-name() = 'name' or local-name() = 'property' or local-name() = 'defaultValue' or local-name()='parameterMapEntry'][last()]">
  46. <!-- Copy the anchor element -->
  47. <xsl:call-template name="myCopy"/>
  48. <!-- Check the model is a relational based model -->
  49. <xsl:if test="$bIsRelational">
  50. <!-- Ok, assume it's a relational model -->
  51. <!-- Insert the governor "shortcutProcessing" for CQE to generate dynamic dimensional information as per the old Baltic style query generation. -->
  52. <xsl:element name="parameterMapEntry">
  53. <xsl:element name="key">shortcutProcessing</xsl:element>
  54. <xsl:element name="value">automatic</xsl:element>
  55. </xsl:element>
  56. <xsl:call-template name="annotate">
  57. <xsl:with-param name="value" select="$strWarnShortcutProcessing"/>
  58. </xsl:call-template>
  59. </xsl:if>
  60. </xsl:template>
  61. <!-- =============================================================================== -->
  62. <!-- Global variables: -->
  63. <!-- =============================================================================== -->
  64. <xsl:variable name="sEmptyNamespace" select="string(document('')/*/namespace::*[name()=''])"/>
  65. <xsl:variable name="nNewSchema" select="number(substring-before(substring-after($sEmptyNamespace, 'http://www.developer.cognos.com/schemas/bmt/'), '/'))"/>
  66. <xsl:variable name="nOldSchema" select="$nNewSchema - 1"/>
  67. <xsl:variable name="bIsRelational" select="/*[local-name()='project']/*[local-name()='dataSources']/*[local-name()='dataSource']/*[local-name()='type']/*[local-name()='queryType' and .='relational']"/>
  68. <xsl:variable name="strWarnShortcutProcessing">
  69. <xsl:call-template name="getLocalizedString">
  70. <xsl:with-param name="stringID" select="$MODELUPGRADE_WARN_SHORTCUT_PROCESSING"/>
  71. <xsl:with-param name="localeVal" select="$defaultLocale"/>
  72. </xsl:call-template>
  73. </xsl:variable>
  74. </xsl:stylesheet>