Skip to content

Commit

Permalink
RP - warning for journal refs with editors
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-atherden committed Dec 2, 2024
1 parent 742b5f3 commit 888043a
Show file tree
Hide file tree
Showing 8 changed files with 210 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/rp-schematron-base.sch
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,10 @@
<report test="text()[matches(.,'\p{L}') and not(matches(lower-case(.),'^[\p{Z}\p{P}]+(doi|pmid|epub|vol|and|pp?|in|is[sb]n)[:\.]?'))]"
role="warning"
id="journal-ref-text-content">This journal reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has untagged textual content - <value-of select="string-join(text()[matches(.,'\p{L}') and not(matches(lower-case(.),'^[\p{Z}\p{P}]+(doi|pmid|epub|vol|and|pp?|in|is[sb]n)[:\.]?'))],'; ')"/>. Is it tagged correctly?</report>

<report test="person-group[@person-group-type='editor']"
role="warning"
id="journal-ref-editor">This journal reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has an editor person-group. This info isn;t typically included in journal refs. Is it really a journal ref? Does it really contain editors?</report>
</rule>

<rule context="mixed-citation[@publication-type='journal']/source" id="journal-source-checks">
Expand Down
2 changes: 2 additions & 0 deletions src/rp-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@
<assert test="article-title" role="error" id="journal-ref-article-title">[journal-ref-article-title] This journal reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has no article-title element.</assert>

<report test="text()[matches(.,'\p{L}') and not(matches(lower-case(.),'^[\p{Z}\p{P}]+(doi|pmid|epub|vol|and|pp?|in|is[sb]n)[:\.]?'))]" role="warning" id="journal-ref-text-content">[journal-ref-text-content] This journal reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has untagged textual content - <value-of select="string-join(text()[matches(.,'\p{L}') and not(matches(lower-case(.),'^[\p{Z}\p{P}]+(doi|pmid|epub|vol|and|pp?|in|is[sb]n)[:\.]?'))],'; ')"/>. Is it tagged correctly?</report>

<report test="person-group[@person-group-type='editor']" role="warning" id="journal-ref-editor">[journal-ref-editor] This journal reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has an editor person-group. This info isn;t typically included in journal refs. Is it really a journal ref? Does it really contain editors?</report>
</rule></pattern><pattern id="journal-source-checks-pattern"><rule context="mixed-citation[@publication-type='journal']/source" id="journal-source-checks">
<let name="preprint-regex" value="'biorxiv|africarxiv|arxiv|cell\s+sneak\s+peak|chemrxiv|chinaxiv|eartharxiv|medrxiv|osf\s+preprints|paleorxiv|peerj\s+preprints|preprints|preprints\.org|psyarxiv|research\s+square|scielo\s+preprints|ssrn|vixra'"/>

Expand Down
13 changes: 13 additions & 0 deletions src/rp-schematron.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2239,6 +2239,19 @@
<xsl:text/>. Is it tagged correctly?</svrl:text>
</svrl:successful-report>
</xsl:if>
<!--REPORT warning-->
<xsl:if test="person-group[@person-group-type='editor']">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="person-group[@person-group-type='editor']">
<xsl:attribute name="id">journal-ref-editor</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-ref-editor] This journal reference (<xsl:text/>
<xsl:value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>
<xsl:text/>) has an editor person-group. This info isn;t typically included in journal refs. Is it really a journal ref? Does it really contain editors?</svrl:text>
</svrl:successful-report>
</xsl:if>
<xsl:apply-templates select="*" mode="M31"/>
</xsl:template>
<xsl:template match="text()" priority="-1" mode="M31"/>
Expand Down
11 changes: 11 additions & 0 deletions test/tests/rp/journal-ref-checks/journal-ref-editor/fail.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?oxygen SCHSchema="journal-ref-editor.sch"?>
<!--Context: mixed-citation[@publication-type='journal']
Test: report person-group[@person-group-type='editor']
Message: This journal reference () has an editor person-group. This info isn;t typically included in journal refs. Is it really a journal ref? Does it really contain editors? -->
<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>
<mixed-citation publication-type="journal">
<person-group person-group-type="editor"/>
</mixed-citation>
</article>
</root>
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="journal-ref-checks-pattern">
<rule context="mixed-citation[@publication-type='journal']" id="journal-ref-checks">
<report test="person-group[@person-group-type='editor']" role="warning" id="journal-ref-editor">[journal-ref-editor] This journal reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has an editor person-group. This info isn;t typically included in journal refs. Is it really a journal ref? Does it really contain editors?</report>
</rule>
</pattern>
<pattern id="root-pattern">
<rule context="root" id="root-rule">
<assert test="descendant::mixed-citation[@publication-type='journal']" role="error" id="journal-ref-checks-xspec-assert">mixed-citation[@publication-type='journal'] must be present.</assert>
</rule>
</pattern>
</schema>
11 changes: 11 additions & 0 deletions test/tests/rp/journal-ref-checks/journal-ref-editor/pass.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?oxygen SCHSchema="journal-ref-editor.sch"?>
<!--Context: mixed-citation[@publication-type='journal']
Test: report person-group[@person-group-type='editor']
Message: This journal reference () has an editor person-group. This info isn;t typically included in journal refs. Is it really a journal ref? Does it really contain editors? -->
<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>
<mixed-citation publication-type="journal">
<person-group person-group-type="author"/>
</mixed-citation>
</article>
</root>
2 changes: 2 additions & 0 deletions test/xspec/rp-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@
<assert test="article-title" role="error" id="journal-ref-article-title">This journal reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has no article-title element.</assert>

<report test="text()[matches(.,'\p{L}') and not(matches(lower-case(.),'^[\p{Z}\p{P}]+(doi|pmid|epub|vol|and|pp?|in|is[sb]n)[:\.]?'))]" role="warning" id="journal-ref-text-content">This journal reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has untagged textual content - <value-of select="string-join(text()[matches(.,'\p{L}') and not(matches(lower-case(.),'^[\p{Z}\p{P}]+(doi|pmid|epub|vol|and|pp?|in|is[sb]n)[:\.]?'))],'; ')"/>. Is it tagged correctly?</report>

<report test="person-group[@person-group-type='editor']" role="warning" id="journal-ref-editor">This journal reference (<value-of select="if (ancestor::ref/@id) then concat('id ',ancestor::ref/@id) else 'no id'"/>) has an editor person-group. This info isn;t typically included in journal refs. Is it really a journal ref? Does it really contain editors?</report>
</rule>
</pattern>
<pattern id="journal-source-checks-pattern">
Expand Down
10 changes: 10 additions & 0 deletions test/xspec/rp-schematron.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,16 @@
<x:expect-report id="journal-ref-text-content" role="warning"/>
<x:expect-not-assert id="journal-ref-checks-xspec-assert" role="error"/>
</x:scenario>
<x:scenario label="journal-ref-editor-pass">
<x:context href="../tests/rp/journal-ref-checks/journal-ref-editor/pass.xml"/>
<x:expect-not-report id="journal-ref-editor" role="warning"/>
<x:expect-not-assert id="journal-ref-checks-xspec-assert" role="error"/>
</x:scenario>
<x:scenario label="journal-ref-editor-fail">
<x:context href="../tests/rp/journal-ref-checks/journal-ref-editor/fail.xml"/>
<x:expect-report id="journal-ref-editor" role="warning"/>
<x:expect-not-assert id="journal-ref-checks-xspec-assert" role="error"/>
</x:scenario>
</x:scenario>
<x:scenario label="journal-source-checks">
<x:scenario label="journal-source-1-pass">
Expand Down

0 comments on commit 888043a

Please sign in to comment.