BIND is cheap.
But
?rel rdfs:subPropertyOf rex:relationship .
{ BIND(?rel AS ?s) }
?s ?p ?o
puts it inside a {} and so the optimizer drops back to a
slow-not-correct algorithm which in involves calcuating unbounded "?s ?p
?o" AKA the whole database.
The execution plan for
?rel rdfs:subPropertyOf rex:relationship .
BIND(?rel AS ?s)
?s ?p ?o
is much better.
Andy
On 28/12/10 02:57, Benson Margulies wrote:
Two queries. The first one works fine, the second one seems to be
prepared to run forever in tdbquery. I suppose that I haven't managed
to really understand the implications of BIND properly, or something.
PREFIX rex:<http://www.basistech.com/ontologies/2010/6/rex.owl#>
PREFIX owl:<http://www.w3.org/2002/07/owl#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX x-arq:<urn:x-arq:>
SELECT ?rel
WHERE
{
GRAPH x-arq:UnionGraph {
# Items of interest.
?rel rdfs:subPropertyOf rex:relationship .
}
}
---------------------------------------------------
PREFIX rex:<http://www.basistech.com/ontologies/2010/6/rex.owl#>
PREFIX owl:<http://www.w3.org/2002/07/owl#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX x-arq:<urn:x-arq:>
CONSTRUCT{ ?s ?p ?o }
WHERE
{
GRAPH x-arq:UnionGraph {
# Items of interest.
?rel rdfs:subPropertyOf rex:relationship .
{ BIND(?rel AS ?s) }
?s ?p ?o .
}
}