Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs16:/tmp/cvs-serv26699/runtime

Modified Files:
        pathfinder.mx pf_support.mx 
Log Message:

- added pf:docname($n as node()*) as xs:string*
  that is, discover the document names from which a sequence of nodes stem

  this is needed in a multi-document scenario where a document, identified
  by some expression over the entire collection, gets deleted.

- allow a collection super-root node to be passed in a context in the fn:id() 
call.

  this is an *extension* of the XQuery semantics, as it allows to look for
  nodes by ID across an entire collection (i.e. in multiple docs=XML 
fragments). 



Index: pathfinder.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pathfinder.mx,v
retrieving revision 1.337
retrieving revision 1.338
diff -u -d -r1.337 -r1.338
--- pathfinder.mx       18 Apr 2007 01:38:51 -0000      1.337
+++ pathfinder.mx       18 Apr 2007 09:42:30 -0000      1.338
@@ -3161,6 +3161,20 @@
     return xmltab4(ws, "document", doc_nme, "collection", doc_col, "url", 
doc_url, "updatable", doc_upd);
 }
 
+PROC ws_docname(BAT[void,BAT] ws, BAT[void,oid] id_iter, BAT[void,oid] 
id_item, BAT[void,int] id_kind) : BAT[oid,str]
+{
+    var id_conts := get_container(id_kind);
+    var id_roots := get_root(ws, id_item, id_kind, 
id_conts).mposjoin(id_conts, ws.fetch(PRE_NID));
+    var res_cont := id_roots.tmark([EMAIL PROTECTED]).leftfetchjoin(id_conts);
+    var res_iter := id_roots.tmark([EMAIL PROTECTED]).leftfetchjoin(id_iter);
+    var res_docid:= id_roots.hmark([EMAIL PROTECTED]).mvaljoin(res_cont, 
ws.fetch(FRAG_ROOT)).tmark([EMAIL PROTECTED]);
+    var res := reverse(res_iter).leftfetchjoin(res_docid);
+    lock_set(pf_short);
+    var err := CATCH(res := res.leftjoin(doc_name));
+    lock_unset(pf_short);
+    if (not(isnil(err))) ERROR(err);
+    return res;
+}
 
 @- shredding documents
 

Index: pf_support.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pf_support.mx,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -d -r1.208 -r1.209
--- pf_support.mx       13 Apr 2007 12:48:28 -0000      1.208
+++ pf_support.mx       18 Apr 2007 09:42:30 -0000      1.209
@@ -548,13 +548,16 @@
         var delta := 100000 / count(frag_frag); # generate 100K intermediate 
tuples max
         var cur := 0, end := count(frag_item);
         while(cur < end) {
-                result.replace(leftthetajoin(frag_item.slice(cur, cur+delta), 
frag_frag, GE).{max}(), true);
+                var batch := frag_item.slice(cur, cur+delta);
+                result.replace(leftthetajoin(batch, frag_frag, GE).{max}(), 
true);
+                result.replace(batch.ord_select([EMAIL PROTECTED]), true); # 
get_root() on collection super-root ([EMAIL PROTECTED]) returns self
                 cur :+= delta + 1;
         }
 }
 
 PROC get_root(BAT[oid,bat] ws, oid item, int kind, oid cont) : oid
 {
+        if (item = [EMAIL PROTECTED]) return [EMAIL PROTECTED]; # get_root() 
on collection super-root ([EMAIL PROTECTED]) returns self
         var nid_rid   := ws.fetch(NID_RID).fetch(cont);
         var map_pid   := ws.fetch(MAP_PID).fetch(cont);
         var frag_root := ws.fetch(FRAG_ROOT).fetch(cont).tmark([EMAIL 
PROTECTED]).leftfetchjoin(nid_rid).[swizzle](map_pid);
@@ -563,7 +566,6 @@
                 item := ws.fetch(ATTR_OWN).fetch(cont).find(item);
                 item := nid_rid.find(item).swizzle(map_pid);
         }
-
         item := max(frag_root.select(oid_nil,item));
         return item;
 }


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to