-
- Weitere Informationen zu diesem Buch:
Inhaltsverzeichnis | Index | Probekapitel | Kolophon | Rezensionen |
- Weitere Informationen zu diesem Buch:
First Edition März 2007
ISBN 978-0-596-00634-1
Weitere Informationen zu diesem Buch
Inhaltsverzeichnis |
Index |
Probekapitel |
Kolophon |
Rezensionen |
Index
[ Symbols ], [ A ], [ B ], [ C ], [ D ], [ E ], [ F ], [ G ], [ H ], [ I ], [ J ], [ K ], [ L ], [ M ], [ N ], [ O ], [ P ], [ Q ], [ R ], [ S ], [ T ], [ U ], [ V ], [ W ], [ X ], [ Y ], [ Z ],
Symbols[ Top ]
& (ampersand)
&& (and) full text operator, 286
entity reference (&), 279
escaping in element constructor content, 59
escaping in string literals, 214
separator character in URIs, 262
< > (angle brackets)
< (less than) operator, 30
comparing dates and times, 246
comparing durations, 248
comparing numeric values, 206
comparing strings, 215
entity reference (<), 229, 279
SQL and XQuery, 297
<!-- -->, XML comment delimiters, 29
<![CDATA[ and ]]> CDATA section delimiter, 280
<, escaping in element constructor content, 59
<< and >> operators, comparing nodes by relative position in document order, 91
<= (less than or equal to) operator, 30
comparing dates and times, 245
comparing numeric values, 206
comparing strings, 215
SQL and XQuery, 297
<? ?>, in processing instruction constructors, 271
> (greater than) operator, 30
comparing dates and times, 246
comparing durations, 248
comparing numeric values, 206
comparing strings, 215
entity reference (>), 279
SQL and XQuery, 297
>= (greater than or equal to) operator, 30
comparing dates and times, 245
comparing numeric values, 206
comparing strings, 215
SQL and XQuery, 297
' (apostrophe), entity reference ('), 279
* (asterisk)
*? (reluctant quantifier), 236
escaping in regular expressions, 229
multiplication operator, 207
multiplying durations by numbers, 252
occurrence indicator, zero, one, or many items, 103, 107, 151, 152
cast expression and, 157
return type of function, 151
quantifier, zero, one, or many occurrences, 227
wildcard in path expressions, 6, 39, 43
@ (at sign)
@*, copying attributes from an element, 111
abbreviation for attribute axis, 45
abbreviation for axes, 45
returning attributes in path expressions, 5
separator character in URIs, 262
\ (backslash)
back references, 238
character escapes in regular expressions, 228
escaping in character class expressions, 235
^ (caret)
beginning-of-line matching in regular expressions, multi-line mode and, 238
beginning-of-string matching in regular expressions, 236
escaping in character class expressions, 235
escaping in regular expressions, 228
negating character class in regular expressions, 234
: (colon)
separator character in URIs, 262
XML name with no colon (NCName), 264
, (comma)
concatenating sequences with sequence constructor, 118
interaction with parentheses and curly braces in XQuery, 32
separating expressions, 16
separator character in URIs, 262
using between adjacent FLWOR clauses, 77
{ } (curly braces)
in computed element constructors, 69
in element constructors, 8
enclosed expressions, 61
enclosing function body, 105
escaping in element content, 59
escaping in regular expressions, 229
interaction with parentheses and commas in XQuery, 32
in text node constructors, 278
$ (dollar sign)
end-of-line matching in regular expressions, multi-line mode and, 238
end-of-string matching in regular expressions, 236
escaping in regular expressions, 228
separator character in URIs, 262
in variable names, 28
function parameters, 106
replacement variables, 241
= (equals sign)
equal to operator, 30, 84, 298
!= operator vs. not function in expression using =, 38
comparing dates and times, 246
comparing durations, 247
comparing numeric values, 206
comparing strings, 215
SQL and XQuery, 297
used on lists of values, 112
separator character in URIs, 262
! (exclamation mark)
! (not) full text operator, 286
!= (not equal to) operator, 30
comparing dates and times, 245
comparing numeric values, 206
comparing strings, 215
not function vs., 38, 112
SQL and XQuery, 297
- (hyphen), subtraction from character class range in regular expressions, 234
in XML comments, 269
- (minus sign)
escaping in regular expressions, 228
negation operator, 207
negative durations, 246
subtraction operator, 207
subtracting durations, 251
( ) (parentheses)
(: :) (XQuery comment delimiters), 29, 268
concatenating sequences with sequence constructor, 118
empty sequence as argument in function call, 102
enclosing test expression after if keyword, 35
escaping in regular expressions, 229
evaluation order and, 30
expressions used as steps, 45
function parameter lists, 105
in functions, 101
interaction with commas and curly braces in XQuery, 32
sub-expressions and branches in regular expressions, 227, 238
using for query clarity, 194
(see also empty sequence)
% (percent sign)
separator character in URIs, 262
URI characters escaped for HTML agents, 348
. (period)
. . (abbreviation for steps), 45
abbreviation for context item, 109
abbreviation for steps, 45
character wildcard in regular expressions, 229
escaping in regular expressions, 228
representing context node in predicates and paths, 55
wildcard, dot-all mode, 238
+ (plus sign)
addition operator, 207
adding durations, 251
adding durations to dates and times, 250
escaping in regular expressions, 229
occurrence indicator, one or many items, 103, 152
cast expression and, 157
quantifier, one or many occurrences, 227
separator character in URIs, 262
# (pound sign), delimiters for extension expression pragmas, 292
? (question mark)
escaping in regular expressions, 228
occurrence indicator (zero or one items), 103, 107, 152
in function argument types, 150
using with cast expression, 157
quantifier, zero or one occurrences, 227
reluctant quantifiers in regular expressions, 235
separator character in URIs, 262
" (quotes, double)
enclosing string literals, 28
entity reference ("), 279
escaping in string literals, 214
string literals included in queries, 213
' (quotes, single)
enclosing string literals, 28
entity reference ('), 279
escaping in string literals, 214
string literals included in queries, 213
; (semicolon)
separator character in URIs, 262
terminating declarations in query prolog, 161
/ (slash)
abbreviation for axes and steps (//), 45
beginning path expressions, 5, 56
// (double slash), 6, 56
in predicates, changing context node, 55
URI separator character, 262
[ ] (square brackets)
character classes in regular expressions, 233
escaping in character class expressions, 235
escaping in regular expressions, 229
in predicates, 6, 46
changing context node, 55
separator character in URIs, 262
| (vertical bar)
|| (or) operator, 286
between branches in regular expressions, 227, 238
escaping in regular expressions, 228
union operator, 45, 118
A[ Top ]
abs (absolute value) function, 212, 321
absent values, 197
absolute URIs, 259
(see also base URIs)
addition, 209
+ operator, 207
durations, 251
durations to dates and times, 250
precedence of arithmetic operators, 209
SQL and XQuery operators, 298
sum function, 401
adjust-dateTime-to-timezone function, 323
adjust-date-to-timezone function, 321
adjust-time-to-timezone function, 245, 323
aggregating values, 11, 94-98
constraining and sorting on aggregated values, 98
counting missing values, 96
ignoring missing values, 95
on multiple values, 96
aggregation functions, 23, 212
analysis (compile) time, 185
ancestor axis, 42, 289
in path expressions, 202
ancestor-or-self axis, 42, 289
in path expressions, 202
ancestors (nodes), 20
anchors (in regular expressions), 236
multi-line mode and, 237, 238
and operator, 37
SQL and XQuery, 298
argument lists (functions), 101
empty sequence or zero-length string, 101
sequences and, 102
arguments (function)
conversion to expected type, 103
empty sequence as argument, 107
nodes vs. atomic values, 107
arithmetic operations, 207-211
addition, subtraction, and multiplication, 209
on dates, times, and durations, 249-252
division, 210
expressions, 27
modulus (remainder), 211
on multiple numeric values, 208
numeric type promotion in expressions, 206
precedence of arithmetic operators, 209
SQL and XQuery, 298
types and, 208
XQuery 1.0 and XPath 1.0 and 2.0, 316
ascending or descending order, 87
assertions, type, 190
at keyword, 116
namespace prefix mapping in module import, 165
atomic types
built into XQuery, 143
hierarchy, 144
as sequence types, 153
atomic values, 22
casting any type to xs:string or xs:untypedAtomic, 158
casting between specific types, 158-159
comparing, 30
constructing with given types, 155
enclosed expressions in direct element constructors evaluating to, 61
nodes vs. in function arguments, 107
returned by last step in a path, 46
sequence types for function parameters, 103
types, 145
untyped, 438
atomization, 148
function conversion rules, 150
on operands of arithmetic expressions, 208
atoms (regular expressions), 226
parenthesized subexpressions as, 227
attribute axis, 41
attribute nodes, 18
(see also attributes)
attribute( ) kind test, 154, 183
attributes
adding to an element, 111
adding to query results, 9
atomic values, 22
computed attribute constructors, 70
declarations in XML Schema, 173
enclosed expressions in direct element constructors evaluating to, 61
finding with path expressions, 5
including with result elements, using enclosed expressions, 62
from input document, including in query results, 57
matching based on name, 183
names, 21
affected by namespace declarations in XQuery, 133
namespaces, 24, 125
declaration attributes, 131
predeclared, 128
prefixes, 124
node hierarchy (family analogy), 19
removing from an element, 111
removing from an element and all descendants, 112
specifying directly using direct element constructors, 62
string and type values, 21
types, 173
averages
avg function, 95, 212, 324
ignoring absent nodes, 96
avg-empty-is-zero function, 97
calculating with missing values, 198
axes, 41
abbreviated syntax, 44
forward, 41
Full Axis feature, 289
reverse, 41
positional predicates and, 50
using node( ) test with, 44
axis steps, 41
node tests, 42-44
B[ Top ]
back-references, 237
base URIs, 259
finding for a node, 260
resolving URIs, 261
specifying with xml:base attribute, 260
of the static context, 261
base-URI declaration, 261
base-uri function, 260, 325
BETWEEN condition (SQL), 297
between function, 34
binary data
xs:base64Binary type, 414
xs:hexBinary type, 427
binding sequence, 74
block escapes in regular expressions, 232
examples, 233
body, functions, 105
invalid use of context, 108
body, queries, 16, 160
main module, 163
variable bindings, 166
boolean function, 149, 327
boolean operators in SQL and XQuery, 298
Boolean values
combining in logical expressions, 37
effective Boolean values, 47
calculated for FLWOR where expression, 78
conditional expressions and, 36
sequences treated as, 148
literal, using in expressions, 28
negating, 38
quantified expressions evaluated to, 79
xs:boolean type, 415
boundary whitespace (in direct element constructors), 65
boundary-space declaration, 66
braces (see { } (curly braces))
branches (in regular expressions), 227, 238
built-in functions
numeric keyword, use in signature, 103
reference, 319-410
shared by XQuery and XSLT 2.0, 308
user-defined vs., 99
XQuery 1.0/XPath 2.0 and 1.0, 317
C[ Top ]
\C (character that cannot be part of an XML name) in regular expressions, 231
\c (character that is part of an XML name) in regular expressions, 231
canonical representation, primitive types, 143
carriage return (\r), in regular expressions, 229
case clauses (typeswitch expressions), 188
case mappings
lower-case function, 364
upper-case function, 408
case-insensitive matching, 238
case-sensitivity, keywords and names, 27
castable as keywords, 157
casting, 24
cast expression, 156, 190
castable expression, 157
date/time types, 245
function conversions and, 103
functions on sequences of numbers, 212
rules, 158-159
types to xs:string, 214
untyped values, 147
in function conversion rules, 150
xs:anyURI values, 413
xs:boolean values, 415
xs:decimal values, 419
xs:double values, 420
xs:float values, 423
xs:hexBinary values, 428
xs:integer values, 430
catalog.xml document (example), 3
category escapes in regular expressions, 231
examples, 233
CDATA sections, 280
ceiling function, 212, 328
change-element-ns function, 258
change-element-ns-deep function, 258
change-elem-names function, 114
character classes, 233
escaping rules, 235
examples of expressions, 234
negative character class expressions, 234
single characters and ranges, 233
subtraction from a range, 234
character encodings, 162
character references, 278
examples, 278
in queries, 280
to whitespace characters in direct element constructors, 67
XML syntax, using in regular expressions, 229
characters
characters.xq module, 165
literal, in element constructor content, 59
checking types in XQuery, 146
child axis, 41
child elements, 173
removing, 113
children (nodes), 19
circular module imports, 165
clarity of queries, 193-196
choosing names, 194
improving layout, 194
user-defined functions and, 104
using comments for documentation, 195
codepoint-equal function, 328
codepoints-to-string function, 218, 220, 329
collations, 223
default collation declaration, 224
default-collation function, 340
specifying sort order of strings, 87
URIs, 259
used by comparison operators, 215
collection function, 53, 329
base URI of the static context, 261
comma (,) (see , (comma))
comment nodes, 19
comment( ) kind test, 154, 268
comments
using for documentation, 195
xqdoc comments for a function, 195
XML, 267
constructing, 268
data model and, 267
included in queries, 29
querying, 268
sequence types and, 268
XQuery, 29
not included in query results, 269
compare function, 215, 330
collations, 224
comparisons, 30-35
comparison expressions, 26
date component types, 253
dates and times, 245
deep-equal function, 82, 339
default collation, using, 224
durations, 247
general comparisons, 30-32
on multi-item sequences, 31
types and, 31
node comparisons, 34
numeric type promotion in comparison expressions, 206
numeric values, 206
in predicates, 47
relative position in document order, 91
in SQL as compared to XQuery, 297
strings, 214-216
untyped values, using general comparison operators, 142
value comparisons, 33
XQuery and XPath, versions 1.0 and 2.0, 316
xs:anyURI values, 413
xs:hexBinary values, 428
complex types, 173
components
date component types, 252
extracting from dates, times, and durations, 248
computed constructors, 10, 57, 68
attribute constructors, 70
comment, 269
document, 274
element constructors, 68-70
content of, 69
processing instruction, 272
transforming content into markup (example), 71
concat function, 218, 219, 331
automatic casting of argument values, 147
concatenation, 219
merging sequences, 118
union expressions vs., 119
conditional expressions, 26, 35-37
effective Boolean values and, 36
nesting, 36
sorting order specifications, 88
conditions, SQL and XQuery, 297
conformance, 289
constant values in queries, 28
constraining query results on aggregated values, 98
construction declaration, 182
constructors, 57, 155
adding elements and attributes to query results, 7-10
computed, 68
constructor expressions, 26
date and time types, 243
direct, 10
document node, 273
processing instruction, 271
sequence, 22
text node, 278
type, converting literal values, 28
using xml:id attribute in element constructors, 266
XML comment, 268
xs:QName, 257
xs:string, 214
contains function, 215, 332
collations and, 223
contains-word function, 215
content types for complex types, 174
context, 16, 55-56
functions and, 108
path expressions and, 40
path used within FLWOR where clause, 78
setting query context in different XQuery implementations, 290
context item, 16, 55
passing to a function, 109
path expressions and, 40
position within context sequence, 49
context node, 40
accessing the root, 56
changing, 55
setting outside of query, 54
working with, 55
conversions, type, 24, 190
automatic, 147-151
atomization, 148
casting untyped values, 147
effective boolean value, 148
function conversion rules, 103, 150
subtype substitution, 147
type promotion, 147
casting
cast expression, 156
castable expression, 157
rules for casting, 158-159
constructors, using, 155
type constructors, using, 28
Coordinated Universal Time (see UTC)
copy-namespaces declaration, 138-140
inherit or no-inherit settings, 138
preserve or no-preserve settings, 138
query with no-preserve, inherit settings, 140
query with preserve, no-inherit settings, 140
count function, 94, 333
cross-references, 264
curly braces (see { }(curly braces))
currency symbols (Unicode), 232
current date and/or time, 243
current-date function, 333
current-dateTime function, 334
current-time function, 334
D[ Top ]
\D (nondecimal digit) character in regular expressions, 230
\d (digit) character in regular expressions, 230
data function, 9, 22, 305, 335
data model, 17-23
atomic values, 22
basic components, 17
common to XQuery and XSLT, 308
differences in XQuery 1.0/XPath 1.0 and 2.0, 315
document nodes and, 273
nodes, 18-22
processing instructions and, 270
relational vs. XML, 294
sequences, 22
text nodes and, 275
XML comments and, 267
data types (see types)
databases, 2
native XML databases supporting XQuery, 3
relational databases supporting XML and XQuery, 3
dates and times, 143, 242-246
arithmetic operators, using on, 249-252
comparing, 245
date component types, 252
date formats, 244
durations of time, 246
adding and subtracting values, 251
comparing, 247
dividing by another duration, 252
multiplying and dividing by numbers, 251
yearMonthDuration and dayTimeDuration types, 247
extracting components, 248
including literal date in an expression, 28
subtracting durations from, 250
types, 242
constructing and casting, 155, 243
time zones, 243-245
xs:date, 416
xs:dateTime, 416
xs:time, 436
dateTime function, 243, 336
days
date component types, 252
day-from-date function, 337
day-from-dateTime function, 337
days-from-duration function, 338
extracting from dates, times, and durations, 248
xs:gDay type, 424
xs:gMonthDay type, 425
decimal digit character (\d), in regular expressions, 230
decimal numbers, 204
xs:decimal type, 418
declarations
base URI, 261
default collation, 224
element and attribute, XML Schema, 173
empty order, 88
function, 104
binding variables to values, 29
external functions, 168
function called from within another function, 105
recursive functions, 109
sequence types, 151
module, 163
namespace, 124
controlling in query results, 135-137
copy-namespaces declaration, 138-140
default namespace, 125
impact and scope in XQuery, 132
in element constructors, 131
query prolog, 128-131
scope and, 126
XQuery queries, 128-134
option, 291
ordering mode, 93
in query prolog, 16, 160, 161
type, 190
variables, 166
external, 168
version, 162
declare function keywords, 105
deep-equal function, 82, 339
default clause (typeswitch expressions), 188
default collation declaration, 224
default namespace
declaring, 125
in query prologs, 129
functions, 131, 133
overriding, 127
default settings defined outside of query scope, 162
default-collation function, 224, 340
derived types
built-in, 143
casting among, 159
descendant axis, 41
descendant-or-self axis, 41
avoiding use in path expressions, 202
descendants (nodes), 20
descending or ascending order, 87
digit character (\d), in regular expressions, 230
direct constructors, 10, 57
processing instruction, 271
XML comment, 269
direct element constructors, 58-67
containing enclosed expressions, 60-62
containing literal characters, 59
containing other element constructors, 59
modifying element from input document (example), 64
namespace declarations, 63, 131
controlling in query results, 135-137
scope of, 132
references in, 280
specifying attributes directly, 62
using computed attribute constructors, 70
whitespace, 65-67
boundary whitespace, 65
boundary-space declaration, 66
forcing boundary whitespace preservation, 67
distinct values, 81
selecting (SQL vs. XQuery), 300
distinct-deep function, 82
distinct-values function, 81, 94, 300, 340
collations, 224
NaN, 207
using in FLWORs for grouping, 303
division, 27
div and idiv operators, 207, 210
durations by durations, 252
durations by numbers, 251
modulus (remainder), 211
SQL and XQuery operators, 298
doc function, 53, 342
base URI of the static context, 261
input document opened with, 272
doc-available function, 343
document element, 20
document nodes, 19, 56
document order, 85, 89
inadvertent resorting in, 90
order comparisons, 91
sorting in, 90
documentation, using comments for, 195
document-node( ) test, 154
documents (XML), 272-274
constructing document nodes, 273
document nodes and sequence types, 273
document nodes and XQuery data model, 273
serialization of query results to, 289
document-uri function, 344
dot-all mode, 230, 238
double-precision floating-point numbers, 205
duplicate nodes, elimination in unions, 119
durations
adding and subtracting from dates and times, 250
adding and subtracting to/from duration types, 251
comparing, 247
days-from-duration function, 338
dividing by durations, 252
hours-from-duration function, 352
minutes-from-duration function, 369
months-from-duration function, 371
multiplying and dividing by numbers, 251
seconds-from-duration function, 392
time zone values in XQuery functions, 243
types
summary of, 247
xs:dayTimeDuration, 247, 417
xs:duration, 246, 421
xs:yearMonthDuration, 247, 439
years-from-duration function, 409
dynamic errors, 199
caused by variations in input documents, 200
type errors, 200
dynamic evaluation phase (type checking), 146
dynamic paths, 52
E[ Top ]
element constructors (see computed constructors; direct element constructors)
element nodes, 18
(see also elements)
element( ) kind test, 151, 154, 183
element-only content, 151, 181
elements
adding to query results, 7
atomic values, 22
computed element constructors, 68-70
recursively processing elements, 71
turning content into markup (example), 71
copying with modifications
adding attributes, 111
changing names, 114
removing attributes, 111
removing attributes from all descendants, 112
removing child elements, 113
declarations in XML Schema, 173
direct element constructors, 58-67
containing literal characters, 59
containing other element constructors, 59
modifying input document element, 64
extracting contents with data function, 9
finding with path expressions, 5
input document
copying with modifications in query, 110-115
including in query results, 57
in-scope namespaces, 135
matching based on name, 183
names, 21
names affected by namespace declarations in XQuery, 133
namespace prefixes, 124
namespaces, 24
node hierarchy (family analogy), 19
roots and documents, 20
string and typed values, 21
types, 173
else if construct, 36
else keyword, 35
empty and nil values, 198
empty content, 181
empty element, 295
empty function, 345
empty greatest or empty least order, 87
empty order declaration, 88
empty sequence, 23
argument lists and, 101
in arithmetic operations, 208
base URI of the static context, 261
else expression evaluated to, 36
in function arguments, 107
in general comparisons, 31
in node comparisons, 34
in value comparisons, 33
empty-sequence( ) kind test, 153
enclosed expressions, 59
computed attribute constructors used in direct element constructors, 70
containing element content, 69
elements returned by, 69
evaluating to atomic values, 61
evaluating to attributes, 62
evaluating to whitespace, 67
evaluation in attribute values, 63
with multiple subexpressions, 61
separation by spaces, 65
whitespace in, 66
encode-for-uri function, 263, 345
encoding keyword, 162
ends-with function, 215, 346
entity references, 214, 278
predefined, 279
query using (example), 279
XML syntax, using in regular expressions, 229
eq operator (see equal to operator)
equal to operator
=, 30, 298
comparing dates and times, 246
comparing durations, 247
comparing numeric values, 206
comparing strings, 215
used on lists of values, 112
eq, 33
comparing numeric values, 207
error function, 200, 347
errors
handling with good query design, 199
avoiding dynamic errors, 200
error and trace functions, 200
reference (in alphabetical order by name), 440-464
serialization, 283
type, 146
dynamic errors, checking for, 146
static errors, checking for, 146
escape-html-uri function, 263, 348
escapes
character class expressions, 235
character references, 278
entity references, 279
quotes in string literals, 214
representing groups of characters in regular expressions, 230-233
single characters in regular expressions, 228
URIs, 262
evaluation (run) time, 185
every (keyword), 27, 80
exactly-one function, 192, 349
except expression, 119
exists function, 350
SQL Server, 304
explicit time zones, 243
expressions, 26-38
categories of, 26
evaluation order and parentheses, 30
in function body, 105
new, in XPath 2.0, 315
in query body, 16
reevaluating, 201
whitespace in queries, 27
(see also FLWORs; listings under expression category names)
extension expressions, 292
external variables, 168
F[ Top ]
false (Boolean value), 149
false function, 28, 351
family relationships among nodes, 19
flags (in regular expressions), 238
floating-point numbers, 205
xs:double type, 419
xs:float type, 423
floor function, 212, 351
FLWORs, 6, 26, 27, 72-84
binding variables, 29
clauses, listed, 7, 73
distinct-values function, using, 303
element constructor in return clause, 8
embedded in another FLWOR, 302
for clause, 74-76
defining positional variable, 116
grouping results into categories, 93
improving readability using whitespace and parentheses, 194
joining data from multiple sources, 10, 81-84
joins and types, 84
outer joins, 84
result order not significant, 91
three-way joins, 83
two-way join in a predicate, 81
let clause, 76
order by clause, 85-89
inadvertent resorting in document order, 90
order of returns, 85
return clause, 78, 105
scope of variables, 79
selecting distinct values, 81, 300
sequence type matching, 154
syntax, 73
type declarations, 191
where clause, 77
using an order comparison, 91
fn namespace, 128
following axis, 42, 289
following-sibling axis, 42, 289
for clause (FLWORs), 7, 73, 74-76
defining positional variable, 116
intermingled with let clauses, 76
multiple for clauses, 75
order of results, 85
range expressions, 74
scope of variables, 79
for, let, where, order by, return (see FLWORs)
forward steps, 41
axis, 41
fragment identifiers in URI references, 259
ftcontains operator, 287
full-text searches, 285
function conversion rules, 103, 150
automatic type conversions, 104
XQuery 1.0 and XPath 1.0 and 2.0, 316
function namespace, 133
functions, 10, 99-109
body, 105
built-in
reference, 319-410
user-defined vs., 99
calling, 29, 99-103
argument lists, 101
function names, 100
function signatures, 100
sequence types for parameters, 103
context and, 108
declarations, 104
names of, 106
default namespace declaration, 131
impact of namespace declarations, 133
namespaces, 24, 127
parameter list, 106-108
reasons for defining your own, 104
recursive, 109
SQL and XQuery equivalents, 299
web site for source code, 34
FunctX XQuery Library, xiv
G[ Top ]
ge operator (see greater than or equal to operator)
generic sequence types, 152
generic types
assigned when no schema is present, 172
assignment to elements or attributes, 180
get-ID function, 266
global attributes, 126
global element and attribute declarations, 173
global variables, 166
declarations, 29
type declarations in, 192
greater than operator
>, 30
comparing dates and times, 246
comparing durations, 248
comparing numeric values, 206
comparing strings, 215
entity reference (>:), 279
SQL and XQuery, 297
gt, 33
comparing numeric values, 207
greater than or equal to operator
>=, 30
comparing dates and times, 245
comparing numeric values, 206
comparing strings, 215
SQL and XQuery, 297
ge, 33
comparing numeric values, 207
Gregorian calendar, 252
grouping, 11, 93
SQL vs. XQuery, 302
(see also aggregating values)
groups of characters, representing in regular expressions, 230-233
gt operator (see greater than operator)
H[ Top ]
hours
extracting from dates, times, and durations, 248
hours-from-dateTime function, 352
hours-from-duration function, 352
hours-from-time function, 353
HTML
entities, 279
escape-html-uri function, 348
I[ Top ]
\I (noninitial) character in XML names used in regular expressions, 231
\i (initial) character allowed as first character of XML names, 230
i option ($flags argument), indicating case-insensitive mode, 238
id function, 265, 353
identity (nodes), 21
comparisons with is operator, 34
idiv (integer division) operator, 207, 210
idref function, 265, 355
IDREFs, 264-266
joining with IDs, 265
xs:IDREF type, 429
xs:IDREFS type, 429
IDs (identifiers), 264-266
constructing, 266
get-ID function, 266
joining with IDREFs, 265
xs:ID type, 428
if, then, and else keywords, 35
if-absent function, 198
if-empty function, 199
if-then-else expressions, 35-37
typeswitch expression vs., 189
use of logical (and/or) operators, 37
implementation-defined features, 289, 290
default values for serialization parameters, 293
option declaration, 291
implementation-dependent features, 289
implementation-specific aspects, XQuery, 289-293
conformance, 289
extension expressions, 292
option declarations, 291
serialization parameters, specifying, 293
setting query context, 290
XML version support, 290
implicit time zones
in date and time comparisons, 246
explicit vs., 243
implicit-timezone function, 244, 356
imports
declarations in prolog, 161
library modules, 164
behavior of imported module, 165
multiple, 165
support for, 289
schema, 176, 289
adding to ISSD for a module, 176
in (keyword), 27, 74
IN condition (SQL), 298
index in path expression predicate, 6
index-of function, 358
use with sequences, 23
INF and -INF (positive and negative infinity), 207
results for mod operator, 211
infinite loop, resulting from recursive function declaration, 109
inherit (in copy-namespace declarations), 138
example query using, 139
initial character (\i), allowed in XML names, 230
initializing expressions, 167
input documents, 15, 52-54
accessing a collection, 53
accessing single document, 53
accessing using variables, 54
copying elements with modifications in query, 110-115
including elements and attributes in query results, 57
modifying element (example), 64
namespace declaration, 25
input elements and, 134
namespaces, 127
setting context node outside the query, 54
variations in, designing robust queries for, 196
in-scope namespaces
controlling copying with copy-namespaces settings, 138
statically known namespaces vs., 135-137
in-scope schema definitions (see ISSDs)
in-scope-prefixes function, 259, 357
insert-before function, 358
use with sequences, 23
value type for second argument, 143
instance of expressions, 154
used in if-then-else expressions, 189
integer division (idiv) operator, 207, 210
integers, 204
xs:byte type, 416
xs:int type, 430
xs:integer type, 430
xs:long type, 432
xs:negativeInteger type, 432
xs:nonNegativeInteger type, 433
xs:nonPositiveInteger type, 433
xs:positiveInteger type, 434
xs:short type, 435
xs:unsignedByte type, 437
xs:unsignedInt type, 437
xs:unsignedLong type, 438
xs:unsignedShort type, 438
intermediate XML documents, 119
reducing complexity of input document, 121-122
International Resource Identifiers (IRIs), 123
internationalization of strings, 223-225
collations, 223
determining language of an element, 225
Unicode normalization, 225
intersect expression, 119
IRIs (International Resource Identifiers), 123
iri-to-uri function, 263, 359
is operator, 34
testing for last item, 117
ISSDs (in-scope schema definitions), 175-178
origins of, 176
schema imports, 176
static typing and, 186
item (data model), 18
item( ), 152
J[ Top ]
Java, XQuery API (XQJ), 287
joins, 10, 81-84
order of results not significant, 91
outer, 84
SQL vs. XQuery, 301
three-way, 83
types and, 84
K[ Top ]
keywords, 27
for categories of expressions, 26
external, 168
for, let, where, order by, and return (see FLWORs)
whitespace separators, 27
kind tests in path expressions, 44, 183
L[ Top ]
lang function, 225, 360
languages
determining language of an element, 225
xml:lang attribute, 225
xs:language type, 431
last function, 49, 117, 362
last item in sequence, testing for, 117
lax validation mode, 179
le operator (see less than or equal to operator)
length of a string
finding, 217
string-length function, 396
whitespace and, 222
less than operator
<, 30
comparing dates and times, 246
comparing durations, 248
comparing numeric values, 206
comparing strings, 215
entity reference (<), 229, 279
lt, 33
comparing numeric values, 207
less than or equal to operator
<=, 30
comparing dates and times, 245
comparing numeric values, 206
comparing strings, 215
SQL and XQuery, 297
le, 33
comparing numeric values, 207
let clause (FLWORs), 7, 73, 76
binding entire sequence of items to a variable, 94
intermingled with for clauses, 76
performing several functions or operations in order, 77
scope of variables, 79
using range expression, 76
Letters category (Unicode), 231
lexical representation, primitive types, 143
library modules, 163
functions declared in, 106
functions separated into for reuse, 196
importing, 164
behavior of a module import, 165
multiple, 165
schema imports and, 177
support for, 289
variable names, 167
LIKE conditions (SQL), 297
line breaks in queries (see whitespace)
line feed (\n), in regular expressions, 229
list types, 174
and typed values, 181
literals, 28
direct element constructors containing literal characters, 59
namespace name in namespace declaration attribute, 132
namespace name in XQuery namespace declaration, 129
numeric literals, 204
passed in function calls, 101
string literals, 213
local element and attribute declarations, 173
local namespace, 128
local-name function, 21, 254, 362
using names as result data, 256
local-name-from-QName function, 257, 363
logical expressions, 26, 37
evaluation order, 37
lookup tables, 120
lower-case function, 220, 364
lt operator (see less than operator)
M[ Top ]
m option ($flags argument), indicating multi-line mode, 238
main module, 163
Marks category (Unicode), 231
matches function, 216, 297, 365
dot-all mode, 230
flags, 238
multi-line mode, anchors and, 237
max function, 95, 212, 366
max-string function, 95
min function, 95, 212, 367
min-non-empty-string function, 96
minutes
extracting from dates, times, and durations, 248
minutes-from-dateTime function, 368
minutes-from-duration function, 369
minutes-from-time function, 369
missing values, 295
handling with robust query design, 197
absent values, 197
default missing values, 198
empty and nil values, 198
in sequence passed to aggregation function
counting, 96
counting in averages, 97
ignoring, 95
(see also empty sequence)
mixed content
in complex types, 174, 181
in text nodes, 277
MMDDYYYY-to-date function, 244
mod (modulus) operator, 207, 211
modifiers, order, 87
modularity of queries, 196
module declaration, 163
modules, 163-165
library, 163
importing, 164
variable names, 167
main, 163
support for library modules and module imports, 289
months
date component types, 252
extracting from dates, times, and durations, 248
month-from-date function, 370
month-from-dateTime function, 370
months-from-duration function, 371
xs:gMonth type, 425
xs:gYearMonth, 427
multi-character escapes in regular expressions, 230
examples, 233
multi-line mode, 237
m option ($flags argument), 238
multiplication, 209
durations by numbers, 251
SQL and XQuery operators, 298
multiplication operator (see * (asterisk))
N[ Top ]
\n (line feed), in regular expressions, 229
N/A values, indicating default missing values, 198
name function, 21
names
affected by namespace declarations in XQuery, 133
choosing for clarity of queries, 194
computed element constructors, 69
conventions in XQuery, 27
element and attribute nodes, 21
elements from input document, changing in query, 114
function, 100, 106
reserved, 106
local-name function, 21, 254, 256, 362
name function, 21, 52, 254, 371
node name tests, 42-43
node-name function, 21, 254
valid name in XML (xs:Name), 432
variables, 28, 167
namespace declaration attributes, 131, 136
namespaces, 24, 123-140
choosing prefixes for clarity of queries, 195
copy-namespaces declarations, 138-140
declarations in element constructors, 63, 131
declarations in prolog, 128-131, 161
default namespace declarations in queries, 133
elements, changing the namespaces of, 258
error names, 440
functions, 100
impact and scope of declarations, 132
in-scope, 357
statically known namespaces vs., 135-137
library module imports, 164
multiple module locations for single namespace, 165
names in XQuery, 27
node name tests and, 43
option names, 292
predeclared, 128
URIs (see URIs)
user-defined function names, 106
variables, 28
XML, 123-127
attributes and, 125
declarations and scope, 126
declaring, 124
default namespace declarations, 125
URIs, 123
XML Schema and, 175
XML versions, 290
Namespaces in XML (W3C recommendation), 123
namespace-uri function, 254, 372
namespace-uri-for-prefix function, 259, 373
namespace-uri-from-QName function, 257, 374
NaN (not-a-number), 205, 208
comparisons, 207
results for mod operator, 211
sorting order, 87
native XML database, 2
NCName, 264, 432
target for processing instructions, 272
ne operator (see not equal to operator)
negation operator (-), 207
negative durations, 246
negative infinity (-INF), 207
results for mod operator when an operand is -INF, 211
nesting
conditional expressions, 36
expressions in XQuery, 302
sequences and, 23
nil and empty values, 198
nilled elements, 295
nilled function, 375
node tests, 42-44
node kind, 44
node name, 42-43
using wildcards, 43
node( ) kind test, 44, 111
generic sequence type, 152
processing instructions, 271
text nodes, 276
XML comments, 268
node-name function, 21, 254, 376
nodes, 18-22
atomic values, 22
comparisons, 30
atomization, 148
comment, 267
comparisons, 34
as context item, 40
nodes (continued )
document, 272-274
document order, 89
duplicate, elimination in unions, 119
family relationships, 19
finding base URI, 260
function arguments as, 107
hierarchy, 19
identity and name, 21
kinds of nodes (listed), 18
newly-constructed, content types and, 182
processing instruction, 270
retrieving names, 254-256
roots, documents, and elements, 20
string and typed values, 21
text, 274-278
type annotations, assigning, 180
typed values and, 181
types and, 145
no-inherit (in copy-namespace declarations), 138
example query using, 140
noncolonized name (see NCName)
nondecimal digit character (\D), in regular expressions, 230
none (return type), 348
nonword character (\W) in regular expressions, 230
no-preserve (in copy-namespace declarations), 138
example query using, 139
normalize-space function, 223, 377
normalize-unicode function, 224, 378
not equal to operator
!=, 30
comparing dates and times, 245
comparing numeric values, 206
comparing strings, 215
not function vs., 38
SQL and XQuery, 297
ne, 33
comparing numeric values, 207
not function, 38, 112, 299, 379
using with quantified expressions, 80
not operator
! (full text not), 286
SQL, 299
(see also not function)
notations, XML, 434
null values, 295
(see also empty sequence)
number function, 205, 380
numbers, 143, 204-212
arithmetic operations on numeric values, 207-211
addition, subtraction, and multiplication, 209
division, 210
modulus, 211
precedence of arithmetic operators, 209
comparing numeric values, 206
constructing numeric values, 205
number function, 205
numeric type promotion, 206
functions for, 211
numeric types, 204
in path expression predicates, 6, 47
Numbers category (Unicode), 231
numeric keyword (in built-in function signatures), 103, 107
numeric literals, 28, 204
numeric-add operator, 99
O[ Top ]
occurrence indicators
*, 152
in function argument types, 151
specifying function return type, 151
+, 152
?, 152
in function argument types, 150
cast expression, using with, 157
empty sequence accepted as function arguments, 107
indicating number of items in a sequence, 103
using with sequence types, 152
generic sequence types, 153
one-or-more function, 192, 381
open-ref-document function, 263
operand expression, 188
operators
arithmetic (see arithmetic operations)
comparison, 30
evaluation order and parentheses, 30
Functions and Operators recommendation, 99
listed, 26
multiple meanings in XQuery, 27
SQL and XQuery, 297
optimization, implementations of XSLT and XQuery, 313
option declarations, 161, 291
optional features (XQuery), 289
or operator, 37
|| (full text or), 286
SQL and XQuery, 298
order by clause (FLWORs), 7, 85-89
complex order specifications, 88
default collation, using, 224
inadvertent resorting in document order, 90
multiple ordering specifications, 86
order modifiers, 87
stable ordering, 88
types, 86
order.xml document (example), 4
ordered expressions, 93
ordering mode declaration, 93
Other category (Unicode), 232
outer joins, 84
outermost element, 21
outermost element node, document node vs., 272
P[ Top ]
parameters
serialization, 282
specifying in different XQuery implementations, 293
user-defined function parameter list, 106-108
parent (nodes), 20
parent axis, 42
parent axis in path expressions, 202
parentheses (see ( ) (parentheses))
path expressions, 5, 26, 39-46
abbreviated syntax, 44
avoiding expensive expressions in, 202
axes, 41
combining sequences via unions, 118
context and, 40
context in query, 16
dynamic paths, 52
element names in XQuery, affected by default namespace declaration, 133
FLWORs vs., 72
general and value comparisons in predicates, 33
kind tests, 183
node tests, 42-44
other expressions as steps, 45
predicates (see predicates)
querying comments, 268
querying text nodes, 276
results returned in document order, 85
returning nodes, 18
selecting elements from input documents, 72
steps, 41
using within FLWOR where clause, 78
XQuery and XPath, versions 1.0 and 2.0, 315
pattern-matching (see regular expressions)
performance, optimizing with query design, 201-203
avoiding expensive path expressions, 202
avoiding reevaluation of same or similar expressions, 201
avoiding unnecessary sorting, 201
using predicates instead of where clauses, 202
pessimistic static typing, 185, 189
pipelining, 122
position function, 49, 116, 382
positions, 115-118
testing for last item, 117
using in predicates, 48-50
positive infinity (INF), 207
results for mod operator when an operand is INF, 211
pragmas, extension expressions, 292
precedence
arithmetic operators, 209
evaluation order of expressions, 30
logical operators, 37
preceding axis, 42, 289
preceding-sibling axis, 42, 289
predicates, 6, 46-52
comparisons in, 47
complex, 51
for clause, joins in, 301
two-way join in FLWOR predicate, 81
using instead of where clauses, 202
using multiple, 50
using positions, 48-50
prefixes, namespace, 124
attributes, 126
functions for, 259
in-scope- prefixes function, 357
mapping directly in module imports, 164
prefixes, namespace (continued )
namespace-uri-for-prefix function, 373
overriding default namespace, 127
predeclared, 128
prefix-from-QName function, 257, 382
schema imports, module declarations, and module imports, 131
(see also namespaces)
preserve (in copy-namespace declarations), 138
example query using, 140
prices.xml document (example), 4
primary expressions, 26
primitive types, 143
casting among, 158
xs:string and xs:untypedAtomic, 158
types derived from (see derived types)
processing instruction nodes, 19
processing instructions (XML), 269-272
constructing, 271
data model and, 270
querying, 270
sequence types and, 271
processing model for XQuery, 15-17
context, 16
queries, 15
query processor, 16
query results, 17
XML input documents, 15
processing-instruction( ) kind test, 154, 270
processors, query, 16
product catalog input document (catalog.xml), 3
prolog, queries, 16, 160
declarations contained in, 161
main module, 163
namespace declarations, 128-131
controlling in query results, 135-137
default namespaces, 129
scope of, 132
variable declarations and bindings, 166
version declaration, 162
promotion, type, 147
comparing different numeric types, 206
in function conversion rules, 150
numeric, 206
pull stylesheets, 310
equivalent in XQuery, 312
use on narrative content (example), 312
Punctuation category (Unicode), 231
push stylesheets, 310
Q[ Top ]
QName function, 257, 383
qualified names, 254-259
computed element constructors, 69
constructing, 257
local-name-from-QName function, 363
namespace-uri-from-QName function, 374
options, 292
prefix-from-QName function, 382
resolve-QName function, 386
retrieving node names, 254-256
xs:QName type, 434
quantified expressions, 27, 79
binding multiple variables, 80
sequence type matching, 154
type declarations, 191
quantifiers
regular expression, 226
reluctant, in regular expressions, 235
using with regular expression character class expressions, 233
queries, 15, 160-169
assembling from multiple modules, 163-165
comparing SQL to XQuery, 296
context, 16
design goals, 193-203
clarity, 193-196
error handling, 199
modularity, 196
performance, 201-203
robustness, 196-199
examples, 3-11
external variables, 168
namespace declarations, 128-134
controlling in results, 135-140
namespace-qualified names, uses of, 127
namespaces, using, 25
processor, 16
prolog and body, 160
prolog declarations
external functions, 168
summary of declaration types, 161
variable declarations, 166
version declaration, 162
results, 17
schemas, advantages of using, 171
setting context node outside of, 54
SQL/XML query, 306
syntax, XQuery vs. XSLT, 309
variables
names of, 167
scope, 166
whitespace in, 27
query function (SQL Server), 305
R[ Top ]
\r (carriage return), in regular expressions, 229
range (characters in a character class), 234
range expressions
using with FLWOR for clause, 74
using with FLWOR let clause, 76
recursion, 104, 109
references
back-references, 237
character, 278
IDREFs, 264-266
joining with IDs, 265
parenthesized sub-expressions in regular expressions, 228
URI
relative URIs, 259
xs:anyURI, 259
regular expressions (and pattern-matching), 226-241
anchors, 236
multi-line mode and, 237
back-references, 237
character class expressions, 233
escaping rules, 235
examples, 234
negative character class, 234
single characters and ranges, 233
subtraction from a range, 234
flags, using, 238
matching string to a pattern, 216
reluctant quantifiers, 235
replacing substrings matching a pattern, 221
representing any character in regular expressions with . (period), 229
representing groups of characters, 230-233
block escapes, 232
category escapes, 231
examples of multi-character, category and block escapes, 233
multi-character escapes, 230
representing individual characters, 228
single-character escapes, 228
SQL LIKE conditions vs., 297
structure of regular expressions, 226-228
atoms, 226
parenthesized subexpressions and branches, 227
quantifiers, 226
sub-expressions with replacement variables, 239
tokenizing strings, 219
relational databases
native XML databases vs., 2
supporting XML and XQuery, 3
XML data model vs., 294
XQuery support in, 303
relative path expressions, 40
relative URIs, 259
resolving URIs, 261
reluctant quantifiers, 235
remainder after dividing (modulus), 207, 211
remove function, 384
remove-attribute function, 111
remove-attributes-deep function, 112
remove-elements-deep function, 113
replace function, 221, 385
back-references and variable references, 228
dot-all mode, 230
flags, 238
multi-line mode, anchors and, 237
reluctant and non-reluctant quantifiers, 236
sub-expressions with replacement variables, 239
replace-first function, 222
reserved function names, 106
resolve-QName function, 257, 386
resolve-uri function, 261, 388
base URI of the static context, 261
results, query, 17
return clause (FLWORs), 7, 73, 78, 105
element constructor in, 8
multiple expressions within, 78
scope of variables, 79
return type of a function, 105
reverse axes, positional predicates and, 50
reverse function, 91, 389
reverse steps, 41
axis, 41
robustness of queries, 196-199
data variations, handling, 196
missing values, handling, 197
root element, 20
root function, 56, 389
root node, 21
root, accessing for context node, 56
round function, 212, 390
round-half-to-even function, 212, 391
S[ Top ]
\S (nonwhitespace) character in regular expressions, 230
\s (space) character in regular expressions, 230
s option ($flags argument), indicating dot-all mode, 238
satisfies (keyword), 27, 80
Saxon, 3
option declarations, 291
schema-attribute( ) kind test, 183
schema-element( ) kind test, 183
schemas, 170-184
changes, managing with user-defined functions, 104
defined, 170
importing, 165
imports, 176
in-scope schema definitions (ISSDs), 175-178
node kind tests for elements and attributes, 44
reasons to use with queries, 171
sequence types and, 154, 183
static typing and, 186
support for schema imports and validation, 289
validation and type assignment, 178-182
assigning type annotations to nodes, 180
nodes and typed values, 181
types and newly constructed elements and attributes, 182
validate expression, 178
validation mode, 179
W3C XML Schema, 14, 172-175
element and attribute declarations, 173
namespaces and, 175
types, 173
scope
default settings defined outside query scope, 162
in-scope namespaces, 135, 357
namespace declarations in XQuery, 126, 132
variables, 166
searches, full text, 285
seconds
extracting from dates, times, and durations, 248
seconds-from-dateTime function, 392
seconds-from-duration function, 392
seconds-from-time function, 393
self axis, 41
separator characters (URI), escaping, 262
Separators category (Unicode), 232
sequence constructors, 118
sequence numbers, 115-118
adding to results, 115
testing for last item, 117
sequence types, 107, 151-155
atomic types as, 153
comments and, 268
document nodes and, 273
element and attribute tests, 154
function parameters as, 103
generic, 152
matching, 154
instance of expression, 154
processing instructions and, 271
schemas and, 183
element and attribute tests, 183
examples based on name and type, 184
text nodes and, 276
using occurrence indicators, 152
sequence-related expressions, 27
sequences, 22
argument lists and, 102
binding to named variable, 23
combining result sequences, 118
converting to boolean values, 148
empty, 23
expression evaluation to, 26
multi-item, general comparisons on, 31
in node comparisons, 34
singleton, 23
in value comparisons, 33
variables bound to particular value, 28
serialization, 17, 282
errors, 283
query results to XML document, support for, 289
specifying parameters for saxon:output, 291
specifying parameters in different XQuery implementations, 293
set operators (SQL), 302
set-string-to-length function, 218
setters (prolog declarations), 161
siblings (nodes), 20
following siblings, 42, 289
preceding siblings, 42, 289
side effects of functions, 169
signatures (function), 100
numeric keyword used by built-in functions, 103
simple types, 173
built-in, 143
singleton sequence, 23
some (keyword), 27, 80
sort key, parameterizing, 89
sorting, 85-93
on aggregated values, 98
avoiding unnecessary sorting, 201
document order, 89
inadvertent resorting in, 90
order comparisons, 91
indicating order is not significant, 91
unordered expression, 92
unordered function, 92
indicating whether order is significant, 93
order by clause (FLWORs), 85-89
complex order specifications, 88
multiple ordering specifications, 86
order modifiers, 87
stable ordering, 88
types, 86
reversing the order, 91
SQL vs. XQuery query results, 296
strings, specifying order with collations, 223
spaces in queries (see whitespace)
splitting strings, 218, 219
SQL users, XQuery for, 14, 294-306
combining SQL and XQuery, 303-306
flexible data structures, 304
structured and semistructured data, 303
comparison of SQL to XQuery syntax, 296-303
conditions and operators, 297-299
functions, 299
grouping, 302
multiple tables and subqueries, 301
simple query, 296
relational vs. XML data models, 294
SQL/XML, 306
stable ordering, 88
standards related to XQuery, 282-288
full-text search, 285
serialization, 282
parameters, 282
Update Facility (W3C) for XQuery, 285
XQJ (XQuery API for Java), 287
XQueryX, 284
starts-with function, 215, 393
static analysis phase (type checking), 146
static context, 261
static typing, 185-192
detection of all errors in analysis phase, 289
expressions and constructs, 187
functions related to, 192
obvious errors, 186
raising false errors, 187
schemas and, 186
treat expression, 189
type declarations, 190
typeswitch expression, 187
statically known namespaces vs. in-scope namespaces, 135-137
static-base-uri function, 261, 394
steps, 41
abbreviated syntax, 44
using expressions other than axis steps, 45
strict validation mode, 179
string function, 22, 394
taking string value of comment node, 268
string literals, 28
string value (nodes), 21
string-join function, 218, 219, 396
string-length function, 217, 396
strings, 143, 213-225
comparing, 214-216
entire strings, 215
joins and, 84
matching string to a pattern, 216
string containing another string, 215
concatenating and splitting, 218
concatenating strings, 219
converting between code points and strings, 220
splitting strings, 219
constructing, 213
string literals, 213
finding length, 217
finding maximum value of many untyped strings, 95
strings (continued )
finding minimum nonempty string value, 96
internationalization, 223-225
collations, 223
determining language of an element, 225
Unicode normalization, 225
manipulating, 220-222
converting between uppercase and lowercase, 220
replacing individual characters, 220
replacing substrings matching a pattern, 221
string function, 214
substring function, 398
substring-after function, 399
substring-before function, 400
substrings, 216
whitespace, 222
xs:normalizedString type, 433
xs:string constructor, 214
xs:string type, 213, 436
(see also regular expressions)
string-to-codepoints function, 218, 220, 397
stylesheets, XSLT, 310-313
pull stylesheets, 310
attempt to use on narrative content, 312
XQuery equivalent, 312
push stylesheets, 310
use on narrative content, 311
XQuery user-defined functions emulating templates, 312
subexpressions
multiple, in enclosed expressions, 61
using with replacement variables, 239
subselects (SQL), 302
subsequence function, 398
substitution groups, 184
substring function, 22, 216, 398
empty sequence as argument, 108
passing empty sequence or zero-length string vs. omitting an argument, 101
signatures, 101
substring-after function, 217, 399
substring-after-last function, 217
substring-before function, 217, 400
subtraction, 207, 209
dates and times, 249
durations, 251
durations from dates and times, 250
precedence of arithmetic operators, 209
SQL and XQuery operators, 298
subtraction operator (-), 207
subtype substitution, 147, 206
in function conversions, 150
sum function, 11, 94, 212, 401
Symbols category (Unicode), 232
syntax diagrams, xi
T[ Top ]
\t (tab character), in regular expressions, 229
tabs in queries (see whitespace)
tabs, escaping in regular expressions, 229
target namespace (schemas), 175
schema imports, 176
target, processing instructions, 270
templates (XSLT), 308
emulating in XQuery with user-defined functions, 312
use by push stylesheets, 310
XQuery user-defined functions as equivalent, 309
test expression (after if keyword), 35
text nodes, 19, 274-278
constructing, 278
data model and, 275
querying, 276
reasons for working with, 276
sequence types and, 276
text( ) kind test, 154, 276
text, full-text searches, 285
then keyword, 35
three-way joins, 83
time zones, 243-245
adjust-dateTime-to-timezone function, 323
adjust-date-to-timezone function, 321
adjusting, 244
adjust-time-to-timezone function, 323
date and time comparisons, 246
explicit vs. implicit, 243
finding for xs:date, xs:time, or xs:dateTime values, 245
implicit-timezone function, 356
timezone-from-date function, 402
timezone-from-dateTime function, 403
timezone-from-time function, 245, 403
times (see dates and times)
to (keyword)
in positional predicates, 49
in range expressions, 75
tokenize function, 218, 219, 404
dot-all mode, 230
flags, 238
multi-line mode, anchors and, 237
trace function, 200, 405
translate function, 220, 406
treat expression, 189
true (Boolean value), 149
true function, 28, 407
two-way joins
in FLWOR predicate, 81
type conversions (see conversions, type; types)
type errors, 146
type promotion
comparing different numeric types, 206
numeric, 206
xs:anyURI values to xs:string, 259
typed values, 21
not automatically typed, 147
type-related expressions, 27
types, 24, 141-159
arithmetic operations and, 208
assigning type annotations to nodes, 180
atomic values and, 22, 145
automatic conversions with function conversion rules, 104
avoiding use of, 142
built-in, 127, 143, 172, 173
reference, 411-439
checking in XQuery, 146
conversions
automatic, 147-151
castable expression, 157
casting, 156
casting rules, 158-159
constructors, using, 28, 155
function arguments to expected type, 103
date and time, 242
constructing and casting, 243
date components, 252
duration types, 247
time zones, 243-245
declarations, 190
dynamic type errors, 200
general comparisons and, 31
generic types used when no schema is present, 172
joins and, 84
list, 174
names affected by namespace declarations in XQuery, 133
namespaces, 24
predeclared, 128
nodes and, 145
nodes and typed values, 181
numeric, 204
sorting and, 86
strong type system, advantages and disadvantages, 141
user-defined, 127
(see also sequence types; static typing)
typeswitch expression, 154, 187
typeswitch keyword, 188
U[ Top ]
undeclaring default namespace, 127
Unicode
block names, 232
categories of characters, 231
code point collations, 224
code points in character references, 278
code points, converting between strings, 220
codepoint-equal function, 328
codepoints-to-string function, 329
normalization, 225
normalize-unicode function, 378
string-to-codepoints function, 397
version support in XQuery implementations, 290
Uniform Resource Identifiers (see URIs)
Uniform Resource Names (URNs), 123
union keyword, 118
union operator (|), 45, 118
union types, nodes declared as, 180
unordered expression
implementation-dependency of order of results, 289
unordered expressions, 92
unordered expressions or functions, 201
unordered function, 92, 407
unprefixed element, 255
untyped data, comparisons in predicates, 47
untyped values
atomic values, 22, 146, 438
casting, 147, 150
comparing with general comparison operators, 142
xs:untyped, 438
Update Facility for XQuery, 285
upper-case function, 220, 408
empty sequence as argument, 102
signature, 100
URIs (Uniform Resource Identifiers), 259-263
base and relative, 259
base URI of the static context, 261
finding base URI of a node, 260
resolving URIs, 261
specifying base URI with xml:base attribute, 260
base-uri function, 325
collations in XQuery, 224
documents and, 262
document-uri function, 344
encode-for-uri function, 345
escape-html-uri function, 348
escaping, 262
iri-to-uri function, 359
namespace, 25, 123
extracting from xs:QName, 257
namespace-uri function, 372
namespace-uri-for-prefix function, 373
prolog declarations, 129
references (xs:anyURI), 259
resolve-uri function, 388
static-base-uri function, 394
xs:anyURI type, 412
URLs (Uniform Resource Locators), 259
URNs (Uniform Resource Names), 123, 259
user-defined functions, 103-109
body, 105
built-in vs., 99
calling, using namespace-qualified names, 100
declarations, 104
examples, 103
names, 106
parameter list, 106-108
reasons for defining your own, 104
recursive, 109
user-defined types, 143, 174
UTC (Coordinated Universal Time), 243
date and time comparisons, 246
UTF-8 character encoding, 162
V[ Top ]
validate expression, 178, 274
support for, 289
validation modes, 179
value comparisons, 33
comparing numeric values, 207
value function (SQL Server), 305
value space, 143
casting among derived types, 159
casting among primitive types, 158
variables, 28
binding entire sequence of items in FLWOR let clause, 94
binding external to input documents, 54
binding multiple in quantified expression, 80
binding multiple in single for clause, 76
binding sequences to named variable, 23
binding to typeswitch expressions, 188
declaring, 166
in query prolog, 161
syntax of declaration, 166
external, 168
function parameter names, 106
imported from modules, 168
initializing expressions, 167
names, 167
names affected by namespace declarations in XQuery, 133
namespaces, 24
passed in function calls, 101
qualified names in queries, 127
replacement, using with subexpressions, 239
scope, 79, 166
setting values with let clause in expressions, 7
version declaration, 162
versions, XML version support in XQuery implementations, 290
W[ Top ]
\W (nonword) character in regular expressions, 230
\w (word) character in regular expressions, 230
W3C
converter for XQuery to XqueryX conversions, 285
Namespaces in XML, 123
XML Schema (see XML Schema)
XQuery Working Group
Full-Text recommendation, 286
XQuery Update Facility, 285
web sites
backward compatibility between XPath 1.0 and 2.0, 314
official XQuery site, 17
source code for functions, 34
user-defined function examples, 103
web page for this book, xiv
weight keyword, 287
where clause (FLWORs), 7, 73, 77
composed of multiple expressions, 77
scope of variables, 79
three-way join, 83
two-way join, 301
using an order comparison, 91
using instead of predicate, 83
using predicates instead of, 202
whitespace, 27
in direct element constructors, 65-67
boundary whitespace, 65
boundary-space declaration, 66
forcing preservation of boundary whitespace, 67
nonstring types cast to xs:string, 214
normalize-space function, 377
in regular expressions
escaping, 228, 230
ignoring, 239
separating list of xs:IDREF values, 265
space, character reference for, 278
in strings, 222
considering in string length, 217
between tags in source XML with no DTD or schema, 275
using for query clarity, 194
wildcards
asterisk (*) in path expressions, 6
schema, types and, 180
using in node name tests, 43
word character (\w) in regular expressions, 230
X[ Top ]
x option ($flags argument), indicating ignoring whitespace characters, 239
XDM (XQuery 1.0 and XPath 2.0 Data Model), 17
XHTML, wrapping query results in, 8
XML
CDATA sections, 280
comments, 267
constructing, 268
data model and, 267
included in queries, 29
querying, 268
sequence types and, 268
data model, relational vs., 294
documents, 272-274
constructing document nodes, 273
document nodes and data model, 273
document nodes and sequence types, 273
serialization of query results to, 289
entity and character references, 278-280
character reference examples, 278
entity references, 279
input documents, 15
namespaces, 123-127
attributes and, 125
declarations and scope, 126
declaring, 124
default namespace declarations, 125
names.xml document (example), 255
URIs, 123
using namespace declarations in XQuery, 136
notations, 434
processing instructions, 269-272
constructing, 271
data model and, 270
querying, 270
sequence types and, 271
SQL/XML query, 306
text nodes, 274-278
constructing, 278
querying, 276
reasons for working with, 276
sequence types and, 276
XQuery data model and, 275
version support in XQuery implementations, 290
XML constructors (see constructors)
xml namespace, 128
XML Schema, 14, 172-175
element and attribute declarations, 173
namespaces and, 175
nilled elements concept, 295
substitution groups, 184
type system, 24
types, 173
user-defined, 174
XML Schema Namespace, 127
xml:base attribute, 260
xml:id attribute, 264
using in element constructors, 266
xml:lang attribute, 126, 225
xmlns prefix (namespace attribute), 25
XML-qualified names, 27
variables, 28
XPath, 13
backward incompatibility between 1.0 and 2.0, web site information, 314
differences in versions 1.0 and 2.0, 314-317
arithmetic expressions, 316
built-in functions, 317
comparison expressions, 316
data model, 315
function conversion rules, 316
new expressions, 315
path expressions, 315
document element (XPath 1.0), 20
Version 2.0, use by XQuery and XSLT, 308
XPath 2.0 Data Model, 17
XQuery and, 307
XPath Datatypes Namespace, 247
XPath Functions Namespace, 100, 128, 131
xqdoc tags, 195
XQJ (XQuery API for Java), 287
XQuery
common uses, 2
features set, 1
implementation-specific features, 289-293
conformance, 289
extension expressions, 292
option declarations, 291
serialization parameters, specifying, 293
setting query context, 290
XML version support, 290
official web site, 17
processing scenarios, 2
SQL vs., 14, 294-306
version declaration, 162
web site, 12
XML Schema and, 14
XPath and, 13, 307
XSLT vs., 13
XQuery 1.0 and XPath 2.0 Data Model (XDM), 17
XQuery 1.0 and XPath 2.0 Full-Text recommendation, 286
XQuery API for Java (XQJ), 287
XQueryX, 284
xs namespace, 128
xs: prefix (types), 24, 127
xs:anyAtomicType, 144, 153, 411
xs:anyType, 180, 411
xs:anyURI, 259, 412
xs:base64Binary, 414
xs:boolean, 415
xs:byte, 416
xs:date, 143, 242, 416
comparisons, 245
component extraction, 248
date formats, 244
finding time zone of a value, 245
subtracting values, 249
xs:dateTime, 242, 416
comparisons, 245
extracting entire date or time from, 249
finding time zone of a value, 245
subtracting values, 249
xs:dayTimeDuration, 247, 417
adding and subtracting values, 251
comparisons, 247
dividing by another duration, 252
implicit time zone as, 244
multiplying by numbers, 252
time zone expressed as, 245
xs:decimal, 204, 418
xs:double, 205, 419
node or atomic value cast as, 205
xs:duration, 246, 421
comparisons, 247
component extraction, 248
xs:ENTITIES, 422
xs:ENTITY, 422
xs:float, 205, 423
xs:gDay, 252, 424
xs:gMonth, 252, 425
xs:gMonthDay, 252, 425
xs:gYear, 252, 426
xs:gYearMonth, 252, 427
xs:hexBinary, 427
casting to strings, 214
xs:ID, 264, 428
xs:IDREF, 264, 429
xs:IDREFS, 265, 429
xs:int, 430
xs:integer, 153, 204, 430
xs:language, 431
xs:long type, 432
xs:Name, 432
xs:NCName, 432
xs:negativeInteger, 432
xs:NMTOKEN, 433
xs:NMTOKENS, 433
xs:nonNegativeInteger, 433
xs:nonPositiveInteger, 433
xs:normalizedString, 433
xs:NOTATION, 434
xs:positiveInteger, 434
xs:QName, 254, 434
constructor, 257
extracting parts of, 257
local-name-from-QName function, 363
xs:short, 435
xs:string, 213, 436
casting atomic value of any type to, 158
casting to any other primitive type, 158
comment content, 268
constructor, 214
URI arguments for functions, 259
xs:time, 242, 436
comparisons, 245
component extraction, 248
finding time zone of a value, 245
subtracting values, 249
xs:token, 437
xs:unsignedByte, 437
xs:unsignedInt, 153, 437
xs:unsignedLong, 438
xs:unsignedShort, 438
xs:untyped, 180, 438
xs:untypedAtomic, 146, 180, 438
casting atomic values of any type to, 158
casting to any other primitive type, 158
string value of text node, 275
xs:yearMonthDuration, 247, 439
adding and subtracting values, 251
comparisons, 247
dividing by another duration, 252
multiplying and dividing by numbers, 252
xsi namespace, 128
xsi:nil attribute, 198, 295, 375
xsi:schemaLocation attribute, 126
xsi:type, 257
XSLT
XQuery vs., 13, 307-314
convenient features of XSLT 2.0 lacking in XQuery, 314
differences in query syntax, 309
equivalent components, 309
optimization for particular use cases, differences in, 313
paradigm differences, push and pull stylesheets, 310-313
shared components, 308
XSLT 2.0 and XQuery 1.0 Serialization, 282
Y[ Top ]
years
date component types, 252
extracting from dates, times, and durations, 248
xs:gYear type, 426
year-from-date function, 408
year-from-dateTime function, 409
years-from-duration function, 409
Z[ Top ]
zero-or-one function, 192, 410
Zurück zu XQuery
