Update of /cvsroot/monetdb/pathfinder/compiler/algebra
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12574/compiler/algebra
Modified Files:
algebra.c builtins.c logical.c physical.c
Log Message:
Algebra and logical implementation of the following build-in functions:
- fn:name(), fn:name(node?)
- fn:local-name(), fn:locla-name(node?)
- fn:namespace-uri(), fn:namespace-uri(node?)
These functions are 1to1 functions since they all return a string for each
node parameter.
Index: physical.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/physical.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- physical.c 19 Dec 2007 22:39:06 -0000 1.48
+++ physical.c 8 Jan 2008 16:54:22 -0000 1.49
@@ -1650,6 +1650,16 @@
res_type = aat_str;
break;
+ case alg_fun_fn_name:
+ case alg_fun_fn_local_name:
+ case alg_fun_fn_namespace_uri:
+ assert (n->sem.fun_1to1.refs.count == 1);
+ /* make sure attribute is of type node */
+ assert (n->schema.items[ix[0]].type & aat_node);
+
+ res_type = aat_str;
+ break;
+
case alg_fun_fn_number:
assert (refs.count == 1);
res_type = aat_dbl;
Index: algebra.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/algebra.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- algebra.c 13 Dec 2007 13:08:14 -0000 1.64
+++ algebra.c 8 Jan 2008 16:54:22 -0000 1.65
@@ -1076,6 +1076,9 @@
case alg_fun_fn_matches_flag: return "fn:matches";
case alg_fun_fn_replace: return "fn:replace";
case alg_fun_fn_replace_flag: return "fn:replace";
+ case alg_fun_fn_name: return "fn:name";
+ case alg_fun_fn_local_name: return "fn:local-name";
+ case alg_fun_fn_namespace_uri: return "fn:namespace-uri";
case alg_fun_fn_number: return "fn:number";
case alg_fun_fn_qname: return "fn:QName";
case alg_fun_pf_fragment: return "#pf:fragment";
Index: logical.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/logical.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- logical.c 19 Dec 2007 22:39:05 -0000 1.73
+++ logical.c 8 Jan 2008 16:54:22 -0000 1.74
@@ -1398,6 +1398,16 @@
res_type = aat_str;
break;
+ case alg_fun_fn_name:
+ case alg_fun_fn_local_name:
+ case alg_fun_fn_namespace_uri:
+ assert (n->sem.fun_1to1.refs.count == 1);
+ /* make sure attribute is of type node */
+ assert (n->schema.items[ix[0]].type & aat_node);
+
+ res_type = aat_str;
+ break;
+
case alg_fun_fn_number:
assert (refs.count == 1);
res_type = aat_dbl;
@@ -1414,7 +1424,7 @@
case alg_fun_pf_fragment:
assert (n->sem.fun_1to1.refs.count == 1);
- /* make sure both attributes are of type string */
+ /* make sure attribute is of type node */
assert (n->schema.items[ix[0]].type & aat_node);
res_type = aat_pnode;
@@ -1422,7 +1432,7 @@
case alg_fun_pf_supernode:
assert (n->sem.fun_1to1.refs.count == 1);
- /* make sure both attributes are of type string */
+ /* make sure attribute is of type node */
assert (n->schema.items[ix[0]].type & aat_node);
res_type = n->schema.items[ix[0]].type;
@@ -1431,7 +1441,7 @@
case alg_fun_upd_delete:
assert(refs.count == 1);
- /* make sure that the attributes is a node */
+ /* make sure that the attribute is a node */
assert(n->schema.items[ix[0]].type & aat_node);
/* the result type is aat_update bitwise OR the type of
Index: builtins.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/builtins.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- builtins.c 27 Dec 2007 13:07:13 -0000 1.69
+++ builtins.c 8 Jan 2008 16:54:22 -0000 1.70
@@ -2360,14 +2360,79 @@
/* 14.1 fn:name */
/* ------------ */
+struct PFla_pair_t
+PFbui_fn_name (const PFla_op_t *loop, bool ordering, struct PFla_pair_t *args)
+{
+ (void) loop; (void) ordering;
+
+ return (struct PFla_pair_t) {
+ .rel = project (
+ fun_1to1 (
+ project (args[0].rel,
+ proj (att_iter, att_iter),
+ proj (att_pos, att_pos),
+ proj (att_item, att_item)),
+ alg_fun_fn_name,
+ att_res,
+ attlist(att_item)),
+ proj (att_iter, att_iter),
+ proj (att_pos, att_pos),
+ proj (att_item, att_res)),
+ .frag = args[0].frag };
+}
+
/* ------------------- */
/* 14.2. fn:local-name */
/* ------------------- */
+struct PFla_pair_t
+PFbui_fn_local_name (const PFla_op_t *loop, bool ordering,
+ struct PFla_pair_t *args)
+{
+ (void) loop; (void) ordering;
+
+ return (struct PFla_pair_t) {
+ .rel = project (
+ fun_1to1 (
+ project (args[0].rel,
+ proj (att_iter, att_iter),
+ proj (att_pos, att_pos),
+ proj (att_item, att_item)),
+ alg_fun_fn_local_name,
+ att_res,
+ attlist(att_item)),
+ proj (att_iter, att_iter),
+ proj (att_pos, att_pos),
+ proj (att_item, att_res)),
+ .frag = args[0].frag };
+}
+
/* --------------------- */
/* 14.3. fn:namespace-uri */
/* --------------------- */
+struct PFla_pair_t
+PFbui_fn_namespace_uri (const PFla_op_t *loop, bool ordering,
+ struct PFla_pair_t *args)
+{
+ (void) loop; (void) ordering;
+
+ return (struct PFla_pair_t) {
+ .rel = project (
+ fun_1to1 (
+ project (args[0].rel,
+ proj (att_iter, att_iter),
+ proj (att_pos, att_pos),
+ proj (att_item, att_item)),
+ alg_fun_fn_namespace_uri,
+ att_res,
+ attlist(att_item)),
+ proj (att_iter, att_iter),
+ proj (att_pos, att_pos),
+ proj (att_item, att_res)),
+ .frag = args[0].frag };
+}
+
/* --------------- */
/* 14.4. fn:number */
/* --------------- */
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins