Update of /cvsroot/monetdb/pathfinder/modules/pftijah/tjc
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29440/tjc

Modified Files:
        tjc_conf.h tjc_main.c tjc_milprint.c tjc_phys_optimize.c 
        tjc_phys_optimize.h 
Log Message:
correct semantics


U tjc_milprint.c
Index: tjc_milprint.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/tjc/tjc_milprint.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- tjc_milprint.c      16 Apr 2009 10:29:37 -0000      1.19
+++ tjc_milprint.c      22 Apr 2009 13:37:59 -0000      1.20
@@ -95,7 +95,7 @@
     if (tjc_c->timing) {
        TJCPRINTF(MILOUT,"timing := FALSE;\n");
     }
-    if (tjc_c->returnall) {
+    if (tjc_c->semantics == 1) {
         TJCPRINTF(MILOUT,"returnAllElements := FALSE;\n");
     } 
     TJCPRINTF(MILOUT,"}\n");
@@ -113,7 +113,7 @@
     TJCPRINTF(MILOUT,"var upprop := \"%s\";\n", tjc_c->upprop);    
     TJCPRINTF(MILOUT,"var andcomb := \"%s\";\n", tjc_c->andcomb);    
     TJCPRINTF(MILOUT,"var orcomb := \"%s\";\n", tjc_c->orcomb);    
-    if (tjc_c->returnall) {
+    if (tjc_c->semantics == 1) {
         TJCPRINTF(MILOUT,"var returnall := TRUE;\n");
     } else {
         TJCPRINTF(MILOUT,"var returnall := FALSE;\n");

U tjc_main.c
Index: tjc_main.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/tjc/tjc_main.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- tjc_main.c  16 Apr 2009 10:29:37 -0000      1.17
+++ tjc_main.c  22 Apr 2009 13:37:59 -0000      1.18
@@ -70,7 +70,7 @@
     tjc_c->lambda      = 0.8;
     tjc_c->okapik1     = 1.2;
     tjc_c->okapib      = 0.75;
-    tjc_c->returnall   = 0;
+    tjc_c->semantics   = 0;
     tjc_c->rmoverlap   = 0;
 
     /*
@@ -167,7 +167,12 @@
                 tjc_c->okapib = atof (optVal);
         } else if ( strcmp(optName,"return-all") == 0 ) {
             if ( strcasecmp(optVal,"TRUE") == 0 ) 
-                tjc_c->returnall = 1;
+                tjc_c->semantics = 1;
+        } else if ( strcmp(optName,"semantics") == 0 ) {
+            if ( strcasecmp(optVal,"strict") == 0 ) 
+                tjc_c->semantics = 0;
+            else if ( strcasecmp(optVal,"vague") == 0 ) 
+                tjc_c->semantics = 1;
         } else if (strcmp(optName, "prior") == 0) {
             if (strcasecmp(optVal, "LENGTH_PRIOR") == 0) {
                 tjc_c->prior = "ls";
@@ -240,7 +245,7 @@
         if (DEBUG) stream_printf(GDKout,"#!tjc start normalize query\n");
         normalize_query(tjc_c, ptree);
         if (DEBUG) stream_printf(GDKout,"#!tjc start physical optimization\n");
-       atree = phys_optimize (ptree, root, rtagbat);
+       atree = phys_optimize (tjc_c, ptree, root, rtagbat);
         if (DEBUG) stream_printf(GDKout,"#!tjc start mil generation\n");
        milres = milprint (tjc_c, atree);
         

U tjc_phys_optimize.c
Index: tjc_phys_optimize.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/tjc/tjc_phys_optimize.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- tjc_phys_optimize.c 16 Apr 2009 11:44:30 -0000      1.9
+++ tjc_phys_optimize.c 22 Apr 2009 13:37:59 -0000      1.10
@@ -176,7 +176,7 @@
     return anode;
 }
     
-TJanode_t* pnode2anode (TJatree_t *atree, TJpnode_t *s, TJpnode_t *pnode, 
short *nt, BAT *rtagbat)
+TJanode_t* pnode2anode (tjc_config *tjc_c, TJatree_t *atree, TJpnode_t *s, 
TJpnode_t *pnode, short *nt, BAT *rtagbat)
 {
     TJanode_t *anode, *anode1;
     short nid = pnode - s;
@@ -205,40 +205,55 @@
            break;
        case p_desc :
            anode = add_node2 (atree, a_contained_by, 
-                               pnode2anode (atree, s, pnode->child[1], nt, 
rtagbat), 
-                               pnode2anode (atree, s, pnode->child[0], nt, 
rtagbat));
+                               pnode2anode (tjc_c, atree, s, pnode->child[1], 
nt, rtagbat), 
+                               pnode2anode (tjc_c, atree, s, pnode->child[0], 
nt, rtagbat));
            annotate_node (anode, anode->child[0]->tag, 0, 
anode->child[0]->nested, anode->child[0]->preIDs);
            if (anode->child[1]->scored)
                anode->scored = 1;
            if (anode->child[0]->scored) {
-               anode = add_node2 (atree, a_and, anode->child[0], anode);
+                //case vague semantics
+                if (tjc_c->semantics == 1)
+                   anode = add_node2 (atree, a_or, anode->child[0], anode);
+                //default: case strict semantics
+                else
+                   anode = add_node2 (atree, a_and, anode->child[0], anode);
                annotate_node (anode, anode->child[0]->tag, 1, 
anode->child[0]->nested, anode->child[0]->preIDs);
            }
            break;
        case p_anc :
            anode = add_node2 (atree, a_containing, 
-                               pnode2anode (atree, s, pnode->child[1], nt, 
rtagbat), 
-                               pnode2anode (atree, s, pnode->child[0], nt, 
rtagbat));
+                               pnode2anode (tjc_c, atree, s, pnode->child[1], 
nt, rtagbat), 
+                               pnode2anode (tjc_c, atree, s, pnode->child[0], 
nt, rtagbat));
            annotate_node (anode, anode->child[0]->tag, 0, 
anode->child[0]->nested, anode->child[0]->preIDs);
            if (anode->child[1]->scored)
                anode->scored = 1;
            if (anode->child[0]->scored) {
-               anode = add_node2 (atree, a_and, anode->child[0], anode);
+                //case vague semantics
+                if (tjc_c->semantics == 1)
+                   anode = add_node2 (atree, a_or, anode->child[0], anode);
+                //default: case strict semantics
+                else
+                   anode = add_node2 (atree, a_and, anode->child[0], anode);
                annotate_node (anode, anode->child[0]->tag, 1, 
anode->child[0]->nested, anode->child[0]->preIDs);
            }
            break;
        case p_about :
-           anode1 = pnode2anode (atree, s, pnode->child[0], nt, rtagbat);
+           anode1 = pnode2anode (tjc_c, atree, s, pnode->child[0], nt, 
rtagbat);
            anode = pnode2anode_about (atree, s, pnode->child[1], anode1, nt, 
rtagbat); 
            if (anode1->scored) {
-               anode = add_node2 (atree, a_and, anode1, anode);
+                //case vague semantics
+                if (tjc_c->semantics == 1)
+                   anode = add_node2 (atree, a_or, anode1, anode);
+                //default: case strict semantics
+                else
+                   anode = add_node2 (atree, a_and, anode1, anode);
                annotate_node (anode, anode1->child[0]->tag, 1, 
anode->child[0]->nested, anode->child[0]->preIDs);
            }
            break;
        case p_and :
            anode = add_node2 (atree, a_and, 
-                               pnode2anode (atree, s, pnode->child[0], nt, 
rtagbat), 
-                               pnode2anode (atree, s, pnode->child[1], nt, 
rtagbat));
+                               pnode2anode (tjc_c, atree, s, pnode->child[0], 
nt, rtagbat), 
+                               pnode2anode (tjc_c, atree, s, pnode->child[1], 
nt, rtagbat));
            annotate_node (anode, anode->child[0]->tag, 
anode->child[0]->scored, anode->child[0]->nested, anode->child[0]->preIDs);
             if (strcmp (anode->child[0]->tag, anode->child[1]->tag) != 0) 
                annotate_node (anode, "*", anode->scored, 1, 1);
@@ -246,14 +261,14 @@
        case p_or :
        case p_union :
            anode = add_node2 (atree, a_or, 
-                               pnode2anode (atree, s, pnode->child[0], nt, 
rtagbat), 
-                               pnode2anode (atree, s, pnode->child[1], nt, 
rtagbat));
+                               pnode2anode (tjc_c, atree, s, pnode->child[0], 
nt, rtagbat), 
+                               pnode2anode (tjc_c, atree, s, pnode->child[1], 
nt, rtagbat));
            annotate_node (anode, anode->child[0]->tag, 
anode->child[0]->scored, anode->child[0]->nested, anode->child[0]->preIDs);
             if (strcmp (anode->child[0]->tag, anode->child[1]->tag) != 0) 
                annotate_node (anode, "*", anode->scored, 1, 1);
            break;
        case p_nexi :
-           anode = pnode2anode (atree, s, pnode->child[0], nt, rtagbat);
+           anode = pnode2anode (tjc_c, atree, s, pnode->child[0], nt, rtagbat);
            break;
        case p_query :
            GDKerror("type p_query should not be found");
@@ -274,7 +289,7 @@
     return anode;
 }
 
-TJatree_t* ptree2atree(TJptree_t *ptree, TJpnode_t *proot, BAT* rtagbat)
+TJatree_t* ptree2atree(tjc_config *tjc_c, TJptree_t *ptree, TJpnode_t *proot, 
BAT* rtagbat)
 {
     TJatree_t *atree;
     short node_translated[TJPTREE_MAXSIZE];
@@ -282,7 +297,7 @@
 
     for (i = 0; i < TJPTREE_MAXSIZE; i++) node_translated[i] = -1;
     atree = init_atree (ptree);
-    pnode2anode(atree, ptree->node, proot, node_translated, rtagbat);
+    pnode2anode (tjc_c, atree, ptree->node, proot, node_translated, rtagbat);
     return atree;
 }
 
@@ -473,12 +488,11 @@
     }
 }
 
-
-TJatree_t* phys_optimize(TJptree_t *ptree, TJpnode_t *proot, BAT* rtagbat)
+TJatree_t* phys_optimize(tjc_config *tjc_c, TJptree_t *ptree, TJpnode_t 
*proot, BAT* rtagbat)
 {
     TJatree_t *atree;
     
-    atree = ptree2atree (ptree, proot, rtagbat);
+    atree = ptree2atree (tjc_c, ptree, proot, rtagbat);
     add_support_nodes (atree);
     set_physical_operators (atree);
     return atree;

U tjc_conf.h
Index: tjc_conf.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/tjc/tjc_conf.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- tjc_conf.h  16 Apr 2009 10:29:37 -0000      1.8
+++ tjc_conf.h  22 Apr 2009 13:37:59 -0000      1.9
@@ -55,7 +55,7 @@
        double lambda;
        double okapik1;
        double okapib;
-       char returnall;
+       char semantics;
        char rmoverlap;
        char errBUFF[1024];
        char milBUFF[MAXMILSIZE];

U tjc_phys_optimize.h
Index: tjc_phys_optimize.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/tjc/tjc_phys_optimize.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- tjc_phys_optimize.h 16 Apr 2009 10:29:37 -0000      1.4
+++ tjc_phys_optimize.h 22 Apr 2009 13:37:59 -0000      1.5
@@ -81,7 +81,7 @@
 };
 
 extern struct TJatree_t*
-phys_optimize(TJptree_t *ptree, TJpnode_t *proot, BAT* rtagbat);
+phys_optimize(tjc_config *tjc_c, TJptree_t *ptree, TJpnode_t *proot, BAT* 
rtagbat);
 
 extern void
 free_atree(TJatree_t *atree);


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to