Skip to content

Commit

Permalink
VOR - add RRID identifiers link check
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-atherden committed Dec 19, 2024
1 parent a594758 commit 6ddd110
Show file tree
Hide file tree
Showing 20 changed files with 1,478 additions and 37 deletions.
6 changes: 4 additions & 2 deletions src/final-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -7059,7 +7059,7 @@

<report see="https://elifeproduction.slab.com/posts/tables-3nehcouh#PMCID-link-test" test="matches(.,'PMCID[:]?\p{Zs}?PMC[0-9][0-9][0-9]+') and (count(ext-link[contains(@xlink:href,'www.ncbi.nlm.nih.gov/pmc')]) = 0)" role="error" id="PMCID-link-test">[PMCID-link-test] td element containing - '<value-of select="."/>' - looks like it contains a PMCID, but it contains no link pointing to PMC, which is incorrect.</report>

<report test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID/.*')])" role="warning" id="addgene-test">[addgene-test] td element containing - '<value-of select="."/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID/RRID:addgene_{number} link?</report>
<report test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID:.*')])" role="warning" id="addgene-test">[addgene-test] td element containing - '<value-of select="."/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID:addgene_{number} link?</report>

</rule></pattern><pattern id="colour-table-pattern"><rule context="table-wrap" id="colour-table">
<let name="allowed-values" value="('background-color: #90CAF9;','background-color: #C5E1A5;','background-color: #FFB74D;','background-color: #FFF176;','background-color: #9E86C9;','background-color: #E57373;','background-color: #F48FB1;','background-color: #E6E6E6;')"/>
Expand Down Expand Up @@ -7179,13 +7179,15 @@


<report see="https://elifeproduction.slab.com/posts/tables-3nehcouh#final-pmid-spacing-table" test="ends-with($lc,'pmid: ') or ends-with($lc,'pmid ')" role="warning" id="final-pmid-spacing-table">[final-pmid-spacing-table] PMID link should be preceding by 'PMID:' with no space but instead it is preceded by '<value-of select="concat(substring($pre-text,string-length($pre-text)-15),.)"/>'.</report>
</rule></pattern><pattern id="rrid-link-pattern"><rule context="ext-link[contains(@xlink:href,'scicrunch.org/resolver') and not(ancestor::sub-article)]" id="rrid-link">
</rule></pattern><pattern id="rrid-link-pattern"><rule context="ext-link[contains(lower-case(@xlink:href),'identifiers.org/rrid') and not(ancestor::sub-article)]" id="rrid-link">
<let name="pre-text" value="preceding-sibling::text()[1]"/>
<let name="lc" value="lower-case($pre-text)"/>



<report see="https://elifeproduction.slab.com/posts/rri-ds-5k19v560#final-rrid-spacing" test="ends-with($lc,'rrid: ') or ends-with($lc,'rrid ')" role="warning" id="final-rrid-spacing">[final-rrid-spacing] RRID link should be preceded by 'RRID:' with no space but instead it is preceded by '<value-of select="concat(substring($pre-text,string-length($pre-text)-15),.)"/>'.</report>

<report test="matches(@xlink:href,'identifiers\.org/RRID/RRID:')" role="error" id="rrid-link-format">[rrid-link-format] RRID links should be in the format 'https://identifiers.org/RRID:XXXX', but this one is not - <value-of select="@xlink:href"/>.</report>
</rule></pattern><pattern id="ref-link-mandate-pattern"><rule context="ref-list/ref" id="ref-link-mandate">
<let name="id" value="@id"/>

