Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RP - add warnings for confproc refs #755

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/rp-schematron-base.sch
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,10 @@
<report test="matches(lower-case(.),'^i{1,3}\.\s') and parent::*/article-title"
role="warning"
id="journal-source-2">Journal reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has a source that starts with a roman numeral. Is part of the article-title captured in source? Source = <value-of select="."/>.</report>

<report test="matches(lower-case(.),'^(symposium|conference|proc\.?|proceeding|meeting|workshop)|\s?(symposium|conference|proc\.?|proceeding|meeting|workshop)\s?|(symposium|conference|proc\.?|proceeding|meeting|workshop)$')"
role="warning"
id="journal-source-3">Journal reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has the following source, '<value-of select="."/>'. Should it be captured as a conference proceeding instead?</report>
</rule>
</pattern>

Expand Down Expand Up @@ -506,6 +510,10 @@
<report test="matches(lower-case(.),'\.\s+in:\s+')"
role="warning"
id="book-source-2">The source in book reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) contains '. In: ' - <value-of select="."/>. Are the details captured correctly?</report>

<report test="matches(lower-case(.),'^(symposium|conference|proc\.?|proceeding|meeting|workshop)|\s?(symposium|conference|proc\.?|proceeding|meeting|workshop)\s?|(symposium|conference|proc\.?|proceeding|meeting|workshop)$')"
role="warning"
id="book-source-3">Book reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has the following source, '<value-of select="."/>'. Should it be captured as a conference proceeding instead?</report>
</rule>
</pattern>

Expand Down
4 changes: 4 additions & 0 deletions src/rp-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@


<report test="matches(lower-case(.),'^i{1,3}\.\s') and parent::*/article-title" role="warning" id="journal-source-2">[journal-source-2] Journal reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has a source that starts with a roman numeral. Is part of the article-title captured in source? Source = <value-of select="."/>.</report>

<report test="matches(lower-case(.),'^(symposium|conference|proc\.?|proceeding|meeting|workshop)|\s?(symposium|conference|proc\.?|proceeding|meeting|workshop)\s?|(symposium|conference|proc\.?|proceeding|meeting|workshop)$')" role="warning" id="journal-source-3">[journal-source-3] Journal reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has the following source, '<value-of select="."/>'. Should it be captured as a conference proceeding instead?</report>
</rule></pattern>

<pattern id="preprint-ref-checks-pattern"><rule context="mixed-citation[@publication-type='preprint']" id="preprint-ref-checks">
Expand All @@ -322,6 +324,8 @@
<report test="matches(lower-case(.),'^chapter\s|\s+chapter\s+')" role="warning" id="book-source-1">[book-source-1] The source in book reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) contains 'chapter' - <value-of select="."/>. Are the details captured correctly?</report>

<report test="matches(lower-case(.),'\.\s+in:\s+')" role="warning" id="book-source-2">[book-source-2] The source in book reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) contains '. In: ' - <value-of select="."/>. Are the details captured correctly?</report>

<report test="matches(lower-case(.),'^(symposium|conference|proc\.?|proceeding|meeting|workshop)|\s?(symposium|conference|proc\.?|proceeding|meeting|workshop)\s?|(symposium|conference|proc\.?|proceeding|meeting|workshop)$')" role="warning" id="book-source-3">[book-source-3] Book reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has the following source, '<value-of select="."/>'. Should it be captured as a conference proceeding instead?</report>
</rule></pattern>

