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

fix URI shortening
handle cases <URI>, <URI/>, URI/ in addition to the known case <URI>/


diffs (35 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
@@ -302,12 +302,27 @@ IncidentFKs* initLinks(int csCount) {
 }
 
 /* Modifies the parameter! */
-/* from:   <URI>/   to:   URI */
+/* from:   <URI>/ or <URI>   to:   URI */
 static
 void removeBrackets(char** s) {
-       if (strlen(*s) < 3) return;
-       (*s)[strlen(*s) - 2] = '\0';
-       (*s) += 1;
+       if (strlen(*s) < 2) return;
+
+       if ((*s)[0] == '<' && (*s)[strlen(*s) - 2] == '>' && (*s)[strlen(*s) - 
1] == '/') {
+               // case <URI>/
+               (*s)[strlen(*s) - 2] = '\0';
+               (*s) += 1;
+       } else if ((*s)[0] == '<' && (*s)[strlen(*s) - 2] == '/' && 
(*s)[strlen(*s) - 1] == '>') {
+               // case <URI/>
+               (*s)[strlen(*s) - 2] = '\0';
+               (*s) += 1;
+       } else if ((*s)[0] == '<' && (*s)[strlen(*s) - 1] == '>') {
+               // case <URI>
+               (*s)[strlen(*s) - 1] = '\0';
+               (*s) += 1;
+       } else if ((*s)[strlen(*s) - 1] == '/') {
+               // case URI/
+               (*s)[strlen(*s) - 1] = '\0';
+       }
 }
 
 /* Modifies the parameter! */
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to