virtuoso-opensource icon indicating copy to clipboard operation
virtuoso-opensource copied to clipboard

Virtuoso 37000 Error TR...: Query contains a transitive derived table but neither end of it is bound by equality to other columns or parameters

Open jakubklimek opened this issue 11 years ago • 7 comments

In 616e55a4f8c14c124479594e743fed76062d313b

The following query gives this weird error:

Virtuoso 37000 Error TR...: Query contains a transitive derived table but neither end of it is bound by equality to other columns or parameters

SPARQL query:
define sql:big-data-const 0 
#output-format:text/html
define sql:signal-void-variables 1 select ?super ?sub (count(?mid) as ?distance) { 
  ?super (ares:spolecnici-s-vkladem/ares:spolecnictvi-s-vkladem/ares:spolecnik-s-vkladem)* ?mid .
  ?mid (ares:spolecnici-s-vkladem/ares:spolecnictvi-s-vkladem/ares:spolecnik-s-vkladem)+ ?sub .
}
group by ?super ?sub 
order by ?super ?sub

jakubklimek avatar May 22 '14 07:05 jakubklimek

I have been able to recreate against local database and reported to development to look into ...

HughWilliams avatar May 24 '14 21:05 HughWilliams

Any updates on this?

mommi84 avatar Dec 06 '18 18:12 mommi84

@mommi84 @jakubklimek /cc @HughWilliams @iv-an-ru @IvanMikhailov

Unfortunately, this report is not self-contained. As reported, the query lacks a definition for the ares: prefix, and does not include a link to the relevant test dataset ... nor is it executable on a public endpoint/dataset, such as DBpedia, URIburner, demo.openlinksw.com, etc.

@jakubklimek - We would appreciate it if you could update this report with such details, especially if you can reproduce it with a current Virtuoso instance, whether public or private.

@mommi84 - If you've encountered this with your own dataset and query, those details would also be helpful, including the specific version of your Virtuoso instance.

TallTed avatar Dec 06 '18 19:12 TallTed

@TallTed I googled the query above and found an answer from @kidehen in this thread: https://sourceforge.net/p/virtuoso/mailman/message/35829035/

It seems that a simple sub-query workaround solves the issue. Here is an example with rdfs:subClassOf on DBpedia.

Endpoint: http://dbpedia.org/sparql Graph: http://dbpedia.org/resource/classes# Query:

SELECT ?super ?sub (count(?mid) as ?distance)
WHERE {
  {
    SELECT distinct ?super
    WHERE {
      ?x rdfs:subClassOf ?super
    }
  }
  ?mid rdfs:subClassOf* ?super.
  ?sub rdfs:subClassOf+ ?mid.
}
GROUP BY ?super ?sub
ORDER BY DESC(?distance) ?super ?sub
LIMIT 100

Link: https://bit.ly/2zNCI9u Version: 07.20.3229

mommi84 avatar Dec 09 '18 16:12 mommi84

@mommi84 - Excellent! I thought this looked familiar...

@jakubklimek - Would you concur that this issue may be considered Closed?

TallTed avatar Dec 10 '18 01:12 TallTed

The issue seems to be closely related to a technique to gather paths in SPARQL (i.e. not only the start- and end point but the whole path) that I learned about on Stack Overflow here. I've tested a similar query on a number of RDF stores (namely Stardog, Oxigraph, rdf4j, GraphDB, RDFox, Allegrograph, Dydra, QLever and Jena-Fuseki), but only Virtuoso throws this error. You might consider to do something more about it, at least let the error message point to a description for the solution?

rat10 avatar Feb 20 '25 11:02 rat10

We are going to schedule to revise this issue ...

HughWilliams avatar Feb 20 '25 16:02 HughWilliams