Hello list,

in Nepomuk I would like to get all search excerpts from all bif:contains
matches in the query and put them into one variable. Currently I use the
following approach which of course gives me several result rows in case
at least one matching bif:contains is in a union:

"select distinct
  ?r
  (bif:concat(
    bif:search_excerpt(bif:vector('eureka'),
                       ?v2),
    bif:search_excerpt(bif:vector('video'),
                       ?v5))
  ) as ?_n_f_t_m_ex_
  where {
  {
    {
      ?r ?v1 ?v2 .
      ?v2 bif:contains "'eureka'" .
    }
    UNION
    {
      ?r ?v1 ?v3 .
      ?v3 rdfs:label ?v2 .
      ?v2 bif:contains "'eureka'" .
    } .
    {
      ?r a nfo:Video .
    }
    UNION
    {
      ?r nie:mimeType ?v5 .
      ?v5 bif:contains "'video'" .
    } .
  } .
}"

I, thus, tried to get the search excerpt as a separate query repeating
all statements from the "original" query like so:

"select distinct
  ?r
  (bif:concat(
    bif:search_excerpt(bif:vector('eureka'),
                       (select ?v2 ?v5 where {
  {
    {
      ?r ?v1 ?v2 .
      ?v2 bif:contains 'eureka' .
    }
    UNION
    {
      ?r ?v1 ?v3 .
      ?v3 rdfs:label ?v2 .
      ?v2 bif:contains 'eureka' .
    } .
    {
      ?r a nfo:Video .
    }
    UNION
    {
      ?r nie:mimeType ?v5 .
      ?v5 bif:contains 'video' .
    } .
  } . })))
  ) as ?_n_f_t_m_ex_
  where {
  {
    {
      ?r ?v1 ?v2 .
      ?v2 bif:contains 'eureka' .
    }
    UNION
    {
      ?r ?v1 ?v3 .
      ?v3 rdfs:label ?v2 .
      ?v2 bif:contains 'eureka' .
    } .
    {
      ?r a nfo:Video .
    }
    UNION
    {
      ?r nie:mimeType ?v5 .
      ?v5 bif:contains 'video' .
    } .
  }
}"

but I get a "Line 48: SP031: SPARQL compiler: Internal error:
sparp_find_origin_of_external_var(): external source equiv is found,
external source var is not)".

So the question is: how can I get all excerpts without having one result
(?r) reported more than once?

Cheers,
Sebastian

Reply via email to