Expand Down
21 changes: 17 additions & 4 deletions src/final-JATS-schematron.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -39938,16 +39938,16 @@
</svrl:successful-report>
</xsl:if>
<!--REPORT warning-->
<xsl:if test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID/.*')])">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID/.*')])">
<xsl:if test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID:.*')])">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID:.*')])">
<xsl:attribute name="id">addgene-test</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>[addgene-test] td element containing - '<xsl:text/>
<xsl:value-of select="."/>
<xsl:text/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID/RRID:addgene_{number} link?</svrl:text>
<xsl:text/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID:addgene_{number} link?</svrl:text>
</svrl:successful-report>
</xsl:if>
<xsl:apply-templates select="*" mode="M540"/>
Expand Down Expand Up @@ -40447,7 +40447,7 @@
</xsl:template>
<!--PATTERN rrid-link-pattern-->
<!--RULE rrid-link-->
<xsl:template match="ext-link[contains(@xlink:href,'scicrunch.org/resolver') and not(ancestor::sub-article)]" priority="1000" mode="M554">
<xsl:template match="ext-link[contains(lower-case(@xlink:href),'identifiers.org/rrid') and not(ancestor::sub-article)]" priority="1000" mode="M554">
<xsl:variable name="pre-text" select="preceding-sibling::text()[1]"/>
<xsl:variable name="lc" select="lower-case($pre-text)"/>
<!--REPORT warning-->
Expand All @@ -40464,6 +40464,19 @@
<xsl:text/>'.</svrl:text>
</svrl:successful-report>
</xsl:if>
<!--REPORT error-->
<xsl:if test="matches(@xlink:href,'identifiers\.org/RRID/RRID:')">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="matches(@xlink:href,'identifiers\.org/RRID/RRID:')">
<xsl:attribute name="id">rrid-link-format</xsl:attribute>
<xsl:attribute name="role">error</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[rrid-link-format] RRID links should be in the format 'https://identifiers.org/RRID:XXXX', but this one is not - <xsl:text/>
<xsl:value-of select="@xlink:href"/>
<xsl:text/>.</svrl:text>
</svrl:successful-report>
</xsl:if>
<xsl:apply-templates select="*" mode="M554"/>
</xsl:template>
<xsl:template match="text()" priority="-1" mode="M554"/>
Expand Down
6 changes: 4 additions & 2 deletions src/final-package-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -7065,7 +7065,7 @@

<report see="https://elifeproduction.slab.com/posts/tables-3nehcouh#PMCID-link-test" test="matches(.,'PMCID[:]?\p{Zs}?PMC[0-9][0-9][0-9]+') and (count(ext-link[contains(@xlink:href,'www.ncbi.nlm.nih.gov/pmc')]) = 0)" role="error" id="PMCID-link-test">td element containing - '<value-of select="."/>' - looks like it contains a PMCID, but it contains no link pointing to PMC, which is incorrect.</report>

<report test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID/.*')])" role="warning" id="addgene-test">td element containing - '<value-of select="."/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID/RRID:addgene_{number} link?</report>
<report test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID:.*')])" role="warning" id="addgene-test">td element containing - '<value-of select="."/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID:addgene_{number} link?</report>

</rule></pattern><pattern id="colour-table-pattern"><rule context="table-wrap" id="colour-table">
<let name="allowed-values" value="('background-color: #90CAF9;','background-color: #C5E1A5;','background-color: #FFB74D;','background-color: #FFF176;','background-color: #9E86C9;','background-color: #E57373;','background-color: #F48FB1;','background-color: #E6E6E6;')"/>
Expand Down Expand Up @@ -7185,13 +7185,15 @@


<report see="https://elifeproduction.slab.com/posts/tables-3nehcouh#final-pmid-spacing-table" test="ends-with($lc,'pmid: ') or ends-with($lc,'pmid ')" role="warning" id="final-pmid-spacing-table">PMID link should be preceding by 'PMID:' with no space but instead it is preceded by '<value-of select="concat(substring($pre-text,string-length($pre-text)-15),.)"/>'.</report>
</rule></pattern><pattern id="rrid-link-pattern"><rule context="ext-link[contains(@xlink:href,'scicrunch.org/resolver') and not(ancestor::sub-article)]" id="rrid-link">
</rule></pattern><pattern id="rrid-link-pattern"><rule context="ext-link[contains(lower-case(@xlink:href),'identifiers.org/rrid') and not(ancestor::sub-article)]" id="rrid-link">
<let name="pre-text" value="preceding-sibling::text()[1]"/>
<let name="lc" value="lower-case($pre-text)"/>



<report see="https://elifeproduction.slab.com/posts/rri-ds-5k19v560#final-rrid-spacing" test="ends-with($lc,'rrid: ') or ends-with($lc,'rrid ')" role="warning" id="final-rrid-spacing">RRID link should be preceded by 'RRID:' with no space but instead it is preceded by '<value-of select="concat(substring($pre-text,string-length($pre-text)-15),.)"/>'.</report>

<report test="matches(@xlink:href,'identifiers\.org/RRID/RRID:')" role="error" id="rrid-link-format">RRID links should be in the format 'https://identifiers.org/RRID:XXXX', but this one is not - <value-of select="@xlink:href"/>.</report>
</rule></pattern><pattern id="ref-link-mandate-pattern"><rule context="ref-list/ref" id="ref-link-mandate">
<let name="id" value="@id"/>

