| Introduction |
|
xiii | |
|
Chapter 1 Why XQuery for Humanists? |
|
|
1 | (17) |
|
1.1 Built for the Kind of Data Most Digital Humanists Use |
|
|
1 | (3) |
|
1.2 Easy for Beginning Programmers to Learn |
|
|
4 | (3) |
|
1.3 XML and Digital Humanities Data |
|
|
7 | (6) |
|
1.3.1 XML Compared to Other Formats |
|
|
9 | (1) |
|
|
|
9 | (2) |
|
|
|
11 | (2) |
|
1.4 XQuery Compared to XSLT |
|
|
13 | (2) |
|
1.5 A Great Digital Humanities Community |
|
|
15 | (2) |
|
|
|
17 | (1) |
|
Chapter 2 Setting Up Your XQuery Environment |
|
|
18 | (15) |
|
|
|
21 | (1) |
|
|
|
21 | (1) |
|
|
|
22 | (2) |
|
|
|
24 | (2) |
|
|
|
26 | (1) |
|
2.6 Accessing Online Companion Materials |
|
|
27 | (1) |
|
2.7 Preserving and Sharing Code with GitHub |
|
|
27 | (4) |
|
2.8 Questions and Exercises |
|
|
31 | (2) |
|
Chapter 3 Reviewing XML and Related Standards |
|
|
33 | (22) |
|
3.1 History and Goals of XML |
|
|
33 | (2) |
|
|
|
35 | (6) |
|
3.2.1 Writing Well-Formed XML |
|
|
35 | (4) |
|
|
|
39 | (2) |
|
3.3 XML as a Data Standard |
|
|
41 | (3) |
|
|
|
44 | (8) |
|
3.4.1 Embracing Namespaces |
|
|
46 | (3) |
|
|
|
49 | (1) |
|
|
|
50 | (2) |
|
3.5 Questions and Exercises |
|
|
52 | (3) |
|
Chapter 4 Finding Your Way Around with XPath |
|
|
55 | (24) |
|
|
|
57 | (1) |
|
|
|
58 | (3) |
|
4.3 XPath's Abbreviated Syntax |
|
|
61 | (2) |
|
|
|
63 | (9) |
|
4.5 XPath Tips and Tricks |
|
|
72 | (4) |
|
|
|
72 | (1) |
|
|
|
73 | (2) |
|
4.5.3 Selecting Multiple Element Names with the Union Operator |
|
|
75 | (1) |
|
4.5.4 Selecting the "Nth" Item or a Range of Items |
|
|
75 | (1) |
|
4.6 Questions and Exercises |
|
|
76 | (3) |
|
|
|
79 | (28) |
|
5.1 The Parts of an XQuery |
|
|
80 | (4) |
|
5.2 Enclosed Expressions and Curly Braces |
|
|
84 | (1) |
|
|
|
85 | (16) |
|
|
|
86 | (2) |
|
5.3.2 Iterating over Variables |
|
|
88 | (2) |
|
|
|
90 | (2) |
|
5.3.3.1 A Short Note on Comparisons |
|
|
92 | (2) |
|
|
|
94 | (2) |
|
|
|
96 | (2) |
|
|
|
98 | (3) |
|
5.4 Conditional Expressions |
|
|
101 | (4) |
|
5.4.1 Effective Boolean Values |
|
|
102 | (1) |
|
5.4.2 The Else Clause Is Required: A Few Tips About Using Conditional Expressions |
|
|
103 | (1) |
|
5.4.3 Chaining Conditional Expressions |
|
|
104 | (1) |
|
5.5 Questions and Exercises |
|
|
105 | (2) |
|
Chapter 6 Next Steps with XQuery |
|
|
107 | (24) |
|
6.1 The Built-In Function Library |
|
|
107 | (7) |
|
6.2 Writing Your Own Functions |
|
|
114 | (5) |
|
6.3 Using Library Modules |
|
|
119 | (8) |
|
6.3.1 Importing Library Modules |
|
|
119 | (2) |
|
6.3.2 Creating Your Own Library Modules |
|
|
121 | (3) |
|
6.3.3 Public and Private Functions |
|
|
124 | (3) |
|
|
|
127 | (1) |
|
6.4 Questions and Exercises |
|
|
127 | (4) |
|
Chapter 7 Advanced XQuery |
|
|
131 | (32) |
|
|
|
131 | (5) |
|
|
|
136 | (16) |
|
7.2.1 Revisiting Sequences |
|
|
136 | (3) |
|
|
|
139 | (6) |
|
|
|
145 | (2) |
|
7.2.4 Combining Maps and Arrays |
|
|
147 | (2) |
|
7.2.5 Modifying Maps and Arrays |
|
|
149 | (3) |
|
|
|
152 | (8) |
|
7.3.1 Understanding Tuple Streams |
|
|
152 | (2) |
|
|
|
154 | (2) |
|
|
|
156 | (4) |
|
7.4 Questions and Exercises |
|
|
160 | (3) |
|
Chapter 8 Thinking Functionally |
|
|
163 | (37) |
|
|
|
164 | (3) |
|
|
|
167 | (5) |
|
|
|
172 | (4) |
|
|
|
176 | (15) |
|
8.4.1 Transforming Data with Recursive Typeswitch |
|
|
179 | (12) |
|
8.5 Higher-Order Functions |
|
|
191 | (7) |
|
8.6 Questions and Exercises |
|
|
198 | (2) |
|
Chapter 9 Modifying Your Data with XQuery Update |
|
|
200 | (24) |
|
|
|
201 | (3) |
|
9.2 Transform Expressions |
|
|
204 | (11) |
|
|
|
204 | (2) |
|
|
|
206 | (1) |
|
|
|
207 | (2) |
|
|
|
209 | (2) |
|
|
|
211 | (4) |
|
|
|
215 | (7) |
|
|
|
215 | (4) |
|
|
|
219 | (3) |
|
9.4 Questions and Exercises |
|
|
222 | (2) |
|
Chapter 10 Searching with XQuery Full Text |
|
|
224 | (27) |
|
10.1 Finding Patterns with XPath |
|
|
224 | (6) |
|
10.1.1 Searching Substrings |
|
|
225 | (1) |
|
10.1.2 Regular Expressions |
|
|
226 | (4) |
|
10.2 The Full Text Contains Text Operator |
|
|
230 | (19) |
|
|
|
233 | (1) |
|
|
|
234 | (2) |
|
|
|
236 | (1) |
|
10.2.4 Positional Filters |
|
|
237 | (5) |
|
|
|
242 | (2) |
|
|
|
244 | (5) |
|
10.3 Questions and Exercises |
|
|
249 | (2) |
|
Chapter 11 Handling Errors Gracefully |
|
|
251 | (18) |
|
11.1 Documenting Your XQuery with XQDoc |
|
|
252 | (5) |
|
11.2 Catching Mistakes Before You Run Anything |
|
|
257 | (3) |
|
11.3 Catching Errors at Runtime |
|
|
260 | (5) |
|
11.4 Unit Testing with XQuery |
|
|
265 | (1) |
|
11.5 Questions and Exercises |
|
|
266 | (3) |
|
Chapter 12 Using XQuery with Other Digital Humanities Tools |
|
|
269 | (27) |
|
|
|
271 | (9) |
|
|
|
280 | (10) |
|
|
|
290 | (4) |
|
12.4 Questions and Exercises |
|
|
294 | (2) |
|
|
|
296 | (9) |
|
|
|
296 | (1) |
|
|
|
297 | (3) |
|
|
|
299 | (1) |
|
13.2 The XQuery Community |
|
|
300 | (4) |
|
|
|
300 | (1) |
|
|
|
301 | (2) |
|
13.2.3 Conferences and Training |
|
|
303 | (1) |
|
13.3 Questions and Exercises |
|
|
304 | (1) |
| Acknowledgments |
|
305 | (2) |
| Notes |
|
307 | (12) |
| About the Authors |
|
319 | (2) |
| Index |
|
321 | |