Changeset 6835
- Timestamp:
- 11/23/15 10:49:56 (8 years ago)
- Location:
- SMC/trunk/SMC/src/xsl
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
SMC/trunk/SMC/src/xsl/dcr_dcif2terms.xsl
r3472 r6835 41 41 --> 42 42 43 <!-- handling compressed dcif-format 44 <dcif:dataCategory definition="start time of recording" identifier="recordingTime" 45 name="recording time" owner="Reichel, Uwe" pid="http://www.isocat.org/datcat/DC-4521" 46 type="complex" version="1:0"> 47 <dcif:conceptualDomain type="constrained"> 48 <dcif:dataType>string</dcif:dataType> 49 <dcif:ruleType>XML Schema regular expression</dcif:ruleType> 50 <dcif:rule>([01][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]</dcif:rule> 51 </dcif:conceptualDomain> 52 </dcif:dataCategory> 53 --> 43 44 <xd:doc xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"> 45 <xd:desc> 46 <xd:p>handling compressed dcif-format</xd:p> 47 <xd:pre> 48 <dcif:dataCategory definition="start time of recording" identifier="recordingTime" 49 name="recording time" owner="Reichel, Uwe" pid="http://www.isocat.org/datcat/DC-4521" 50 type="complex" version="1:0"> 51 <dcif:conceptualDomain type="constrained"> 52 <dcif:dataType>string</dcif:dataType> 53 <dcif:ruleType>XML Schema regular expression</dcif:ruleType> 54 <dcif:rule>([01][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]</dcif:rule> 55 </dcif:conceptualDomain> 56 </dcif:dataCategory> 57 </xd:pre> 58 </xd:desc> 59 60 <xd:param name="set">the set from which the concept is coming (only valid value: 'isocat' (?))</xd:param> 61 </xd:doc> 54 62 <xsl:template match="dcif:dataCategory[@name]" > 55 63 <xsl:param name="set" /> … … 76 84 </xsl:template> 77 85 78 <!-- handling full dcif-format --> 86 <xd:doc xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"> 87 <xd:desc> 88 <xd:p>handling full dcif-format </xd:p> 89 <xd:p>TODO: should process all ocurring languages</xd:p> 90 </xd:desc> 91 <xd:param name="set"></xd:param> 92 </xd:doc> 79 93 <xsl:template match="dcif:dataCategory" > 80 94 <xsl:param name="set" /> … … 104 118 <Concept type="datcat" id="{@pid}" datcat-type="{@type}"> 105 119 <Term set="{$set}" type="mnemonic" > 120 <xsl:value-of select=".//dcif:identifier" /> 121 </Term> 122 <Term set="{$set}" type="mnemonic" xml:lang="{($n/*/xs:string(@xml:lang),$lang)[1]}" > 106 123 <xsl:value-of select="$n" /> 107 124 </Term> -
SMC/trunk/SMC/src/xsl/graph2json-d3.xsl
r3435 r6835 98 98 <xsl:text>, "value":</xsl:text> 99 99 <xsl:value-of select="@value"/> 100 <xsl:if test="exists(@weight)" > 101 <xsl:text>, "weight":</xsl:text> 102 <xsl:value-of select="@weight"/> 103 </xsl:if> 100 104 <!-- <xsl:text>{"source":"</xsl:text><xsl:value-of select="@from" /><xsl:text>", "target":"</xsl:text><xsl:value-of select="@to" /><xsl:text>", "value":</xsl:text><xsl:value-of select="$count" />--> 101 105 <xsl:text>}</xsl:text> -
SMC/trunk/SMC/src/xsl/smc2stats_datasets.xsl
r3481 r6835 24 24 25 25 26 <xsl:import href="smc_commons .xsl"/>26 <xsl:import href="smc_commons_vars.xsl"/> 27 27 28 28 <xsl:output method="xml" indent="yes" /> … … 30 30 <xsl:param name="title" select="'SMC Stats'" /> 31 31 32 <xsl:param name="parts" select="'overall,profiles,components,datcats,ambigue-terms,list'" /> 33 32 34 <!-- 33 35 … … 71 73 <xsl:template match="/"> 72 74 <multiresult> 73 <xsl:call-template name="summary-overall"></xsl:call-template>74 <xsl: call-template name="summary-profiles"></xsl:call-template>75 <xsl: call-template name="summary-components"></xsl:call-template>76 <xsl: call-template name="summary-datcats"></xsl:call-template>77 <xsl: call-template name="ambigue-terms"></xsl:call-template>75 <xsl:if test="contains($parts, 'overall')" ><xsl:call-template name="summary-overall"></xsl:call-template></xsl:if> 76 <xsl:if test="contains($parts, 'profiles')" ><xsl:call-template name="summary-profiles"></xsl:call-template></xsl:if> 77 <xsl:if test="contains($parts, 'components')" ><xsl:call-template name="summary-components"></xsl:call-template></xsl:if> 78 <xsl:if test="contains($parts, 'datcats')" ><xsl:call-template name="summary-datcats"></xsl:call-template></xsl:if> 79 <xsl:if test="contains($parts, 'ambigue-terms')" ><xsl:call-template name="ambigue-terms"></xsl:call-template></xsl:if> 78 80 </multiresult> 79 81 <!-- <xsl:call-template name="summary-concepts"></xsl:call-template> … … 99 101 <ds:label key="elems-without-datcats">Elements without DatCats</ds:label> 100 102 <ds:label key="elems-without-datcats-ratio" >ratio of elements without DatCats</ds:label> 101 <!-- <ds:label key="distinct-datcats">distinct used Data Categories</ds:label>-->103 <ds:label key="distinct-datcats">distinct used Data Categories</ds:label> 102 104 <ds:label key="used-concepts">used Concept</ds:label> 103 105 <ds:label key="available-concepts">available Concepts (in Metadata profile or used in CMD)</ds:label> … … 120 122 <ds:value key="elems-without-datcats-ratio" formatted="{format-number($elems-distinct-without-datcats-ratio, '0.00 %')}"> 121 123 <xsl:value-of select="$elems-distinct-without-datcats-ratio"/></ds:value> 122 <!-- <ds:value key="distinct-datcats"><xsl:value-of select="$count_distinct_datcats"/></ds:value>-->124 <ds:value key="distinct-datcats"><xsl:value-of select="$count_distinct_datcats"/></ds:value> 123 125 <ds:value key="used-concepts"><xsl:value-of select="count($dcr-cmd-map//Concept)"/></ds:value> 124 126 <!-- <ds:value key="blind-concepts"><xsl:value-of select="count(//Concept[not(Term[@set='isocat'])])"/></ds:value>--> … … 213 215 <xsl:with-param name="key">distinct-datcats</xsl:with-param> 214 216 <xsl:with-param name="type">datcat</xsl:with-param> 215 <xsl:with-param name="data" select="distinct-values(./Term[@type='CMD_Element']/@datcat[not(.='')])"></xsl:with-param> 217 <!-- <xsl:with-param name="data" select="distinct-values(./Term[@type='CMD_Element']/@datcat[not(.='')])"></xsl:with-param>--> 218 <xsl:with-param name="data" select="distinct-values(./Term/data(@datcat[not(.='')]))"></xsl:with-param> 216 219 </xsl:call-template> 217 220 218 <!-- <ds:value key=""><xsl:value-of select="$count_distinct_datcats"/></ds:value>--> 221 <!-- <ds:value key=""><xsl:value-of select="$count_distinct_datcats"/></ds:value>--> 219 222 <ds:value key="elems-with-datcats"><xsl:value-of select="count(./Term[@type='CMD_Element']/@datcat[not(.='')])"/></ds:value> 220 223 <ds:value key="elems-without-datcats"><xsl:value-of select="count(./Term[@type='CMD_Element'][@datcat=''])"/></ds:value> 224 <!-- <ds:value key="comp-with-datcats"><xsl:value-of select="count(./Term[@type='CMD_Components']/@datcat[not(.='')])"/></ds:value>--> 221 225 <xsl:variable name="elems-without-datcats-ratio" select="if($count_elems > 0) then count(./Term[@type='CMD_Element'][@datcat='']) div $count_elems else 0"></xsl:variable> 222 226 <ds:value key="elems-without-datcats-ratio" formatted="{format-number($elems-without-datcats-ratio, '0.00 %')}"> … … 283 287 id="#applicationType">AnnotationTool.applicationType</Term>--> 284 288 <xsl:for-each select="$dcr-cmd-map//Concept" > 285 <xsl:sort select="lower-case(Term[@type='label'][1])" order="ascending"/> 289 <!-- <xsl:sort select="lower-case(Term[@type=('label','mnemonic')][1])" order="ascending"/>--> 290 <xsl:sort select="count(distinct-values(Term[@type='full-path']/@schema))" data-type="number" order="descending"/> 291 286 292 287 293 <xsl:variable name="def" select="$dcr-terms//Concept[@id=current()/@id]/info[1]" ></xsl:variable> … … 289 295 <xsl:variable name="profiles" select="distinct-values(Term[@type='full-path']/@schema)" ></xsl:variable> 290 296 291 <ds:dataseries key="{@id}" label="{ Term[@type='label'][1]}" >297 <ds:dataseries key="{@id}" label="{concat(Term[@type=('label','mnemonic')][1],' [', my:shortURL(@id), ']')}" > 292 298 <!-- <ds:value key="distinct-components"><xsl:value-of select="$count_distinct_components"/></ds:value>--> 293 299 294 <ds:value key="def"><xsl:value-of select="$def"/></ds:value> 300 <ds:value key="def"><xsl:value-of select="$def"/></ds:value> 295 301 <xsl:call-template name="list"> 296 302 <xsl:with-param name="key" >used-in-profiles</xsl:with-param> … … 423 429 <xsl:param name="type" ></xsl:param> 424 430 <xsl:param name="data" ></xsl:param> 425 426 431 <xsl:variable name="processed_data"> 427 432 <xsl:choose> … … 474 479 </xsl:variable> 475 480 <ds:value key="{$key}" abs="{count($processed_data/*)}" > 476 <ds:list> 477 <xsl:for-each select="$processed_data/*" > 478 <xsl:sort select="lower-case(.)" ></xsl:sort> 479 <!--<xsl:variable name="profile-name" select="$all_profiles[@id=current()]/@name"></xsl:variable>--> 480 <!-- <li><a href="#{.}" ><xsl:value-of select="$profile-name" /></a></li>--> 481 <xsl:copy-of select="."></xsl:copy-of> 482 </xsl:for-each> 483 </ds:list> 481 <xsl:if test="contains($parts,'list')" > 482 483 <ds:list> 484 <xsl:for-each select="$processed_data/*" > 485 <xsl:sort select="lower-case(.)" ></xsl:sort> 486 <!--<xsl:variable name="profile-name" select="$all_profiles[@id=current()]/@name"></xsl:variable>--> 487 <!-- <li><a href="#{.}" ><xsl:value-of select="$profile-name" /></a></li>--> 488 <xsl:copy-of select="."></xsl:copy-of> 489 </xsl:for-each> 490 </ds:list> 491 </xsl:if> 484 492 </ds:value> 485 493 </xsl:template> -
SMC/trunk/SMC/src/xsl/smc_commons.xsl
r5213 r6835 69 69 <xsl:with-param name="message">getData writing to: <xsl:value-of select="$cache_path"></xsl:value-of></xsl:with-param> 70 70 </xsl:call-template> 71 72 <xsl:result-document href="{$cache_path}" format="xml" >71 72 <xsl:result-document href="{$cache_path}" format="xml" > 73 73 <xsl:sequence select="$result" /> 74 74 </xsl:result-document> -
SMC/trunk/SMC/src/xsl/terms2graph.xsl
r3527 r6835 26 26 </xd:doc> 27 27 28 <xsl:output method="xml" encoding="utf-8" />28 <xsl:output method="xml" encoding="utf-8" indent="yes"/> 29 29 30 30 <xd:doc xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"> … … 34 34 <xd:p>recognized values: collections,components,profile-groups,datcats,relations (delimited by ',')</xd:p> 35 35 <xd:p>if datcats and no components - direct links between profiles and datcats are generated</xd:p> 36 <xd:p>if no datcats and no components - direct links between profiles are generated (weighted by the number of shared data categories</xd:p> 36 37 <xd:p>profile-groups generates extra nodes grouping profiles by metadata (creatore, groupName, domainName)</xd:p> 37 38 </xd:desc> 38 39 </xd:doc> 39 40 <!-- <xsl:param name="parts" select="'profile-groups'"/>--> 41 <xsl:param name="debug" select="false()"/> 40 42 <xsl:param name="parts" select="'collections,profile-groups,components,datcats,relations'"/> 41 43 <xsl:variable name="parts-sequence" select="tokenize($parts,',')"></xsl:variable> … … 47 49 </xd:doc> 48 50 <xsl:param name="profiles" select="''"/> <!--teiHeader--> 51 52 <xd:doc xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"> 53 <xd:desc> 54 <xd:p>threshold for the similarity quotient (matched_datcats : profile_terms), when linking profiles (mode=edges-profiles)</xd:p> 55 </xd:desc> 56 </xd:doc> 57 <xsl:param name="match_threshold" select="0.5"/> 58 49 59 50 60 … … 110 120 </xd:doc> 111 121 <xsl:key name="cmd-terms-path" match="Term" use="@path"/> 122 123 <xsl:key name="cmd-terms-datcat" match="Term" use="@datcat"/> 112 124 113 125 <xd:doc xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"> … … 207 219 <xsl:if test="'datcats' = $parts-sequence and 'components' = $parts-sequence" ><xsl:apply-templates select="$enriched-termsets//Term" mode="edges-datcats"/></xsl:if> 208 220 <xsl:if test="'datcats' = $parts-sequence and not('components' = $parts-sequence)" ><xsl:apply-templates select="$enriched-termsets//Term" mode="edges-profiles-datcats"/></xsl:if> 221 <xsl:if test="not('datcats' = $parts-sequence) and not('components' = $parts-sequence)" ><xsl:apply-templates select="$enriched-termsets//Termset[@type='CMD_Profile']" mode="edges-profiles"/></xsl:if> 209 222 <xsl:if test="'relations' = $parts-sequence" ><xsl:apply-templates select="$rr-relations//Relation" mode="edges-rels"/></xsl:if> 210 223 <xsl:if test="'profile-groups' = $parts-sequence"> … … 221 234 <xsl:variable name="distinct-edges"> 222 235 <xsl:for-each-group select="$edges/*" group-by="concat(@from, @to)"> 223 <xsl:variable name="count" select="count(current-group())"/> 236 <xsl:variable name="value" select="if (exists(@value)) then sum(@value) else count(current-group())"/> 237 <xsl:variable name="weight" select="if (exists(@weight)) then sum(@weight) else 1"/> 224 238 <xsl:variable name="ix_from" select="$distinct-nodes/*[@key=current()/@from]/@position - 1 "/> 225 239 <xsl:variable name="ix_to" select="$distinct-nodes/*[@key=current()/@to]/@position - 1"/> 226 <edge ix_from="{$ix_from}" ix_to="{$ix_to}" from="{@from}" to="{@to}" value="{$ count}"/>240 <edge ix_from="{$ix_from}" ix_to="{$ix_to}" from="{@from}" to="{@to}" value="{$value}" weight="{$weight}"/> 227 241 </xsl:for-each-group> 228 242 </xsl:variable> 229 243 <xsl:variable name="graph"> 230 244 <graph> 231 <nodes count="{count($filtered-termsets//Term)}"> 245 <!-- <nodes count="{count($filtered-termsets//Term)}">--> 246 <nodes count="{count($distinct-nodes)}"> 232 247 233 248 <!-- <xsl:copy-of select="$dcr-terms-copy"/>--> … … 237 252 <edges> 238 253 <xsl:copy-of select="$distinct-edges"/> 239 <!-- <debug><xsl:copy-of select="$edges"/></debug>-->254 <xsl:if test="$debug"><debug><xsl:copy-of select="$edges"/></debug></xsl:if> 240 255 </edges> 241 256 </graph> … … 256 271 257 272 <xsl:variable name="current_profile_key" select="my:normalize(@id)"/> 258 <node id="{@id}" key="{$current_profile_key}" name="{@name}" type="Profile" level="0" count="{ @count}" path="{@path}">273 <node id="{@id}" key="{$current_profile_key}" name="{@name}" type="Profile" level="0" count="{(@count, count(.//Term))[1]}" path="{@path}"> 259 274 <!-- <xsl:value-of select="$equivalent_schema_term"></xsl:value-of>--> 260 275 </node> … … 262 277 <xsl:if test="xs:string(@id) ne Term/xs:string(@id)"> 263 278 <xsl:for-each select="Term"> 264 <node id="{@id}" key="{my:normalize(@id)}" name="{@name}" type="Component" level="1" count="{ @count}" path="{@path}"/>279 <node id="{@id}" key="{my:normalize(@id)}" name="{@name}" type="Component" level="1" count="{(@count, count(.//Term))[1]}" path="{@path}"/> 265 280 </xsl:for-each> 266 281 </xsl:if> … … 470 485 <xsl:variable name="current_profile_key" select="my:normalize(ancestor::Termset/@id)"/> 471 486 <edge from="{$current_profile_key}" to="{my:normalize(@datcat)}"/> 487 </xsl:template> 488 489 <xd:doc xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"> 490 <xd:desc> 491 <xd:p>create direct links between profiles based on shared Datcats</xd:p> 492 </xd:desc> 493 </xd:doc> 494 <xsl:template match="Termset[@type='CMD_Profile']" mode="edges-profiles"> 495 <xsl:variable name="current_profile_key" select="my:normalize(@id)"/> 496 <xsl:variable name="current_profile_name" select="@name"/> 497 <xsl:variable name="profile_datcats" select="distinct-values(.//Term/data(@datcat)[not(.='')])"/> 498 <xsl:variable name="profile_terms" select=".//Term/data(@id)"/> 499 <!-- <edge from="{$current_profile_key}" weight="{count($profile_datcats)}"/>--> 500 <xsl:for-each select="following-sibling::Termset" > 501 <xsl:variable name="other_profile_key" select="my:normalize(@id)"/> 502 <xsl:variable name="matching_datcats" select="distinct-values(.//Term[not(@datcat='')][@datcat=$profile_datcats]/data(@datcat))"/> 503 <xsl:variable name="other_datcats" select="distinct-values(.//Term[not(@datcat='')]/data(@datcat))"/> 504 <xsl:variable name="matching_terms" select="distinct-values(.//Term[@id=$profile_terms]/data(@id))"/> 505 <!--<xsl:variable name="matching_datcats"> 506 <xsl:copy-of select=".//Term[key('cmd-terms-datcat',$profile_datcats)]"/> 507 </xsl:variable>--> 508 <!-- <xsl:if test="exists($matching_datcats)" > --> 509 <xsl:variable name="match_quotient1" select="if (exists($profile_datcats)) then count($matching_datcats) div count($profile_datcats) else 0 " /> 510 <xsl:variable name="match_quotient2" select="if (exists($other_datcats)) then count($matching_datcats) div count($other_datcats) else 0" /> 511 <xsl:variable name="match_quotient" select="number(($match_quotient1 + $match_quotient2) div 2)" /> 512 513 <xsl:if test="number($match_quotient) > number($match_threshold)" > 514 <!--<xsl:if test="not(number($match_quotient) = number($match_quotient))" > 515 <xsl:message>DEBUG: <xsl:value-of select="$match_quotient"></xsl:value-of> </xsl:message> 516 </xsl:if>--> 517 <!-- weight="{count($matching_datcats) + count($matching_terms)}"--> 518 <edge from="{$current_profile_key}" to="{$other_profile_key}" 519 from_name="{$current_profile_name}" to_name="{data(@name)}" 520 value="{count($matching_datcats)}" 521 weight="{$match_quotient}" 522 count_matching_distinct_terms="{count($matching_terms)}" match_quotient="{$match_quotient}" 523 count_matching_datcats="{count($matching_datcats)}" 524 count_profile_datcats="{count($profile_datcats)}" 525 count_other_datcats="{count($other_datcats)}" 526 count_terms="{count($profile_terms)}" 527 count_other_terms="{count(.//Term)}" 528 > 529 <!--DEBUG: 530 <xsl:copy-of select="$matching_datcats"></xsl:copy-of>--> 531 </edge> 532 </xsl:if> 533 534 </xsl:for-each> 535 472 536 </xsl:template> 473 537
Note: See TracChangeset
for help on using the changeset viewer.