1 <?xml version="1.0" encoding="utf-8" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
5 <!ENTITY in "<small style='font-size:small'>∈</small>">
6 <!ENTITY notin "<small style='font-size:small'>∉</small>">
13 <!ENTITY cduce "ℂDuce">
16 <!ENTITY setminus "∖" >
19 <!ENTITY subseteq "⊆" >
24 <!ENTITY lbrack "<span style='font-size:xx-large;'>⟦</span>" >
25 <!ENTITY rbrack "<span style='font-size:xx-large;'>⟧</span>" >
27 <!ENTITY left "<tt style='color:#d33'>L</tt>" >
28 <!ENTITY right "<tt style='color:#33d'>R</tt>">
30 <!ENTITY rleadsto "⟿"> <!-- -->
37 <html xmlns="http://www.w3.org/1999/xhtml" >
39 <title>A Core Calculus for XQuery 3.0</title>
41 <meta http-equiv="Content-Type"
42 content="text/html; charset=utf-8" />
43 <meta name="copyright"
44 content="Copyright © 2013 Kim Nguyễn" />
47 <script src="../jquery-2.0.3.min.js" type="text/javascript" ></script>
48 <script src="../libs/raphael-min.js" type="text/javascript" ></script>
49 <!-- Load the library -->
50 <script src="../simpleWebSlides.js" type="text/javascript" ></script>
52 <link rel="stylesheet" href="../simpleWebSlides.css" type="text/css" media="all" />
53 <!-- Load a custom Theme, the class-element marks this style-sheet
54 a "theme" that can be swtiched dynamicaly -->
55 <link class="sws-theme" rel="stylesheet" title="U-Psud style" href="../themes/uPsud.css" type="text/css" />
57 <!-- Customize some templates and initialize -->
59 <script type="text/javascript">
60 SWS.Config['sws-slide-change'] = SWS.Effects.slideChangeFadeOutIn;
61 SWS.Config['sws-object-deactivate'] = SWS.Effects.objectDeactivateFadeOut;
62 SWS.Config['sws-object-activate'] = SWS.Effects.objectActivateFadeIn;
64 //Ensures that we load SWS at the very end, after MathJax has
67 $(window).load(SWS.Presentation.init);
69 var col_change = function (sel, col) {
70 return function (canvas) {
71 canvas.find(".xpath *").css("color","");
72 var objs = canvas.find(sel);
73 objs.css("color", col);
76 var reg = SWS.Presentation.registerCallback;
82 src: url("OpenSans-Regular.ttf") format("truetype");
83 font-family: "Open Sans";
88 src: url("OpenSans-Bold.ttf") format("truetype");
89 font-family: "Open Sans";
94 src: url("OpenSans-Italic.ttf") format("truetype");
95 font-family: "Open Sans";
100 src: url("OpenSans-BoldItalic.ttf") format("truetype");
101 font-family: "Open Sans";
109 font-family: 'Open Sans',sans-serif;
111 background-color: white;
121 pre, dfn, .infer { font-family : serif;
128 vertical-align:text-bottom;
129 display:inline-block;
140 vertical-align:text-bottom;
141 display:inline-block;
147 margin: 0pt 0pt 0pt 0pt;
148 padding: 0pt 0pt 0pt 0pt;
151 .infer > span:last-child {
152 margin: 0pt 0pt 0pt 0pt;
153 padding: 0pt 0pt 0pt 0pt;
154 border-width: 1pt 0pt 0pt 0pt;
156 border-color: #292928;
159 vertical-align:text-top;
165 margin: 0pt 0pt 0pt 0pt;
166 padding: 0pt 0pt 0pt 0pt;
168 span.fill { display:inline-block;
176 <div class="sws-slide sws-cover sws-option-nofooter">
177 <h1 style="font-size:200%;position:relative;top:-1em;">A Core Calculus for XQuery 3.0</h1>
178 <h3>Combining Navigational and Pattern-Matching Approaches</h3>
179 <div style="text-align:center;">
180 <table style="display:inline-block">
182 <td>Giuseppe Castagna<sup>1</sup></td>
183 <td>Hyeonseung Im<sup>2</sup></td>
186 <td><u>Kim Nguyễn</u><sup>3</sup></td>
187 <td>Véronique Benzaken<sup>3</sup></td>
191 <p style="font-size:80%;position:absolute;bottom:2.5em;left:4em;">
192 CNRS, PPS, Université Paris-Diderot, Paris, France <br/>
193 Kangwon National University, Chuncheon, Rep. of Korea<br/>
194 LRI, Université Paris-Sud, Orsay, France
197 <div class="sws-slide">
199 <p>W3C standard language for querying XML
200 databases/documents</p>
201 <code style="background:white">
202 declare function <u>get_links</u>(<u>$page</u>, <u>$print</u>) {
204 <span class="for">for</span> <u>$i</u> <span class="for">in</span> <u>$page</u><span class="xpath">/descendant::a[not(ancestor::b)]</span>
205 <span class="for">return</span> <u>print</u>(<u>$i</u>)
208 declare function <u>pretty</u>(<u>$link</u>) {
209 <span class="ts">typeswitch</span>(<u>$link</u>)
210 <span class="ts">case</span> <u>$l</u> <span class="ts">as element(a)</span>
211 return <span class="sw">switch</span> (<u>$l</u><span class="xpath">/@class</span>)
212 <span class="sw">case</span> "style1"
213 return <a href={<u>$l</u><span class="xpath">/@href</span>}><b>{<u>$l</u><span class="xpath">/text()</span>}</b></a>
214 default return <u>$l</u>
216 <span class="ts">default return</span> <u>$link</u>
219 <script type="text/javascript">
220 reg ("0", col_change(".xpath, .for, .ts, .sw",""));
221 reg ("1", col_change(".xpath", "#f80"));
222 reg ("2", col_change(".for",""));
223 reg ("2", col_change(".for", "#290"));
224 reg ("3", col_change(".ts", ""));
225 reg ("3", col_change(".ts", "#80f"));
226 reg ("4", col_change(".sw", ""));
227 reg ("4", col_change(".sw", "#0f2"));
230 <div class="sws-slide">
235 + nice declarative syntax for paths
238 - weird distinction between types/value case<br/>
239 - <s>no type-checking for functions</s>
242 <p>It's a pity since XML <em>documents</em> are very precisely
243 typed (DTD, XMLSchemas)</p>
244 <p>Document type information is validated at runtime rather than
245 checked statically</p>
247 <div class="sws-slide">
249 <p>A polymorphic functional language (ML-style) equipped with
250 semantic subtyping</p>
253 let <u>pretty</u> (<a>_ -> <a>_ & Any\<a>_ &rarrow; Any\<a>_)
255 | <a class="style1" href=<u>h</u> ..> <u>l</u> &rarrow; <a href=<u>h</u>>[ <b><u>l</u> ]
259 let <u>get_links</u> (page: <_>_) (print: <a>_ -> <a>_) : [ <a>_ * ] =
262 <a>_ & x &rarrow; [ (print x) ]
263 | < (_\‘b) > l &rarrow;
264 (transform l with (i & <_>_) &rarrow; get_links i print)
274 <div class="sws-slide">
278 + Statically typed <br/>
279 + compact (and efficient) type and value pattern-matching
282 - <s>complex navigation encoded through recursion</s>
283 - no type inference for functions
286 <p>Writing functions to traverse documents is painfull</p>
288 <div class="sws-slide">
290 <ol style="margin-left:1em; margin-right:0.25em;list-style-position:inside;">
291 <li id="tobox" style="padding:1em 0em 1em 0em;"><span class="lh">Add support for path navigation to
293 <ul id="toshow" style="margin-top:2em;display:none;">
294 <li>Enrich the type algebra with <em>zippers</em> (à la Huet)</li>
295 <li>Extend pattern-matching construct to <em>zipped values and types</em></li>
296 <li>Encode path expressions as recursive patterns</li>
299 <li style="padding:1em 0em 1em 0em;">Perform a type-directed translation from XQuery to
303 <script type="text/javascript">
304 reg ("0", col_change(".lh",""));
305 reg ("1", col_change(".lh", "#f80"));
307 reg ("2", function (canvas) { $("#toshow").show(); });
308 reg ("3", function (c) { $("#tobox").css (
309 { 'background' : '#dfd', 'border-radius': '1em' });});
312 <div class="sws-slide">
313 <h1>&cduce;'s type algebra</h1>
315 t ::= b | c | t × t | t &rarrow; t | t &lor; t | t &land; t | t ∖ t | ⊤ | ⊥ | α
317 <p><dfn>b</dfn> : ranges over basic types (<tt>Int</tt>, <tt>String</tt>, …)<br/>
318 <dfn>c</dfn> : ranges over singleton types
319 (<tt>`A</tt>, <tt>42</tt>, …)<br/>
320 <dfn>α</dfn> : type variables<br/>
321 types are interpreted co-inductively (recursive types) and regular
322 expression types<br/>
325 t<sub>1</sub> ≡ (<tt>Int</tt> × t<sub>1</sub>) &lor; t<sub>2</sub>
326 t<sub>2</sub> ≡ (<tt>Bool</tt> × t<sub>2</sub>) &lor; (<tt>Bool</tt> × <tt>`nil</tt>)
328 <span class="sws-pause">t<sub>1</sub> ≡ <tt>[ Int* Bool+ ]</tt></span>
332 <div class="sws-slide">
333 <h1>Semantic subtyping</h1>
334 <pre style="text-align:center;">
335 t ≤ s &Lrarrow; [t] ⊆ [s]
337 <p><dfn>[ ]</dfn> interpretation of types as sets of
339 Allows to reason <i>modulo</i> semantic equivalence of type connectives :
342 <tt>[ Int* (Int | Bool*)? ]</tt> &land; <tt>[ Int+ (Bool+ | Int)* ]</tt> ≡ <tt>[Int+ Bool*]</tt>
345 <div class="sws-slide">
346 <h1>&cduce; patterns</h1>
347 <pre style="text-align:center;"> p ::= t | p | p | p & p | (p, p) | x </pre>
348 <p><dfn>t</dfn> ranges over types<br/>
349 <dfn>x</dfn> ranges over capture variables<br/>
350 patterns are also co-inductively interpreted (recursive patterns)
352 <p><dfn><u>v / p</u></dfn> : matching a value against a pattern yields a
353 substitution from variables to values<br/>
354 <dfn><u>&lbag; p &rbag;</u></dfn> : the set of values accepted by a
355 pattern is <u>a type</u><br/>
356 <dfn><u> t / p</u></dfn> : matching a type against a pattern yields a
357 substitution from variables to types<br/>
360 <div class="sws-slide">
361 <h1>&cduce; patterns (example)</h1>
362 <p>Assume <tt><u>l</u></tt> has type <tt>[ Int+ Bool* ]</tt>, consider:</p>
365 [ _* (<u>x</u> & Int) Bool* (<u>y</u> & Bool) ] &rarrow; (<u>x</u>, <u>y</u>)
366 | [ _* (<u>x</u> & Int) ] &rarrow; (<u>x</u>, `false)
367 | [ ] &rarrow; (0, `false)
370 <li><dfn>&lbag;<tt>[ _* (<u>x</u> & Int) Bool* (<u>y</u> & Bool) ]</tt>&rbag; ≡ <tt>[ ⊤* Int Bool+ ]</tt></dfn><br/>
371 yield : { x ↦ <tt>Int</tt>, y ↦ <tt>Bool</tt> }
373 <li><dfn>&lbag;<tt>[ _* (<u>x</u> & Int) ]</tt>&rbag; ≡ <tt>[ ⊤* Int ]</tt></dfn><br/>
374 yield : { x ↦ <tt>Int</tt> }
376 <li>Since <dfn><tt>[Int+ Bool* ]</tt> ∖ ( <tt>[ ⊤* Int Bool+ ]</tt> &lor; <tt>[ ⊤* Int]</tt>) ≡ ⊥ </dfn>
377 the third case is unreachable.
384 <div class="sws-slide">
385 <h1>&cduce; data-model</h1>
386 <p>Sequences are nested pairs: <dfn><tt>[</tt> v<sub>1</sub> … v<sub>n</sub> <tt>]</tt> ≡ (v<sub>1</sub>, (…, (v<sub>n</sub>, <tt>`nil</tt>)))
388 <p>XML documents are tagged sequences: <pre style="text-align:center;"><tt><foo>[</tt> v<sub>1</sub> … v<sub>n</sub> <tt>]</tt> ≡ (<tt>`foo</tt>, <tt>[</tt> v<sub>1</sub> … v<sub>n</sub> <tt>]</tt>)</pre>
390 <p>Ususal lisp-like encoding of trees, how to perform navigation
391 (including upward ?)</p>
393 <div class="sws-slide">
394 <h1>Zippers (1/2)</h1>
396 <li>Introduced in 1997 by Gérard Huet</li>
397 <li>Stack of visited</li>
398 <li>Push the current node on the stack when descending</li>
399 <li>Put the top of the stack and pop it to go backward</li>
400 <li>Tag the elements of the stack to remember which of a node we
403 <pre style="text-align:center;"> v ::= … | v<sub>δ</sub>
404 δ ::= &bcirc; | &left;v · δ | &right;v · δ
408 <div class="sws-slide">
409 <h1>Zippers (2/2)</h1>
410 <p><tt><u>fst</u></tt> (resp. <tt><u>snd</u></tt>) takes the first (resp. second)
411 projection of a pair and update its zipper accordingly:</p>
412 <pre> v<sub>1</sub> ≡ (1, (2, (3, (4, `nil))))<sub>&bcirc;</sub>
413 v<sub>11</sub> ≡ fst v<sub>1</sub> ≡ 1<sub>&left;(1, (2, (3, (4, `nil))))<sub>&bcirc;</sub> · &bcirc; </sub>
414 v<sub>2</sub> ≡ snd v<sub>1</sub> ≡ (2, (3, (4, `nil)))<sub>&right;(1, (2, (3, (4, `nil))))<sub>&bcirc;</sub> · &bcirc; </sub>
415 v<sub>3</sub> ≡ snd v<sub>2</sub> ≡ (3, (4, `nil))<sub>&right;v<sub>2</sub> · &right;v<sub>1</sub> · &bcirc; </sub>
417 <p><tt><u>up</u></tt> pops returns the head of the zipper: </p>
418 <pre> up v<sub>3</sub> ≡ v<sub>2</sub> ≡ (2, (3, (4, `nil)))<sub>&right;(1, (2, (3, (4, `nil))))<sub>&bcirc;</sub> · &bcirc; </sub>
421 <div class="sws-slide">
422 <h1>Zipper types</h1>
423 <p>We extend the type-algebra with zipper types:</p>
424 <pre style="text-align:center;"> t ::= … | t<sub>τ</sub>
425 τ ::= &bcirc; | &left;t · τ | &right;t · τ | τ &lor; τ | τ ∖ τ | &ztop;
427 <p><dfn>&bcirc;</dfn>: singleton type denoting the empty zipper<br/>
428 <dfn>&ztop;</dfn>: the top zipper types<br/>
429 Zipper types are interpreted co-inductively (regular expressions on
431 <dfn><tt>Int</tt><sub>(&left;⊤)* &bcirc;</sub></dfn>: type of
432 integers that are the leftmost descendant of a tree.<br/>
433 <dfn><tt><![CDATA[<html>[ <head>[…] <body>[…] ]]]></tt><sub>&bcirc;</sub></dfn>: type of
435 <dfn><tt><![CDATA[<a href=String>[ … ]]]></tt><sub>&ztop;</sub></dfn>: types of links in any context
439 <div class="sws-slide">
440 <h1>Tree navigation</h1>
441 <p>Since patterns contain types, we can check complex
443 <pre style="width:60%;display:inline-block;border-width:0pt 1pt 0pt 0pt; border-style:dashed;border-color: black;vertical-align:middle">
444 p ≡ <tt id="test"><a>_</tt> &lor; <tt><_>[ _* p _* ]</tt>
446 τ ≡ &bcirc; &lor; &right;⊤ · τ &lor; &left;(⊤∖ <tt><b>_</tt>) · τ
449 <code style="width:20%;display:inline-block;vertical-align:middle">
451 <dfn>p<sub>τ</sub></dfn> & <u>x</u> &rarrow; …
454 <p style="background:white">
455 We want more, namely return <i>all</i> descendants (ancestor,
456 children, siblings, …) of a node matching a particular condition
458 Remark: (recursive) patterns <u>already perform a recursive traversal
461 <em>Idea</em>: Piggy back on the traversal and <em>accumulate</em>
462 nodes in special variables
464 <script type="text/javascript">
465 reg (0, col_change ("#test", ""));
466 reg (1, col_change ("#test", "orange"));
469 <div class="sws-slide">
470 <h1>Operators and Accumulators</h1>
471 <p>An <u>operator</u> is a 4-tupple <dfn>(o, n<sub>o</sub>,
472 &rleadsto;<sub>o</sub>, &rarrow;<sub>o</sub>)</dfn>, where:</p>
473 <p><dfn><u>o</u></dfn>: is the accumulator name<br/>
474 <dfn><u>n<sub>o</sub></u></dfn>: is the arity of <u>o</u><br/>
475 <dfn><u>&rleadsto;<sub>o</sub></u></dfn>:
476 &mathV;<sup>n<sub>o</sub></sup> &rsarrow; &mathV;, the reduction relation <br/>
477 <dfn><u>&rarrow;<sub>o</sub></u></dfn>:
478 &mathT;<sup>n<sub>o</sub></sup> &rsarrow; &mathT;, the typing relation <br/>
480 <p>An <u>accumulator</u> is a variable (ranged over
481 by <u>ẋ</u>, <u>ẏ</u>, …) with:<br/><br/>
482 <dfn><u>Op(ẋ)</u></dfn>: an operator<br/>
483 <dfn><u>Init(ẋ)</u> ∈ &mathV;</dfn> : an initial value<br/>
486 <div class="sws-slide">
487 <h1>Some operators</h1>
489 v, v' &rleadsto;<sup>cons,</sup> (v, v') <br/>
490 v, <tt>`nil</tt> &rleadsto;<sup>snoc</sup> (v, <tt>`nil</tt>)<br/>
491 v, (v',v'') &rleadsto;<sup>snoc</sup> (v', snoc(v,v''))<br/>
493 <p>Now we can use accumulators equipped with cons/snoc in
494 patterns. Instead of matching a single node against a variable, it
495 <u>accumulates</u> that node in sequence (in reverse or in-order).</p>
497 <div class="sws-slide">
498 <h1>Pattern matching semantics (v/p)</h1>
499 <pre style="text-align:center;">
500 σ; δ ⊢ v / p &rleadsto; γ, σ'
502 <p style="font-size:90%"><dfn><u>σ</u>, <u>σ'</u></dfn>: mapping from accumulators to
504 <dfn><u>v</u></dfn>: input value<br/>
505 <dfn><u>p</u></dfn>: pattern<br/>
506 <dfn><u>γ</u></dfn>: mapping from capture variables to
508 <dfn><u>δ</u></dfn>: current context
510 <div style="padding:0em 1em 0em; text-align:justify;font-size:85%;background:white;">
512 <span> v ∈ [ t ]</span>
513 <span>σ; δ ⊢ v / t &rleadsto; ∅,
515 </div><span>(type)</span>
519 <span>σ; δ ⊢ v / ẋ &rleadsto; ∅,
520 σ[ ẋ := Op(ẋ) (v<sub>δ</sub>, σ(ẋ)) ]</span>
521 </div><span>(acc)</span>
525 <span>σ; δ ⊢ v / x &rleadsto; { x ↦ v },
527 </div><span>(var)</span>
530 <span>σ; &left;v · δ ⊢ (fst v)/p<sub>1</sub>
531 &rleadsto; γ<sub>1</sub>, σ' </span>
532 <span>σ'; &right;v · δ ⊢ (snd v)/p<sub>2</sub>
533 &rleadsto; γ<sub>2</sub>, σ''
535 <span>σ; δ ⊢ v /
536 (p<sub>1</sub>, p<sub>2</sub>) &rleadsto;
537 γ<sub>1</sub>∪ γ<sub>2</sub>,
539 </div><span>(pair)</span> <span class="fill"></span>
540 <span>… and some other rules for alternation, failure, recursion, <i>etc.</i></span>
543 <div class="sws-slide">
544 <h1>Typing of patterns (with accumulators) 1/2</h1>
545 <p>Well known that typing path expressions escapes regular tree languages
546 (i.e. &cduce;'s types). Consider:
548 <pre style="margin:-3em 0pt -1em;">
549 t ≡ <tt><c>[ <u><a>[]</u> t <u><b>[]</u> ] </tt> &lor; <tt><c>[]</tt> <img style="margin-left:3em;width:15%;vertical-align:middle;" src="anbn_tree.svg" alt="anbn"/>
551 <p>The set of all <tt><u>a</u></tt> or <tt><u>b</u></tt> labeled
553 is <dfn>{ <tt>[<u><a>[]</u></tt><sup>n</sup> <tt><u><b>[]</u></tt><sup>n</sup> <tt>]</tt> | n ≥ 0 }</dfn>
554 which is not a type.</p>
555 <p> Intuitively it means that when applying a
556 recursive pattern against a recursive type, we may generate an
557 <s>infinite number of distinct types</s> for an accumulator.
560 <div class="sws-slide">
561 <h1>Typing of patterns (with accumulators) 2/2</h1>
562 <p>We use the typing relation of operators to introduce
565 <u>t<sub>0</sub></u>, <tt>[</tt> (t<sub>1</sub> &lor; … &lor; t<sub>n</sub>)<tt>* ]</tt> &rarrow;<sup>cons</sup> <tt>[</tt> (<u>t<sub>0</sub></u> &lor; t<sub>1</sub> &lor; … &lor; t<sub>n</sub>)<tt>* ]</tt> <br/>
566 <u>t<sub>0</sub></u>, <tt>[</tt> (t<sub>1</sub> &lor; … &lor; t<sub>n</sub>)<tt>* ]</tt> &rarrow;<sup>snoc</sup> <tt>[</tt> (<u>t<sub>0</sub></u> &lor; t<sub>1</sub> &lor; … &lor; t<sub>n</sub>)<tt>* ]</tt>
568 <p>Ensures termination of typechecking of patterns.</p>
570 <div class="sws-slide">
572 <p>Zippers (in values, types, patterns) are orthogonal to the rest of the language</p>
574 <li><u>Subtyping and typechecking</u> are extended straightforwardly</li>
575 <li>Typing of patterns introduces <u>sound approximations</u> only for accumulators</li>
576 <li>Provided the operators are sound, the whole language remains <u>type-safe</u></li>
579 <div class="sws-slide">
580 <h1>From zippers to XPath</h1>
581 <p>We use <u>regular expressions</u> over basic &left;/&right; zippers to encode XPath</p>
582 <code style="width:50%;float:left;"> <![CDATA[<a>[ <b>[
588 </code><img style="width:17.5%;" src="ex_ntree.svg" alt="ex_ntree" /><br/>
589 <p class="sws-pause"><img style="margin-top:-1em;margin-left:5%;width:85%;" src="rb_tree.svg" alt="rb_tree"/></p>
591 <div class="sws-slide">
592 <h1>Downward axes</h1>
593 <tt> <![CDATA[<a>[ <b>[ <c>[] <d>[] <e>[ <f> [] ] ] ]]]><sub>&bcirc;</sub></tt>
594 <object id="svgRBTree" data="rb_tree.svg" type="image/svg+xml" style="margin-left:7.5%;width:85%" />
596 <tt>self ::</tt> t ≡ (ẋ <tt>&</tt> t | _ )<sub>&ztop;</sub>
597 <tt>child ::</tt> t ≡ <tt><_>[</tt> (ẋ <tt>&</tt> t | _ )<tt>* ]</tt><sub>&ztop;</sub>
598 <tt>descendant-or-self::</tt> t ≡ X ≡ ((ẋ <tt>&</tt> t | _ ) <tt> & <_>[</tt> X <tt>* ]</tt>)<sub>&ztop;</sub>
599 <tt>descendant</tt> :: t ≡ <tt><_>[ (descendant-or-self::</tt>t<tt>)* ]</tt><sub>&ztop;</sub>
602 <script type="text/javascript">
607 svgDoc = svgDoc || document.getElementById("svgRBTree").contentDocument;
608 var f = svgDoc.getElementById("nodef");
609 f.style['fillOpacity'] = "0";
610 var elems = svgDoc.getElementsByClassName("parentf");
611 for(var i = 0; i < elems.length; i++) {
612 elems[i].style['strokeWidth'] = '2px';
616 reg (0, function (c) {
621 reg (1, function (c) {
623 var f = svgDoc.getElementById("nodef");
624 console.log(' Opacity ' + f.style['fillOpacity']);
625 f.style['fillOpacity'] = "0.5";
626 console.log(' Opacity ' + f.style['fillOpacity']);
629 reg (2, function (c) {
631 var elems = svgDoc.getElementsByClassName("parentf");
632 for(i = 0; i < elems.length; i++) {
633 elems[i].style['strokeWidth'] = '6px';
636 reg (3, function (c) { console.log(3); reset(); });
641 <div class="sws-slide">
643 <tt> <![CDATA[<a>[ <b>[ <c>[] <d>[] <e>[ <f> [] ] ] ]]]><sub>&bcirc;</sub></tt>
644 <object id="svgRBTree" data="rb_tree.svg" type="image/svg+xml" style="margin-left:7.5%;width:85%" />
646 <tt>parent ::</tt> t ≡ ⊤<sub> (&left;_) · (&right;_)* · (&right; ẋ & t) · (( (&left; _) · &ztop;) &lor; &bcirc; )</sub>
647 <tt>ancestor ::</tt> t ≡ ⊤<sub> ((&left;_) · (&right;_)* · (&right; ẋ & t))* · &bcirc; </sub>
650 <div class="sws-slide">
651 <h1>Other results</h1>
653 <li>Encoding of paths is compositional</li>
654 <li>Once we have path, translation from XQuery to &cduce; is straightforward</li>
655 <li>We also give a direct typing algorithm for XQuery 3.0 rather than typing the translation to &cduce;</li>
658 <div class="sws-slide">
659 <h1>Conclusion, thoughts and future work</h1>
661 <li>Adding path expressions to a functional language such as &cduce; is possible </li>
662 <li>Semantic subtyping and regular expression types play nicely with zippers</li>
663 <li>In terms of language design, exposing directly zippers patterns to the programmer is a big no-no</li>
664 <li>Can also be applied to XSLT</li>
665 <li>Implementation on-going (including a &cduce; to javascript backend)</li>
666 <li>Extend the approach to Json (google ``path language for json''), i.e. generalise from products to extensible records</li>