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

Query hangs, a very long time

$
0
0
This is a fragment of an even larger query that might never complete in our lifetimes:

SELECT DISTINCT ?O ?T ?E
WHERE{
?E a x:E.
{ SELECT ?O ?T
WHERE {
?O :oE ?;
:oT ?T .
} ORDER BY DESC(?T)
LIMIT 3

Here’s what I want:

For every E, the top 3 O’s as sorted by T.

My TDB store contains 779 O’s, 7273 E’s, and a T for every O.

The full query is this:

SELECT DISTINCT ?O ?T ?S ?E ?P
WHERE{
?E a prov:E.
{ SELECT ?O ?T
WHERE {
?O :otE ?E;
:oT ?T .
} ORDER BY DESC(?T)
LIMIT 3
}{ SELECT ?SH
WHERE {
?EHS :ehsO ?O.
?EH :ehEHSf ?EHS.
?SHS :shsEHS ?EHS;
:shsSH ?SH .
?SH :rank ?SHRank.
} ORDER BY ASC(?SHRank)
LIMIT 1

?SH :shS ?S.
OPTIONAL {?O :op ?P.}

A pretty complex query, and one that *certainly* won’t complete if the simpler one won’t.

Thanks,

Mark

Viewing all articles
Browse latest Browse all 5648

Trending Articles