Skip to content

Instantly share code, notes, and snippets.

@WaxCylinderRevival
WaxCylinderRevival / find-date-mismatches.xq
Created October 7, 2016 12:44 — forked from joewiz/find-date-mismatches.xq
Find FRUS documents whose English dates do not match the date metadata
xquery version "3.1";
(:
Find cases such as this:
<dateline>
<placeName>Washington</placeName>,
<date when="1971-10-05">October 15, 1971</date>.
</dateline>
@WaxCylinderRevival
WaxCylinderRevival / frus-document-dates.xq
Last active October 6, 2016 00:07 — forked from joewiz/frus-document-dates.xq
Look through FRUS documents for dates
xquery version "3.1";
declare namespace tei="http://www.tei-c.org/ns/1.0";
import module namespace dates="http://xqdev.com/dateparser" at "xmldb:exist:///db/apps/twitter/modules/date-parser.xqm";
declare function local:get-date-candidate-field($div) {
let $head := normalize-space(string-join($div/tei:head[1]/node()[not(./self::tei:note)]))
let $source-note := normalize-space(string-join($div//tei:note[@type='source']))
let $body := normalize-space(string-join($div/tei:head/following-sibling::node()))