Copyright © 2006 FLWOR Foundation®, All Rights Reserved.
This document defines an extension of the XML Query language, XQuery 1.0. The XQueryP language provides procedular extension to XQuery that permit the language to be used as an effective Web application programming platform.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current Zorba publications and the latest revision of this technical report can be found in the Zorba technical reports index at http://www.zorba.org/TR/.
This document is designed to be read in conjunction with the following documents:
1 Introduction
2 Extensions to XQuery 1.0
2.1 Extensions to the Processing
Model
2.2 Extensions to the Prolog
2.3 New Kinds of Expressions
2.3.1 Blocks
2.3.2 Assignment
2.3.3 While
2.3.4 Try-catch
2.4 Extensions to Existing
Expressions
2.4.1 FLWOR Expression
2.4.2 Typeswitch
Expression
2.4.3 Conditional
Expression
2.4.4 Comma Expression
2.4.5 Parenthesized
Expression
2.4.6 Function Declaration
2.4.7 Function Call
2.4.8 Other Expressions
2.5 Extensions to Built-in Function
Library
2.5.1 fn:set
3 Sequential Execution Mode
A EBNF for XQueryP Grammar
B References
C Error Conditions
D Glossary
E Revision Log
This document defines the syntax and semantics of XQueryP, an extension to XQuery 1.0. This language extension provides procedural programming facilities intended to make XQueryP into a simple and powerful Web application programming environment.
[Definition: Within this document, the term XQuery refers to the language specified by XQuery 1.0, XQuery 1.0 Update Facility, and XQuery 1.0 and XPath 2.0 Full-Text.]
[Definition: The term data model refers to the data model specified by XQuery 1.0 and XPath 2.0 Data Model (XDM).]
[Definition: The term XDM instance denotes an unconstrained sequence of zero or more nodes and/or atomic values as defined by the data model.]
An XQuery 1.0 expression takes one or more XDM instances as input and returns an XDM instance as a result. In XQuery 1.0, an expression never modifies the state of an existing node; however, constructor expressions create new nodes with new identities.
The XQuery Update Facility introduces a new category of expression called updating expressions, which can modify the state of an existing node.
The XQuery Full-Text Extension defines a set of expressions and an extended data model (tokenized text), which can be used for full-text and text-structural searches over collections of XML documents.
The goal of the XQueryP proposal is to define the smallest extension to XQuery that makes development of XML applications reasonably feasible.
The extensions to XQuery 1.0 provided by XQueryP may be characterized as follow:
In XQuery, as in SQL, data is passed from one expression to another by physical nesting of expressions. Side effects are saved on "pending update lists" and made effective only as the last step in the query processing. As a result, the side effects of one expression cannot be seen by other expressions. This approach does not scale well to complex applications. Application development would be made easier by the notion od a "state" that could be modified by successive updating expressions. The idea of a state, represented by a set of variables, is a natural extension of XQuery, since the language already has variables that are bound by various kinds of expressions such as for, let, some, and every.
The XQuery Update Facility defines an internal "apply" operation that makes updates visible, and invokes this operation at the root of the expression tree. If the "apply" operation were invoked at earlier stages in query processing, expressions would be able to see the side effects of other expressions. In order to make the result well-defined, it would be necessary to define an ordering on the evaluation of expressions in the expression tree. We propose to define such an ordering and to make it effective by means of a prolog declaration called an execution declaration. In the absence of an execution declaration, the semantics of XQuery are exactly as specified by XQuery 1.0 and the XQuery Update Facility. If an execution declaration is present, the query is said to be in sequential mode, and a sequential ordering is defined on the expression tree. The semantics of updating expressions are changed to invoke the "apply" operation immediately rather than returning a pending update list. In sequential mode, each expression can see the side effects of previous expressions. In sequential mode, the effect of evaluating an expression tree must be the same as though the expressions were evaluated in sequential order. If none of the expressions have side effects, sequential mode is not relevant, and all the optimizations available in XQuery 1.0 still apply. In the presence of side effects, the evaluation order of expressions is effectively constrained by the interdependencies among the expressions, which can be detected by standard data-flow optimization techniques.
[7] | Setter |
::= | BoundarySpaceDecl | DefaultCollationDecl |
BaseURIDecl | ConstructionDecl | OrderingModeDecl | EmptyOrderDecl | CopyNamespacesDecl | RevalidationDecl
|
[141] | ExecutionDecl |
::= | "declare" "execution" ("sequential" | "default") |
The Prolog is extended by adding a new kind of Setter called an execution declaration.
[Definition: The execution declaration sets the execution mode in the static context, overriding any implementation-defined default.]
[Definition: Execution mode, which may be
set to sequential
or default
, is a component of the
static context that imposes a sequential ordering on the evaluation of XQuery
expressions, including updates.]
The value of execution mode is determined as follows:
Default initial value: default
.
Can be overwritten by an implementation: Yes
Scope: Global.
Consistency rules: Must be sequential
or
default
.
In sequential mode a sequential ordering is defined on the XQuery expression tree. The semantics of updating expressions are changed to invoke the "apply" operation immediately rather than returning a pending update list. In sequential mode, each expression can see the effects of previous expressions in the same module.
In sequential mode, the effect of evaluating an expression tree must be the same as though the expression were evaluated in sequential order. If none of the sub-expressions have side-effects, then sequential mode is neutral.
The evaluation order of expressions in sequential mode is defined as follows:
[84] | PrimaryExpr |
::= | Literal
|
[32] | ExprSingle |
::= | FLWORExpr |
XQueryP extends the syntax of PrimaryExpr by adding a
Block
expression. XQueryP extends the syntax of ExprSingle by adding three new types of
expression: AssignExpr
, WhileExpr
and
TryCatchExpr
. The syntax and semantics of these expressions are
described in the following sections.
[401] | Block |
::= | "{" (BlockDecl ";" )* Expr (";" Expr)* "}" |
[402] | BlockDecl |
::= | "declare" "$" VarName TypeDeclaration? (":=" ExprSingle)? ("," "$" VarName TypeDeclaration? (":=" ExprSingle)? )* |
Example:
for $item in /catalog/item[price < 100] return {do replace value of $item/price with $item/price * 1.1; $item}
A block may contain a mixture of updating and non-updating expressions. In common usage, it is expected that all the expressions in a block, possibly excepting the final one, will be updating expressions. A block is defined to be an updating expression if any of its contained expressions is an updating expression. Inside a block, the syntax and semantics of a declaration are very similar to those of a let-clause in a FLWOR expression. Each declaration names one or more variables and can provide a type and an initializing expression for each variable.
The semantics of a block expression are as follows:
[403] | AssignExpr |
::= | "set" "$" VarName ":=" ExprSingle |
Assignment expressions bind variables to values. They allow different parts of a computation to exchange information through side effects rather than by returning values. Like the insert, delete, replace, and rename expressions, theassignment expression is an updating expression that returns an empty sequence.
Example:
{ declare $total-cost as xs:decimal := 0; for $p in /project[year eq 2005] return { set $total-cost := $total-cost + $p/cost; <project> <name>{$p/name}</name> <cost>{$p/cost}</cost> <cumulative-cost>{$total-cost}</cumulative-cost> </project> } }
The semantics of an assignment expression are as follows:
[404] | WhileExpr |
::= | "while" "(" TestExpr ")"
"return" BodyExpr |
[405] | TestExpr |
::= | ExprSingle |
[406] | BodyExpr |
::= | ExprSingle |
A FLWOR expression iterates over a predefined set of values. In sequential mode, successive iterations may see a different dynamic context, and there is a need to terminate an iteration based on the dynamic context. This is accomplished by introducing a new iterator called a while expression.
Example:
while ( ... ) return ...
The semantics of a while expression are as follows:
• The body expression is evaluated and its side effects are made effective.
• The test expression is re-evaluated.
[407] | TryCatchExpr |
::= | "try" "(" TryExpr ")"
"catch" CatchExpr |
[408] | TryExpr |
::= | ExprSingle |
[409] | CatchExpr |
::= | ... |
.
Example:
try ( ... ) catch ...
The semantics of a try-catch expression are as follows:
XQueryP provides extensions to the semantics of several existing kinds of XQuery expressions, as specified in this section.
The syntax of the FLWOR expression is not changed. Its semantics are extended as follows:
The following example .. :
for $p in ..
[43] | TypeswitchExpr |
::= | "typeswitch" "(" Expr ")" CaseClause+ "default" ("$" VarName)? "return" ExprSingle |
[44] | CaseClause |
::= | "case" ("$" VarName
"as")? SequenceType "return"
ExprSingle |
The syntax of the typeswitch expression is unchanged. Its semantics are
extended as follows (the term "branch" refers to any case
or
default
clause in the typeswitch expression):
The semantics of conditional expressions are extended as follows (the term
"branch" refers to the then
and else
clauses in the
conditional expression):
The following example illustrates .. :
if ..
The semantics of comma expressions (composed of one or more expressions concatenated by the comma operator, as described in Section 3.3.1 of [XQuery 1.0]) are extended as follows:
The following example illustrates ..
let ..
The semantics of a parenthesized expression (any XQuery expression enclosed in parentheses) are extended as follows:
The following example illustrates ..
let ..
[26] | FunctionDecl |
::= | "declare" "updating"? "function" QName "(" ParamList? ")" ("as" SequenceType)? (EnclosedExpr |
"external") |
The syntax of a function declaration is ..
The following example ..
declare ..
The semantics of a function call are extended as follows:
The function call is evaluated as specified in Section 3.1.5 of [XQuery 1.0]. If any input parameter of the function ..
The EBNF in this document and in this section is aligned with the current XML Query 1.0 grammar (see [XQuery 1.0]).
[1] | Module |
::= | VersionDecl? (LibraryModule | MainModule) |
|
[2] | VersionDecl |
::= | "xquery" "version" StringLiteral ("encoding" StringLiteral)? Separator |
|
[3] | MainModule |
::= | Prolog QueryBody |
|
[4] | LibraryModule |
::= | ModuleDecl Prolog |
|
[5] | ModuleDecl |
::= | "module" "namespace" NCName "=" URILiteral Separator |
|
[6] | Prolog |
::= | ((DefaultNamespaceDecl |
Setter | NamespaceDecl | Import) Separator)* ((VarDecl | FunctionDecl | OptionDecl) Separator)* |
|
[7] | Setter |
::= | BoundarySpaceDecl | DefaultCollationDecl |
BaseURIDecl | ConstructionDecl | OrderingModeDecl | EmptyOrderDecl | RevalidationDecl | CopyNamespacesDecl |
|
[8] | Import |
::= | SchemaImport | ModuleImport |
|
[9] | Separator |
::= | ";" |
|
[10] | NamespaceDecl |
::= | "declare" "namespace" NCName "=" URILiteral |
|
[11] | BoundarySpaceDecl |
::= | "declare" "boundary-space" ("preserve" | "strip") |
|
[12] | DefaultNamespaceDecl |
::= | "declare" "default" ("element" | "function") "namespace" URILiteral |
|
[13] | OptionDecl |
::= | "declare" "option" QName StringLiteral |
|
[14] | OrderingModeDecl |
::= | "declare" "ordering" ("ordered" | "unordered") |
|
[15] | EmptyOrderDecl |
::= | "declare" "default" "order" "empty" ("greatest" |
"least") |
|
[16] | CopyNamespacesDecl |
::= | "declare" "copy-namespaces" PreserveMode "," InheritMode |
|
[17] | PreserveMode |
::= | "preserve" | "no-preserve" |
|
[18] | InheritMode |
::= | "inherit" | "no-inherit" |
|
[19] | DefaultCollationDecl |
::= | "declare" "default" "collation" URILiteral |
|
[20] | BaseURIDecl |
::= | "declare" "base-uri" URILiteral |
|
[21] | SchemaImport |
::= | "import" "schema" SchemaPrefix? URILiteral ("at" URILiteral ("," URILiteral)*)? |
|
[22] | SchemaPrefix |
::= | ("namespace" NCName "=") |
("default" "element" "namespace") |
|
[23] | ModuleImport |
::= | "import" "module" ("namespace" NCName "=")? URILiteral ("at" URILiteral ("," URILiteral)*)? |
|
[24] | VarDecl |
::= | "declare" "variable" "$" QName TypeDeclaration? ((":=" ExprSingle) |
"external") |
|
[25] | ConstructionDecl |
::= | "declare" "construction" ("strip" | "preserve") |
|
[26] | FunctionDecl |
::= | "declare" "updating"? "function" QName "(" ParamList? ")" ("as" SequenceType)? (EnclosedExpr |
"external") |
|
[27] | ParamList |
::= | Param ("," Param)* |
|
[28] | Param |
::= | "$" QName TypeDeclaration? |
|
[29] | EnclosedExpr |
::= | "{" Expr "}" |
|
[30] | QueryBody |
::= | Expr |
|
[31] | Expr |
::= | ExprSingle ("," ExprSingle)* |
|
[32] | ExprSingle |
::= | FLWORExpr |
|
[33] | FLWORExpr |
::= | (ForClause | LetClause)+ WhereClause? OrderByClause? "return" ExprSingle |
|
[34] | ForClause |
::= | "for" "$" VarName TypeDeclaration? PositionalVar? "in" ExprSingle ("," "$" VarName TypeDeclaration? PositionalVar? "in" ExprSingle)* |
|
[35] | PositionalVar |
::= | "at" "$" VarName |
|
[36] | LetClause |
::= | "let" "$" VarName TypeDeclaration? ":=" ExprSingle ("," "$" VarName TypeDeclaration? ":=" ExprSingle)* |
|
[37] | WhereClause |
::= | "where" ExprSingle |
|
[38] | OrderByClause |
::= | (("order" "by") | ("stable" "order" "by")) OrderSpecList |
|
[39] | OrderSpecList |
::= | OrderSpec ("," OrderSpec)* |
|
[40] | OrderSpec |
::= | ExprSingle OrderModifier |
|
[41] | OrderModifier |
::= | ("ascending" | "descending")? ("empty" ("greatest" |
"least"))? ("collation" URILiteral)? |
|
[42] | QuantifiedExpr |
::= | ("some" | "every") "$" VarName TypeDeclaration? "in" ExprSingle ("," "$" VarName TypeDeclaration? "in" ExprSingle)* "satisfies" ExprSingle |
|
[43] | TypeswitchExpr |
::= | "typeswitch" "(" Expr ")" CaseClause+ "default" ("$" VarName)? "return" ExprSingle |
|
[44] | CaseClause |
::= | "case" ("$" VarName
"as")? SequenceType "return"
ExprSingle |
|
[45] | IfExpr |
::= | "if" "(" Expr ")" "then" ExprSingle "else" ExprSingle |
|
[46] | OrExpr |
::= | AndExpr ( "or" AndExpr )* |
|
[47] | AndExpr |
::= | ComparisonExpr (
"and" ComparisonExpr
)* |
|
[48] | ComparisonExpr |
::= | RangeExpr ( (ValueComp |
|
[49] | RangeExpr |
::= | AdditiveExpr ( "to"
AdditiveExpr )? |
|
[50] | AdditiveExpr |
::= | MultiplicativeExpr ( ("+"
| "-") MultiplicativeExpr
)* |
|
[51] | MultiplicativeExpr |
::= | UnionExpr ( ("*" |
"div" | "idiv" | "mod") UnionExpr )* |
|
[52] | UnionExpr |
::= | IntersectExceptExpr (
("union" | "|") IntersectExceptExpr
)* |
|
[53] | IntersectExceptExpr |
::= | InstanceofExpr (
("intersect" | "except") InstanceofExpr )* |
|
[54] | InstanceofExpr |
::= | TreatExpr ( "instance"
"of" SequenceType
)? |
|
[55] | TreatExpr |
::= | CastableExpr (
"treat" "as" SequenceType
)? |
|
[56] | CastableExpr |
::= | CastExpr ( "castable"
"as" SingleType )? |
|
[57] | CastExpr |
::= | UnaryExpr ( "cast" "as"
SingleType )? |
|
[58] | UnaryExpr |
::= | ("-" | "+")* ValueExpr |
|
[59] | ValueExpr |
::= | ValidateExpr | PathExpr | ExtensionExpr |
|
[60] | GeneralComp |
::= | "=" | "!=" | "<" | "<=" | ">" | ">=" |
|
[61] | ValueComp |
::= | "eq" | "ne" | "lt" | "le" | "gt" | "ge" |
|
[62] | NodeComp |
::= | "is" | "<<" | ">>" |
|
[63] | ValidateExpr |
::= | "validate" ValidationMode? "{" Expr "}" |
|
[64] | ValidationMode |
::= | "lax" | "strict" |
|
[65] | ExtensionExpr |
::= | Pragma+ "{" Expr? "}" |
|
[66] | Pragma |
::= | "(#" S? QName (S
PragmaContents)?
"#)" |
/* ws: explicitXQ */ |
[67] | PragmaContents |
::= | (Char* - (Char* '#)'
Char*)) |
|
[68] | PathExpr |
::= | ("/" RelativePathExpr?) |
/* gn: leading-lone-slashXQ */ |
[69] | RelativePathExpr |
::= | StepExpr (("/" | "//")
StepExpr)* |
|
[70] | StepExpr |
::= | FilterExpr | AxisStep |
|
[71] | AxisStep |
::= | (ReverseStep | ForwardStep) PredicateList |
|
[72] | ForwardStep |
::= | (ForwardAxis NodeTest) | AbbrevForwardStep |
|
[73] | ForwardAxis |
::= | ("child" "::") |
|
[74] | AbbrevForwardStep |
::= | "@"? NodeTest |
|
[75] | ReverseStep |
::= | (ReverseAxis NodeTest) | AbbrevReverseStep |
|
[76] | ReverseAxis |
::= | ("parent" "::") |
|
[77] | AbbrevReverseStep |
::= | ".." |
|
[78] | NodeTest |
::= | KindTest | NameTest |
|
[79] | NameTest |
::= | QName | Wildcard |
|
[80] | Wildcard |
::= | "*" |
/* ws: explicitXQ */ |
[81] | FilterExpr |
::= | PrimaryExpr PredicateList |
|
[82] | PredicateList |
::= | Predicate* |
|
[83] | Predicate |
::= | "[" Expr "]" |
|
[84] | PrimaryExpr |
::= | Literal | VarRef | ParenthesizedExpr | ContextItemExpr | FunctionCall | OrderedExpr | UnorderedExpr | Constructor |
|
[85] | Literal |
::= | NumericLiteral |
StringLiteral |
|
[86] | NumericLiteral |
::= | IntegerLiteral |
DecimalLiteral | DoubleLiteral |
|
[87] | VarRef |
::= | "$" VarName |
|
[88] | VarName |
::= | QName |
|
[89] | ParenthesizedExpr |
::= | "(" Expr? ")" |
|
[90] | ContextItemExpr |
::= | "." |
|
[91] | OrderedExpr |
::= | "ordered" "{" Expr
"}" |
|
[92] | UnorderedExpr |
::= | "unordered" "{" Expr
"}" |
|
[93] | FunctionCall |
::= | QName "(" (ExprSingle ("," ExprSingle)*)? ")" |
/* gn: reserved-function-namesXQ */ |
/* gn: parensXQ */ | ||||
[94] | Constructor |
::= | DirectConstructor |
|
[95] | DirectConstructor |
::= | DirElemConstructor |
|
[96] | DirElemConstructor |
::= | "<" QName DirAttributeList ("/>" |
(">" DirElemContent*
"</" QName S? ">")) |
/* ws: explicitXQ */ |
[97] | DirAttributeList |
::= | (S (QName S?
"=" S? DirAttributeValue)?)* |
/* ws: explicitXQ */ |
[98] | DirAttributeValue |
::= | ('"' (EscapeQuot | QuotAttrValueContent)*
'"') |
/* ws: explicitXQ */ |
[99] | QuotAttrValueContent |
::= | QuotAttrContentChar |
|
[100] | AposAttrValueContent |
::= | AposAttrContentChar |
|
[101] | DirElemContent |
::= | DirectConstructor |
|
[102] | CommonContent |
::= | PredefinedEntityRef | CharRef | "{{" | "}}" | EnclosedExpr |
|
[103] | DirCommentConstructor |
::= | "<!--" DirCommentContents
"-->" |
/* ws: explicitXQ */ |
[104] | DirCommentContents |
::= | ((Char - '-') | ('-' (Char - '-')))* |
/* ws: explicitXQ */ |
[105] | DirPIConstructor |
::= | "<?" PITarget (S DirPIContents)?
"?>" |
/* ws: explicitXQ */ |
[106] | DirPIContents |
::= | (Char* - (Char* '?>'
Char*)) |
/* ws: explicitXQ */ |
[107] | CDataSection |
::= | "<![CDATA[" CDataSectionContents
"]]>" |
/* ws: explicitXQ */ |
[108] | CDataSectionContents |
::= | (Char* - (Char* ']]>'
Char*)) |
/* ws: explicitXQ */ |
[109] | ComputedConstructor |
::= | CompDocConstructor |
|
[110] | CompDocConstructor |
::= | "document" "{" Expr
"}" |
|
[111] | CompElemConstructor |
::= | "element" (QName | ("{" Expr "}")) "{" ContentExpr? "}" |
|
[112] | ContentExpr |
::= | Expr |
|
[113] | CompAttrConstructor |
::= | "attribute" (QName | ("{"
Expr "}")) "{" Expr? "}" |
|
[114] | CompTextConstructor |
::= | "text" "{" Expr
"}" |
|
[115] | CompCommentConstructor |
::= | "comment" "{" Expr
"}" |
|
[116] | CompPIConstructor |
::= | "processing-instruction" (NCName | ("{" Expr "}")) "{" Expr? "}" |
|
[117] | SingleType |
::= | AtomicType
"?"? |
|
[118] | TypeDeclaration |
::= | "as" SequenceType |
|
[119] | SequenceType |
::= | ("empty-sequence" "(" ")") |
|
[120] | OccurrenceIndicator |
::= | "?" | "*" | "+" |
/* gn: occurrence-indicatorsXQ */ |
[121] | ItemType |
::= | KindTest | ("item" "("
")") | AtomicType |
|
[122] | AtomicType |
::= | QName |
|
[123] | KindTest |
::= | DocumentTest |
|
[124] | AnyKindTest |
::= | "node" "(" ")" |
|
[125] | DocumentTest |
::= | "document-node" "(" (ElementTest | SchemaElementTest)?
")" |
|
[126] | TextTest |
::= | "text" "(" ")" |
|
[127] | CommentTest |
::= | "comment" "(" ")" |
|
[128] | PITest |
::= | "processing-instruction" "(" (NCName | StringLiteral)? ")" |
|
[129] | AttributeTest |
::= | "attribute" "(" (AttribNameOrWildcard
("," TypeName)?)? ")" |
|
[130] | AttribNameOrWildcard |
::= | AttributeName |
"*" |
|
[131] | SchemaAttributeTest |
::= | "schema-attribute" "(" AttributeDeclaration
")" |
|
[132] | AttributeDeclaration |
::= | AttributeName |
|
[133] | ElementTest |
::= | "element" "(" (ElementNameOrWildcard
("," TypeName "?"?)?)?
")" |
|
[134] | ElementNameOrWildcard |
::= | ElementName |
"*" |
|
[135] | SchemaElementTest |
::= | "schema-element" "(" ElementDeclaration
")" |
|
[136] | ElementDeclaration |
::= | ElementName |
|
[137] | AttributeName |
::= | QName |
|
[138] | ElementName |
::= | QName |
|
[139] | TypeName |
::= | QName |
|
[140] | URILiteral |
::= | StringLiteral |
|
[141] | RevalidationDecl |
::= | "declare" "revalidation" ("strict" | "lax" |
"skip") |
|
[142] | InsertExpr |
::= | "do" "insert" SourceExpr ((("as" ("first" |
"last"))? "into") |
|
[143] | DeleteExpr |
::= | "do" "delete" TargetExpr |
|
[144] | ReplaceExpr |
::= | "do" "replace" ("value" "of")? TargetExpr "with" ExprSingle |
|
[145] | RenameExpr |
::= | "do" "rename" TargetExpr "as" NewNameExpr |
|
[146] | SourceExpr |
::= | ExprSingle |
|
[147] | TargetExpr |
::= | ExprSingle |
|
[148] | NewNameExpr |
::= | ExprSingle |
|
[149] | TransformExpr |
::= | "transform" "copy" "$" VarName ":=" ExprSingle ("," "$" VarName ":=" ExprSingle)* "modify" ExprSingle "return" ExprSingle |
[150] | IntegerLiteral |
::= | Digits |
|
[151] | DecimalLiteral |
::= | ("." Digits) | (Digits "." [0-9]*) |
/* ws: explicitXQ */ |
[152] | DoubleLiteral |
::= | (("." Digits) | (Digits ("." [0-9]*)?)) [eE] [+-]? Digits |
/* ws: explicitXQ */ |
[153] | StringLiteral |
::= | ('"' (PredefinedEntityRef | CharRef | EscapeQuot | [^"&])* '"') |
("'" (PredefinedEntityRef | CharRef | EscapeApos | [^'&])*
"'") |
/* ws: explicitXQ */ |
[154] | PredefinedEntityRef |
::= | "&" ("lt" | "gt" | "amp" | "quot" | "apos")
";" |
/* ws: explicitXQ */ |
[155] | EscapeQuot |
::= | '""' |
|
[156] | EscapeApos |
::= | "''" |
|
[157] | ElementContentChar |
::= | Char -
[{}<&] |
|
[158] | QuotAttrContentChar |
::= | Char -
["{}<&] |
|
[159] | AposAttrContentChar |
::= | Char -
['{}<&] |
|
[160] | Comment |
::= | "(:" (CommentContents | Comment)* ":)" |
/* ws: explicitXQ */ |
/* gn: commentsXQ */ | ||||
[161] | PITarget |
::= | [http://www.w3.org/TR/REC-xml#NT-PITarget]XML |
/* gn: xml-versionXQ */ |
[162] | CharRef |
::= | [http://www.w3.org/TR/REC-xml#NT-CharRef]XML |
/* gn: xml-versionXQ */ |
[163] | QName |
::= | [http://www.w3.org/TR/REC-xml-names/#NT-QName]Names |
/* gn: xml-versionXQ */ |
[164] | NCName |
::= | [http://www.w3.org/TR/REC-xml-names/#NT-NCName]Names |
/* gn: xml-versionXQ */ |
[165] | S |
::= | [http://www.w3.org/TR/REC-xml#NT-S]XML |
/* gn: xml-versionXQ */ |
[166] | Char |
::= | [http://www.w3.org/TR/REC-xml#NT-Char]XML |
/* gn: xml-versionXQ */ |
The following symbols are used only in the definition of terminal symbols; they are not terminal symbols in the grammar of A EBNF for XQuery 1.0 Grammar with Update extensions.
[167] | Digits |
::= | [0-9]+ |
[168] | CommentContents |
::= | (Char+ - (Char* ('(:' |
':)') Char*)) |
A basic updating expression is an insert, delete, replace, or rename expression, or a call to an updating function.
The term data model refers to the data model specified by [XQuery/XPath Data Model (XDM)].
To mark a node means to identify the node as participating in a later operation.
A non-updating expression is any XQuery expression that is not an updating expression.
A pending update list is an unordered collection of update primitives, which represent node state changes that have not yet been applied.
The upd:applyUpdates
operation determines the scope
within which all expressions are evaluated before any updates are
applied. This is sometimes called the scope of snapshot
semantics.
The first argument of an update primitive, called its target node, is the principal node to be affected by the update primitive.
Update operations are used in defining the semantics of XQuery updates, but are not directly available to users. Update operations are defined in 3 Update Operations.
Update primitives are the components of pending update lists. Each update primitive represents a node state change that has not yet been applied.
An updating expression is an expression that contains a basic updating expression that
is not inside the modify
clause of a transform
expression.
The term XDM instance denotes an unconstrained sequence of zero or more nodes and/or atomic values as defined by the data model.
Within this document, the term XQuery refers to the language specified by [XQuery 1.0].