Hello Sebastian,
There are two problems with this query.
First, ?v2 and ?v5 are barely connected. It looks like the query is
written to select the excerpt of the "best" resource about a keyword and
the score of it, but max(?v5) seems to be redundant: the score of ?v2 is
always the same, no matter how many branches of UNION will calculate it.
Second issue, the visible due to an error message, is that
the ?_n_f_t_m_ex_ may get a value of arbitrary size, as far as I can
understand, so obtaining the "distinct" from a temporary table of all
data is a real problem. A possible workaround it to exclude
the ?_n_f_t_m_ex_ from distinct, something like
select ?r
(bif:concat(bif:search_excerpt(bif:vector('trueg.'), ?v2))) as
?_n_f_t_m_ex_
where {
{ select distinct ?r
where { {
{ ?r ?v1 ?v2 .
?v2 bif:contains "'trueg.'" }
UNION { ?r ?v1 ?v3 . ?v3 ?v4 ?v2 .
?v4
<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>
<http://www.w3.org/2000/01/rdf-schema#label> .
?v2 bif:contains "'trueg.'" } } .
?r a ?v6 .
?v6
<http://www.semanticdesktop.org/ontologies/2007/08/15/nao#userVisible>
'true'^^<sopranofakes:/booleanHackUntilVirtuosoProblemIsResolved> . } LIMIT 10 }
{ { ?r ?v1 ?v2 .
?v2 bif:contains "'trueg.'" OPTION (score ?_n_f_t_m_s_) . }
UNION { ?r ?v1 ?v3 . ?v3 ?v4 ?v2 .
?v4
<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>
<http://www.w3.org/2000/01/rdf-schema#label> .
?v2 bif:contains "'trueg.'" OPTION (score ?_n_f_t_m_s_) . } }
}
for one or many excerpts per ?r or
select ?r
(bif:concat(bif:search_excerpt(bif:vector('trueg.'),
(select ?v2 where
{ { ?r ?v1 ?v2 .
?v2 bif:contains "'trueg.'" OPTION (score ?_n_f_t_m_s_) . }
UNION { ?r ?v1 ?v3 . ?v3 ?v4 ?v2 .
?v4
<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>
<http://www.w3.org/2000/01/rdf-schema#label> .
?v2 bif:contains "'trueg.'" OPTION (score ?_n_f_t_m_s_) . } }
)
))) as
?_n_f_t_m_ex_
where {
{ select distinct ?r
where { {
{ ?r ?v1 ?v2 .
?v2 bif:contains "'trueg.'" }
UNION { ?r ?v1 ?v3 . ?v3 ?v4 ?v2 .
?v4
<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>
<http://www.w3.org/2000/01/rdf-schema#label> .
?v2 bif:contains "'trueg.'" } } .
?r a ?v6 .
?v6
<http://www.semanticdesktop.org/ontologies/2007/08/15/nao#userVisible>
'true'^^<sopranofakes:/booleanHackUntilVirtuosoProblemIsResolved> . } LIMIT 10 }
}
for some single excerpt per ?r
Best Regards,
Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com
On Fri, 2010-09-10 at 20:51 +0200, Sebastian Trüg wrote:
> I got the error message "[OpenLink][Virtuoso iODBC Driver][Virtuoso
> Server]SR319: Max length of a temp row (10508) exceeded" with the
> following query:
>
> select distinct ?r max(?v5) as ?_n_f_t_m_s_
> (bif:concat(bif:search_excerpt(bif:vector('trueg.'), ?v2))) as
> ?_n_f_t_m_ex_ where { { ?r ?v1 ?v2 . ?v2 bif:contains "'trueg.'" OPTION
> (score ?v5) . } UNION { ?r ?v1 ?v3 . ?v3 ?v4 ?v2 . ?v4
> <http://www.w3.org/2000/01/rdf-schema#subPropertyOf>
> <http://www.w3.org/2000/01/rdf-schema#label> . ?v2 bif:contains
> "'trueg.'" OPTION (score ?v5) . } . ?r a ?v6 . ?v6
> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#userVisible>
> 'true'^^<sopranofakes:/booleanHackUntilVirtuosoProblemIsResolved> . }
> LIMIT 10
>
> What does the error mean and what can I do to avoid it?
>
> Cheers,
> Sebastian