Expand Down
6 changes: 4 additions & 2 deletions src/pre-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -7004,7 +7004,7 @@

<report see="https://elifeproduction.slab.com/posts/tables-3nehcouh#PMCID-link-test" test="matches(.,'PMCID[:]?\p{Zs}?PMC[0-9][0-9][0-9]+') and (count(ext-link[contains(@xlink:href,'www.ncbi.nlm.nih.gov/pmc')]) = 0)" role="error" id="PMCID-link-test">[PMCID-link-test] td element containing - '<value-of select="."/>' - looks like it contains a PMCID, but it contains no link pointing to PMC, which is incorrect.</report>

<report test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID/.*')])" role="warning" id="addgene-test">[addgene-test] td element containing - '<value-of select="."/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID/RRID:addgene_{number} link?</report>
<report test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID:.*')])" role="warning" id="addgene-test">[addgene-test] td element containing - '<value-of select="."/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID:addgene_{number} link?</report>

</rule></pattern><pattern id="colour-table-pattern"><rule context="table-wrap" id="colour-table">
<let name="allowed-values" value="('background-color: #90CAF9;','background-color: #C5E1A5;','background-color: #FFB74D;','background-color: #FFF176;','background-color: #9E86C9;','background-color: #E57373;','background-color: #F48FB1;','background-color: #E6E6E6;')"/>
Expand Down Expand Up @@ -7114,13 +7114,15 @@
<report see="https://elifeproduction.slab.com/posts/tables-3nehcouh#pre-pmid-spacing-table" test="ends-with($lc,'pmid: ') or ends-with($lc,'pmid ')" role="error" id="pre-pmid-spacing-table">[pre-pmid-spacing-table] PMID link should be preceding by 'PMID:' with no space but instead it is preceded by '<value-of select="concat(substring($pre-text,string-length($pre-text)-15),.)"/>'.</report>


</rule></pattern><pattern id="rrid-link-pattern"><rule context="ext-link[contains(@xlink:href,'scicrunch.org/resolver') and not(ancestor::sub-article)]" id="rrid-link">
</rule></pattern><pattern id="rrid-link-pattern"><rule context="ext-link[contains(lower-case(@xlink:href),'identifiers.org/rrid') and not(ancestor::sub-article)]" id="rrid-link">
<let name="pre-text" value="preceding-sibling::text()[1]"/>
<let name="lc" value="lower-case($pre-text)"/>

<report see="https://elifeproduction.slab.com/posts/rri-ds-5k19v560#pre-rrid-spacing" test="ends-with($lc,'rrid: ') or ends-with($lc,'rrid ')" role="error" id="pre-rrid-spacing">[pre-rrid-spacing] RRID link should be preceded by 'RRID:' with no space but instead it is preceded by '<value-of select="concat(substring($pre-text,string-length($pre-text)-15),.)"/>'.</report>



<report test="matches(@xlink:href,'identifiers\.org/RRID/RRID:')" role="error" id="rrid-link-format">[rrid-link-format] RRID links should be in the format 'https://identifiers.org/RRID:XXXX', but this one is not - <value-of select="@xlink:href"/>.</report>
</rule></pattern><pattern id="ref-link-mandate-pattern"><rule context="ref-list/ref" id="ref-link-mandate">
<let name="id" value="@id"/>

