- Timestamp:
- 09/19/12 10:36:16 (12 years ago)
- Location:
- SMC/trunk/SMC/src/scripts
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
SMC/trunk/SMC/src/scripts/cmd_includes.xsl
r1657 r2235 55 55 <!-- <xsl:variable name="resolved_uri" select="concat($root_uri, '/', id)" />--> 56 56 <!--<xsl:variable name="resolved_uri" select="concat($cmd_profiles_uri , '/', my:extractID(id))" />--> 57 <xsl:variable name="resolved_uri" select="concat($cmd_profiles_uri , id )" />57 <xsl:variable name="resolved_uri" select="concat($cmd_profiles_uri , id, '/xml')" /> 58 58 59 59 <xsl:message>PROFILE: document-uri:<xsl:value-of select="document-uri(/)" /></xsl:message> -
SMC/trunk/SMC/src/scripts/dcr_rdf2terms.xsl
r1607 r2235 6 6 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 7 7 xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 8 xmlns:dcif="http://www.isocat.org/ns/dcif" 8 9 exclude-result-prefixes="dcr rdf rdfs" 9 10 > … … 24 25 <xsl:output method="xml" indent="yes" > </xsl:output> 25 26 26 <xsl:param name="isocat_prefix" select="'http://www.isocat.org/datcat/'"></xsl:param>27 <!-- <xsl:param name="isocat_prefix" select="'http://www.isocat.org/datcat/'"></xsl:param>--> 27 28 28 29 <!-- 29 30 decide based on the inner-structure, what it is and how to handle 30 31 --> 31 <xsl:template match="*" mode="dcr"> 32 <xsl:template match="*" mode="dcr"> 33 <xsl:param name="config-node" /> 32 34 <xsl:param name="set" /> 33 35 34 <Termset set="{$set}" >35 <xsl:apply-templates select="/rdf:RDF/rdf:Description | /rdf:RDF/rdf:Property ">36 <Termset set="{$set}" name="{$config-node/name}" url="{$config-node/url_prefix}" > 37 <xsl:apply-templates select="/rdf:RDF/rdf:Description | /rdf:RDF/rdf:Property | /dcif:dataCategorySelection/dcif:dataCategory "> 36 38 <xsl:with-param name="set" select="$set" /> 37 39 </xsl:apply-templates> 38 40 </Termset> 39 41 </xsl:template> 42 43 <xsl:template match="*" mode="rr"> 44 <xsl:param name="set" /> 45 46 <Termset set="{$set}"> 47 <xsl:apply-templates select="/rdf:RDF/rdf:Description" mode="rr"> 48 <xsl:with-param name="set" select="$set" /> 49 </xsl:apply-templates> 50 </Termset> 51 </xsl:template> 52 40 53 41 54 <!-- isocat.rdf --> … … 80 93 </Concept> 81 94 </xsl:template> 82 95 96 <!-- process relations from RR --> 97 <xsl:template match="rdf:Description" mode="rr"> 98 <xsl:param name="set" /> 99 <xsl:variable name="reltype" select= "*/name()" /> 100 <Relation type="{$reltype}" > 101 <Concept type="datcat" id="{@rdf:about}" role="about"></Concept> 102 <Concept type="datcat" id="{*/@rdf:resource}" ></Concept> 103 </Relation> 104 </xsl:template> 83 105 </xsl:stylesheet> -
SMC/trunk/SMC/src/scripts/dcr_smc2skos.xsl
r2225 r2235 13 13 exclude-result-prefixes="xs my" 14 14 > 15 <xsl:import href="smc_commons.xsl"/> 16 15 17 <xd:doc xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet"> 16 18 <xd:desc> … … 23 25 </xd:doc> 24 26 25 <xsl:import href="smc_commons.xsl"/> 27 26 28 27 29 <xd:doc xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"> -
SMC/trunk/SMC/src/scripts/smc_commons.xsl
r1876 r2235 7 7 <xsl:include href="cmd_includes.xsl"/> 8 8 <xsl:include href="dcr_rdf2terms.xsl"/> 9 <xsl:include href="dcr_dcif2terms.xsl"/> 9 10 10 11 <!-- use either input (precedence) or the config-file as the termsets configuration --> … … 26 27 <!-- intermediate datasets bound into variables,to prevent calling the function every time --> 27 28 <xsl:variable name="dcr-terms" select="my:getData('dcr-terms')" /> 29 <xsl:variable name="rr-relations" select="my:getData('rr-relations')" /> 30 <!-- rr-relations expanded with terms--> 31 <xsl:variable name="rr-terms" select="my:getData('rr-terms')" /> 28 32 <xsl:variable name="cmd-terms" select="my:getData('cmd-terms')" /> 33 <xsl:variable name="cmd-terms-nested" select="my:getData('cmd-terms-nested')" /> 29 34 <xsl:variable name="dcr-cmd-map" select="my:getData('dcr-cmd-map')" /> 30 35 <xsl:variable name="isocat-languages" select="my:getData('isocat-languages')" /> … … 41 46 <xsl:variable name="cached_data_file" select="concat($cache_dir, $key, '.xml')"></xsl:variable> 42 47 <xsl:message> 43 cache: <xsl:value-of select="$cache" /> 48 cache: <xsl:value-of select="$cache" /> - 44 49 <xsl:value-of select="$cached_data_file" />: <xsl:value-of select="doc-available($cached_data_file)" /> 45 50 </xsl:message> … … 48 53 <xsl:message>reading in: <xsl:value-of select="$cached_data_file" /> 49 54 </xsl:message> 50 <xsl:copy-of select="doc ument($cached_data_file)"></xsl:copy-of>55 <xsl:copy-of select="doc($cached_data_file)"></xsl:copy-of> 51 56 </xsl:when> 52 57 <xsl:when test="$key='cmd-profiles-raw'"> … … 57 62 </xsl:when> 58 63 <xsl:when test="$key='cmd-terms'"> 59 <xsl:copy-of select="my:profiles2termsets(my:getData('cmd-resolved')//profileDescription)" /> 60 </xsl:when> 64 <xsl:copy-of select="my:profiles2termsets(my:getData('cmd-resolved')//profileDescription,false())" /> 65 </xsl:when> 66 <xsl:when test="$key='cmd-terms-nested'"> 67 <xsl:copy-of select="my:profiles2termsets(my:getData('cmd-resolved')//profileDescription,true())" /> 68 </xsl:when> 69 <xsl:when test="$key='cmd-terms-nested-minimal'"> 70 <xsl:apply-templates select="$cmd-terms-nested" mode="min-context"></xsl:apply-templates> 71 </xsl:when> 61 72 <xsl:when test="$key='dcr-terms'"> 62 73 <xsl:call-template name="load-dcr" /> 63 74 </xsl:when> 75 <xsl:when test="$key='rr-relations'"> 76 <xsl:call-template name="load-rr-relations" /> 77 </xsl:when> 78 <xsl:when test="$key='rr-terms'"> 79 <xsl:call-template name="rr-terms" /> 80 </xsl:when> 64 81 <xsl:when test="$key='termsets'"> 65 82 <xsl:call-template name="termsets" /> … … 94 111 <xsl:variable name="dcr_termset" select="document(url)" /> 95 112 <xsl:apply-templates select="$dcr_termset" mode="dcr" > 113 <xsl:with-param name="config-node" select="."></xsl:with-param> 96 114 <xsl:with-param name="set" select="key"></xsl:with-param> 97 115 </xsl:apply-templates> … … 100 118 </xsl:template> 101 119 120 102 121 <!-- invert the profiles-termsets + match with data from DCRs = create map datcat -> cmd-elements[] --> 103 122 <xsl:template name="dcr-cmd-map"> … … 105 124 <xsl:for-each-group select="$cmd-terms//Term[not(@datcat='')]" group-by="@datcat"> 106 125 <Concept id="{@datcat}" type="datcat"> 107 <xsl:copy-of select="$dcr-terms//Concept[@id=current()/@datcat]/Term" />126 <xsl:copy-of select="$dcr-terms//Concept[@id=current()/@datcat]/Term" exclude-result-prefixes="my" /> 108 127 <xsl:for-each select="current-group()"> 109 128 <xsl:variable name="parent_profile" select="ancestor::Termset[@type='CMD_Profile']/@id" /> … … 154 173 </xsl:template> 155 174 175 <!-- load relation sets from the configuration and transform into Termset/Relation/Concepet 176 (uses mode=rr-templates in dcr_rdf2terms.xsl) --> 177 <xsl:template name="load-rr-relations"> 178 <Termsets type="rr"> 179 <xsl:for-each select="$termsets_config//*[type='rr']" > 180 <xsl:variable name="rr_termset" select="document(url)" /> 181 <xsl:apply-templates select="$rr_termset" mode="rr" > 182 <xsl:with-param name="set" select="key"></xsl:with-param> 183 </xsl:apply-templates> 184 </xsl:for-each> 185 </Termsets> 186 </xsl:template> 187 188 <!-- take the rr-relations and expand them with data from dcr-cmd-terms, 189 to get rr-expanded terms --> 190 <xsl:template name="rr-terms"> 191 <xsl:apply-templates select="$rr-relations" mode="rr-expand" ></xsl:apply-templates> 192 </xsl:template> 193 194 <xsl:template match="*" mode="rr-expand"> 195 <xsl:copy> 196 <xsl:copy-of select="@*" /> 197 <xsl:apply-templates mode="rr-expand"></xsl:apply-templates> 198 </xsl:copy> 199 </xsl:template> 200 <!-- expand rr-concepts--> 201 <xsl:template match="Concept" mode="rr-expand"> 202 <xsl:variable name="concept-id" select="@id" /> 203 <xsl:copy> 204 <xsl:copy-of select="@*" /> 205 <xsl:copy-of select="$dcr-cmd-map//Concept[@id=$concept-id]/Term" /> 206 </xsl:copy> 207 </xsl:template> 208 156 209 <!-- return a property of a Termset from the configuration. --> 157 210 <xsl:function name="my:config"> … … 160 213 <xsl:value-of select="$termsets_config//*[key=$key]/*[name()=$property]"></xsl:value-of> 161 214 </xsl:function> 215 216 162 217 </xsl:stylesheet> -
SMC/trunk/SMC/src/scripts/smc_op.xsl
r1683 r2235 15 15 <xsl:param name="context">*</xsl:param> 16 16 <xsl:param name="term"></xsl:param> 17 <xsl:param name="relset"></xsl:param> 17 18 <!--<xsl:param name="lang">pt</xsl:param>--> 18 19 … … 22 23 <xsl:when test="$operation='map'"> 23 24 <Terms> 24 <xsl:variable name="matching_concepts" select="$dcr-cmd-map//Concept[Term=$term]"></xsl:variable> 25 <xsl:variable name="matching_concepts" > 26 <xsl:choose> 27 <xsl:when test="$relset=''"> 28 <xsl:copy-of select="$dcr-cmd-map//Concept[Term/lower-case(text())=lower-case($term)]" /> 29 </xsl:when> 30 <xsl:otherwise> 31 <xsl:variable name="matching-concept" select="$dcr-cmd-map//Concept[Term/lower-case(text())=lower-case($term)]" /> 32 <!-- this returns both, the original concept and the expanded/related one --> 33 <xsl:variable name="related-concepts" select="$rr-relations//Termset[@set='rr-cmdi']//Concept[@id=$matching-concept/@id]/parent::Relation/Concept" /> 34 <xsl:copy-of select="$dcr-cmd-map//Concept[@id = $related-concepts/@id]" /> 35 </xsl:otherwise> 36 </xsl:choose> 37 38 </xsl:variable> 25 39 <xsl:for-each select="$matching_concepts//Term[@set='cmd']"> 26 40 <xsl:copy-of select="." />
Note: See TracChangeset
for help on using the changeset viewer.