Hi,

I'm having problems with a SPARQL query I need to run on virtuoso. The sparql engine returns this error message (with a simplified version of my query):

37000 Error SP031: SPARQL compiler: Internal error: The SPARQL optimizer has 
failed to process the query with reasonable quality. The resulting SQL query is 
abnormally long. Please paraphrase the SPARQL query.

SPARQL query:
PREFIX owl:
PREFIX sc:
PREFIX common:
PREFIX config:
PREFIX xsd:
select *
FROM config:
where {
  ?g1 common:useGraph "true"^^xsd:boolean
  . ?type common:resultForContext ?ctx
  . GRAPH ?g1 {
    ?ind a ?type
    . OPTIONAL {
       ?ind ?correctLangProp ?correctLangVal
       . filter(langMatches(lang(?correctLangVal),"en"))
    }
  }
} limit 10


The idea is to have a named graph (config: in this query) that contains the names of graphs which in turn contain the data I want to work on. This works fine unless I use optional graph patterns to select from a graph IRI found in the config: graph (?g1 in this query). I tried different reformulations of the query, but I had no luck.

Any ideas, anyone? - Thanks!

Best,
Florian

Reply via email to