- Timestamp:
- 12/16/11 20:20:28 (12 years ago)
- Location:
- SMC/trunk/SMC/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
SMC/trunk/SMC/src/eu/clarin/cmdi/smc/SMC.java
r1660 r1671 262 262 transformer.configure(Utils.getAppConfig(appname), this.getClass().getClassLoader()); 263 263 264 264 log.debug("term: " + term); 265 265 addParam("operation", "map"); 266 266 addParam("term", term); -
SMC/trunk/SMC/src/scripts/smc_commons.xsl
r1653 r1671 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 xmlns:xs="http://www.w3.org/2001/XMLSchema" 4 xmlns:my="myFunctions" 5 exclude-result-prefixes="xs" 6 version="2.0"> 2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" 3 xmlns:my="myFunctions" exclude-result-prefixes="xs my" version="2.0"> 7 4 8 5 <xsl:include href="smc_params.xsl"/> … … 26 23 <xsl:variable name="cmd_components_uri" select="my:config('cmd-components','url')" /> 27 24 <xsl:variable name="cmd_profiles_uri" select="my:config('cmd-profiles','url')" /> 28 29 <!-- intermediate datasets bound into variables,to prevent calling the function every time -->30 25 26 <!-- intermediate datasets bound into variables,to prevent calling the function every time --> 31 27 <xsl:variable name="dcr-terms" select="my:getData('dcr-terms')" /> 32 28 <xsl:variable name="cmd-terms" select="my:getData('cmd-terms')" /> 33 29 <xsl:variable name="dcr-cmd-map" select="my:getData('dcr-cmd-map')" /> 34 30 <xsl:variable name="isocat-languages" select="my:getData('isocat-languages')" /> 35 31 36 <!-- 37 serves individual datasets (cmd-profiles, dcr-termsets...) 32 <!-- serves individual datasets (cmd-profiles, dcr-termsets...) 38 33 primitive cache mechanism - 39 34 if data of given key is already stored, serve it, 40 35 otherwise build a new (but don't store in cache - within this function) 41 regard the cache-param - beware of the param-value in recursive calls (currently 'use' is fixed for deeper calls) 42 --> 43 44 <xsl:function name="my:getData"> 36 regard the cache-param - beware of the param-value in recursive calls (currently 'use' is fixed for deeper calls) --> 37 <xsl:function name="my:getData"> 45 38 <xsl:param name="key"></xsl:param> 46 39 <xsl:param name="cache"></xsl:param> … … 72 65 <xsl:call-template name="termsets" /> 73 66 </xsl:when> 67 <xsl:when test="$key='isocat-languages'"> 68 <xsl:copy-of select="document(my:config('isocat-languages','url'))" /> 69 </xsl:when> 74 70 <xsl:when test="$key='dcr-cmd-map'"> 75 71 <xsl:call-template name="dcr-cmd-map" /> … … 82 78 <diagnostics>unknown data: <xsl:value-of select="$key" /></diagnostics> 83 79 </xsl:otherwise> 84 </xsl:choose> 85 80 </xsl:choose> 86 81 </xsl:function> 87 82 … … 92 87 </xsl:function> 93 88 94 95 89 <!-- load all dcrs from the configuration and transform them into Termsets 96 (uses mode=dcr-templates in dcr_rdf2terms.xsl) 97 --> 90 (uses mode=dcr-templates in dcr_rdf2terms.xsl) --> 98 91 <xsl:template name="load-dcr"> 99 92 <Termsets type="dcr"> … … 102 95 <xsl:apply-templates select="$dcr_termset" mode="dcr" > 103 96 <xsl:with-param name="set" select="key"></xsl:with-param> 104 </xsl:apply-templates> 105 97 </xsl:apply-templates> 106 98 </xsl:for-each> 107 99 </Termsets> 108 100 </xsl:template> 109 101 110 <!-- 111 invert the profiles-termsets + match with data from DCRs = create map datcat -> cmd-elements[] 112 --> 102 <!-- invert the profiles-termsets + match with data from DCRs = create map datcat -> cmd-elements[] --> 113 103 <xsl:template name="dcr-cmd-map"> 114 104 <Termset type="dcr-cmd-map" > 115 105 <xsl:for-each-group select="$cmd-terms//Term[not(@datcat='')]" group-by="@datcat"> 116 106 <Concept id="{@datcat}" type="datcat"> 117 <xsl:copy-of select="$dcr-terms//Concept[@id=current()/@datcat]/Term" /> 118 107 <xsl:copy-of select="$dcr-terms//Concept[@id=current()/@datcat]/Term" /> 119 108 <xsl:for-each select="current-group()"> 120 109 <xsl:variable name="parent_profile" select="ancestor::Termset[@type='CMD_Profile']/@id" /> … … 129 118 <!-- list dcr-termsets + cmd (+ cmd-profiles) 130 119 TODO: missing: isocat@langs, RR-sets --> 131 <xsl:template name="termsets"> 120 <xsl:template name="termsets"> 132 121 <Termsets type="list"> 133 122 <!-- add dcr-termsets directly from config --> 134 <xsl:for-each select="$termsets_config//*[type='dcr'] " >123 <xsl:for-each select="$termsets_config//*[type='dcr'][not(key='isocat')]" > 135 124 <Termset> 136 125 <xsl:copy-of select="*" /> 137 126 </Termset> 127 </xsl:for-each> 128 <xsl:for-each select="$termsets_config//*[type='dcr'][key='isocat']" > 129 <Termset> 130 <xsl:copy-of select="*" /> 131 <xsl:for-each select="$isocat-languages/languages/language" > 132 <Termset> 133 <!-- name="Finnish" search="finnish" tag="fi"--> 134 <key>isocat-<xsl:value-of select="@tag"></xsl:value-of></key> 135 <name>ISOcat <xsl:value-of select="@name"></xsl:value-of></name> 136 </Termset> 137 </xsl:for-each> 138 </Termset> 138 139 </xsl:for-each> 140 139 141 <Termset type="cmd"> 140 142 <xsl:for-each select="$cmd-terms//Termset" > … … 152 154 </xsl:template> 153 155 154 <!-- 155 return a property of a Termset from the configuration. 156 --> 156 <!-- return a property of a Termset from the configuration. --> 157 157 <xsl:function name="my:config"> 158 158 <xsl:param name="key"></xsl:param> … … 160 160 <xsl:value-of select="$termsets_config//*[key=$key]/*[name()=$property]"></xsl:value-of> 161 161 </xsl:function> 162 163 164 162 </xsl:stylesheet> -
SMC/trunk/SMC/src/scripts/smc_params.xsl
r1665 r1671 9 9 10 10 <!-- used to config smc_init.xsl --> 11 <!-- allowed values: cmd-profiles-raw , cmd-resolved, cmd-terms, dcr-terms, dcr-cmd-map -->11 <!-- allowed values: cmd-profiles-raw , cmd-resolved, cmd-terms, dcr-terms, dcr-cmd-map, isocat-languages --> 12 12 <xsl:param name="data_key" select="'termsets'" /> 13 13 … … 15 15 <xsl:param name="cache" select="'use'" /> 16 16 <!-- <xsl:param name="cache_dir" select="'file:/C:/Users/m/3lingua/clarin/CMDI/SMC/cache/'" />--> 17 <xsl:variable name="cache_dir" select="'file:/C:/Users/m/3lingua/clarin/CMDI/SMC/cache/'" /> 18 17 <xsl:variable name="cache_dir" select="'file:/C:/Users/m/3lingua/clarin/CMDI/_repo2/SMC/data/'" /> 19 18 </xsl:stylesheet> -
SMC/trunk/SMC/src/smc_config.xml
r1665 r1671 30 30 </item> 31 31 <item> 32 <!-- no "standard" type, because this is for special handling of isocat --> 33 <type>dcrx</type> 34 <key>isocat-languages</key> 35 <name>ISOcat Languages</name> 36 <url>http://www.isocat.org/rest/info/languages.xml</url> 37 <url_prefix></url_prefix> 38 <format>rdf</format> 39 </item> 40 <item> 32 41 <type>dcr</type> 33 42 <key>dce</key>
Note: See TracChangeset
for help on using the changeset viewer.