Dear all,
I bother you again with more basic questions, we havent yet reached
experimenting with tdbloader.
I am having issues with performance of
the OWL reasoner with a LUBM size 1 and Im wondering if Im doing something
wrong.
I started with Lubm 100, and an extended LUBM schema, however, things were so
slow that
I downgraded to lubm 1 and the original lubm ontology, still things are slow.
Everything
is done in memory right now.
This is the code at the moment:
Model lubm1 =
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
lubm1.read("file:/Users/mariano/Documents/Archive/Work/projects/semantic-index/univ-bench-original.owl",
"RDF/XML");
lubm1.read("file:/Users/mariano/Documents/Archive/Work/projects/semantic-index/uba1.7/lubm1/university-data-1univ.nt",
"N-TRIPLE");
This is relatively fast, few seconds.
Then for each of the 14 original LUBM queries I'm doing
Query query = QueryFactory.create(queries[i]);
QueryExecution qexec = QueryExecutionFactory.create(query, lubm1);
try {
ResultSet results = qexec.execSelect();
log.info("Counting");
int rcount = 0;
while (results.hasNext()) {
QuerySolution soln = results.next();
rcount += 1;
}
log.info("Count: {}", rcount);
} finally {
qexec.close();
}
The first query looks like this:
PREFIX : <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?x WHERE { ?x a :GraduateStudent. ?x :takesCourse
<http://www.Department0.University0.edu/GraduateCourse0> .}
The results are fine. However, the time to compute them is slow. In particular,
returning from qexec.exectSelect is very fast (few millisecond)
but retrieving the count is very slow, even if its just a couple of rows. Am I
doing something wrong here?
I'm now thinking it might be actually better to store the model, complete with
inferences in TDB, and then querying. Would this be more efficient? If so,
would this code suffice?
String directory =
/Users/mariano/Documents/Archive/Work/projects/semantic-index/lubm/benchmarks/jena/tdb10";
Model database = TDBFactory.createModel(directory);
database.add(lubm1);
database.commit();
database.close();
Thank you in advance,
Best regards,
Mariano
Mariano Rodriguez Muro
http://www.inf.unibz.it/~rodriguez/
KRDB Research Center
Faculty of Computer Science
Free University of Bozen-Bolzano (FUB)
Piazza Domenicani 3,
I-39100 Bozen-Bolzano BZ, Italy
猴