|
@@ -1,9 +1,7 @@
|
|
#include <time.h>
|
|
#include <time.h>
|
|
#include "lsup_rdf.h"
|
|
#include "lsup_rdf.h"
|
|
|
|
|
|
-#ifndef NT
|
|
|
|
#define NT 100000
|
|
#define NT 100000
|
|
-#endif
|
|
|
|
|
|
|
|
static LSUP_Triple *
|
|
static LSUP_Triple *
|
|
generate_triples(size_t nt)
|
|
generate_triples(size_t nt)
|
|
@@ -19,8 +17,8 @@ generate_triples(size_t nt)
|
|
sprintf(pstr, "urn:p:%lu", i % (nt / 1000));
|
|
sprintf(pstr, "urn:p:%lu", i % (nt / 1000));
|
|
sprintf(ostr, "urn:o:%lu", i);
|
|
sprintf(ostr, "urn:o:%lu", i);
|
|
LSUP_triple_init(
|
|
LSUP_triple_init(
|
|
- trp + i, LSUP_uri_new (sstr),
|
|
|
|
- LSUP_uri_new (pstr), LSUP_uri_new (ostr));
|
|
|
|
|
|
+ trp + i, LSUP_iriref_new (sstr, NULL),
|
|
|
|
+ LSUP_iriref_new (pstr, NULL), LSUP_iriref_new (ostr, NULL));
|
|
}
|
|
}
|
|
LSUP_triple_init (trp + nt, NULL, NULL, NULL);
|
|
LSUP_triple_init (trp + nt, NULL, NULL, NULL);
|
|
log_info ("Triples generated.");
|
|
log_info ("Triples generated.");
|
|
@@ -37,7 +35,10 @@ int main(int argc, char *argv[])
|
|
// 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"));
|
|
|
|
|
|
- if (LSUP_init() != LSUP_OK) abort();
|
|
|
|
|
|
+ if (LSUP_init() != LSUP_OK) {
|
|
|
|
+ log_fatal ("Failed to initialize LSUP environment.");
|
|
|
|
+ exit (-1);
|
|
|
|
+ }
|
|
|
|
|
|
int rc;
|
|
int rc;
|
|
clock_t start, tc1, tc2, end;
|
|
clock_t start, tc1, tc2, end;
|
|
@@ -52,14 +53,15 @@ int main(int argc, char *argv[])
|
|
log_info ("Time elapsed: %lf s", wallclock);
|
|
log_info ("Time elapsed: %lf s", wallclock);
|
|
|
|
|
|
log_info ("Inserting triples.");
|
|
log_info ("Inserting triples.");
|
|
- LSUP_Graph *gr = LSUP_graph_new (LSUP_STORE_MDB);
|
|
|
|
|
|
+ LSUP_Graph *gr = LSUP_graph_new (
|
|
|
|
+ LSUP_iriref_new (NULL, NULL), LSUP_STORE_MDB);
|
|
if (!gr) {
|
|
if (!gr) {
|
|
log_error ("Error creating graph!");
|
|
log_error ("Error creating graph!");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
size_t ct;
|
|
size_t ct;
|
|
- rc = LSUP_graph_add_trp(gr, trp, &ct);
|
|
|
|
|
|
+ rc = LSUP_graph_add(gr, trp, &ct);
|
|
if (rc != LSUP_OK) log_warn ("Graph loading interrupted: %d.", rc);
|
|
if (rc != LSUP_OK) log_warn ("Graph loading interrupted: %d.", rc);
|
|
else log_info ("Graph populated with %lu triples.", ct);
|
|
else log_info ("Graph populated with %lu triples.", ct);
|
|
|
|
|
|
@@ -78,9 +80,9 @@ int main(int argc, char *argv[])
|
|
log_info ("Lookup...");
|
|
log_info ("Lookup...");
|
|
ct = 0;
|
|
ct = 0;
|
|
LSUP_Triple *spo = TRP_DUMMY;
|
|
LSUP_Triple *spo = TRP_DUMMY;
|
|
- LSUP_Term *s = LSUP_uri_new ("urn:s:8");
|
|
|
|
- LSUP_Term *p = LSUP_uri_new ("urn:p:0");
|
|
|
|
- LSUP_Term *o = LSUP_uri_new ("urn:o:300");
|
|
|
|
|
|
+ LSUP_Term *s = LSUP_iriref_new ("urn:s:8", NULL);
|
|
|
|
+ LSUP_Term *p = LSUP_iriref_new ("urn:p:0", NULL);
|
|
|
|
+ LSUP_Term *o = LSUP_iriref_new ("urn:o:300", NULL);
|
|
LSUP_GraphIterator *it = LSUP_graph_lookup(gr, s, NULL, NULL, &ct);
|
|
LSUP_GraphIterator *it = LSUP_graph_lookup(gr, s, NULL, NULL, &ct);
|
|
log_info ("Found triples by count: %lu", ct);
|
|
log_info ("Found triples by count: %lu", ct);
|
|
ct = 0;
|
|
ct = 0;
|