<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!--
 | Copyright (c) 2012 Symplectic Limited. All rights reserved.
 | This Source Code Form is subject to the terms of the Mozilla Public
 | License, v. 2.0. If a copy of the MPL was not distributed with this
 | file, You can obtain one at http://mozilla.org/MPL/2.0/.
 -->
<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:fn="http://www.w3.org/2005/xpath-functions"
                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
                xmlns:bibo="http://purl.org/ontology/bibo/"
                xmlns:obo="http://purl.obolibrary.org/obo/"
                xmlns:vivo="http://vivoweb.org/ontology/core#"
                xmlns:vcard="http://www.w3.org/2006/vcard/ns#"
                xmlns:foaf="http://xmlns.com/foaf/0.1/"
                xmlns:score="http://vivoweb.org/ontology/score#"
                xmlns:ufVivo="http://vivo.ufl.edu/ontology/vivo-ufl/"
                xmlns:vitro="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#"
                xmlns:api="http://www.symplectic.co.uk/publications/api"
                xmlns:symp="http://www.symplectic.co.uk/vivo/"
                xmlns:svfn="http://www.symplectic.co.uk/vivo/namespaces/functions"
                xmlns:config="http://www.symplectic.co.uk/vivo/namespaces/config"
                exclude-result-prefixes="rdf rdfs fn bibo obo vivo vcard foaf score ufVivo vitro api symp svfn config xs"
        >

    <!--
        XSLT for generating VIVO representation of a publication object (journal article, conference preceding, etc.)
    -->

    <!-- Import the utility XSLT -->
    <xsl:import href="elements-to-vivo-utils.xsl" />

    <!-- Match objects of type 'publication' -->
    <xsl:template match="api:object[@category='publication']">
        <xsl:variable name="publicationId" select="@id" />
        <xsl:variable name="publicationUri" select="svfn:objectURI(.)" />

        <!-- Labels -->
        <xsl:variable name="allLabels" select="api:all-labels" />

        <!-- Attempt to generate a URI for the publication date object -->
        <xsl:variable name="publicationDateURI" select="concat(svfn:objectURI(.),'-publicationDate')" />

        <!-- Generate the publication date object. Custom XSLT 2 function that takes the current object, the URI for the date, and the field that holds the publication date -->
        <xsl:variable name="publicationDateObject" select="svfn:renderDateObject(.,$publicationDateURI,svfn:getRecordField(.,'publication-date'))" />

        <!-- Attempt to generate a URI for the filed date object -->
        <xsl:variable name="filedDateURI" select="concat(svfn:objectURI(.),'-filedDate')" />

        <!-- Generate the filed date object. Custom XSLT 2 function that takes the current object, the URI for the date, and the field that holds the filed date -->
        <xsl:variable name="filedDateObject" select="svfn:renderDateObject(.,$filedDateURI,svfn:getRecordField(.,'filed-date'))" />

        <!-- Attempt to get a journal title for the article -->
        <xsl:variable name="publicationVenueTitle" select="svfn:selectJournalTitle(.)" />

        <!-- Generate a publication venue object URI from the journal title -->
        <xsl:variable name="publicationVenueURI" select="svfn:makeURI('journal-',$publicationVenueTitle)" />

        <!-- Generate the publication venue object. Custom XSLT 2 function that takes the current object, journal URI and journal title. -->
        <xsl:variable name="publicationVenueObject" select="svfn:renderPublicationVenueObject(.,$allLabels,$publicationVenueURI,$publicationVenueTitle,svfn:objectURI(.))" />

        <!-- Get the authors -->
        <xsl:variable name="authors" select="svfn:getRecordField(.,'authors')" />
        <xsl:variable name="editors" select="svfn:getRecordField(.,'editors')" />

        <!-- Web pages -->
        <xsl:variable name="arxivPdfUrl" select="svfn:getRecordField(.,'arxiv-pdf-url')" />
        <xsl:variable name="authorUrl" select="svfn:getRecordField(.,'author-url')" />
        <xsl:variable name="publisherUrl" select="svfn:getRecordField(.,'publisher-url')" />

        <xsl:variable name="publicationStatus" select="svfn:getRecordField(.,'publication-status')" />

        <xsl:variable name="externalIdentifiers" select="svfn:getRecordField(.,'external-identifiers')" />

        <!-- Render an RDF object -->
        <xsl:call-template name="render_rdf_object">
            <!-- Generate a URI for the current publication -->
            <xsl:with-param name="objectURI" select="$publicationUri" />
            <!--
                Generate the RDF property statements for the publication object.
                Uses the getTypesForPublication custom XSLT function to retrieve all the type statements (including mostSpecificType)
                The renderPropertyFromField function creates a property from the specified Elements data field, restricted to your configured preferred records
                - it takes the full namespace/element name for the resulting property, and the field name in Elements
                  The resulting property comes from an apply-templates on the selected field, so you can override how the data is rendered
                  by overloading those templates
                The renderPropertyFromFieldOrFirst operates the same way, except if none of you preferred data sources are present, it takes the field from the first record
                - this is used only for the title, so that there will always be some information about the items that could not be transferred fully, because of the records available
                Also, the properties to reference the publication date and venue are output, if the objects have been created (test for child nodes)
            -->
            <xsl:with-param name="rdfNodes">
                <xsl:copy-of select="svfn:getTypesForPublication(@type)" />
                <xsl:copy-of select="svfn:renderPropertyFromFieldOrFirst(.,'rdfs:label','title')" />
                <xsl:copy-of select="svfn:renderPropertyFromField(.,'bibo:abstract','abstract')" />
                <xsl:copy-of select="svfn:renderPropertyFromField(.,'bibo:doi','doi')" />
                <xsl:copy-of select="svfn:renderPropertyFromField(.,'bibo:issue','issue')" />
                <xsl:copy-of select="svfn:renderPropertyFromField(.,'bibo:pageStart','pagination')" />
                <xsl:copy-of select="svfn:renderPropertyFromField(.,'bibo:pageEnd','pagination')" /><commit_msg>Add bibo:edition<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!--
 | Copyright (c) 2012 Symplectic Limited. All rights reserved.
 | This Source Code Form is subject to the terms of the Mozilla Public
 | License, v. 2.0. If a copy of the MPL was not distributed with this
 | file, You can obtain one at http://mozilla.org/MPL/2.0/.
 -->
