Changeset: f9bbc6341b05 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f9bbc6341b05
Modified Files:
monetdb5/extras/rdf/rdfschema.c
monetdb5/extras/rdf/rdfschema.h
sql/backends/monet5/sql.mx
Branch: rdf
Log Message:
Use real names for table names
diffs (150 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
@@ -5178,6 +5178,7 @@ void getObjStr(BAT *mapbat, BATiter mapi
//Assume Tokenizer is openned
//
+/*
void getTblName(char *name, oid nameId){
str canStr = NULL;
str canStrShort = NULL;
@@ -5190,7 +5191,7 @@ void getTblName(char *name, oid nameId){
if (strstr (canStrShort,".") != NULL ||
strcmp(canStrShort,"") == 0 ||
strstr(canStrShort,"-") != NULL ){ // WEBCRAWL
specific problem with Table name a.jpg, b.png....
-
+
strcpy(name,"NONAME");
}
else {
@@ -5213,7 +5214,65 @@ void getTblName(char *name, oid nameId){
}
-
+*/
+
+void getTblName(str *name, oid nameId){
+ str canStr = NULL;
+ str canStrShort = NULL;
+ char *pch;
+ int lngth = 0;
+ str s;
+ int i;
+
+ if (nameId != BUN_NONE){
+ takeOid(nameId, &canStr);
+ getPropNameShort(&canStrShort, canStr);
+
+ if (strstr (canStrShort,".") != NULL ||
+ strcmp(canStrShort,"") == 0 ||
+ strstr(canStrShort,"-") != NULL ){ // WEBCRAWL
specific problem with Table name a.jpg, b.png....
+
+ lngth = 6;
+ *name = (str)GDKmalloc(sizeof(char) * lngth + 1);
+ s = *name;
+ strcpy(s,"noname");
+ s += lngth;
+ *s = '\0';
+ }
+ else {
+ pch = strstr (canStrShort,"(");
+ if (pch != NULL) *pch = '\0'; //Remove (...)
characters from table name
+
+ lngth = strlen(canStrShort);
+ *name = (str)GDKmalloc(sizeof(char) * lngth + 1);
+ s = *name;
+ strcpy(s,canStrShort);
+
+ //Convert to lower case
+ for (i = 0; i < lngth; i++){
+ if (s[i] >= 65 && s[i] <= 90){
+ s[i] = s[i] | 32;
+ }
+ }
+ s += lngth;
+ *s = '\0';
+ }
+
+
+ GDKfree(canStr);
+
+ GDKfree(canStrShort);
+ }
+ else {
+ lngth = 6;
+ *name = (str)GDKmalloc(sizeof(char) * lngth + 1);
+ s = *name;
+ strcpy(s,"noname");
+ s += lngth;
+ *s = '\0';
+ }
+
+}
#if NO_OUTPUTFILE == 0
static
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
@@ -423,7 +423,7 @@ rdf_export str
RDFreorganize(int *ret, CStableStat *cstablestat, bat *sbatid, bat *pbatid,
bat *obatid, bat *mapbatid, int *freqThreshold, int *mode);
rdf_export void
-getTblName(char *name, oid nameId);
+getTblName(str *name, oid nameId);
rdf_export char
getObjType(oid objOid); /* Return the type of the object value
from obj oid*/
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
@@ -7813,6 +7813,7 @@ SQLrdfreorganize(Client cntxt, MalBlkPtr
sql_schema *sch;
int ret = 0;
CStableStat *cstablestat;
+ str baseTblName;
char tmptbname[100];
char tmpstr[20];
char tmptbnameex[100];
@@ -7934,15 +7935,16 @@ SQLrdfreorganize(Client cntxt, MalBlkPtr
}
for (i = 0; i < cstablestat->numTables; i++){
//printf("creating table %d \n", i);
- sprintf(tmptbname, "cstable");
sprintf(tmpstr, "%d",i);
- //getTblName(tmptbname, cstablestat->lstcstable[i].tblname);
+ getTblName(&baseTblName, cstablestat->lstcstable[i].tblname);
+ sprintf(tmptbname, "%s", baseTblName);
strcat(tmptbname,tmpstr);
- //printf("Table %d:|| %s ||\n",i, tmptbname);
+ printf("Table %d:|| %s ||\n",i, tmptbname);
cstables[i] = mvc_create_table(m, sch, tmptbname, tt_table, 0,
SQL_PERSIST, 0, 3);
+ GDKfree(baseTblName);
totalNoTablesCreated++;
//Multivalues tables for each column
csmvtables[i] = (sql_table **)malloc(sizeof(sql_table*) *
cstablestat->numPropPerTable[i]);
@@ -7985,15 +7987,16 @@ SQLrdfreorganize(Client cntxt, MalBlkPtr
#if CSTYPE_TABLE == 1
// Add non-default type table
if (cstablestat->lstcstableEx[i].numCol != 0){
- sprintf(tmptbnameex, "cstable");
sprintf(tmpstr, "ex%d",i);
- //getTblName(tmptbname,
cstablestat->lstcstable[i].tblname);
+ getTblName(&baseTblName,
cstablestat->lstcstable[i].tblname);
+ sprintf(tmptbnameex, "%s", baseTblName);
strcat(tmptbnameex,tmpstr);
- //printf("TableEx %d: || %s || \n",i, tmptbname);
+ printf("TableEx %d: || %s || \n",i, tmptbnameex);
cstablesEx[i] = mvc_create_table(m, sch, tmptbnameex,
tt_table, 0,
SQL_PERSIST, 0, 3);
+ GDKfree(baseTblName);
totalNoTablesCreated++;
totalNoExTables++;
for (j = 0; j < cstablestat->lstcstableEx[i].numCol;
j++){
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list