Yes, it’s a BlazeGraph extension. According to BlazeGraph’s
documentation there’s also a query hint (syntactically, just a
regular triple) to lift a regular subquery into a named one, but I
could never get that to work. For me, the performance gain is
worth the nonstandard syntax…
SPARQL 1.1 parsers should find such syntax invalid.
On Tue, Jun 27, 2017 at 11:05 PM, Lucas Werkmeister <mail@lucaswerkmeister.de> wrote:
The best explanation I can offer is that the optimizer does weird things sometimes, especially with subqueries: in my experience, subqueries rarely bring the optimization I expect. However, named subqueries often perform a lot better (they run exactly once). This version of your query runs in less than a second:
PREFIX wp: <http://vocabularies.
Cheers,wikipathways.org/wp#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT DISTINCT ?metabolite1Label ?metabolite2Label ?mass1 ?mass2 WITH {
SELECT ?metabolite1 ?metabolite2 WHERE {
?pathwayItem wdt:P2410 "WP706";
wdt:P2888 ?pwIri.
SERVICE <http://sparql.wikipathways.org/> {
?pathway dc:identifier ?pwIri.
?interaction rdf:type wp:Interaction;
wp:participants ?wpmb1, ?wpmb2;
dcterms:isPartOf ?pathway.
FILTER (?wpmb1 != ?wpmb2)
?wpmb1 wp:bdbWikidata ?metabolite1.
?wpmb2 wp:bdbWikidata ?metabolite2.
}
}
} AS %metabolites WHERE {
INCLUDE %metabolites.
?metabolite1 wdt:P2067 ?mass1.
?metabolite2 wdt:P2067 ?mass2.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Lucas
On 26.06.2017 21:58, Andra Waagmeester wrote:
I am puzzled by a pattern I am seeing in submitting nested SELECT statements to the WDQS.In cases where a federated query to the WDQS time out, it helps to include redundant SELECT statements for the same query to resolve.
The following query does not resolve:
results: http://tinyurl.com/ybl55tk4 When the lines 7 and 9 in the above example are duplicated, suddenly the query does resolveresults: http://tinyurl.com/y9mjkejo
What is the added value of a double SELECT (line 7,8 and line 10,11). Also the lines 5 and 9 had to be separated by a SELECT statement to be successful.
Is this an implementation issue, or am I doing something wrong?
kind regards,
Andra Waagmeester
_______________________________________________ Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/ mailman/listinfo/wikidata
_______________________________________________
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata
_______________________________________________ Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata