-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
58 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<package xmlns="http://expath.org/ns/pkg" name="http://history.state.gov/ns/data/visits" abbrev="visits" version="0.4" spec="1.0"> | ||
<package abbrev="visits" name="http://history.state.gov/ns/data/visits" spec="1.0" version="0.4" | ||
xmlns="http://expath.org/ns/pkg"> | ||
<title>Visits (data)</title> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<package xmlns="http://expath.org/ns/pkg" name="@url@" abbrev="@name@" version="@version@" spec="1.0"> | ||
<package abbrev="@name@" name="@url@" spec="1.0" version="@version@" | ||
xmlns="http://expath.org/ns/pkg"> | ||
<title>@title@</title> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,45 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt3" xmlns:sqf="http://www.schematron-quickfix.com/validator/process"> | ||
<schema queryBinding="xslt3" xmlns="http://purl.oclc.org/dsdl/schematron" | ||
xmlns:sqf="http://www.schematron-quickfix.com/validator/process"> | ||
<title>Visits Rules</title> | ||
|
||
<p>This schematron file contains rules for visits.</p> | ||
|
||
<let name="visit-ids" value="collection('../data?select=*.xml')//id"/> | ||
<let name="next-id" value="max(($visit-ids ! (. cast as xs:integer))) + 1"/> | ||
|
||
<pattern> | ||
<rule context="visit"> | ||
<assert test="start-date le end-date">Start/end date problem: Start date should precede end date, but <value-of select="start-date"/> is given as the start date and <value-of select="end-date"/> is given as the end date</assert> | ||
<assert test="start-date le end-date">Start/end date problem: Start date should precede | ||
end date, but <value-of select="start-date"/> is given as the start date and | ||
<value-of select="end-date"/> is given as the end date</assert> | ||
</rule> | ||
</pattern> | ||
|
||
<pattern> | ||
<rule context="visit[preceding-sibling::visit]"> | ||
<assert test="start-date ge preceding-sibling::visit[1]/start-date">Visit ordering problem: Visits should be given in chronological order, but visit <value-of select="id"/> starts before visit <value-of select="preceding-sibling::visit[1]/id"/></assert> | ||
<assert test="start-date ge preceding-sibling::visit[1]/start-date">Visit ordering | ||
problem: Visits should be given in chronological order, but visit <value-of | ||
select="id"/> starts before visit <value-of | ||
select="preceding-sibling::visit[1]/id"/></assert> | ||
</rule> | ||
</pattern> | ||
|
||
<pattern> | ||
<rule context="id"> | ||
<let name="this-id" value="./string()"/> | ||
<let name="count-used" value="count($visit-ids[. = $this-id])"/> | ||
<assert test="$count-used eq 1" sqf:fix="update-id">Visit ID problem: <value-of select="$count-used"/> other visit(s) also use the same ID, <value-of select="$this-id"/>.</assert> | ||
<assert sqf:fix="update-id" test="$count-used eq 1">Visit ID problem: <value-of | ||
select="$count-used"/> other visit(s) also use the same ID, <value-of | ||
select="$this-id"/>.</assert> | ||
<sqf:fix id="update-id"> | ||
<sqf:description> | ||
<sqf:title>Fix ID (use next available ID, <value-of select="$next-id"/>)</sqf:title> | ||
<sqf:title>Fix ID (use next available ID, <value-of select="$next-id" | ||
/>)</sqf:title> | ||
</sqf:description> | ||
<sqf:replace match="text()" select="$next-id"/> | ||
</sqf:fix> | ||
</rule> | ||
</pattern> | ||
</schema> | ||
|
||
</schema> |