Skip to content

Commit 27dea00

Browse files
committed
add xquery for extracting from existing collection()
1 parent 755b945 commit 27dea00

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

getCMIF.xquery

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
xquery version "3.0";
2+
declare namespace functx = "http://www.functx.com";
3+
declare namespace tei = "http://www.tei-c.org/ns/1.0";
4+
declare option omit-xml-declaration "yes";
5+
declare variable $pdu external;
6+
7+
(: define some string constants :)
8+
let $baseurl := 'https://qhod.net/'
9+
let $uuid := 'c3a12a74-341f-11ed-a261-0242ac120002' (: option: call unparsed-text(doc('https://www.uuidgenerator.net/api/version1')) :)
10+
let $projectname := 'QhoD project'
11+
12+
(: fallback if the Oxygen Scenario does not include a value for $pdu as a parameter :)
13+
let $pdu := '/home/skurz/Dokumente/git/qhod-data/TEI'
14+
let $docs := collection(concat($pdu, "?select=*.xml;recurse=yes"))
15+
let $letterlike := $docs[//tei:correspAction]//tei:teiHeader
16+
17+
(:
18+
Quick XQuery to get all correspDesc elements of the QhoD project into a CMIF file according to the example files at https://github.com/TEI-Correspondence-SIG/CMIF/tree/main/examples
19+
The actual loop fetching //correspAction starts in line 54
20+
21+
Output might need some XSL postprocessing in order to validate against the strict CMIF schema.
22+
:)
23+
24+
return
25+
<TEI xmlns="http://www.tei-c.org/ns/1.0"><?xml-model href="https://raw.githubusercontent.com/TEI-Correspondence-SIG/CMIF/main/schema/cmi-customization.rng"?>
26+
<teiHeader>
27+
<fileDesc>
28+
<titleStmt>
29+
<title xml:lang="de">CMIF data for {$projectname}</title>
30+
<editor><persName ref="https://orcid.org/0000-0003-2546-2570 http://d-nb.info/gnd/13281899X">Stephan Kurz</persName></editor>
31+
</titleStmt>
32+
<publicationStmt>
33+
<publisher>Austrian Academy of Sciences, Institute for Habsburg and Balkan Studies</publisher>
34+
<idno type="PID">o:qhod.cmif</idno>
35+
<idno type="url">https://qhod.net/archive/objects/o:qhod.cmif/methods/sdef:TEI/getSource</idno>
36+
<date when="2022"/>
37+
<availability>
38+
<licence target="https://creativecommons.org/licenses/by/4.0/">CC-BY 4.0</licence>
39+
</availability>
40+
</publicationStmt>
41+
<!--<seriesStmt>
42+
<title xml:lang="de">Digitale Edition von Quellen zur habsburgisch-osmanischen Diplomatie 1500–1918</title>
43+
<title xml:lang="en">Digital Scholarly Edition of Habsburg-Ottoman Diplomatic Sources 1500–1918</title>
44+
<title xml:lang="tr">Habsburg-Osmanlı Diplomasisi Kaynakları Dijital Edisyonu 1500–1918</title>
45+
<respStmt>
46+
<resp>Projektleitung</resp>
47+
<persName>Arno Strohmeyer</persName>
48+
</respStmt>
49+
</seriesStmt>-->
50+
<sourceDesc>
51+
<bibl type="online" xml:id="{$uuid}">Digitale Edition von Quellen zur habsburgisch-osmanischen Diplomatie (15001918)</bibl>
52+
</sourceDesc>
53+
</fileDesc>
54+
<profileDesc>{
55+
for $letter in $letterlike
56+
let $filestring := concat($baseurl, $letter//tei:idno[@type='PID'])
57+
return <correspDesc ref="{$filestring}" source="{concat('#', $uuid)}">{$letter//tei:correspAction}</correspDesc>
58+
}</profileDesc>
59+
<!--<revisionDesc>
60+
<change><persName>Stephan Kurz</persName> <date when="{format-dateTime(current-dateTime(),'[Y0001]-[M01]-[D01]T[H01]:[m01]:[s]')}"></date> run XQuery</change>
61+
</revisionDesc>-->
62+
</teiHeader>
63+
<text><body><p/></body></text>
64+
</TEI>

0 commit comments

Comments
 (0)