Expand Down
21 changes: 17 additions & 4 deletions src/pre-JATS-schematron.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -39649,16 +39649,16 @@
</svrl:successful-report>
</xsl:if>
<!--REPORT warning-->
<xsl:if test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID/.*')])">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID/.*')])">
<xsl:if test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID:.*')])">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID:.*')])">
<xsl:attribute name="id">addgene-test</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>[addgene-test] td element containing - '<xsl:text/>
<xsl:value-of select="."/>
<xsl:text/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID/RRID:addgene_{number} link?</svrl:text>
<xsl:text/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID:addgene_{number} link?</svrl:text>
</svrl:successful-report>
</xsl:if>
<xsl:apply-templates select="*" mode="M538"/>
Expand Down Expand Up @@ -40300,7 +40300,7 @@
</xsl:template>
<!--PATTERN rrid-link-pattern-->
<!--RULE rrid-link-->
<xsl:template match="ext-link[contains(@xlink:href,'scicrunch.org/resolver') and not(ancestor::sub-article)]" priority="1000" mode="M551">
<xsl:template match="ext-link[contains(lower-case(@xlink:href),'identifiers.org/rrid') and not(ancestor::sub-article)]" priority="1000" mode="M551">
<xsl:variable name="pre-text" select="preceding-sibling::text()[1]"/>
<xsl:variable name="lc" select="lower-case($pre-text)"/>
<!--REPORT error-->
Expand All @@ -40317,6 +40317,19 @@
<xsl:text/>'.</svrl:text>
</svrl:successful-report>
</xsl:if>
<!--REPORT error-->
<xsl:if test="matches(@xlink:href,'identifiers\.org/RRID/RRID:')">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="matches(@xlink:href,'identifiers\.org/RRID/RRID:')">
<xsl:attribute name="id">rrid-link-format</xsl:attribute>
<xsl:attribute name="role">error</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[rrid-link-format] RRID links should be in the format 'https://identifiers.org/RRID:XXXX', but this one is not - <xsl:text/>
<xsl:value-of select="@xlink:href"/>
<xsl:text/>.</svrl:text>
</svrl:successful-report>
</xsl:if>
<xsl:apply-templates select="*" mode="M551"/>
</xsl:template>
<xsl:template match="text()" priority="-1" mode="M551"/>
Expand Down
10 changes: 7 additions & 3 deletions src/schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -13737,9 +13737,9 @@ else self::*/local-name() = $allowed-p-blocks"
id="PMCID-link-test">td element containing - '<value-of select="."/>' - looks like it contains a PMCID, but it contains no link pointing to PMC, which is incorrect.</report>

<report
test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID/.*')])"
test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID:.*')])"
role="warning"
id="addgene-test">td element containing - '<value-of select="."/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID/RRID:addgene_{number} link?</report>
id="addgene-test">td element containing - '<value-of select="."/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID:addgene_{number} link?</report>

</rule>

Expand Down Expand Up @@ -14019,7 +14019,7 @@ else self::*/local-name() = $allowed-p-blocks"
id="final-pmid-spacing-table">PMID link should be preceding by 'PMID:' with no space but instead it is preceded by '<value-of select="concat(substring($pre-text,string-length($pre-text)-15),.)"/>'.</report>
</rule>

<rule context="ext-link[contains(@xlink:href,'scicrunch.org/resolver') and not(ancestor::sub-article)]" id="rrid-link">
<rule context="ext-link[contains(lower-case(@xlink:href),'identifiers.org/rrid') and not(ancestor::sub-article)]" id="rrid-link">
<let name="pre-text" value="preceding-sibling::text()[1]"/>
<let name="lc" value="lower-case($pre-text)"/>

Expand All @@ -14032,6 +14032,10 @@ else self::*/local-name() = $allowed-p-blocks"
test="ends-with($lc,'rrid: ') or ends-with($lc,'rrid ')"
role="warning"
id="final-rrid-spacing">RRID link should be preceded by 'RRID:' with no space but instead it is preceded by '<value-of select="concat(substring($pre-text,string-length($pre-text)-15),.)"/>'.</report>

<report test="matches(@xlink:href,'identifiers\.org/RRID/RRID:')"
role="error"
id="rrid-link-format">RRID links should be in the format 'https://identifiers.org/RRID:XXXX', but this one is not - <value-of select="@xlink:href"/>.</report>
</rule>

<rule context="ref-list/ref" id="ref-link-mandate">
Expand Down
2 changes: 1 addition & 1 deletion test/tests/gen/KRT-td-checks/addgene-test/addgene-test.sch
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@
</xsl:function>
<pattern id="house-style">
<rule context="table-wrap[@id='keyresource']//td" id="KRT-td-checks">
<report test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID/.*')])" role="warning" id="addgene-test">td element containing - '<value-of select="."/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID/RRID:addgene_{number} link?</report>
<report test="matches(lower-case(.),'addgene\p{Zs}?#?\p{Zs}?\d') and not(ext-link[matches(@xlink:href,'identifiers\.org/RRID:.*')])" role="warning" id="addgene-test">td element containing - '<value-of select="."/>' - looks like it contains an addgene number. Should this be changed to an RRID with a https://identifiers.org/RRID:addgene_{number} link?</report>
</rule>
</pattern>
<pattern id="root-pattern">
Expand Down
Loading

0 comments on commit 6ddd110

Please sign in to comment.