<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2011 Graphity Team

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
exclude-result-prefixes="xsl rdf">

    <!-- groups and sorts triples in RDF/XML to ease further XSLT processing -->
    <xsl:output indent="yes" method="xml" encoding="UTF-8" media-type="application/rdf+xml"/>
    <xsl:strip-space elements="*"/>
  
    <!-- only match subjects (i.e. elements that have property children) -->
    <xsl:key name="resources" match="*[*][@rdf:about] | *[*][@rdf:nodeID]" use="@rdf:about | @rdf:nodeID"/>

    <xsl:template match="rdf:RDF">
        <xsl:copy>
            <!-- URI resources -->
            <xsl:apply-templates select="*[@rdf:about][count(. | key('resources', @rdf:about)[1]) = 1]">
		<xsl:sort select="@rdf:about" data-type="text" order="ascending"/>
            </xsl:apply-templates>

            <!-- blank nodes -->
            <xsl:apply-templates select="*[@rdf:nodeID][count(. | key('resources', @rdf:nodeID)[1]) = 1]">
		<xsl:sort select="@rdf:nodeID" data-type="text" order="ascending"/> 
            </xsl:apply-templates>
        </xsl:copy>
    </xsl:template>

    <!-- subject resource -->
    <xsl:template match="*[*][@rdf:about]">
	<xsl:copy>
	    <xsl:copy-of select="@*"/>
	    <xsl:for-each select="key('resources', @rdf:about)">
		<xsl:apply-templates>
		    <xsl:sort select="concat(namespace-uri(.), local-name(.))" data-type="text" order="ascending"/>
		</xsl:apply-templates>
	    </xsl:for-each>
	</xsl:copy>
    </xsl:template>

    <!-- subject blank node -->
    <xsl:template match="*[*][@rdf:nodeID]">
	<xsl:copy>
	    <xsl:copy-of select="@*"/>
	    <xsl:for-each select="key('resources', @rdf:nodeID)">
		<xsl:apply-templates>
		    <xsl:sort select="concat(namespace-uri(.), local-name(.))" data-type="text" order="ascending"/>
		    <xsl:sort select="@rdf:resource" data-type="text" order="ascending"/>
		    <xsl:sort select="@rdf:nodeID" data-type="text" order="ascending"/>
		    <xsl:sort select="@rdf:datatype" data-type="text" order="ascending"/>
		    <xsl:sort select="@xml:lang" data-type="text" order="ascending"/>
		</xsl:apply-templates>
	    </xsl:for-each>
	</xsl:copy>
    </xsl:template>

    <!-- property -->
    <xsl:template match="*[@rdf:about]/* | *[@rdf:nodeID]/*">
	<xsl:copy-of select="."/>
    </xsl:template>
    
</xsl:stylesheet><commit_msg>Improved sorting<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2011 Graphity Team

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
exclude-result-prefixes="xsl rdf">

    <!-- groups and sorts triples in RDF/XML to ease further XSLT processing -->
    <xsl:output indent="yes" method="xml" encoding="UTF-8" media-type="application/rdf+xml"/>
    <xsl:strip-space elements="*"/>
  
    <!-- only match subjects (i.e. elements that have property children) -->
    <xsl:key name="resources" match="*[*][@rdf:about] | *[*][@rdf:nodeID]" use="@rdf:about | @rdf:nodeID"/>

    <xsl:template match="rdf:RDF">
        <xsl:copy>
            <!-- URI resources -->
            <xsl:apply-templates select="*[@rdf:about][count(. | key('resources', @rdf:about)[1]) = 1]">
		<xsl:sort select="@rdf:about" data-type="text" order="ascending"/>
            </xsl:apply-templates>

            <!-- blank nodes -->
            <xsl:apply-templates select="*[@rdf:nodeID][count(. | key('resources', @rdf:nodeID)[1]) = 1]">
		<xsl:sort select="@rdf:nodeID" data-type="text" order="ascending"/> 
            </xsl:apply-templates>
        </xsl:copy>
    </xsl:template>

    <!-- subject resource -->
    <xsl:template match="*[*][@rdf:about]">
	<xsl:copy>
	    <xsl:copy-of select="@*"/>
	    <xsl:for-each select="key('resources', @rdf:about)">
		<xsl:apply-templates>
		    <xsl:sort select="concat(namespace-uri(.), local-name(.))" data-type="text" order="ascending"/>
		    <xsl:sort select="@rdf:resource" data-type="text" order="ascending"/>
		    <xsl:sort select="@rdf:nodeID" data-type="text" order="ascending"/>
		    <xsl:sort select="@rdf:datatype" data-type="text" order="ascending"/>
		    <xsl:sort select="@xml:lang" data-type="text" order="ascending"/>
		    <xsl:sort select="text()" data-type="text" order="ascending"/>		    
		</xsl:apply-templates>
	    </xsl:for-each>
	</xsl:copy>
    </xsl:template>

    <!-- subject blank node -->
    <xsl:template match="*[*][@rdf:nodeID]">
	<xsl:copy>
	    <xsl:copy-of select="@*"/>
	    <xsl:for-each select="key('resources', @rdf:nodeID)">
		<xsl:apply-templates>
		    <xsl:sort select="concat(namespace-uri(.), local-name(.))" data-type="text" order="ascending"/>
		    <xsl:sort select="@rdf:resource" data-type="text" order="ascending"/>
		    <xsl:sort select="@rdf:nodeID" data-type="text" order="ascending"/>
		    <xsl:sort select="@rdf:datatype" data-type="text" order="ascending"/>
		    <xsl:sort select="@xml:lang" data-type="text" order="ascending"/>
		    <xsl:sort select="text()" data-type="text" order="ascending"/>
		</xsl:apply-templates>
	    </xsl:for-each>
	</xsl:copy>
    </xsl:template>

    <!-- property -->
    <xsl:template match="*[@rdf:about]/* | *[@rdf:nodeID]/*">
	<xsl:copy-of select="."/>
    </xsl:template>
    
</xsl:stylesheet>
{'fraction_non_alphanumeric': 0.2010111843113222, 'fraction_numerical': 0.011337521066339819, 'mean_word_length': 3.8, 'pattern_counts': {'":': 0, '<': 111, '<?xml version=': 2, '>': 111, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 15}, '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': '3098110', 'n_tokens_mistral': 2400, 'n_tokens_neox': 2122, 'n_words': 462}