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

Choose an ontology-based type value for the name if there is one.

This tried to fix the problem when several type-property such as rdf:type, 
dbp:type provide candidates for table name.
The former solution choose the one that does not occur frequently in other 
CS's. But, we now will choose the one that comes from ontology class


diffs (66 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
@@ -2086,15 +2086,18 @@ void getTableName(CSlabel* label, int cs
        oid             typeOid;
        int             depth, maxDepth;
        int             freq;
+       
+       char            foundOntologyTypeValue = 0;     
+       oid             choosenOntologyTypeValue = BUN_NONE;
+
        (void) ontmetaBat;
-
-
        // --- TYPE ---
        // get most frequent type value per type attribute
        tmpList = NULL;
        tmpListCount = 0;
 
        for (i = 0; i < typeAttributesCount; ++i) {
+               foundOntologyTypeValue = 0;
                if (typeAttributesHistogramCount[csIdx][i] == 0) continue;
                /*   //TODO: Uncomment this path
                for (j = 0; j < typeAttributesHistogramCount[csIdx][i]; j++){
@@ -2140,6 +2143,7 @@ void getTableName(CSlabel* label, int cs
                        typeOid = typeAttributesHistogram[csIdx][i][j].value;
                        ontClassPos = BUNfnd(BATmirror(ontmetaBat), &typeOid);
                        if (ontClassPos != BUN_NONE){
+                               foundOntologyTypeValue = 1;
                                depth = ontclassSet[ontClassPos].hierDepth;
                                freq = 
typeAttributesHistogram[csIdx][i][j].freq;
 
@@ -2156,10 +2160,12 @@ void getTableName(CSlabel* label, int cs
                        }
                }
 
-               //
-
                tmpList[tmpListCount] = maxDepthOid;
                tmpListCount += 1;
+
+               if (foundOntologyTypeValue){
+                       choosenOntologyTypeValue = maxDepthOid;
+               }
        }
 
        // add all most frequent type values to list of candidates
@@ -2193,6 +2199,18 @@ void getTableName(CSlabel* label, int cs
                }
        }
 
+       //If there is any ontology-based type value, use it for the name
+       if (!nameFound){
+               if (choosenOntologyTypeValue != BUN_NONE){
+                       label->name = choosenOntologyTypeValue;
+                       nameFound = 1;
+                       
+                       #if INFO_WHERE_NAME_FROM
+                       label->isType = 1; 
+                       #endif
+               }
+       }
+
        if (!nameFound) {
                // multiple type attributes --> use the one with fewest 
occurances in other CS's
                if (tmpListCount > 1) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to