- filename = malloc((sizeof('a')*2000));
- file_uri = malloc((sizeof('a')*2000));
- inductive_uri = malloc((sizeof('a')*2000));
- filename_prefix=argv[1];
- file_uri_prefix=argv[2];
- /* fprintf(stderr,"qua"); */
- yyin = fopen("tmp/inductive_type.xml", "r");
- yylex();
-}
-
-print_file()
-{
- FILE *out, *outrel, *outsort;
-
- if (!(out = fopen(filename,"w")))
- {
- fprintf(stderr, "error in openinf file %s\n", filename);
- exit(-1);
- }
- if (!(outrel = fopen("forward_rel.rdf","a")))
- {
- fprintf(stderr, "error in openinf file forward_rel.rdf\n");
- exit(-1);
- }
- if (!(outsort = fopen("forward_sort.rdf","a")))
- {
- fprintf(stderr, "error in openinf file forward_rel.rdf\n");
- exit(-1);
- }
-
- // We process the type
-
- fprintf(out,"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n");
-fprintf(out,"<!DOCTYPE rdf:RDF [
- <!ENTITY rdfns 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
- <!ENTITY hthns 'http://www.cs.unibo.it/helm/schemas/schema-helmth#'>
- <!ENTITY hns 'http://www.cs.unibo.it/helm/schemas/schema-helm#'>
-
- ]>\n");
- fprintf(out,"<rdf:RDF xml:lang=\"en\" xmlns:rdf=\"&rdfns;\" xmlns:h=\"&hns;\" xmlns:hth=\"&hthns;\">\n");
- fprintf(out,"\t<h:Object rdf:about=\"");
- fprintf(out,"%s",file_uri);
- fprintf(out,"\">\n");
- print_all(file_uri,out,outrel,outsort);
- fprintf(out,"\t</h:Object>\n");
- fprintf(out,"</rdf:RDF>\n");
- fclose(out);
- fclose(outrel);
- fclose(outsort);
+ struct stat buf;
+
+ char *pghost,
+ *pgport,
+ *pgoptions,
+ *pgtty;
+ char *dbName;
+
+ /* FILE *debug; */
+
+ PGresult *res;
+
+ if (argc != 3)
+ {
+ fprintf(stderr, "Usage: meta_ind <object_uri> <inductive_type_file>\n");
+ exit(1);
+ }
+
+ /*
+ * begin, by setting the parameters for a backend connection if the
+ * parameters are null, then the system will try to use reasonable
+ * defaults by looking up environment variables or, failing that,
+ * using hardwired constants
+ */
+
+ /* make a connection to the database */
+ conn = PQconnectdb("user=helm dbname=mowgli");
+
+ /*
+ * check to see that the backend connection was successfully made
+ */
+ if (PQstatus(conn) == CONNECTION_BAD)
+ {
+ fprintf(stderr, "Connection to database '%s' failed.\n", dbName);
+ fprintf(stderr, "%s", PQerrorMessage(conn));
+ exit_nicely(conn);
+ }
+
+ /* debug = fopen("/tmp/trace.out","w"); */
+ /* PQtrace(conn, debug); */
+
+ source_uri = malloc((sizeof('a')*2000));
+ source_uri_prefix=argv[1];
+ /* fprintf(stderr,"qua"); */
+ yyin = fopen(argv[2], "r");
+ yylex();
+
+ return 0;