Update of /cvsroot/monetdb/pathfinder/compiler/mil
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv25104/compiler/mil

Modified Files:
        milprint_summer.c 
Log Message:
- finishing the value indexing => they now get maintained under XUF updates

- fixed bugs in te updating code (these got new atr/text values from 
  PROP_VAL/PROP_TEXT, where they are only found if those values already existed.
  if not, we need to check PROP_VAL_UPDATE/PROP_TEXT_UPDATE.

- as it turned out expensive to figure out for changed text nodes which node
  was the parent, we went for the asy solution and changed the semantics.
   
  Now text node indexing no longer takes into account the parent element 
  (ie no condition on its qname).  thus, the signature of pf:text() is now:

  pf:text($ctx as node()*, $val as xs:string) as text()*



Index: milprint_summer.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milprint_summer.c,v
retrieving revision 1.358
retrieving revision 1.359
diff -u -d -r1.358 -r1.359
--- milprint_summer.c   4 Apr 2007 13:51:59 -0000       1.358
+++ milprint_summer.c   4 Apr 2007 22:23:52 -0000       1.359
@@ -6579,30 +6579,54 @@
                 "  pos  := tmark_grp_unique(iter,ipik);\n"
                 "} # end of translate fn:collections () as string*\n", 
cur_level, consistent);
         return NORMAL;
-    } else if (PFqname_eq(fnQname,PFqname (PFns_lib,"text")) == 0 ||
-               (rc = 2, PFqname_eq(fnQname,PFqname (PFns_lib,"attribute")) == 
0))
+    } else if (PFqname_eq(fnQname,PFqname (PFns_lib,"text")) == 0) {
+        /* index-powered element lookup by attribute or text-child on equal 
value (string) 
+         * - pf:text(NODES, VALUE) 
+         *   delivers all text nodes from the fragments in NODES with a VALUE 
as text value
+         * within each iter, the returned pre-sequence is unique and in 
doc-order
+         */
+
+        /* NODES that solely identify the XML fragment(s) of interest */ 
+        rc = translate2MIL (f, NORMAL, cur_level, counter, L(args));
+        milprintf(f, "iter := iter.materialize(ipik);\nkind := 
kind.materialize(ipik);\n");
+
+        /* VALUES to look for */
+        saveResult_ (f, ++counter, NORMAL);
+        rc = translate2MIL (f, VALUES, cur_level, counter, RL(args));
+        milprintf(f, "item_str_ := item%s.materialize(ipik);\n",  (rc == 
NORMAL)?val_join(STR):"_str_");
+
+        milprintf(f,
+                "{ # translate pf:text () as string*\n"
+                "  var id_pre := vx_lookup(ws, iter%03u, kind%03u, item_str_, 
str_nil, str_nil);\n"
+                "  iter := id_pre.hmark([EMAIL 
PROTECTED]).leftfetchjoin(iter%03u);\n"
+                "  kind := id_pre.hmark([EMAIL 
PROTECTED]).leftfetchjoin(kind%03u);\n"
+                "  item := id_pre.tmark([EMAIL PROTECTED]);\n"
+                "  ipik := item;\n"
+                "  pos  := tmark_grp_unique(iter,ipik);\n"
+                "} # end of translate pf:text () as element()*\n", 
+                    counter, counter, counter, counter);
+
+        deleteResult_ (f, counter, NORMAL);
+        return NORMAL;
+    } else if (PFqname_eq(fnQname,PFqname (PFns_lib,"attribute")) == 0)
     {
         /* index-powered element lookup by attribute or text-child on equal 
value (string) 
-         * - pf:text(NODES, VALUE, URI, LOC) 
-         *   delivers all URI:LOC elements from the fragments in NODES with a 
VALUE as text value
          * - pf:attribute(NODES, VALUE, URI, LOC) 
          *   all elements (any qname) from the fragments in NODES with a 
URI:LOC attribute with value "VALUE"
          * within each iter, the returned pre-sequence is unique and in 
doc-order
          */
-        int attr = (rc == 2);
-        char *fcn = attr?"attribute":"text"; 
 
         /* NODES that solely identify the XML fragment(s) of interest */ 
         rc = translate2MIL (f, NORMAL, cur_level, counter, L(args));
         milprintf(f, "iter := iter.materialize(ipik);\nkind := 
kind.materialize(ipik);\n");
-        saveResult_ (f, ++counter, NORMAL);
 
         /* VALUES to look for */
+        saveResult_ (f, ++counter, NORMAL);
         rc = translate2MIL (f, VALUES, cur_level, counter, RL(args));
         milprintf(f, "item_str_ := item%s.materialize(ipik);\n",  (rc == 
NORMAL)?val_join(STR):"_str_");
-        saveResult_ (f, ++counter, STR);
 
-        /* element URI and LOC parameters are assumed to be constant value (no 
support for computed qnames) */
+        /* attribute URI and LOC parameters are assumed to be constant value 
(no support for computed qnames) */
+        saveResult_ (f, ++counter, STR);
         rc = translate2MIL (f, VALUES, cur_level, counter, RRL(args));
         milprintf(f, "item_str_ := item%s.fetch(0)%s;\n", (rc == 
NORMAL)?"":"_str_", (rc == NORMAL)?val_join(STR):"");
         saveResult_ (f, ++counter, STR);
@@ -6610,15 +6634,15 @@
         milprintf(f, "item_str_ := item%s.fetch(0)%s;\n", (rc == 
NORMAL)?"":"_str_", (rc == NORMAL)?val_join(STR):"");
 
         milprintf(f,
-                "{ # translate pf:%s () as string*\n"
-                "  var id_pre := vx_lookup(ws, iter%03u, kind%03u, 
item_str_%03u, item_str_%03u, item_str_, %s);\n"
+                "{ # translate pf:attribute() as string*\n"
+                "  var id_pre := vx_lookup(ws, iter%03u, kind%03u, 
item_str_%03u, item_str_%03u, item_str_);\n"
                 "  iter := id_pre.hmark([EMAIL 
PROTECTED]).leftfetchjoin(iter%03u);\n"
                 "  kind := id_pre.hmark([EMAIL 
PROTECTED]).leftfetchjoin(kind%03u);\n"
                 "  item := id_pre.tmark([EMAIL PROTECTED]);\n"
                 "  ipik := item;\n"
                 "  pos  := tmark_grp_unique(iter,ipik);\n"
-                "} # end of translate fn:%s () as element()*\n", 
-                fcn, counter-2, counter-2, counter-1, counter, 
(*fcn=='t')?"true":"false", counter-2, counter-2, fcn);
+                "} # end of translate pf:attribute () as element()*\n",
+                   counter-2, counter-2, counter-1, counter, counter-2, 
counter-2);
 
         deleteResult_ (f, counter--, STR);
         deleteResult_ (f, counter--, STR);


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to