<pattern id="ref-list-checks-pattern"><rule context="ref-list" id="ref-list-checks">
Expand Down
30 changes: 30 additions & 0 deletions src/rp-schematron.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2248,6 +2248,21 @@
<xsl:text/>.</svrl:text>
</svrl:successful-report>
</xsl:if>
<!--REPORT warning-->
<xsl:if test="matches(lower-case(.),'^(symposium|conference|proc\.?|proceeding|meeting|workshop)|\s?(symposium|conference|proc\.?|proceeding|meeting|workshop)\s?|(symposium|conference|proc\.?|proceeding|meeting|workshop)$')">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="matches(lower-case(.),'^(symposium|conference|proc\.?|proceeding|meeting|workshop)|\s?(symposium|conference|proc\.?|proceeding|meeting|workshop)\s?|(symposium|conference|proc\.?|proceeding|meeting|workshop)$')">
<xsl:attribute name="id">journal-source-3</xsl:attribute>
<xsl:attribute name="role">warning</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[journal-source-3] Journal reference (<xsl:text/>
<xsl:value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>
<xsl:text/>) has the following source, '<xsl:text/>
<xsl:value-of select="."/>
<xsl:text/>'. Should it be captured as a conference proceeding instead?</svrl:text>
</svrl:successful-report>
</xsl:if>
<xsl:apply-templates select="*" mode="M32"/>
</xsl:template>
<xsl:template match="text()" priority="-1" mode="M32"/>
Expand Down Expand Up @@ -2410,6 +2425,21 @@
<xsl:text/>. Are the details captured correctly?</svrl:text>
</svrl:successful-report>
</xsl:if>
<!--REPORT warning-->
<xsl:if test="matches(lower-case(.),'^(symposium|conference|proc\.?|proceeding|meeting|workshop)|\s?(symposium|conference|proc\.?|proceeding|meeting|workshop)\s?|(symposium|conference|proc\.?|proceeding|meeting|workshop)$')">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="matches(lower-case(.),'^(symposium|conference|proc\.?|proceeding|meeting|workshop)|\s?(symposium|conference|proc\.?|proceeding|meeting|workshop)\s?|(symposium|conference|proc\.?|proceeding|meeting|workshop)$')">
<xsl:attribute name="id">book-source-3</xsl:attribute>
<xsl:attribute name="role">warning</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[book-source-3] Book reference (<xsl:text/>
<xsl:value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>
<xsl:text/>) has the following source, '<xsl:text/>
<xsl:value-of select="."/>
<xsl:text/>'. Should it be captured as a conference proceeding instead?</svrl:text>
</svrl:successful-report>
</xsl:if>
<xsl:apply-templates select="*" mode="M35"/>
</xsl:template>
<xsl:template match="text()" priority="-1" mode="M35"/>
Expand Down
157 changes: 157 additions & 0 deletions test/tests/rp/book-ref-source-checks/book-source-3/book-source-3.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<schema xmlns="http://purl.oclc.org/dsdl/schematron" xmlns:meca="http://manuscriptexchange.org" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:ali="http://www.niso.org/schemas/ali/1.0/" xmlns:file="java.io.File" xmlns:java="http://www.java.com/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" queryBinding="xslt2">
<title>eLife reviewed preprint schematron</title>
<ns uri="http://www.niso.org/schemas/ali/1.0/" prefix="ali"/>
<ns uri="http://www.w3.org/XML/1998/namespace" prefix="xml"/>
<ns uri="http://www.w3.org/1999/xlink" prefix="xlink"/>
<ns uri="http://www.w3.org/2001/XInclude" prefix="xi"/>
<ns uri="http://www.w3.org/1998/Math/MathML" prefix="mml"/>
<ns uri="http://saxon.sf.net/" prefix="saxon"/>
<ns uri="http://purl.org/dc/terms/" prefix="dc"/>
<ns uri="http://www.w3.org/2001/XMLSchema" prefix="xs"/>
<ns uri="https://elifesciences.org/namespace" prefix="e"/>
<ns uri="java.io.File" prefix="file"/>
<ns uri="http://www.java.com/" prefix="java"/>
<ns uri="http://manuscriptexchange.org" prefix="meca"/>
<xsl:function name="e:isbn-sum" as="xs:integer">
<xsl:param name="s" as="xs:string"/>
<xsl:choose>
<xsl:when test="string-length($s) = 10">
<xsl:variable name="d1" select="number(substring($s,1,1)) * 10"/>
<xsl:variable name="d2" select="number(substring($s,2,1)) * 9"/>
<xsl:variable name="d3" select="number(substring($s,3,1)) * 8"/>
<xsl:variable name="d4" select="number(substring($s,4,1)) * 7"/>
<xsl:variable name="d5" select="number(substring($s,5,1)) * 6"/>
<xsl:variable name="d6" select="number(substring($s,6,1)) * 5"/>
<xsl:variable name="d7" select="number(substring($s,7,1)) * 4"/>
<xsl:variable name="d8" select="number(substring($s,8,1)) * 3"/>
<xsl:variable name="d9" select="number(substring($s,9,1)) * 2"/>
<xsl:variable name="d10" select="number(substring($s,10,1)) * 1"/>
<xsl:value-of select="number($d1 + $d2 + $d3 + $d4 + $d5 + $d6 + $d7 + $d8 + $d9 + $d10) mod 11"/>
</xsl:when>
<xsl:when test="string-length($s) = 13">
<xsl:variable name="d1" select="number(substring($s,1,1))"/>
<xsl:variable name="d2" select="number(substring($s,2,1)) * 3"/>
<xsl:variable name="d3" select="number(substring($s,3,1))"/>
<xsl:variable name="d4" select="number(substring($s,4,1)) * 3"/>
<xsl:variable name="d5" select="number(substring($s,5,1))"/>
<xsl:variable name="d6" select="number(substring($s,6,1)) * 3"/>
<xsl:variable name="d7" select="number(substring($s,7,1))"/>
<xsl:variable name="d8" select="number(substring($s,8,1)) * 3"/>
<xsl:variable name="d9" select="number(substring($s,9,1))"/>
<xsl:variable name="d10" select="number(substring($s,10,1)) * 3"/>
<xsl:variable name="d11" select="number(substring($s,11,1))"/>
<xsl:variable name="d12" select="number(substring($s,12,1)) * 3"/>
<xsl:variable name="d13" select="number(substring($s,13,1))"/>
<xsl:value-of select="number($d1 + $d2 + $d3 + $d4 + $d5 + $d6 + $d7 + $d8 + $d9 + $d10 + $d11 + $d12 + $d13) mod 10"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="number('1')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
<xsl:function name="e:is-valid-issn" as="xs:boolean">
<xsl:param name="s" as="xs:string"/>
<xsl:choose>
<xsl:when test="not(matches($s,'^\d{4}\-\d{3}[\dX]$'))">
<xsl:value-of select="false()"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="d1" select="number(substring($s,1,1)) * 8"/>
<xsl:variable name="d2" select="number(substring($s,2,1)) * 7"/>
<xsl:variable name="d3" select="number(substring($s,3,1)) * 6"/>
<xsl:variable name="d4" select="number(substring($s,4,1)) * 5"/>
<xsl:variable name="d5" select="number(substring($s,6,1)) * 4"/>
<xsl:variable name="d6" select="number(substring($s,7,1)) * 3"/>
<xsl:variable name="d7" select="number(substring($s,8,1)) * 2"/>
<xsl:variable name="remainder" select="number($d1 + $d2 + $d3 + $d4 + $d5 + $d6 + $d7) mod 11"/>
<xsl:variable name="calc" select="if ($remainder=0) then 0 else (11 - $remainder)"/>
<xsl:variable name="check" select="if (substring($s,9,1)='X') then 10 else number(substring($s,9,1))"/>
<xsl:value-of select="$calc = $check"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
<xsl:function name="e:get-name" as="xs:string">
<xsl:param name="name"/>
<xsl:choose>
<xsl:when test="$name/given-names[1] and $name/surname[1] and $name/suffix[1]">
<xsl:value-of select="concat($name/given-names[1],' ',$name/surname[1],' ',$name/suffix[1])"/>
</xsl:when>
<xsl:when test="not($name/given-names[1]) and $name/surname[1] and $name/suffix[1]">
<xsl:value-of select="concat($name/surname[1],' ',$name/suffix[1])"/>
</xsl:when>
<xsl:when test="$name/given-names[1] and $name/surname[1] and not($name/suffix[1])">
<xsl:value-of select="concat($name/given-names[1],' ',$name/surname[1])"/>
</xsl:when>
<xsl:when test="not($name/given-names[1]) and $name/surname[1] and not($name/suffix[1])">
<xsl:value-of select="$name/surname[1]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'No elements present'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
<xsl:function name="e:get-copyright-holder">
<xsl:param name="contrib-group"/>
<xsl:variable name="author-count" select="count($contrib-group/contrib[@contrib-type='author'])"/>
<xsl:choose>
<xsl:when test="$author-count lt 1"/>
<xsl:when test="$author-count = 1">
<xsl:choose>
<xsl:when test="$contrib-group/contrib[@contrib-type='author']/collab">
<xsl:value-of select="$contrib-group/contrib[@contrib-type='author']/collab[1]/text()[1]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$contrib-group/contrib[@contrib-type='author']/name[1]/surname[1]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$author-count = 2">
<xsl:choose>
<xsl:when test="$contrib-group/contrib[@contrib-type='author']/collab">
<xsl:choose>
<xsl:when test="$contrib-group/contrib[@contrib-type='author'][1]/collab and $contrib-group/contrib[@contrib-type='author'][2]/collab">
<xsl:value-of select="concat($contrib-group/contrib[@contrib-type='author']/collab[1]/text()[1],' &amp; ',$contrib-group/contrib[@contrib-type='author']/collab[2]/text()[1])"/>
</xsl:when>
<xsl:when test="$contrib-group/contrib[@contrib-type='author'][1]/collab">
<xsl:value-of select="concat($contrib-group/contrib[@contrib-type='author'][1]/collab[1]/text()[1],' &amp; ',$contrib-group/contrib[@contrib-type='author'][2]/name[1]/surname[1])"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($contrib-group/contrib[@contrib-type='author'][1]/name[1]/surname[1],' &amp; ',$contrib-group/contrib[@contrib-type='author'][2]/collab[1]/text()[1])"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($contrib-group/contrib[@contrib-type='author'][1]/name[1]/surname[1],' &amp; ',$contrib-group/contrib[@contrib-type='author'][2]/name[1]/surname[1])"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>

