Changeset: fb94f422a1f0 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fb94f422a1f0 Modified Files: monetdb5/extras/rdf/rdflabels.c Branch: rdf Log Message:
Fix use of short and long names in GraphViz export diffs (109 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 @@ -1664,6 +1664,7 @@ void printUML2(CSset *freqCSset, CSlabel for (i = 0; i < freqCSset->numCSadded; ++i) { int width; str labelStr; + str tmpStr; str labelStrEscaped = NULL; #if USE_SHORT_NAMES str labelStrShort = NULL; @@ -1682,7 +1683,8 @@ void printUML2(CSset *freqCSset, CSlabel if (!labelStrEscaped) fprintf(stderr, "ERROR: Couldn't malloc memory!\n"); strcpy(labelStrEscaped, "DUMMY"); } else { - takeOid(labels[i].name, &labelStr); + takeOid(labels[i].name, &tmpStr); + labelStr = removeBrackets(tmpStr); #if USE_SHORT_NAMES getPropNameShort(&labelStrShort, labelStr); labelStrEscaped = (str) GDKmalloc(sizeof(char) * (strlen(labelStrShort) + 1)); @@ -1707,19 +1709,13 @@ void printUML2(CSset *freqCSset, CSlabel str propStr; str tmpStr; char *propStrEscaped = NULL; +#if USE_SHORT_NAMES char *propStrShort = NULL; +#endif str color; takeOid(cs.lstProp[j], &tmpStr); - // copy propStr to propStrEscaped because .dot-PORTs cannot contain colons and quotes - propStr = removeBrackets(tmpStr); - propStrEscaped = (char *) malloc(sizeof(char) * (strlen(propStr) + 1)); - if (!propStrEscaped) fprintf(stderr, "ERROR: Couldn't malloc memory!\n"); - memcpy(propStrEscaped, propStr, (strlen(propStr) + 1)); - escapeURI(propStrEscaped); - getPropNameShort(&propStrShort, propStr); - // assign color (the more tuples the property occurs in, the darker if ((1.0 * cs.lstPropSupport[j])/cs.support > 0.8) { color = "#5555FF"; @@ -1732,10 +1728,22 @@ void printUML2(CSset *freqCSset, CSlabel } else { color = "#DDDDFF"; } + + // copy propStr to propStrEscaped because .dot-PORTs cannot contain colons and quotes + propStr = removeBrackets(tmpStr); + propStrEscaped = (char *) malloc(sizeof(char) * (strlen(propStr) + 1)); + if (!propStrEscaped) fprintf(stderr, "ERROR: Couldn't malloc memory!\n"); + memcpy(propStrEscaped, propStr, (strlen(propStr) + 1)); + escapeURI(propStrEscaped); +#if USE_SHORT_NAMES + getPropNameShort(&propStrShort, propStr); fprintf(fout, "<TR><TD BGCOLOR=\"%s\" PORT=\"%s\">%s (%d%%)</TD></TR>\n", color, propStrEscaped, propStrShort, (100 * cs.lstPropSupport[j])/cs.support); + GDKfree(propStrShort); +#else + fprintf(fout, "<TR><TD BGCOLOR=\"%s\" PORT=\"%s\">%s (%d%%)</TD></TR>\n", color, propStrEscaped, propStrEscaped, (100 * cs.lstPropSupport[j])/cs.support); +#endif GDKfree(propStr); - GDKfree(propStrShort); free(propStrEscaped); GDKfree(tmpStr); @@ -1752,6 +1760,9 @@ void printUML2(CSset *freqCSset, CSlabel str tmpStr; str propStr; char *propStrEscaped = NULL; +#if USE_SHORT_NAMES + char *propStrShort = NULL; +#endif takeOid(cs.lstProp[j], &tmpStr); @@ -1762,15 +1773,30 @@ void printUML2(CSset *freqCSset, CSlabel memcpy(propStrEscaped, propStr, (strlen(propStr) + 1)); escapeURI(propStrEscaped); +#if USE_SHORT_NAMES + getPropNameShort(&propStrShort, propStr); for (k = 0; k < relationMetadataCount[i][j]; ++k) { if (relationMetadata[i][j][k].percent >= FK_FREQ_THRESHOLD) { // target of links is frequent enough, not an outlier int from = relationMetadata[i][j][k].from; int to = relationMetadata[i][j][k].to; - fprintf(fout, "\""BUNFMT"\":\"%s\" -> \""BUNFMT"\" [label=\"%s\"];\n", freqCSset->items[from].csId, propStrEscaped, freqCSset->items[to].csId, propStr); // print foreign keys to dot file + fprintf(fout, "\""BUNFMT"\":\"%s\" -> \""BUNFMT"\" [label=\"%s\"];\n", freqCSset->items[from].csId, propStrEscaped, freqCSset->items[to].csId, propStrShort); // print foreign keys to dot file } } + GDKfree(propStrShort); +#else + for (k = 0; k < relationMetadataCount[i][j]; ++k) { + + if (relationMetadata[i][j][k].percent >= FK_FREQ_THRESHOLD) { + // target of links is frequent enough, not an outlier + int from = relationMetadata[i][j][k].from; + int to = relationMetadata[i][j][k].to; + fprintf(fout, "\""BUNFMT"\":\"%s\" -> \""BUNFMT"\" [label=\"%s\"];\n", freqCSset->items[from].csId, propStrEscaped, freqCSset->items[to].csId, propStrEscaped); // print foreign keys to dot file + } + } +#endif + GDKfree(propStr); free(propStrEscaped); GDKfree(tmpStr); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list