<commit_before><?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sparql="http://www.w3.org/2005/sparql-results#">
    <xsl:output method="text" encoding="UTF-8"/>
    <xsl:param name="handler" select="'google.visualization.Query.setResponse'" />
    <xsl:param name="reqId" select="'0'" />
    <xsl:template match="sparql:sparql">
        <xsl:value-of select="$handler" />
        <xsl:text>({version:'0.6',reqId:'</xsl:text>
        <xsl:value-of select="$reqId" />
        <xsl:text>',status:'ok',table:{</xsl:text>
        <xsl:apply-templates select="sparql:head" />
        <xsl:text>,</xsl:text>
        <xsl:apply-templates select="sparql:results" />
        <xsl:text>}});</xsl:text>
    </xsl:template>
    <xsl:template match="sparql:head">
        <xsl:text>cols:[</xsl:text>
        <xsl:apply-templates select="sparql:variable" />
        <xsl:text>]</xsl:text>
    </xsl:template>
    <xsl:template match="sparql:variable">
        <xsl:variable name="name" select="@name"/>
        <xsl:variable name="datatype" select="/sparql:sparql/sparql:results/sparql:result[1]/sparql:binding[@name=$name]/sparql:literal/@datatype" />
        <xsl:variable name="local" select="substring-after($datatype, '#')" />
        <xsl:text>{id:'</xsl:text>
        <xsl:value-of select="$name" />
        <xsl:text>',label:'</xsl:text>
        <xsl:value-of select="translate($name,'_',' ')" />
        <xsl:text>',type:'</xsl:text>
        <xsl:choose>
            <xsl:when test="not(starts-with($datatype, 'http://www.w3.org/2001/XMLSchema#'))">
                <xsl:text>string</xsl:text>
            </xsl:when>
            <xsl:when test="$local='boolean'">
                <xsl:text>boolean</xsl:text>
            </xsl:when>
            <xsl:when test="$local='date'">
                <xsl:text>date</xsl:text>
            </xsl:when>
            <xsl:when test="$local='dateTime'">
                <xsl:text>datetime</xsl:text>
            </xsl:when>
            <xsl:when test="$local='time'">
                <xsl:text>timeofday</xsl:text>
            </xsl:when>
            <xsl:when test="$local='float' or $local='decimal' or $local='double' or $local='integer' or $local='long' or $local='int' or $local='short' or $local='byte' or $local='nonPositiveInteger' or $local='negativeInteger' or $local='nonNegativeInteger' or $local='positiveInteger' or $local='unsignedLong' or $local='unsignedInt' or $local='unsignedShort' or $local='unsignedByte'">
                    <xsl:text>number</xsl:text>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>string</xsl:text>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:text>'}</xsl:text>
        <xsl:if test="position() != last()">
            <xsl:text>,</xsl:text>
        </xsl:if>
    </xsl:template>
    <xsl:template match="sparql:results">
        <xsl:text>rows:[</xsl:text>
        <xsl:apply-templates select="sparql:result" />
        <xsl:text>]</xsl:text>
    </xsl:template>
    <xsl:template match="sparql:result">
        <xsl:text>{c:[</xsl:text>
        <xsl:variable name="current" select="."/> 
        <xsl:for-each select="../../sparql:head/sparql:variable">
            <xsl:variable name="name" select="@name"/>
            <xsl:if test="not($current/sparql:binding[@name=$name])">
                <xsl:text>{v:''}</xsl:text>
            </xsl:if>
            <xsl:apply-templates select="$current/sparql:binding[@name=$name]" />
            <xsl:if test="position() != last()">
                <xsl:text>,</xsl:text>
            </xsl:if>
        </xsl:for-each>
        <xsl:text>]}</xsl:text><commit_msg>Don't use empty sting as null anymore<commit_after><?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sparql="http://www.w3.org/2005/sparql-results#">
    <xsl:output method="text" encoding="UTF-8"/>
    <xsl:param name="handler" select="'google.visualization.Query.setResponse'" />
    <xsl:param name="reqId" select="'0'" />
    <xsl:template match="sparql:sparql">
        <xsl:value-of select="$handler" />
        <xsl:text>({version:'0.6',reqId:'</xsl:text>
        <xsl:value-of select="$reqId" />
        <xsl:text>',status:'ok',table:{</xsl:text>
        <xsl:apply-templates select="sparql:head" />
        <xsl:text>,</xsl:text>
        <xsl:apply-templates select="sparql:results" />
        <xsl:text>}});</xsl:text>
    </xsl:template>
    <xsl:template match="sparql:head">
        <xsl:text>cols:[</xsl:text>
        <xsl:apply-templates select="sparql:variable" />
        <xsl:text>]</xsl:text>
    </xsl:template>
    <xsl:template match="sparql:variable">
        <xsl:variable name="name" select="@name"/>
        <xsl:variable name="datatype" select="/sparql:sparql/sparql:results/sparql:result[1]/sparql:binding[@name=$name]/sparql:literal/@datatype" />
        <xsl:variable name="local" select="substring-after($datatype, '#')" />
        <xsl:text>{id:'</xsl:text>
        <xsl:value-of select="$name" />
        <xsl:text>',label:'</xsl:text>
        <xsl:value-of select="translate($name,'_',' ')" />
        <xsl:text>',type:'</xsl:text>
        <xsl:choose>
            <xsl:when test="not(starts-with($datatype, 'http://www.w3.org/2001/XMLSchema#'))">
                <xsl:text>string</xsl:text>
            </xsl:when>
            <xsl:when test="$local='boolean'">
                <xsl:text>boolean</xsl:text>
            </xsl:when>
            <xsl:when test="$local='date'">
                <xsl:text>date</xsl:text>
            </xsl:when>
            <xsl:when test="$local='dateTime'">
                <xsl:text>datetime</xsl:text>
            </xsl:when>
            <xsl:when test="$local='time'">
                <xsl:text>timeofday</xsl:text>
            </xsl:when>
            <xsl:when test="$local='float' or $local='decimal' or $local='double' or $local='integer' or $local='long' or $local='int' or $local='short' or $local='byte' or $local='nonPositiveInteger' or $local='negativeInteger' or $local='nonNegativeInteger' or $local='positiveInteger' or $local='unsignedLong' or $local='unsignedInt' or $local='unsignedShort' or $local='unsignedByte'">
                    <xsl:text>number</xsl:text>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>string</xsl:text>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:text>'}</xsl:text>
        <xsl:if test="position() != last()">
            <xsl:text>,</xsl:text>
        </xsl:if>
    </xsl:template>
    <xsl:template match="sparql:results">
        <xsl:text>rows:[</xsl:text>
        <xsl:apply-templates select="sparql:result" />
        <xsl:text>]</xsl:text>
    </xsl:template>
    <xsl:template match="sparql:result">
        <xsl:text>{c:[</xsl:text>
        <xsl:variable name="current" select="."/> 
        <xsl:for-each select="../../sparql:head/sparql:variable">
            <xsl:variable name="name" select="@name"/>
            <xsl:if test="not($current/sparql:binding[@name=$name])">
                <xsl:text>{}</xsl:text>
            </xsl:if>
            <xsl:apply-templates select="$current/sparql:binding[@name=$name]" />
            <xsl:if test="position() != last()">
                <xsl:text>,</xsl:text>
            </xsl:if>
        </xsl:for-each>
        <xsl:text>]}</xsl:text>
{'fraction_non_alphanumeric': 0.20843405855492883, 'fraction_numerical': 0.006715014773032501, 'mean_word_length': 2.732832080200501, 'pattern_counts': {'":': 0, '<': 203, '<?xml version=': 2, '>': 203, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1083025', 'n_tokens_mistral': 2707, 'n_tokens_neox': 2422, 'n_words': 313}