Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Inferred Triples

$
0
0
I'm working with a medium sized dataset of around 8 million triples, and
I'm using fuseki to query it via an inference model (either RDFS or OWL
micro). This works, but I'm looking to boost performance by pre-computing
the inferences, storing them in a named graph and using
tdb:unionDefaultGraph to merge them at run time. I'll then have the
option of recomputing the inferences from scratch whenever the schema
changes; The code below takes under 2 minutes to run which is ok for my
use case provided I don't have to do it every time I restart the server.

I'm therefore looking for a way to take a reasoner and extract just the
new inferences from the resulting InfModel.

Code:

// Assume tdbModel loaded from TDB
Model schema = ModelFactory.createDefaultModel();
schema.read("schema.ttl", "TURTLE");
Model unionModel = ModelFactory.createUnion(tdbModel, schema);
OntModel ont =
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
ont.add(unionModel);
//ont.write(System.out, "TURTLE");
ont.writeAll(System.out, "TURTLE");
System.out.println("ont triples: " + ont.size());

I suppose I could write out the entire model + inferences, but that can
take a while. The Jena API must know which triples are inferred in order
for ont.write() to behave differently from ont.writeAll(), but I can't see
how to filter them out from the information in the Javadocs.

Thanks,
Steve.

Viewing all articles
Browse latest Browse all 5648

Trending Articles