Changeset: b3ab6e952a2f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b3ab6e952a2f
Modified Files:
        monetdb5/extras/rdf/rdf_shredder.c
        monetdb5/extras/rdf/rdflabels.c
        monetdb5/extras/rdf/rdfontologyload.c
        monetdb5/extras/rdf/rdfschema.c
Branch: rdf
Log Message:

More BATmirror removing


diffs (truncated from 624 to 300 lines):

diff --git a/monetdb5/extras/rdf/rdf_shredder.c 
b/monetdb5/extras/rdf/rdf_shredder.c
--- a/monetdb5/extras/rdf/rdf_shredder.c
+++ b/monetdb5/extras/rdf/rdf_shredder.c
@@ -150,8 +150,6 @@ static void
 rdf_BUNappend_unq_ForObj(parserData* pdata, BAT *b, void* objStr, ObjectType 
objType, BUN* bun){
 
        BATprint(b);    
-       printf("Append %s ...", (str)objStr);
-       printf("Checking existency\n"); 
        *bun = BUNfnd(b,(ptr) (str)objStr);
        if (*bun == BUN_NONE) {
                if (b->T->hash && BATcount(b) > 4 * b->T->hash->mask) {
@@ -174,7 +172,6 @@ rdf_BUNappend_unq_ForObj(parserData* pda
                        raptor_parser_parse_abort (pdata->rparser);
                }
        } else {
-               printf("Existing value at "BUNFMT " with objType = %d seqbase 
is " BUNFMT "\n", *bun, objType, (b)->hseqbase);
                *bun += RDF_MIN_LITERAL;
                *bun |= (BUN)objType << (sizeof(BUN)*8 - 4);
        }
diff --git a/monetdb5/extras/rdf/rdflabels.c b/monetdb5/extras/rdf/rdflabels.c
--- a/monetdb5/extras/rdf/rdflabels.c
+++ b/monetdb5/extras/rdf/rdflabels.c
@@ -420,7 +420,7 @@ void insertValuesIntoTypeAttributesHisto
 
        for (i = 0; i < typeListLength; ++i) {
                #if ONLY_USE_ONTOLOGYBASED_TYPE
-               BUN pos = BUNfnd(BATmirror(ontmetaBat), &typeList[i]);
+               BUN pos = BUNfnd(ontmetaBat, &typeList[i]);
                if (pos == BUN_NONE) continue; // no ontology information, 
ignore
                #endif
                // add to histogram
@@ -758,7 +758,7 @@ oid* getOntologyCandidates(oid** ontattr
                for (k = 0; k < listCount[i]; ++k) {
                        BUN p, bun; 
                        p = listOids[i][k];
-                       bun = BUNfnd(BATmirror(propStat->pBat), (ptr) &p);
+                       bun = BUNfnd(propStat->pBat, (ptr) &p);
                        if (bun == BUN_NONE) continue; 
                        else{
                                candidates[k] = malloc(sizeof(oid) * 
(propStat->plCSidx[bun].numAdded));
@@ -785,7 +785,7 @@ oid* getOntologyCandidates(oid** ontattr
                for (j = 0; j < listCount[i]; ++j) { // for each list
                        BUN p, bun;
                        p = listOids[i][j];
-                       bun = BUNfnd(BATmirror(propStat->pBat), (ptr) &p);
+                       bun = BUNfnd(propStat->pBat, (ptr) &p);
                        if (bun == BUN_NONE) continue; // property does not 
belong to an ontology class and therefore has no tfidfs score
                        for (k = 0; k < candidatesCount[j]; ++k) { // for each 
candidate
                                // search for this class
@@ -817,7 +817,7 @@ oid* getOntologyCandidates(oid** ontattr
                for (j = 0; j < listCount[i]; ++j) {
                        BUN bun;
                        if (candidatesCount[j] == 0) continue; // ignore 
properties without classes (dbpedia-specific issue)
-                       bun = BUNfnd(BATmirror(propStat->pBat), (ptr) 
&listOids[i][j]);
+                       bun = BUNfnd(propStat->pBat, (ptr) &listOids[i][j]);
                        totalTfidfs += (propStat->tfidfs[bun] * 
propStat->tfidfs[bun]);
                }
                for (j = 0; j < num; ++j) {
@@ -938,7 +938,7 @@ PropStat* initPropStat(void) {
                return NULL;
        }
 
-       (void)BATprepareHash(BATmirror(propStat->pBat));
+       (void)BATprepareHash(propStat->pBat);
        if (!(propStat->pBat->T->hash)) {
                return NULL;
        }
@@ -969,12 +969,12 @@ void createPropStatistics(PropStat* prop
                oid attr = ontattributes[1][i];
                oid uri = ontattributes[0][i];
                // add prop to propStat
-               BUN     bun = BUNfnd(BATmirror(propStat->pBat), (ptr) &attr);
+               BUN     bun = BUNfnd(propStat->pBat, (ptr) &attr);
                if (bun == BUN_NONE) {
                        numProps++;
                        if (propStat->pBat->T->hash && BATcount(propStat->pBat) 
> 4 * propStat->pBat->T->hash->mask) {
                                HASHdestroy(propStat->pBat);
-                               BAThash(BATmirror(propStat->pBat), 
2*BATcount(propStat->pBat));
+                               BAThash(propStat->pBat, 
2*BATcount(propStat->pBat));
                        }
 
                        propStat->pBat = BUNappend(propStat->pBat, &attr, TRUE);
@@ -1399,7 +1399,7 @@ void getTableName(CSlabel* label, CSset*
 
                        typeOid = typeAttributesHistogram[csIdx][i][j].value;
                        printf("FreqCS %d : Type[%d][%d][oid] = " BUNFMT, 
csIdx, i,j, typeOid);
-                       ontClassPos = BUNfnd(BATmirror(ontmetaBat), &typeOid); 
+                       ontClassPos = BUNfnd(ontmetaBat, &typeOid); 
                        if (ontClassPos != BUN_NONE){
                                takeOid(typeOid,&typelabel);
                                assert(ontclassSet[ontClassPos].cOid == 
typeOid); 
@@ -1421,7 +1421,7 @@ void getTableName(CSlabel* label, CSset*
                // of all values that are >= TYPE_FREQ_THRESHOLD, choose the 
value with the highest hierarchy level ("deepest" value)
                maxDepthOid = typeAttributesHistogram[csIdx][i][0].value;
                maxFreq = typeAttributesHistogram[csIdx][i][0].freq;
-               ontClassPos = BUNfnd(BATmirror(ontmetaBat), &maxDepthOid);
+               ontClassPos = BUNfnd(ontmetaBat, &maxDepthOid);
                if ( ontClassPos != BUN_NONE){
                        foundOntologyTypeValue = 1;
                        maxDepth = ontclassSet[ontClassPos].hierDepth;
@@ -1436,7 +1436,7 @@ void getTableName(CSlabel* label, CSset*
                        if (typeAttributesHistogram[csIdx][i][j].percent < 
TYPE_FREQ_THRESHOLD) break;
                        
                        typeOid = typeAttributesHistogram[csIdx][i][j].value;
-                       ontClassPos = BUNfnd(BATmirror(ontmetaBat), &typeOid);
+                       ontClassPos = BUNfnd(ontmetaBat, &typeOid);
                        if (ontClassPos != BUN_NONE){
                                foundOntologyTypeValue = 1;
                                depth = ontclassSet[ontClassPos].hierDepth;
@@ -1618,7 +1618,7 @@ void getTableName(CSlabel* label, CSset*
        
        //Add hierarchy information for ontology-based name
        if (nameFound){
-               ontClassPos = BUNfnd(BATmirror(ontmetaBat), &(label->name));
+               ontClassPos = BUNfnd(ontmetaBat, &(label->name));
                if ( ontClassPos != BUN_NONE){
                        label->hierarchy = getOntoHierarchy(label->name, 
&(label->hierarchyCount), ontmetadata, ontmetadataCount);
                }
@@ -1921,7 +1921,7 @@ void createOntoUsageTree(OntoUsageNode**
                if (uri == BUN_NONE) continue;  //No name freqCS
        
                //Check if the name is ontology name    
-               pos = BUNfnd(BATmirror(ontmetaBat), &uri);
+               pos = BUNfnd(ontmetaBat, &uri);
                if (pos == BUN_NONE) continue; // no ontology information, 
ignore
 
                // get ontology hierarchy
diff --git a/monetdb5/extras/rdf/rdfontologyload.c 
b/monetdb5/extras/rdf/rdfontologyload.c
--- a/monetdb5/extras/rdf/rdfontologyload.c
+++ b/monetdb5/extras/rdf/rdfontologyload.c
@@ -287,7 +287,7 @@ str buildOntologyClassesInfo(oid **ontme
        
        ontmetaBat = BATnew(TYPE_void, TYPE_oid, ontmetadataCount, TRANSIENT);
        BATseqbase(ontmetaBat, 0);
-       (void)BATprepareHash(BATmirror(ontmetaBat));
+       (void)BATprepareHash(ontmetaBat);
        if (!(ontmetaBat->T->hash)){
                throw(RDF, "buildOntologyClassesInfo", "Cannot allocate the 
hash for Bat");
        }
@@ -300,7 +300,7 @@ str buildOntologyClassesInfo(oid **ontme
                classOid = ontmetadat[0][i];
                assert(classOid != BUN_NONE); 
 
-               tmpBun = BUNfnd(BATmirror(ontmetaBat),&classOid);
+               tmpBun = BUNfnd(ontmetaBat,&classOid);
                if (tmpBun == BUN_NONE){        //If it is a new class
                        if (BUNappend(ontmetaBat,&classOid, TRUE) == NULL)    
                                throw(RDF, "buildOntologyClassesInfo", "Cannot 
insert to ontmetaBat");
@@ -321,7 +321,7 @@ str buildOntologyClassesInfo(oid **ontme
                scOid = ontmetadat[1][i];
 
                if (scOid != BUN_NONE){ //The superClass oid is there
-                       tmpBun = BUNfnd(BATmirror(ontmetaBat),&scOid);  
+                       tmpBun = BUNfnd(ontmetaBat,&scOid);     
                        if (tmpBun == BUN_NONE){        //If it is a new class
                                if (BUNappend(ontmetaBat, &scOid, TRUE) == 
NULL)    
                                        throw(RDF, "buildOntologyClassesInfo", 
"Cannot insert to ontmetaBat");
@@ -381,14 +381,14 @@ str buildOntologyClassesInfo(oid **ontme
                //Get index
                classOid = ontmetadat[0][i];
                scOid = ontmetadat[1][i];
-               tmpBun = BUNfnd(BATmirror(ontmetaBat), &classOid);
+               tmpBun = BUNfnd(ontmetaBat, &classOid);
                assert(tmpBun != BUN_NONE);
 
                classIdx = (int) (tmpBun); 
 
                if (scOid == BUN_NONE) continue; 
                else{
-                       tmpBun = BUNfnd(BATmirror(ontmetaBat), &scOid);
+                       tmpBun = BUNfnd(ontmetaBat, &scOid);
                        assert(tmpBun != BUN_NONE);
                        scIdx = (int) (tmpBun); 
 
@@ -419,7 +419,7 @@ str buildOntologyClassesInfo(oid **ontme
                classOid = ontattributes[0][i];
                if (classOid != curClassOid){
 
-                       tmpBun = BUNfnd(BATmirror(ontmetaBat), &curClassOid);
+                       tmpBun = BUNfnd(ontmetaBat, &curClassOid);
                        assert(tmpBun != BUN_NONE); 
                        classIdx = (int) (tmpBun);
                        tmpontclassSet[classIdx].lstProp = 
(oid*)malloc(sizeof(oid) * tmpNumProp);
@@ -440,7 +440,7 @@ str buildOntologyClassesInfo(oid **ontme
        }
        
        //Last one
-       tmpBun = BUNfnd(BATmirror(ontmetaBat), &curClassOid);
+       tmpBun = BUNfnd(ontmetaBat, &curClassOid);
        assert(tmpBun != BUN_NONE); 
        classIdx = (int) (tmpBun);
        tmpontclassSet[classIdx].lstProp = (oid*)malloc(sizeof(oid) * 
tmpNumProp);
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
@@ -171,7 +171,7 @@ str printTKNZStringFromOid(oid id){
 static 
 char isOntologyName(oid valueOid, BUN *ontClassPos){
        *ontClassPos = BUN_NONE; 
-       *ontClassPos = BUNfnd(BATmirror(ontmetaBat), &valueOid);
+       *ontClassPos = BUNfnd(ontmetaBat, &valueOid);
        if (*ontClassPos == BUN_NONE) return 0; 
        else return 1; 
 }
@@ -2089,7 +2089,7 @@ int getOntologyIndex(BAT *ontbat, oid pr
                ontpart = substring((char*)propStr, 1, ontlen); 
 
                //Check whether ontpart appear in the ontBat
-               bunOnt = BUNfnd(BATmirror(ontbat),(ptr) (str)ontpart);  
+               bunOnt = BUNfnd(ontbat,(ptr) (str)ontpart);     
                if (bunOnt == BUN_NONE){
                        //printf("Non-ontology string: %s \n",propStr);
                        GDKfree(ontpart);
@@ -2698,11 +2698,11 @@ void testBatHash(void){
                
        for (i = 0; i < 7; i++){
                csKey = key[i]; 
-               bun = BUNfnd(BATmirror(testBat),(ptr) &key[i]);
+               bun = BUNfnd(testBat,(ptr) &key[i]);
                if (bun == BUN_NONE) {
                        if (testBat->T->hash && BATcount(testBat) > 4 * 
testBat->T->hash->mask) {
                                HASHdestroy(testBat);
-                               BAThash(BATmirror(testBat), 
2*BATcount(testBat));
+                               BAThash(testBat, 2*BATcount(testBat));
                        }
 
                        testBat = BUNappend(testBat, (ptr) &csKey, TRUE);
@@ -2736,11 +2736,11 @@ void addaProp(PropStat* propStat, oid pr
        int* _tmp4; 
        
        p = prop; 
-       bun = BUNfnd(BATmirror(propStat->pBat),(ptr) &prop);
+       bun = BUNfnd(propStat->pBat,(ptr) &prop);
        if (bun == BUN_NONE) {  /* New Prop */
               if (propStat->pBat->T->hash && BATcount(propStat->pBat) > 4 * 
propStat->pBat->T->hash->mask) {
                        HASHdestroy(propStat->pBat);
-                       BAThash(BATmirror(propStat->pBat), 
2*BATcount(propStat->pBat));
+                       BAThash(propStat->pBat, 2*BATcount(propStat->pBat));
                }
 
                propStat->pBat = BUNappend(propStat->pBat,&p, TRUE);
@@ -2830,7 +2830,7 @@ void addNewCS(CSBats *csBats, PropStat* 
        
        if (csBats->hsKeyBat->T->hash && BATcount(csBats->hsKeyBat) > 4 * 
csBats->hsKeyBat->T->hash->mask) {
                HASHdestroy(csBats->hsKeyBat);
-               BAThash(BATmirror(csBats->hsKeyBat), 
2*BATcount(csBats->hsKeyBat));
+               BAThash(csBats->hsKeyBat, 2*BATcount(csBats->hsKeyBat));
        }
 
        csBats->hsKeyBat = BUNappend(csBats->hsKeyBat, csKey, TRUE);
@@ -2892,7 +2892,7 @@ oid putaCStoHash(CSBats *csBats, oid* ke
        (void) numOnt;
 
        csKey = RDF_hash_oidlist(key, num, numTypeValues, 
rdftypeOntologyValues);
-       bun = BUNfnd(BATmirror(csBats->hsKeyBat),(ptr) &csKey);
+       bun = BUNfnd(csBats->hsKeyBat,(ptr) &csKey);
        if (bun == BUN_NONE) {
                csId = *csoid; 
                addNewCS(csBats, fullPropStat, &csKey, key, csoid, num, 
numTriples, numTypeValues, rdftypeOntologyValues);
@@ -3418,7 +3418,7 @@ PropStat* initPropStat(void){
                return NULL; 
        }
 
-       (void)BATprepareHash(BATmirror(propStat->pBat));
+       (void)BATprepareHash(propStat->pBat);
        if (!(propStat->pBat->T->hash)){
                return NULL;
        }
@@ -3652,7 +3652,7 @@ void generatecsRelSum(CSrel csRel, int f
                    && freqOfReferredCS < csRel.lstCnt[i] * 
MIN_TO_PERCETAGE_S5){                       
                        
                        p = csRel.lstPropId[i]; 
-                       bun = BUNfnd(BATmirror(propStat->pBat),(ptr) &p);
+                       bun = BUNfnd(propStat->pBat,(ptr) &p);
                        assert(bun != BUN_NONE);
                        //printf("Prop " BUNFMT "Prop TFIDF score in S5 is %f 
\n",p, propStat->tfidfs[bun]); 
                        if (propStat->tfidfs[bun] > MIN_TFIDF_PROP_S5){
@@ -3691,7 +3691,7 @@ LabelStat* initLabelStat(void){
        if (labelStat->labelBat == NULL){
                return NULL; 
        }
-       (void)BATprepareHash(BATmirror(labelStat->labelBat));
+       (void)BATprepareHash(labelStat->labelBat);
        if (!(labelStat->labelBat->T->hash)) 
                return NULL; 
        labelStat->lstCount = (int*)malloc(sizeof(int) * INIT_DISTINCT_LABEL);
@@ -3757,12 +3757,12 @@ void buildLabelStatForTable(LabelStat *l
        for (i = 0; i  < numTables; i++){
                if ( cstablestat->lstcstable[i].tblname != BUN_NONE){
                        name = cstablestat->lstcstable[i].tblname;
-                       bun = BUNfnd(BATmirror(labelStat->labelBat),(ptr) 
&name);
+                       bun = BUNfnd(labelStat->labelBat,(ptr) &name);
                        if (bun == BUN_NONE) {
                                //New string
                                if (labelStat->labelBat->T->hash && 
BATcount(labelStat->labelBat) > 4 * labelStat->labelBat->T->hash->mask) {
                                        HASHdestroy(labelStat->labelBat);
-                                       BAThash(BATmirror(labelStat->labelBat), 
2*BATcount(labelStat->labelBat));
+                                       BAThash(labelStat->labelBat, 
2*BATcount(labelStat->labelBat));
                                }
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to