<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:fn="http://www.w3.org/2005/xpath-functions"
                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
                xmlns:bibo="http://purl.org/ontology/bibo/"
                xmlns:obo="http://purl.obolibrary.org/obo/"
                xmlns:vivo="http://vivoweb.org/ontology/core#"
                xmlns:vcard="http://www.w3.org/2006/vcard/ns#"
                xmlns:foaf="http://xmlns.com/foaf/0.1/"
                xmlns:score="http://vivoweb.org/ontology/score#"
                xmlns:ufVivo="http://vivo.ufl.edu/ontology/vivo-ufl/"
                xmlns:vitro="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#"
                xmlns:api="http://www.symplectic.co.uk/publications/api"
                xmlns:symp="http://www.symplectic.co.uk/vivo/"
                xmlns:svfn="http://www.symplectic.co.uk/vivo/namespaces/functions"
                xmlns:config="http://www.symplectic.co.uk/vivo/namespaces/config"
                exclude-result-prefixes="rdf rdfs fn bibo obo vivo vcard foaf score ufVivo vitro api symp svfn config xs"
        >

    <!--
        XSLT for generating VIVO representation of a publication object (journal article, conference preceding, etc.)
    -->

    <!-- Import the utility XSLT -->
    <xsl:import href="elements-to-vivo-utils.xsl" />

    <!-- Match objects of type 'publication' -->
    <xsl:template match="api:object[@category='publication']">
        <xsl:variable name="publicationId" select="@id" />
        <xsl:variable name="publicationUri" select="svfn:objectURI(.)" />

        <!-- Labels -->
        <xsl:variable name="allLabels" select="api:all-labels" />

        <!-- Attempt to generate a URI for the publication date object -->
        <xsl:variable name="publicationDateURI" select="concat(svfn:objectURI(.),'-publicationDate')" />

        <!-- Generate the publication date object. Custom XSLT 2 function that takes the current object, the URI for the date, and the field that holds the publication date -->
        <xsl:variable name="publicationDateObject" select="svfn:renderDateObject(.,$publicationDateURI,svfn:getRecordField(.,'publication-date'))" />

        <!-- Attempt to generate a URI for the filed date object -->
        <xsl:variable name="filedDateURI" select="concat(svfn:objectURI(.),'-filedDate')" />

        <!-- Generate the filed date object. Custom XSLT 2 function that takes the current object, the URI for the date, and the field that holds the filed date -->
        <xsl:variable name="filedDateObject" select="svfn:renderDateObject(.,$filedDateURI,svfn:getRecordField(.,'filed-date'))" />

        <!-- Attempt to get a journal title for the article -->
        <xsl:variable name="publicationVenueTitle" select="svfn:selectJournalTitle(.)" />

        <!-- Generate a publication venue object URI from the journal title -->
        <xsl:variable name="publicationVenueURI" select="svfn:makeURI('journal-',$publicationVenueTitle)" />

        <!-- Generate the publication venue object. Custom XSLT 2 function that takes the current object, journal URI and journal title. -->
        <xsl:variable name="publicationVenueObject" select="svfn:renderPublicationVenueObject(.,$allLabels,$publicationVenueURI,$publicationVenueTitle,svfn:objectURI(.))" />

        <!-- Get the authors -->
        <xsl:variable name="authors" select="svfn:getRecordField(.,'authors')" />
        <xsl:variable name="editors" select="svfn:getRecordField(.,'editors')" />

        <!-- Web pages -->
        <xsl:variable name="arxivPdfUrl" select="svfn:getRecordField(.,'arxiv-pdf-url')" />
        <xsl:variable name="authorUrl" select="svfn:getRecordField(.,'author-url')" />
        <xsl:variable name="publisherUrl" select="svfn:getRecordField(.,'publisher-url')" />

        <xsl:variable name="publicationStatus" select="svfn:getRecordField(.,'publication-status')" />

        <xsl:variable name="externalIdentifiers" select="svfn:getRecordField(.,'external-identifiers')" />

        <!-- Render an RDF object -->
        <xsl:call-template name="render_rdf_object">
            <!-- Generate a URI for the current publication -->
            <xsl:with-param name="objectURI" select="$publicationUri" />
            <!--
                Generate the RDF property statements for the publication object.
                Uses the getTypesForPublication custom XSLT function to retrieve all the type statements (including mostSpecificType)
                The renderPropertyFromField function creates a property from the specified Elements data field, restricted to your configured preferred records
                - it takes the full namespace/element name for the resulting property, and the field name in Elements
                  The resulting property comes from an apply-templates on the selected field, so you can override how the data is rendered
                  by overloading those templates
                The renderPropertyFromFieldOrFirst operates the same way, except if none of you preferred data sources are present, it takes the field from the first record
                - this is used only for the title, so that there will always be some information about the items that could not be transferred fully, because of the records available
                Also, the properties to reference the publication date and venue are output, if the objects have been created (test for child nodes)
            -->
            <xsl:with-param name="rdfNodes">
                <xsl:copy-of select="svfn:getTypesForPublication(@type)" />
                <xsl:copy-of select="svfn:renderPropertyFromFieldOrFirst(.,'rdfs:label','title')" />
                <xsl:copy-of select="svfn:renderPropertyFromField(.,'bibo:abstract','abstract')" />
                <xsl:copy-of select="svfn:renderPropertyFromField(.,'bibo:doi','doi')" />
                <xsl:copy-of select="svfn:renderPropertyFromField(.,'bibo:edition','edition')" />
                <xsl:copy-of select="svfn:renderPropertyFromField(.,'bibo:issue','issue')" />
                <xsl:copy-of select="svfn:renderPropertyFromField(.,'bibo:pageStart','pagination')" />
                <xsl:copy-of select="svfn:renderPropertyFromField(.,'bibo:pageEnd','pagination')" />
{'fraction_non_alphanumeric': 0.1344575105391613, 'fraction_numerical': 0.008283410990311367, 'mean_word_length': 2.8968299711815564, 'pattern_counts': {'":': 0, '<': 100, '<?xml version=': 2, '>': 100, 'https://': 0, 'lorem ipsum': 0, 'www.': 20, 'xml': 38}, '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': '6992135', 'n_tokens_mistral': 4043, 'n_tokens_neox': 3713, 'n_words': 931}