Am 21.10.2011 21:22, schrieb Andy Seaborne:
On 21/10/11 10:24, Thorben Wallmeyer wrote:
Hi all,


I've got a simple problem and looking forward to a "good" solution.
Hopefully someone can give me a useful hint... ;-)

I've got two TDB backed models both containing several named graphs: A
and B

You mean 2 TDB datasets?


All I want to do now is querying the "union" of A and B for statements
with SPARQL or just by calling listStatements(). Can you tell me
(perhaps by sending a short piece of code) how to do it the best way?

My current solution is doing it this way (pseudo code):

- build union A' of all named graphs within A
- build union B' of all named graphs within B
- build union AB of A' and B'
- query resulting graph/model AB (its a OntModel that calculates the
transitive closure)

Also this algorithm should work I think it is not very fast. Therefore
I'm very interested in better solutions/approaches.

Because the data is in two datasets there is not very much you can do. The data is in two different places so has to (at the bottom level) accessed twice, and RDF semantics maintained (set of triples).

Your pseudo code looks OK. Only if there is a way to exploit some extra knowledge might there be a faster way.

    Andy

Hi Andy,

thanks for your response. Yes, I do mean two TDB datasets. So my original idea is not that bad...

But what do you mean by "extra knowledge" that could be exploited? Maybe that's a way I haven't thought of yet...

Best,

Thorben


Reply via email to