<xsl:otherwise>
<xsl:variable name="is-equal-contrib" select="if ($contrib-group/contrib[@contrib-type='author'][1]/@equal-contrib='yes') then true() else false()"/>

<xsl:value-of select="concat(e:get-surname($contrib-group/contrib[@contrib-type='author'][1]),' et al')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
<xsl:function name="e:get-surname" as="text()">
<xsl:param name="contrib"/>
<xsl:choose>
<xsl:when test="$contrib/collab">
<xsl:value-of select="$contrib/collab[1]/text()[1]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$contrib//name[1]/surname[1]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
<pattern id="book-ref-source-checks-pattern">
<rule context="mixed-citation[@publication-type='book']/source" id="book-ref-source-checks">
<report test="matches(lower-case(.),'^(symposium|conference|proc\.?|proceeding|meeting|workshop)|\s?(symposium|conference|proc\.?|proceeding|meeting|workshop)\s?|(symposium|conference|proc\.?|proceeding|meeting|workshop)$')" role="warning" id="book-source-3">[book-source-3] Book reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has the following source, '<value-of select="."/>'. Should it be captured as a conference proceeding instead?</report>
</rule>
</pattern>
<pattern id="root-pattern">
<rule context="root" id="root-rule">
<assert test="descendant::mixed-citation[@publication-type='book']/source" role="error" id="book-ref-source-checks-xspec-assert">mixed-citation[@publication-type='book']/source must be present.</assert>
</rule>
</pattern>
</schema>
13 changes: 13 additions & 0 deletions test/tests/rp/book-ref-source-checks/book-source-3/fail.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?oxygen SCHSchema="book-source-3.sch"?>
<!--Context: mixed-citation[@publication-type='book']/source
Test: report matches(lower-case(.),'^(symposium|conference|proc\.?|proceeding|meeting|workshop)|\s?(symposium|conference|proc\.?|proceeding|meeting|workshop)\s?|(symposium|conference|proc\.?|proceeding|meeting|workshop)$')
Message: Book reference () has the following source, ''. Should it be captured as a conference proceeding instead? -->
<root xmlns:ali="http://www.niso.org/schemas/ali/1.0/" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">
<article>
<ref id="c1">
<mixed-citation publication-type="book">
<source>Proceedings of the 20th International Conference on World Wide Web</source>
</mixed-citation>
</ref>
</article>
</root>
13 changes: 13 additions & 0 deletions test/tests/rp/book-ref-source-checks/book-source-3/pass.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?oxygen SCHSchema="book-source-3.sch"?>
<!--Context: mixed-citation[@publication-type='book']/source
Test: report matches(lower-case(.),'^(symposium|conference|proc\.?|proceeding|meeting|workshop)|\s?(symposium|conference|proc\.?|proceeding|meeting|workshop)\s?|(symposium|conference|proc\.?|proceeding|meeting|workshop)$')
Message: Book reference () has the following source, ''. Should it be captured as a conference proceeding instead? -->
<root xmlns:ali="http://www.niso.org/schemas/ali/1.0/" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">
<article>
<ref id="c1">
<mixed-citation publication-type="book">
<source>eLife</source>
</mixed-citation>
</ref>
</article>
</root>
13 changes: 13 additions & 0 deletions test/tests/rp/journal-source-checks/journal-source-3/fail.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?oxygen SCHSchema="journal-source-3.sch"?>
<!--Context: mixed-citation[@publication-type='journal']/source
Test: report matches(lower-case(.),'^(symposium|conference|proc\.?|proceeding|meeting|workshop)|\s?(symposium|conference|proc\.?|proceeding|meeting|workshop)\s?|(symposium|conference|proc\.?|proceeding|meeting|workshop)$')
Message: Journal reference () has the following source, ''. Should it be captured as a conference proceeding instead? -->
<root xmlns:ali="http://www.niso.org/schemas/ali/1.0/" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">
<article>
<ref id="c1">
<mixed-citation publication-type="journal">
<source>Proceedings of the 20th International Conference on World Wide Web</source>
</mixed-citation>
</ref>
</article>
</root>
Loading