On 08/09/2015 16:15, Markus Krötzsch wrote:
Yes, path queries (called TREE queries in WDQ) are usually faster in
WDQ. I think that WDQ is better optimised for this type of queries. This
is also what I had in mind with what I wrote: if you narrow down your
query language to specific use cases and (possibly) a subset of the
data, then you may be able to achieve a better performance in return.
There is always a trade-off there. SPARQL is rather complex (if you look
at the query examples page, you get an idea of the possibilities), but
there is a price to pay for this. I still hope that path queries in
particular can be made faster in the future (it still is a rather recent
SPARQL feature and I am sure BlazeGraph are continuously working on
improving their code).
Markus
Thanks, Markus.
Path queries are pretty important for Wikidata, though, because the way Wikidata is constructed in practice you almost never want to query for an instance (P31) of a class -- you will almost always want to include its subclasses too.
Another query I tried and gave trouble was when somebody asked how to find (or even count) all statements referenced to
http://www.lefigaro.fr/...
-- see https://www.wikidata.org/wiki/Wikidata:Project_chat#WQS:_Searching_for_items_with_reference_to_.22Le_Figaro.22
It may be that there's a better solution than my newbie attempt at
http://tinyurl.com/pxlrkd7
-- but on the face of it, it looks as if WQS is timing out trying to make a list of all URLs that are the target of a P854 in a reference, and falling over trying.
But perhaps people with more SPARQL experience than my approximately 24 hours may be able to suggest a better way round this?
All best,
James.
_______________________________________________
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata