-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathzanetti-create-bibl-tei.xql
More file actions
86 lines (81 loc) · 4 KB
/
zanetti-create-bibl-tei.xql
File metadata and controls
86 lines (81 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
xquery version "3.0";
(:
: Create new TEI bibl records from ZanettiBiblConverted.xml
: Save records to db, must be logged into eXist as admin/with admin privileges
:)
declare default element namespace "http://www.tei-c.org/ns/1.0";
declare namespace tei = "http://www.tei-c.org/ns/1.0";
declare namespace syriaca = "http://syriaca.org";
declare namespace functx = "http://www.functx.com";
(: Build TEI record for Syriaca.org data app :)
declare function syriaca:build-tei($node as element()*) as node(){
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<fileDesc>
<titleStmt>
{
for $titles in $node//tei:title
return $titles
}
<sponsor>Syriaca.org: The Syriac Reference Portal</sponsor>
<funder>The National Endowment for the Humanities</funder>
<funder>The International Balzan Prize Foundation</funder>
<principal>David A. Michelson</principal>
<editor role="general" ref="http://syriaca.org/editors.xml#dmichelson">David A. Michelson</editor>
<editor role="creator" ref="http://syriaca.org/editors.xml#uzanetti">Ugo Zanetti</editor>
<editor role="creator" ref="http://syriaca.org/editors.xml#ngibson">Nathan P. Gibson</editor>
<respStmt>
<resp>XML coded by</resp>
<name ref="http://syriaca.org/editors.xml#ngibson">Nathan P. Gibson</name>
</respStmt>
<respStmt>
<resp>TEI records generated by</resp>
<name ref="http://syriaca.org/editors.xml#wsalesky">Winona Salesky</name>
</respStmt>
<respStmt>
<resp>Bibliography items adapted from the work of</resp>
<name type="person" ref="http://syriaca.org/editors.xml#uzanetti">Ugo Zanetti</name>
</respStmt>
</titleStmt>
<publicationStmt>
<authority>Syriaca.org: The Syriac Reference Portal</authority>
<idno type="URI">{concat($node//tei:idno[contains(.,'syriaca')]/text(),'/tei')}</idno>
<availability>
<licence target="http://creativecommons.org/licenses/by/3.0/">
<p>Distributed under a Creative Commons Attribution 3.0 Unported License.</p>
</licence>
</availability>
<date>{current-date()}</date>
</publicationStmt>
<sourceDesc>
<p>Born digital.</p>
</sourceDesc>
</fileDesc>
<revisionDesc>
<change who="http://syriaca.org/editors.xml#wsalesky" when="{current-date()}">CREATED: bibl</change>
</revisionDesc>
</teiHeader>
<text>
<body>
<biblStruct>
{$node/child::*[name()!='citedRange']}
</biblStruct>
</body>
</text>
</TEI>
};
(: Create a new TEI record for each biblStruct element, save to db. :)
declare function syriaca:create-tei-records($node as node()){
for $bibl in $node//tei:biblStruct
let $collection-uri := '/db/apps/srophe-data/data/bibl/tei/'
let $file-name := concat(tokenize($bibl//tei:idno[1],'/')[last()],'.xml')
return
(:($collection-uri, $file-name, syriaca:build-tei($bibl) ):)
xmldb:store($collection-uri, xmldb:encode-uri($file-name), syriaca:build-tei($bibl))
};
(: Copy of latest xml data to be converted. This is my local path :)
let $uri := "/db/apps/srophe-data/data/ZanettiBiblConverted.xml"
(: This is the file on github :)
(: "https://raw.githubusercontent.com/srophe/draft-data/blob/master/data/works/Zanetti_XSL_Conversion/ZanettiBiblConverted.xml":)
let $tei := doc($uri)//tei:TEI
return syriaca:create-tei-records($tei)