query-7f648442a354416636abbddc641aa5bb

rq turtle/ttl

TODO

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?player ?playerLabel ?Wikipedia ?Wikipedia_language_code ?sitelink ?country_code
WHERE {
  VALUES ?ATP_player_ID { "H355" }
  VALUES ?language_code { "no" }

  # Find the player
  ?player wdt:P536 ?ATP_player_ID.

  # Find the Wikipedia and its language(s)
  BIND (URI(CONCAT("https://", ?language_code, ".wikipedia.org/")) AS ?Wikipedia)
  ?sitelink schema:about ?player.
  ?sitelink schema:isPartOf ?Wikipedia.
  ?Wikipedia ^wdt:P856/wdt:P407/wdt:P424 ?Wikipedia_language_code. 

  # Find player's label in the language(s)
  ?player rdfs:label ?playerLabel.
  FILTER (LANG(?playerLabel) = ?Wikipedia_language_code)

  # Find the country/ies and country code(s)
  OPTIONAL { ?player wdt:P1532 ?represents. }
  ?player wdt:P27 ?citizenship.
  BIND (COALESCE(?represents, ?citizenship) AS ?country)
  ?country wdt:P298 ?country_code.
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?ATP_player_ID") v6("?Wikipedia"):::projected v2("?Wikipedia_language_code"):::projected v9("?citizenship") v10("?country") v11("?country_code"):::projected v4("?language_code") v5("?player"):::projected v1("?playerLabel"):::projected v8("?represents") v7("?sitelink"):::projected a1((" ")) a2((" ")) f0[["?playerLabel = ?Wikipedia_language_code"]] f0 --> v1 f0 --> v2 bind1[/VALUES ?ATP_player_ID/] bind1-->v3 bind10(["H355"]) bind10 --> bind1 bind2[/VALUES ?language_code/] bind2-->v4 bind20(["no"]) bind20 --> bind2 v5 --"wdt:P536"--> v3 bind3[/"concat('https://',?language_code,'.wikipedia.org/')"/] v4 --o bind3 bind3 --as--o v6 v7 --"schema:about"--> v5 v7 --"schema:isPartOf"--> v6 a1 --"wdt:P856"--> v6 a1 --"wdt:P407"--> a2 a2 --"wdt:P424"--> v2 v5 --"rdfs:label"--> v1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."wdt:P1532".-> v8 end v5 --"wdt:P27"--> v9 bind4[/"?represents?citizenship"/] v8 --o bind4 v9 --o bind4 bind4 --as--o v10 v10 --"wdt:P298"--> v11