query-1cf80950118bed662d6ac868c92af472

rq turtle/ttl

Wolbo

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?winner ?winnerLabel ?date_for_first_GS 
WHERE
{

{
  SELECT ?winner (MIN(?date) AS ?date_for_first_GS)
  WHERE
  {
    VALUES ?class { wd:Q16893403 wd:Q16893072 } # vomen's and men's singles
    ?GS_single wdt:P361 ?GS .
    ?GS (wdt:P279| wdt:P31) / wdt:P361 wd:Q102113 .
    ?GS wdt:P582 ?date . # End date of the tournament. Beware it is missing in many cases. 
    ?GS_single wdt:P2094 ?class .
    ?GS_single wdt:P1346 ?winner .
  }
  GROUP BY ?winner
}  FILTER NOT EXISTS
  {
    VALUES ?tour { wd:Q2537906 wd:Q300008 } # WTA and ATP Tour
    VALUES ?class { wd:Q16893403 wd:Q16893072 } # vomen's and men's singles
    ?tour_season wdt:P3450 ?tour .
    ?tourney wdt:P361 ?tour_season .
    ?tourney wdt:P582 ?date . # End date of the tournament. Beware it is missing in many cases.
    ?single wdt:P361 ?tourney .
    ?single wdt:P2094 ?class .
    ?single wdt:P1346 ?winner .
    FILTER (?date < ?date_for_first_GS)
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v10("?GS") v9("?GS_single") v9("?class") v1("?date") v11("?date_for_first_GS"):::projected v7("?single") v3("?tour") v5("?tour_season") v6("?tourney") v8("?winner"):::projected a1((" ")) c8(["wd:Q102113"]):::iri c10(["bd:serviceParam"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0f0[["?date < ?date_for_first_GS"]] e0f0 --> e0v1 e0f0 --> e0v2 bind1[/VALUES ?tour/] bind1-->e0v3 bind10(["wd:Q2537906"]) bind10 --> bind1 bind11(["wd:Q300008"]) bind11 --> bind1 bind2[/VALUES ?class/] bind2-->e0v4 bind20(["wd:Q16893403"]) bind20 --> bind2 bind21(["wd:Q16893072"]) bind21 --> bind2 e0v5 --"wdt:P3450"--> e0v3 e0v6 --"wdt:P361"--> e0v5 e0v6 --"wdt:P582"--> e0v1 e0v7 --"wdt:P361"--> e0v6 e0v7 --"wdt:P2094"--> e0v4 e0v7 --"wdt:P1346"--> e0v8 e0v4("?class"):::projected e0v1("?date"):::projected e0v2("?date_for_first_GS"):::projected e0v7("?single"):::projected e0v3("?tour"):::projected e0v5("?tour_season"):::projected e0v6("?tourney"):::projected e0v8("?winner"):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> v11 f0 --> v5 f0 --> c1 f0 --> v3 f0 --> v6 f0 --> c2 f0 --> c3 f0 --> v7 f0 --> c4 f0 --> v9 f0 --> c5 f0 --> v8 f1[["?date < ?date_for_first_GS"]] f1 --> v1 f1 --> v11 bind2[/VALUES ?tour/] bind2-->v3 bind20(["wd:Q2537906"]) bind20 --> bind2 bind21(["wd:Q300008"]) bind21 --> bind2 bind3[/VALUES ?class/] bind3-->v9 bind30(["wd:Q16893403"]) bind30 --> bind3 bind31(["wd:Q16893072"]) bind31 --> bind3 v5 --"wdt:P3450"--> v3 v6 --"wdt:P361"--> v5 v6 --"wdt:P582"--> v1 v7 --"wdt:P361"--> v6 v7 --"wdt:P2094"--> v9 v7 --"wdt:P1346"--> v8 bind4[/VALUES ?class/] bind4-->v9 bind40(["wd:Q16893403"]) bind40 --> bind4 bind41(["wd:Q16893072"]) bind41 --> bind4 v9 --"wdt:P361"--> v10 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v10 --"wdt:P31"--> a1 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v10 --"wdt:P279"--> a1 end union0r <== or ==> union0l end a1 --"wdt:P361"--> c8 v10 --"wdt:P582"--> v1 v9 --"wdt:P2094"--> v9 v9 --"wdt:P1346"--> v8 bind6[/"min(?date)"/] v1 --o bind6 bind6 --as--o v11 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end