query-498ddfcb644fa964c28d5c5052c0c56c
.17:37, 11 August 2019 (UTC)) at contribs • talk (TomT0m comment was added byunsignedThe preceding – 18:44, 11 August 2019 (UTC) JuraYou used "" --- : TomT0mHello @we had the same problem with queries that worked before (until about end of July), but now are running into a timeout ("java.util.concurrent.TimeoutException"). . d:Wikidata_talk:SPARQL_query_service#Query_timeout_limit_for_important_query_reachedSee We also used the asterisk operator ("/wdt:P279") for any number of instances (zero to unlimited/infinite) from the instance to the subclasses, like all the examples fiven in the tutorial (which are not working anymore neither): d:Wikidata:SPARQL_tutorial#Instances_and_classes[...] The solution: ?item wdt:P31/wdt:P279 ?class. This means that there’s one “instance of” and then any number of “subclass of” statements between the item and the class. ?work wdt:P31/wdt:P279 wd:Q838948. # instance of any subclass of work of artFirst I assumed, that the query runs into an endless loop, if A is subclass of B and B is subclass of A, but i could not confirm that by viewing the tree structure (here for the class "film"): https://tools.wmflabs.org/wikidata-todo/tree.html?q=Q11424&rp=279&method=list&lang=en?depth=20 https://tools.wmflabs.org/wikidata-todo/tree.html?q=Q11424&rp=279&method=d3 https://tools.wmflabs.org/wikidata-todo/tree.html?q=Q11424&rp=279&method=list&lang=en was missing, since it is a "animation film"/"3D film" as subclass of "film"). d:Q18517638When I removed the "/wdt:P279" in the query, I got all films, but not the subclasses (for example When I used "/wdt:P279+", I got only the subclasses of "film", but not the instances of "film" themselves. From my point of view, a solution could be to combine those two by using "UNION" { ?film wdt:P31 wd:Q11424 . } UNION { ?film wdt:P31/wdt:P279+ wd:Q11424 . } For example, to get all films released in 2019 in Germany the query would be: Asterisk operator ("/wdt:P279") for any number of subclasses running into a timeoutWe had some problem with queries that worked before (until about end of July 2019), but now are running into a timeout ("java.util.concurrent.TimeoutException"). See d:Wikidata:Contact_the_development_team#Query_that_timeouts,_I_really_don't_understand_why .d:Wikidata_talk:SPARQL_query_service#Query_timeout_limit_for_important_query_reachedWe used the asterisk operator ("/wdt:P279") for any number of instances (zero to unlimited/infinite) from the instance to the subclasses, like all the examples of the tutorial (which are not working anymore neither): d:Wikidata:SPARQL_tutorial#Instances_and_classes[...] The solution: ?item wdt:P31/wdt:P279 ?class. This means that there’s one “instance of” and then any number of “subclass of” statements between the item and the class. ?work wdt:P31/wdt:P279 wd:Q838948. # instance of any subclass of work of artFirst I assumed, that the query runs into an endless loop, if A is subclass of B and B is subclass of A, but i could not confirm that by viewing the tree structure (here for the class "film"): https://tools.wmflabs.org/wikidata-todo/tree.html?q=Q11424&rp=279&method=list&lang=en?depth=20 https://tools.wmflabs.org/wikidata-todo/tree.html?q=Q11424&rp=279&method=d3 https://tools.wmflabs.org/wikidata-todo/tree.html?q=Q11424&rp=279&method=list&lang=en was missing, since it is a "animation film"/"3D film" as subclass of "film"). d:Q18517638When I removed the "/wdt:P279" in the query, I got all films, but not the subclasses (for example When I used "/wdt:P279+", I got only the subclasses of "film", but not the instances of "film" themselves. From my point of view, a solution could be to combine those two by using "UNION" { ?film wdt:P31 wd:Q11424 . } UNION { ?film wdt:P31/wdt:P279+ wd:Q11424 . } For example, to get all films released in 2019 in Germany the query would be: Query timeout limit for important query reached ]reply[21:55, 10 August 2019 (UTC)) talk (Jobu0101. Since August I've always been getting a timeout. Why is this the case? Any suggestions what to do? --Kinostarts 2019. Here is for example Kinostarts pages in order to update our 32 this queryHi! I need to perform : Jobu0101Hallo @das Problem ("java.util.concurrent.TimeoutException") ist der Stern-Operator ("/wdt:P279") für eine beliebige (Null bis unendlich) Anzahl von Unterklassen von "Film": d:Wikidata:SPARQL_tutorial/de#Instanzen_und_Klassen[...] Die Lösung: ?objekt wdt:P31/wdt:P279 ?klasse. Dies heißt, dass es eine "Instanz von" und dann eine beliebige Anzahl von "Unterklassen von" Aussagen zwischen dem Datenobjekt und der Klasse. ?kunstwerk wdt:P31/wdt:P279 wd:Q838948. # Instanz von einer beliebigen Unterklasse von Kunstwerk d:Wikidata:Contact_the_development_team#Query_that_timeouts,_I_really_don't_understand_whySiehe auch Mein Anfangsverdacht war, dass die Query möglicherweise in eine Endlosschleife läuft, wenn A Unterklasse von B ist und B Unterklasse von A und in der Baumstruktur für Filme und deren Unterklassen irgendwo so eine Endlosschleife eingebaut wurde. Diesen Verdacht konnte ich allerdings durch die Baumansicht der Klasse Film (vorerst) nicht bestätigen: https://tools.wmflabs.org/wikidata-todo/tree.html?q=Q11424&rp=279&method=list&lang=en?depth=20 https://tools.wmflabs.org/wikidata-todo/tree.html?q=Q11424&rp=279&method=d3 https://tools.wmflabs.org/wikidata-todo/tree.html?q=Q11424&rp=279&method=list&lang=enLässt man in der Query "/wdt:P279" weg, so erhält man alle Filme, aber nicht Unterklassen davon. Beispielsweise fehlt ... ist ein: "Animationsfilm"/"3D-Film" als Unterklasse von "Film".d:Q18517638Gibt man hingegen "/wdt:P279+" an, so erhält nur die Unterklassen von "Film", nicht aber die Instanzen von "Film" selbst. Eine Lösungsmöglichkeit ist daher aus meiner Sicht beides mittels UNION zu kombinieren, also { ?film wdt:P31 wd:Q11424 . } UNION { ?film wdt:P31/wdt:P279+ wd:Q11424 . } Die Query pro Jahr würde also wie folgt lauten:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?film ?release ?filmLabel WHERE {
{ ?film wdt:P31 wd:Q11424. }
UNION
{ ?film (wdt:P31/(wdt:P279+)) wd:Q11424. }
?film p:P577 ?release_statement.
?release_statement (psv:P577/wikibase:timePrecision) 11 ;
ps:P577 ?release.
FILTER((YEAR(?release)) = 2019 )
?release_statement pq:P291 wd:Q183.
FILTER(NOT EXISTS { ?release_statement wikibase:rank wikibase:DeprecatedRank. })
FILTER(NOT EXISTS { ?release_statement pq:P400 ?platform. })
FILTER(NOT EXISTS { ?release_statement pq:P437 ?distribution. })
FILTER(NOT EXISTS { ?film wdt:P31 wd:Q506240. })
FILTER(NOT EXISTS { ?film wdt:P31 wd:Q21191270. })
SERVICE wikibase:label { bd:serviceParam wikibase:language "de". }
}
ORDER BY (?release) (?filmLabel)
Query found at
- https://www.wikidata.org/wiki/Wikidata:Contact_the_development_team/Archive/2019/08
- https://www.wikidata.org/wiki/Wikidata_talk:SPARQL_query_service
- https://www.wikidata.org/wiki/Wikidata_talk:SPARQL_query_service/Wikidata_Query_Help
- https://www.wikidata.org/wiki/Wikidata_talk:SPARQL_tutorial