Changeset: 3967b6658444 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3967b6658444 Modified Files: monetdb5/extras/rdf/rdflabels.c Branch: rdf Log Message:
simplify computation of ontology-based label because of changed order of data sources when assigning labels diffs (94 lines): 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 @@ -2076,7 +2076,7 @@ void removeDuplicatedCandidates(CSlabel /* For one CS: Choose the best table name out of all collected candidates (ontology, type, fk). */ static void getTableName(CSlabel* label, int csIdx, int typeAttributesCount, TypeAttributesFreq*** typeAttributesHistogram, int** typeAttributesHistogramCount, TypeStat* typeStat, int typeStatCount, oid** result, int* resultCount, IncidentFKs* links, oid** ontmetadata, int ontmetadataCount, BAT *ontmetaBat, OntClass *ontclassSet) { - int i, j, k; + int i, j; oid *tmpList; int tmpListCount; char nameFound = 0; @@ -2243,9 +2243,8 @@ void getTableName(CSlabel* label, int cs label->candidatesCount += resultCount[csIdx]; } - // one ontology class --> use it - if (!nameFound){ - if (resultCount[csIdx] == 1) { + // chose first ontology candidate as label + if (!nameFound && resultCount[csIdx] >= 1){ label->name = result[csIdx][0]; label->hierarchy = getOntoHierarchy(label->name, &(label->hierarchyCount), ontmetadata, ontmetadataCount); nameFound = 1; @@ -2253,69 +2252,6 @@ void getTableName(CSlabel* label, int cs label->isOntology = 1; #endif } - } - - if (!nameFound) { - // multiple ontology classes --> intersect with types - if (resultCount[csIdx] > 1) { - tmpList = NULL; - tmpListCount = 0; - // search for type values - for (i = 0; i < typeAttributesCount; ++i) { - for (j = 0; j < typeAttributesHistogramCount[csIdx][i]; ++j) { - if (typeAttributesHistogram[csIdx][i][j].percent < TYPE_FREQ_THRESHOLD) break; // sorted - - // intersect type with ontology classes - for (k = 0; k < resultCount[csIdx]; ++k) { - if (result[csIdx][k] == typeAttributesHistogram[csIdx][i][j].value) { - // found, copy ontology class to tmpList - tmpList = (oid *) realloc(tmpList, sizeof(oid) * (tmpListCount + 1)); - if (!tmpList) fprintf(stderr, "ERROR: Couldn't realloc memory!\n"); - tmpList[tmpListCount] = result[csIdx][k]; - tmpListCount += 1; - } - } - } - } - - // only one left --> use it - if (tmpListCount == 1) { - label->name = tmpList[0]; - label->hierarchy = getOntoHierarchy(label->name, &(label->hierarchyCount), ontmetadata, ontmetadataCount); - free(tmpList); - nameFound = 1; - #if INFO_WHERE_NAME_FROM - label->isOntology = 1; - #endif - } - - if (!nameFound) { - // multiple left --> use the class that covers most attributes, most popular ontology, ... - if (tmpListCount > 1) { - label->name = tmpList[0]; // sorted - label->hierarchy = getOntoHierarchy(label->name, &(label->hierarchyCount), ontmetadata, ontmetadataCount); - free(tmpList); - nameFound = 1; - - #if INFO_WHERE_NAME_FROM - label->isOntology = 1; - #endif - } - } - - if (!nameFound) { - // empty intersection -> use the class that covers most attributes, most popular ontology, .. - label->name = result[csIdx][0]; // sorted - label->hierarchy = getOntoHierarchy(label->name, &(label->hierarchyCount), ontmetadata, ontmetadataCount); - free(tmpList); - nameFound = 1; - - #if INFO_WHERE_NAME_FROM - label->isOntology = 1; - #endif - } - } - } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list