Changeset: b3dce5049ba2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b3dce5049ba2
Modified Files:
        monetdb5/extras/rdf/rdfschema.c
        monetdb5/extras/rdf/rdfschema.h
        sql/backends/monet5/sql.mx
Branch: rdf
Log Message:

Use the oid of property for column names


diffs (85 lines):

diff --git a/monetdb5/extras/rdf/rdfschema.c b/monetdb5/extras/rdf/rdfschema.c
--- a/monetdb5/extras/rdf/rdfschema.c
+++ b/monetdb5/extras/rdf/rdfschema.c
@@ -3445,18 +3445,22 @@ void initCStablesAndIdxMapping(CStableSt
                        cstablestat->lstcstable[k].numCol = tmpNumProp;
                        cstablestat->lstcstable[k].colBats = 
(BAT**)malloc(sizeof(BAT*) * tmpNumProp); 
                        cstablestat->lstcstable[k].mvBats = 
(BAT**)malloc(sizeof(BAT*) * tmpNumProp); 
+                       cstablestat->lstcstable[k].lstProp = 
(oid*)malloc(sizeof(oid) * tmpNumProp);
                        #if CSTYPE_TABLE == 1
                        cstablestat->lastInsertedSEx[k] = (oid*) 
malloc(sizeof(oid) * tmpNumProp); 
                        cstablestat->lstcstableEx[k].numCol = tmpNumProp;
                        cstablestat->lstcstableEx[k].colBats = 
(BAT**)malloc(sizeof(BAT*) * tmpNumProp); 
+                       cstablestat->lstcstableEx[k].lstProp = 
(oid*)malloc(sizeof(oid) * tmpNumProp);
                        #endif
 
                        for(j = 0; j < tmpNumProp; j++){
                                cstablestat->lstcstable[k].colBats[j] = 
BATnew(TYPE_void, TYPE_oid, smallbatsz);
                                cstablestat->lstcstable[k].mvBats[j] = 
BATnew(TYPE_void, TYPE_oid, smallbatsz);
+                               cstablestat->lstcstable[k].lstProp[j] = 
freqCSset->items[i].lstProp[j];
                                //TODO: use exact aount for each BAT
                                #if CSTYPE_TABLE == 1
                                cstablestat->lstcstableEx[k].colBats[j] = 
BATnew(TYPE_void, TYPE_oid, smallbatsz);
+                               cstablestat->lstcstableEx[k].lstProp[j] = 
freqCSset->items[i].lstProp[j];               /* Do not need to store this info 
?*/
                                #endif
 
                        }
@@ -3508,8 +3512,10 @@ void freeCStableStat(CStableStat* cstabl
                }
                free(cstablestat->lstcstable[i].colBats);
                free(cstablestat->lstcstable[i].mvBats);
+               free(cstablestat->lstcstable[i].lstProp);
                #if CSTYPE_TABLE == 1
                free(cstablestat->lstcstableEx[i].colBats);
+               free(cstablestat->lstcstableEx[i].lstProp);
                #endif
        }
        BBPunfix(cstablestat->pbat->batCacheid); 
diff --git a/monetdb5/extras/rdf/rdfschema.h b/monetdb5/extras/rdf/rdfschema.h
--- a/monetdb5/extras/rdf/rdfschema.h
+++ b/monetdb5/extras/rdf/rdfschema.h
@@ -189,6 +189,7 @@ typedef struct CStable {
        BAT**   colBats; 
        BAT**   mvBats;         /* One bat for one Muti-values property */
        int     numCol; 
+       oid*    lstProp;
 } CStable; 
 
 
diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx
--- a/sql/backends/monet5/sql.mx
+++ b/sql/backends/monet5/sql.mx
@@ -7685,7 +7685,7 @@ SQLrdfreorganize(Client cntxt, MalBlkPtr
                
                for (j = 0; j < cstablestat->numPropPerTable[i]; j++){
                        //TODO: Use propertyId from Propstat
-                       sprintf(tmpcolname, "col%d",j);
+                       sprintf(tmpcolname, 
"col%d",(int)cstablestat->lstcstable[i].lstProp[j]);
                        mvc_create_column(m, cstables[i], tmpcolname,  &tpe);
 
                        //For multi-values table
@@ -7705,7 +7705,7 @@ SQLrdfreorganize(Client cntxt, MalBlkPtr
 
                //Add data
                for (j = 0; j < cstablestat->numPropPerTable[i]; j++){
-                       sprintf(tmpcolname, "col%d",j);
+                       sprintf(tmpcolname, 
"col%d",(int)cstablestat->lstcstable[i].lstProp[j]);
                        store_funcs.append_col(m->session->tr,
                                        mvc_bind_column(m, 
cstables[i],tmpcolname ), 
                                        cstablestat->lstcstable[i].colBats[j], 
TYPE_bat);
@@ -7722,13 +7722,13 @@ SQLrdfreorganize(Client cntxt, MalBlkPtr
                totalNoTablesCreated++;
                for (j = 0; j < cstablestat->numPropPerTable[i]; j++){
                        //TODO: Use propertyId from Propstat
-                       sprintf(tmpcolname, "colex%d",j);
+                       sprintf(tmpcolname, 
"colex%d",(int)cstablestat->lstcstableEx[i].lstProp[j]);
                        mvc_create_column(m, cstablesEx[i], tmpcolname,  &tpe);
                }
 
                //Add data
                for (j = 0; j < cstablestat->numPropPerTable[i]; j++){
-                       sprintf(tmpcolname, "colex%d",j);
+                       sprintf(tmpcolname, 
"colex%d",(int)cstablestat->lstcstableEx[i].lstProp[j]);
                        store_funcs.append_col(m->session->tr,
                                        mvc_bind_column(m, 
cstablesEx[i],tmpcolname ), 
                                        
cstablestat->lstcstableEx[i].colBats[j], TYPE_bat);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to