|
@@ -23,7 +23,7 @@ generate_triples()
|
|
LSUP_uri_new (pstr), LSUP_uri_new (ostr));
|
|
LSUP_uri_new (pstr), LSUP_uri_new (ostr));
|
|
}
|
|
}
|
|
LSUP_triple_init (trp + NT, NULL, NULL, NULL);
|
|
LSUP_triple_init (trp + NT, NULL, NULL, NULL);
|
|
- TRACE(STR, "Triples generated.");
|
|
|
|
|
|
+ log_info ("Triples generated.");
|
|
|
|
|
|
return trp;
|
|
return trp;
|
|
}
|
|
}
|
|
@@ -33,8 +33,8 @@ insert_triples (LSUP_Graph *gr, LSUP_Triple *trp)
|
|
{
|
|
{
|
|
size_t ct;
|
|
size_t ct;
|
|
LSUP_rc rc = LSUP_graph_add_trp(gr, trp, &ct);
|
|
LSUP_rc rc = LSUP_graph_add_trp(gr, trp, &ct);
|
|
- if (rc != LSUP_OK) printf ("Graph loading interrupted: %d.\n", rc);
|
|
|
|
- else printf ("Graph populated with %lu triples.\n", ct);
|
|
|
|
|
|
+ if (rc != LSUP_OK) log_warn ("Graph loading interrupted: %d.", rc);
|
|
|
|
+ else log_info ("Graph populated with %lu triples.", ct);
|
|
|
|
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
@@ -46,22 +46,23 @@ int main()
|
|
putenv ("LSUP_MDB_STORE_PATH=" TMPDIR "/lsup_profile_mdb");
|
|
putenv ("LSUP_MDB_STORE_PATH=" TMPDIR "/lsup_profile_mdb");
|
|
// Clear out database from previous test.
|
|
// Clear out database from previous test.
|
|
rm_r (getenv ("LSUP_MDB_STORE_PATH"));
|
|
rm_r (getenv ("LSUP_MDB_STORE_PATH"));
|
|
|
|
+ LSUP_init();
|
|
|
|
|
|
int rc;
|
|
int rc;
|
|
clock_t start, tc1, tc2, end;
|
|
clock_t start, tc1, tc2, end;
|
|
double wallclock, rate;
|
|
double wallclock, rate;
|
|
|
|
|
|
- printf ("Generating triples.\n");
|
|
|
|
|
|
+ log_info ("Generating triples.");
|
|
start = clock();
|
|
start = clock();
|
|
LSUP_Triple *trp = generate_triples();
|
|
LSUP_Triple *trp = generate_triples();
|
|
tc1 = clock();
|
|
tc1 = clock();
|
|
wallclock = (tc1 - start) / CLOCKS_PER_SEC;
|
|
wallclock = (tc1 - start) / CLOCKS_PER_SEC;
|
|
- printf("Time elapsed: %lf s\n", wallclock);
|
|
|
|
|
|
+ log_info ("Time elapsed: %lf s", wallclock);
|
|
|
|
|
|
- printf("Inserting triples.\n");
|
|
|
|
|
|
+ log_info ("Inserting triples.");
|
|
LSUP_Graph *gr = LSUP_graph_new (LSUP_STORE_MDB);
|
|
LSUP_Graph *gr = LSUP_graph_new (LSUP_STORE_MDB);
|
|
if (!gr) {
|
|
if (!gr) {
|
|
- fprintf (stderr, "Error creating graph!\n");
|
|
|
|
|
|
+ log_error ("Error creating graph!");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
rc = insert_triples (gr, trp);
|
|
rc = insert_triples (gr, trp);
|
|
@@ -75,10 +76,10 @@ int main()
|
|
|
|
|
|
tc2 = clock();
|
|
tc2 = clock();
|
|
wallclock = (tc2 - tc1) / CLOCKS_PER_SEC;
|
|
wallclock = (tc2 - tc1) / CLOCKS_PER_SEC;
|
|
- printf("Time elapsed: %lf s\n", wallclock);
|
|
|
|
- printf ("Graph size: %lu\n", LSUP_graph_size (gr));
|
|
|
|
|
|
+ log_info ("Time elapsed: %lf s", wallclock);
|
|
|
|
+ log_info ("Graph size: %lu", LSUP_graph_size (gr));
|
|
|
|
|
|
- printf("Lookup...\n");
|
|
|
|
|
|
+ log_info ("Lookup...");
|
|
size_t ct = 0;
|
|
size_t ct = 0;
|
|
LSUP_Triple *spo = TRP_DUMMY;
|
|
LSUP_Triple *spo = TRP_DUMMY;
|
|
LSUP_Term *s = LSUP_uri_new ("urn:s:0");
|
|
LSUP_Term *s = LSUP_uri_new ("urn:s:0");
|
|
@@ -87,16 +88,16 @@ int main()
|
|
LSUP_GraphIterator *it = LSUP_graph_lookup(gr, NULL, NULL, NULL, NULL);
|
|
LSUP_GraphIterator *it = LSUP_graph_lookup(gr, NULL, NULL, NULL, NULL);
|
|
while (LSUP_graph_iter_next (it, spo) != LSUP_END)
|
|
while (LSUP_graph_iter_next (it, spo) != LSUP_END)
|
|
ct ++;
|
|
ct ++;
|
|
- printf("Found triples per subject: %lu\n", ct);
|
|
|
|
|
|
+ log_info ("Found triples per subject: %lu", ct);
|
|
LSUP_graph_iter_free (it);
|
|
LSUP_graph_iter_free (it);
|
|
end = clock();
|
|
end = clock();
|
|
wallclock = (end - tc2) / CLOCKS_PER_SEC;
|
|
wallclock = (end - tc2) / CLOCKS_PER_SEC;
|
|
- printf("Time elapsed: %lf s\n", wallclock);
|
|
|
|
|
|
+ log_info ("Time elapsed: %lf s", wallclock);
|
|
|
|
|
|
wallclock = (end - start) / CLOCKS_PER_SEC;
|
|
wallclock = (end - start) / CLOCKS_PER_SEC;
|
|
rate = NT / wallclock;
|
|
rate = NT / wallclock;
|
|
- printf(
|
|
|
|
- "%d triples created and inserted in %lf s (%lf triples/s)\n",
|
|
|
|
|
|
+ log_info (
|
|
|
|
+ "%d triples created and inserted in %lf s (%lf triples/s)",
|
|
NT, wallclock, rate);
|
|
NT, wallclock, rate);
|
|
|
|
|
|
LSUP_term_free (s);
|
|
LSUP_term_free (s);
|