Could you try removing the "rdf:type" or putting them last?
It might be calculating a 3-ways cross product of the database.
Andy
On 02/05/11 08:45, Christoph Höger wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
I am running the following query
prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix modelica:<http://modelica.org#>
select distinct ?a ?b ?c
where {
?a rdf:type modelica:Port .
?b rdf:type modelica:Port .
?c rdf:type modelica:Port .
?a modelica:connect ?b .
?b modelica:connect ?a .
?b modelica:connect ?c .
?c modelica:connect ?b .
filter not exists {
?a modelica:connect ?c .
}
filter not exists {
?c modelica:connect ?a .
}
FILTER(?a != ?b&& ?a != ?c)
FILTER(?b != ?c)
}
against 500 triples in a in-memory model. I get the expected 200 results
but it takes> 60s to do so. I know that this query is not trivial but 60s?
The test data basically looks like this (repeated 50 times with distinct
names):
modelica:a rdf:type modelica:Port
modelica:b rdf:type modelica:Port
modelica:c rdf:type modelica:Port
modelica:d rdf:type modelica:Port
modelica:a modelica:connect modelica:b
modelica:b modelica:connect modelica:a
modelica:b modelica:connect modelica:c
modelica:c modelica:connect modelica:b
modelica:c modelica:connect modelica:d
modelica:d modelica:connect modelica:c
Can anyone point out what I am doing wrong here or could do better?