Skip to content

Instantly share code, notes, and snippets.

@wsalesky
Created June 24, 2016 14:58
Show Gist options
  • Save wsalesky/482f0e4ef20f680156ab48163570888c to your computer and use it in GitHub Desktop.
Save wsalesky/482f0e4ef20f680156ab48163570888c to your computer and use it in GitHub Desktop.
Update incomplete persons abstracts.
for $rec in doc('/db/apps/bug-test/data/abstracts-incomplete-saints.xml')//tei:div
return
for $r in collection('/db/apps/bug-test/data/tei')//tei:idno[. = $rec/tei:idno]/ancestor::tei:TEI/descendant::tei:person
return
(
for $names in $r/tei:persName[@xml:id = $rec/tei:persName/@xml:id]
return
update replace $names with $rec/tei:persName[@xml:id = $names/@xml:id],
for $notes in $r/tei:note[@type='abstract']
return
update replace $notes with $rec/tei:note[@type='abstract'],
update insert
<change who="http://syriaca.org/documentation/editors.xml#dmichelson" n="2.0" when="2016-6-24-09:00" xmlns="http://www.tei-c.org/ns/1.0">Change: tagged abstract for persons, places, titles and edited the "en" persNames</change>
preceding $r/ancestor::tei:TEI/descendant::tei:teiHeader/tei:revisionDesc/tei:change[1],
update value $r/ancestor::tei:TEI/descendant::tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:date with current-date()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment