Skip to content

Commit

Permalink
Substantial revision of deep update proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhkay committed May 17, 2024
1 parent a5eecd7 commit d2954e0
Show file tree
Hide file tree
Showing 7 changed files with 1,013 additions and 626 deletions.
38 changes: 34 additions & 4 deletions specifications/grammar-40/xpath-grammar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2098,10 +2098,10 @@ ErrorVal ::= "$" VarName

<g:production name="Modifier">
<g:choice>
<g:string>pairs</g:string>
<g:string>keys</g:string>
<g:string>values</g:string>
<g:string>items</g:string>
<g:string>entry</g:string>
<g:string>key</g:string>
<g:string>value</g:string>
<g:string>content</g:string>
</g:choice>
</g:production>

Expand Down Expand Up @@ -2700,12 +2700,42 @@ ErrorVal ::= "$" VarName
<g:string>array</g:string>
</g:choice>
<g:ref name="ExprSingle"/>
<g:string>{</g:string>
<g:ref name="UpdateClause"/>
<g:zeroOrMore>
<g:string>,</g:string>
<g:ref name="UpdateClause"/>
</g:zeroOrMore>
<g:string>}</g:string>
</g:production>

<g:production name="UpdateClause" if="xquery40">
<g:choice>
<g:ref name="ReplaceClause"/>
<g:ref name="DeleteClause"/>
<g:ref name="ExtendClause"/>
</g:choice>
</g:production>

<g:production name="ReplaceClause" if="xquery40">
<g:string>replace</g:string>
<g:ref name="ExprSingle"/>
<g:string>with</g:string>
<g:ref name="ExprSingle"/>
</g:production>

<g:production name="DeleteClause" if="xquery40">
<g:string>delete</g:string>
<g:ref name="ExprSingle"/>
</g:production>

<g:production name="ExtendClause" if="xquery40">
<g:string>extend</g:string>
<g:ref name="ExprSingle"/>
<g:string>with</g:string>
<g:ref name="ExprSingle"/>
</g:production>


<!-- ] end PrimaryExpr -->

Expand Down
12 changes: 8 additions & 4 deletions specifications/xpath-datamodel-40/src/xpath-datamodel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1541,17 +1541,21 @@ For all positions greater than 0 and less than or equal to the array size,
such as <code>is</code> and <code>instance of</code>, cast expressions, atomization,
and functions such as
<code>fn:avg</code> or <code>fn:index-of</code>.</p></item>
<item><p>The <code>fn:label</code> function is a special case: it returns the
<!--<item><p>The <code>fn:label</code> function is a special case: it returns the
label of a labeled item, as a map. If applied to an item that is not labeled, it
returns an empty map.</p></item>
returns an empty map.</p></item>-->
</ulist>
<note><p>Two items representing the same node (such that <code>$n1 is $n2</code> returns
true) may nevertheless have different labels. It is perhaps helpful to think of such items
not as nodes, but as references to nodes, which are automatically dereferenced by the majority
of operations.</p></note>
<note><p>A labeled item matches a type if its subject matches the type; labels are thus extraneous
to the type system.</p></note>
<p>Labeled items are returned by certain operations, such as the lookup operators <code>?</code>
<note><p>The concept of labels has been added to the data model as a very general mechanism,
but it is currently used only for very specific purposes: in particular, for the intermediate
results of lookup expressions and update expressions on maps and arrays. Labels are currently
used only for internal purposes, and are not exposed to user-written code.</p></note>
<!--<p>Labeled items are returned by certain operations, such as the lookup operators <code>?</code>
and <code>??</code>. As a result, the lookup operation can be treated at one level as if it
returned a simple value (an entry found in a map or array), but applications that need extra
information about the value can find this by examining the label: for example, they can identify
Expand All @@ -1561,7 +1565,7 @@ For all positions greater than 0 and less than or equal to the array size,
is itself a labeled item), and with a map <var>M</var> as its label, where <var>M</var> contains
a single entry having the key <code>"pinned"</code> (as an <code>xs:string</code>) and an associated
<code>xs:boolean</code> value <code>true</code>. An item <code>$item</code>
satisfying <code>$item[label(.)?pinned]</code> is referred to as a <term>pinned</term> item.</p>
satisfying <code>$item[label(.)?pinned]</code> is referred to as a <term>pinned</term> item.</p>-->
</div2>
</div1>

Expand Down
8 changes: 4 additions & 4 deletions specifications/xpath-functions-40/src/function-catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31547,7 +31547,7 @@ return $result
</fos:history>
</fos:function>

<fos:function name="pin" prefix="fn">
<!--<fos:function name="pin" prefix="fn">
<fos:signatures>
<fos:proto name="pin" return-type="item()">
<fos:arg name="input" type="item()"/>
Expand Down Expand Up @@ -31718,9 +31718,9 @@ return pin($data)??languages[. = 'German'] ! label()?path()[1]</eg></fos:express
<fos:history>
<fos:version version="4.0">Proposed for 4.0</fos:version>
</fos:history>
</fos:function>
</fos:function>-->

<fos:function name="label" prefix="fn">
<!--<fos:function name="label" prefix="fn">
<fos:signatures>
<fos:proto name="label" return-type="map(xs:string, item()*)?">
<fos:arg name="input" type="item()?"/>
Expand Down Expand Up @@ -31752,6 +31752,6 @@ return pin($data)??languages[. = 'German'] ! label()?path()[1]</eg></fos:express
<fos:history>
<fos:version version="4.0">Proposed for 4.0</fos:version>
</fos:history>
</fos:function>
</fos:function>-->

</fos:functions>
4 changes: 2 additions & 2 deletions specifications/xpath-functions-40/src/xpath-functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6880,12 +6880,12 @@ correctly in all browsers, depending on the system configuration.</emph></p>-->
<!--<div3 id="func-json" diff="add" at="A">
<head><?function fn:json?></head>
</div3>-->
<div3 id="func-pin" diff="add" at="A">
<!--<div3 id="func-pin" diff="add" at="A">
<head><?function fn:pin?></head>
</div3>
<div3 id="func-label" diff="add" at="A">
<head><?function fn:label?></head>
</div3>
</div3>-->
</div2>
<div2 id="csv-functions">
<head>Functions on CSV Data</head>
Expand Down
3 changes: 2 additions & 1 deletion specifications/xquery-40/src/errors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,9 @@ It is a static error if the name of a feature in
if a function declaration is annotated as
<code>%variadic</code> then none of its parameters may
contain a <nt def="ParamWithDefault">ParamWithDefault</nt>.</p>
</error>

<error spec="XQ" role="xquery" code="0150" class="DY" type="dynamic">
<error spec="XQ" role="xquery" code="0151" class="DY" type="dynamic">
<p> It is a <termref def="dt-dynamic-error">dynamic error</termref>
if the selection subexpression in an update expression selects items
that are not labeled as being part of the subtree of the pinned root.</p>
Expand Down
Loading

0 comments on commit d2954e0

Please sign in to comment.