X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fmetadata%2Fextractor%2Fsthandler.c;h=87e0d49c71e0833ec4d29afd8123fb5ef1aaff12;hb=4167cea65ca58897d1a3dbb81ff95de5074700cc;hp=6f87cdfb5448dd15e45c2dad08376803261639df;hpb=407c75f92f1a641dc49243209cd246f6affd924d;p=helm.git diff --git a/helm/metadata/extractor/sthandler.c b/helm/metadata/extractor/sthandler.c index 6f87cdfb5..87e0d49c7 100644 --- a/helm/metadata/extractor/sthandler.c +++ b/helm/metadata/extractor/sthandler.c @@ -247,6 +247,18 @@ void print_all(about,conn) } } +void print_name(char *name, char *uri) +{ + size_t len = strlen(uri) + 1; + char *quri = malloc (sizeof(char) * len * 2); + PQescapeString(quri,uri,len); + len = strlen(name) + 1; + char *qname = malloc (sizeof(char) * len * 2); + PQescapeString(qname,name,len); + printf("INSERT INTO objectName VALUES ('%s', '%s');\n",quri,qname); + free(quri); + free(qname); +} /****************************************************************/ /* 5. Definitions of functions local to the module. */ @@ -290,6 +302,7 @@ void print_mainhyp(about,uri,l) char *qabout = malloc (sizeof(char) * len * 2); PQescapeString(qabout,about,len); printf("INSERT INTO refRel VALUES ('%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainHypothesis', %d);\n",qabout,curr->val); + free(qabout); curr = curr->next; } } @@ -303,6 +316,7 @@ void print_mainhyp(about,uri,l) char *qabout = malloc (sizeof(char) * len * 2); PQescapeString(qabout,about,len); printf("INSERT INTO refSort VALUES ('%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainHypothesis', %d, '%s');\n",qabout,curr->val,uri); + free(qabout); curr = curr->next; } } @@ -319,6 +333,8 @@ void print_mainhyp(about,uri,l) quri = malloc (sizeof(char) * len * 2); PQescapeString(quri,uri,len); printf("INSERT INTO refObj VALUES ('%s', '%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainHypothesis', %d);\n",qabout,quri,curr->val); + free(qabout); + free(quri); curr = curr->next; } } @@ -337,6 +353,7 @@ void print_mainconcl(about,uri,depth) char *qabout = malloc (sizeof(char) * len * 2); PQescapeString(qabout,about,len); printf("INSERT INTO refRel VALUES ('%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainConclusion', %d);\n",qabout,depth); + free(qabout); } else if ((!strcmp(uri,"Prop")) || (!strcmp(uri,"Type")) || (!strcmp(uri,"Set"))) @@ -345,6 +362,7 @@ void print_mainconcl(about,uri,depth) char *qabout = malloc (sizeof(char) * len * 2); PQescapeString(qabout,about,len); printf("INSERT INTO refSort VALUES ('%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainConclusion', %d, '%s');\n",qabout,depth,uri); + free(qabout); } else { @@ -356,6 +374,8 @@ void print_mainconcl(about,uri,depth) quri = malloc (sizeof(char) * len * 2); PQescapeString(quri,uri,len); printf("INSERT INTO refObj VALUES ('%s', '%s','http://www.cs.unibo.it/helm/schemas/schema-helm#MainConclusion', %d);\n",qabout,quri,depth); + free(qabout); + free(quri); } } @@ -385,6 +405,8 @@ void print_one(about,uri,pos) position="MainConclusion"; /* This should never happen */ printf("INSERT INTO refObj VALUES ('%s', '%s', \ 'http://www.cs.unibo.it/helm/schemas/schema-helm#%s', NULL);\n",qabout,quri,position); + free(qabout); + free(quri); } /* The following function allocates a bucket for an identifier. */