Changeset: 07e27feeb14c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=07e27feeb14c
Modified Files:
monetdb5/extras/rdf/rdfschema.c
monetdb5/extras/rdf/rdfschema.h
Branch: rdf
Log Message:
Remove dirty data for FK.
diffs (101 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
@@ -618,6 +618,9 @@ void initCSPropTypes(CSPropTypes* csProp
csPropTypes[id].lstPropTypes[j].isMVProp = 0;
csPropTypes[id].lstPropTypes[j].numMvTypes = 0;
csPropTypes[id].lstPropTypes[j].defColIdx = -1;
+ csPropTypes[id].lstPropTypes[j].isFKProp = 0;
+ csPropTypes[id].lstPropTypes[j].refTblId = -1;
+ csPropTypes[id].lstPropTypes[j].isDirtyFKProp =
0;
csPropTypes[id].lstPropTypes[j].lstTypes =
(char*)GDKmalloc(sizeof(char) * csPropTypes[id].lstPropTypes[j].numType);
csPropTypes[id].lstPropTypes[j].lstFreq =
(int*)GDKmalloc(sizeof(int) * csPropTypes[id].lstPropTypes[j].numType);
csPropTypes[id].lstPropTypes[j].lstFreqWithMV =
(int*)GDKmalloc(sizeof(int) * csPropTypes[id].lstPropTypes[j].numType);
@@ -5244,13 +5247,22 @@ CSrel* getFKBetweenTableSet(CSrel *csrel
// else, all instances of that prop must refer to the
certain table
if (freqCSset->items[i].coverage > MINIMUM_TABLE_SIZE){
if
(csPropTypes[from].lstPropTypes[propIdx].propCover * MIN_FK_PROPCOVERAGE >
rel.lstCnt[j]) continue;
+ else
+
csPropTypes[from].lstPropTypes[propIdx].isDirtyFKProp = 1;
}
else{
if
(csPropTypes[from].lstPropTypes[propIdx].propCover != rel.lstCnt[j]) continue;
+ else
+
csPropTypes[from].lstPropTypes[propIdx].isDirtyFKProp = 0;
}
assert(to < numTables);
addReltoCSRelWithFreq(from, to, rel.lstPropId[j],
rel.lstCnt[j], rel.lstBlankCnt[j], &refinedCsRel[from]);
+
+ //Add rel info to csPropTypes
+ csPropTypes[from].lstPropTypes[propIdx].isFKProp = 1;
+ csPropTypes[from].lstPropTypes[propIdx].refTblId = to;
+
}
}
return refinedCsRel;
@@ -5835,6 +5847,16 @@ void getTblIdxFromS(oid Soid, int *tbidx
*tbidx = *tbidx - 1;
+ //return freqCSid;
+}
+
+/* This function should be the same as getTblIdxFromS */
+static
+void getTblIdxFromO(oid Ooid, int *tbidx){
+
+ *tbidx = (int) ((Ooid >> (sizeof(BUN)*8 - NBITS_FOR_CSID)) & ((1 <<
(NBITS_FOR_CSID-1)) - 1)) ;
+
+ *tbidx = *tbidx - 1;
//return freqCSid;
}
@@ -6305,6 +6327,7 @@ str RDFdistTriplesToCSs(int *ret, bat *s
oid *pbt, *sbt, *obt;
oid lastP, lastS;
int tblIdx = -1;
+ int tmpOidTblIdx = -1;
oid tmpSoid = BUN_NONE;
BUN ppos;
int* tmpTblIdxPropIdxMap; //For each property, this maps the
table Idx (in the posting list
@@ -6433,6 +6456,26 @@ str RDFdistTriplesToCSs(int *ret, bat *s
continue;
}
+ if
(csPropTypes[tblIdx].lstPropTypes[tmpPropIdx].isDirtyFKProp){ //Check
whether this URI have a reference
+ if (objType != URI){ //Must be a dirty one --> put to
pso
+ //printf("Dirty FK at tbl %d | propId " BUNFMT
" \n", tblIdx, *pbt);
+ BUNappend(cstablestat->pbat,pbt , TRUE);
+ BUNappend(cstablestat->sbat,sbt , TRUE);
+ BUNappend(cstablestat->obat,obt , TRUE);
+ continue;
+ }
+ else{ //
+ getTblIdxFromO(*obt,&tmpOidTblIdx);
+ if (tmpOidTblIdx !=
csPropTypes[tblIdx].lstPropTypes[tmpPropIdx].refTblId){
+ //printf("Dirty FK at tbl %d | propId "
BUNFMT " \n", tblIdx, *pbt);
+ BUNappend(cstablestat->pbat,pbt , TRUE);
+ BUNappend(cstablestat->sbat,sbt , TRUE);
+ BUNappend(cstablestat->obat,obt , TRUE);
+ continue;
+ }
+ }
+ }
+
//printf(" Tbl: %d | Col: %d \n", tblIdx, tmpColIdx);
if (isSetLasttblIdx == 0){
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
@@ -325,6 +325,9 @@ typedef struct PropTypes{
char defaultType;
char isMVProp; /* = 1 if this prop is a multi-valued prop*/
char numMvTypes; /* Number of extype BAT for this MV col */
+ char isFKProp;
+ int refTblId; /* refTblId != -1 only when isFKProp = 1 */
+ char isDirtyFKProp; /* = 1 if not all instances of this prop points
to refTblId*/
} PropTypes;
typedef struct CSPropTypes {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list