- printf("\t\t<h:refObj rdf:parseType=\"Resource\">");
- printf("\n\t\t\t\t<h:position rdf:resource=\"&hns;MainHypothesis\"/>");
- printf("\n\t\t\t\t<h:depth>%d</h:depth>",curr->val);
- printf("\n\t\t\t\t<h:occurrence><h:Object rdf:about=\"%s\"/></h:occurrence>",uri);
- printf("\n\t\t</h:refObj>\n");
+ size_t len = strlen(about) + 1;
+ char *qabout = malloc (sizeof(char) * len * 2);
+ char *quri;
+ PQescapeString(qabout,about,len);
+ len = strlen(uri) + 1;
+ quri = malloc (sizeof(char) * len * 2);
+ PQescapeString(quri,uri,len);
+ sprintf(command,"INSERT INTO refObj values ('%s', '%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainHypothesis', %d)",qabout,quri,curr->val);
+ /* fprintf(stderr, "%s\n", command); */
+ res = PQexec(conn, command);
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
+ {
+ fprintf(stderr, "BEGIN command failed\n");
+ PQclear(res);
+ exit_nicely(conn);
+ }