Hi,

I have performance issues with certain types of SPARQL queries over Jena model. 
Things get slow when I try to query patterns with multiple relations between 
resources, for example:

DESCRIBE ?var1 ?var2 ?var3 WHERE {
        ?var1 NS:type 'X' .
        ?var2 NS:type 'Y' .
        ?var3 NS:type 'Z' .
        ?var1 NS:dependency ?var2 .
        ?var2 NS:dependency ?var3
}

or even just:

DESCRIBE ?var1 ?var2 ?var3 WHERE {
        ?var1 NS:type 'X' .
        ?var2 NS:type 'Y' .
        ?var3 NS:type 'Z' .
}

These take longer to complete than I care to wait (over an hour at least) while 
similar query will complete in seconds, e.g.

DESCRIBE ?var1 ?var2 WHERE {
        ?var1 NS:type 'X' .
        ?var2 NS:type 'Y' .
        ?var1 NS:dependency ?var2 .
}

I'm doing the queries over single inferred in memory model, which has around 
half a million triplets. Written as RDF/XML it takes around 5 MB on disk. I run 
the queries on desktop with 4 GB of RAM and Core 2 Quad @ 2.66GHz.  Am I 
missing something with the computational complexity of the first two queries? 
What makes the second and third query so different?

Regards,

Matti Jauhiainen

Reply via email to