Changeset 3480


Ignore:
Timestamp:
08/28/13 12:30:13 (11 years ago)
Author:
vronk
Message:

simplified Term to node, corrected type (parts=relations)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • SMC/trunk/SMC/src/xsl/terms2graph.xsl

    r3469 r3480  
    198198            <xsl:if test="'datcats' = $parts-sequence and 'components' = $parts-sequence" ><xsl:apply-templates select="$enriched-termsets//Term" mode="edges-datcats"/></xsl:if>
    199199            <xsl:if test="'datcats' = $parts-sequence and not('components' = $parts-sequence)" ><xsl:apply-templates select="$enriched-termsets//Term" mode="edges-profiles-datcats"/></xsl:if>
    200             <xsl:if test="'relation' = $parts-sequence" ><xsl:apply-templates select="$rr-relations//Relation" mode="edges-rels"/></xsl:if>           
     200            <xsl:if test="'relations' = $parts-sequence" ><xsl:apply-templates select="$rr-relations//Relation" mode="edges-rels"/></xsl:if>           
    201201            <xsl:if test="'profile-groups' = $parts-sequence">
    202202                <xsl:apply-templates select="$enriched-termsets//info/(groupName | domainName | creatorName)[. ne '']" mode="edges-profiles-groups"/>
     
    205205        <xsl:variable name="distinct-nodes">
    206206            <xsl:for-each-group select="$nodes/*" group-by="@key">
    207                 <node position="{position()}" count="{(sum(current-group()/@count[number(.)=number(.)]), count(current-group()))[1]}" avg_level="{avg(current-group()/@level)}" sum_level="{sum(current-group()/@level)}">
     207                <node position="{position()}" count="{(sum(current-group()/@count[. ne ''][number(.)=number(.)])[.>0], count(current-group()))[1]}" avg_level="{avg(current-group()/@level)}" sum_level="{sum(current-group()/@level)}">
    208208                    <xsl:copy-of select="@*[not (name()='count')]"/>
    209209                </node>
     
    224224<!--                                                            <xsl:copy-of select="$dcr-terms-copy"/>-->
    225225                    <xsl:copy-of select="$distinct-nodes"/>
     226<!--       DEBUG: <xsl:copy-of select="$nodes"/>-->
    226227                </nodes>
    227228                <edges>
     
    259260    <xd:doc xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl">
    260261        <xd:desc>
    261             <xd:p>Generate nodes for CMD-Components (and CMD-Profiles in instance-data) </xd:p>
     262            <xd:p>Generate nodes for CMD-Components and CMD-Elements (and CMD-Profiles in instance-data) </xd:p>
    262263            <xd:p>Expects Terms with @id-attribute, so instance data has to be enriched first</xd:p>
    263264            <xd:pre><Termset name="Bedevaartbank" id="clarin.eu:cr1:p_1280305685223" type="CMD_Profile">
     
    268269        </xd:desc>       
    269270    </xd:doc>
    270     <xsl:template match="Term[Term]" mode="nodes">
    271    
    272         <xsl:variable name="current_comp_key" select="my:normalize(@id)"/>
     271    <xsl:template match="Term" mode="nodes">
     272   
     273        <xsl:variable name="current_term_key" select="my:normalize(@id)"/>
    273274        <xsl:variable name="type">
    274275            <xsl:choose>
    275                 <xsl:when test="@type='CMD_Profile' or parent::Termset">Profile</xsl:when>
     276                <xsl:when test="@type='CMD_Profile' or parent::Termset[@context]">Profile</xsl:when>
    276277                <xsl:when test="@type='CMD_Component'">Component</xsl:when>
     278                <xsl:when test="@type='CMD_Element'">Element</xsl:when>
    277279                <!-- pass special types -->
    278280                <xsl:otherwise>
     
    282284        </xsl:variable>
    283285        <xsl:variable name="level" select="count(ancestor::Term)"/>
    284         <node id="{@id}" key="{$current_comp_key}" name="{@name}" type="{$type}" level="{$level}" count="{@count}" path="{@path}">
     286        <node id="{@id}" key="{$current_term_key}" name="{@name}" type="{$type}" level="{$level}" count="{@count}" path="{@path}">
    285287            <!--       <xsl:value-of select="$equivalent_schema_term"></xsl:value-of>-->
    286288        </node>
     
    310312    <xd:doc xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl">
    311313        <xd:desc>
     314            <xd:p>OBSOLETING in favor of more general template for all Term</xd:p>
    312315            <xd:p>Generate nodes for CMD-Elements (leaf nodes in cmd-terms)</xd:p>
     316            <xd:p>However, in the data there is also CMD_ComponentsGenerate nodes for CMD-Elements (leaf nodes in cmd-terms)</xd:p>
    313317            <xd:p>Expects Terms with @id-attribute, so instance data has to be enriched first</xd:p>
    314318            <xd:pre><Term type="CMD_Element" name="applicationType"
     
    321325        </xd:desc>       
    322326    </xd:doc>
    323     <xsl:template match="Term[not(Term)]" mode="nodes">       
     327    <!--<xsl:template match="Term[not(Term)]" mode="nodes">       
    324328        <xsl:variable name="current_elem_key" select="my:normalize(@id)"/>
    325329        <xsl:variable name="level" select="count(ancestor::Term)"/>
    326330        <xsl:variable name="type">
    327331            <xsl:choose>
    328                 <xsl:when test="@type='CMD_Element'">Element</xsl:when>               
    329                 <!-- pass special types -->
     332                <xsl:when test="@type='CMD_Element'">Element</xsl:when>
     333               
     334                <xsl:when test="@type='CMD_Component'">Component</xsl:when>               
     335                <!-\- pass special types -\->
    330336                <xsl:otherwise>
    331337                    <xsl:value-of select="@type"/>
     
    334340        </xsl:variable>
    335341        <node id="{@id}" key="{$current_elem_key}" name="{@name}" type="{$type}" level="{$level}" count="{@count}" path="{@path}"/>
    336 <!--        <xsl:message><xsl:value-of select="concat(@id, '-', ancestor::Term[1]/@id)"></xsl:value-of></xsl:message>-->
    337     </xsl:template>
     342<!-\-        <xsl:message><xsl:value-of select="concat(@id, '-', ancestor::Term[1]/@id)"></xsl:value-of></xsl:message>-\->
     343    </xsl:template>-->
    338344   
    339345    <xd:doc xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl">
     
    353359            <xsl:value-of select="if($get-mnemonic ne '') then $get-mnemonic else tokenize(@datcat,'/')[last()]"/>
    354360        </xsl:variable>
    355 <!--     DEBUG:get-mnemonic:<xsl:value-of select="$get-mnemonic"/>-->
    356         <node id="{$datcat-id}" key="{my:normalize($datcat-id)}" name="{$datcat-name}" type="DatCat" level="{$level}"/>
     361<!--     DEBUG:get-mnemonic:<xsl:value-of select=""/>-->
     362        <node id="{$datcat-id}" key="{my:normalize($datcat-id)}" name="{$datcat-name}" type="DatCat" level="{$level}"
     363            mnemonic="{$get-mnemonic}" ref_term_id="{@id}"/>
    357364    </xsl:template>
    358365   
Note: See TracChangeset for help on using the changeset viewer.