query-61fc526098e5432ad109190391b96f6c
TODO
Use at
- https://query.wikidata.org/sparql
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
?en_sitelink ?de_sitelink ?es_sitelink ?it_sitelink ?fr_sitelink ?ru_sitelink ?ja_sitelink
WHERE {
VALUES ?ATP_player_ID { "H355" }
VALUES ?language_code { "no" }
# Find the player
?player wdt:P536 ?ATP_player_ID.
# Find the Wikipedia, its language(s), and sitelink for the Wikipedia
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.
# Sitelinks to selected Wikipedias
OPTIONAL {
?en_sitelink schema:about ?player.
?en_sitelink schema:isPartOf <https://en.wikipedia.org/>.
}
OPTIONAL {
?de_sitelink schema:about ?player.
?de_sitelink schema:isPartOf <https://de.wikipedia.org/>.
}
OPTIONAL {
?es_sitelink schema:about ?player.
?es_sitelink schema:isPartOf <https://es.wikipedia.org/>.
}
OPTIONAL {
?it_sitelink schema:about ?player.
?it_sitelink schema:isPartOf <https://it.wikipedia.org/>.
}
OPTIONAL {
?fr_sitelink schema:about ?player.
?fr_sitelink schema:isPartOf <https://fr.wikipedia.org/>.
}
OPTIONAL {
?ru_sitelink schema:about ?player.
?ru_sitelink schema:isPartOf <https://ru.wikipedia.org/>.
}
OPTIONAL {
?ja_sitelink schema:about ?player.
?ja_sitelink schema:isPartOf <https://ja.wikipedia.org/>.
}
}
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
v13("?de_sitelink"):::projected
v12("?en_sitelink"):::projected
v14("?es_sitelink"):::projected
v16("?fr_sitelink"):::projected
v15("?it_sitelink"):::projected
v18("?ja_sitelink"):::projected
v4("?language_code")
v5("?player"):::projected
v1("?playerLabel"):::projected
v8("?represents")
v17("?ru_sitelink"):::projected
v7("?sitelink"):::projected
a1((" "))
a2((" "))
c12([https://de.wikipedia.org/]):::iri
c15([https://fr.wikipedia.org/]):::iri
c14([https://it.wikipedia.org/]):::iri
c11([https://en.wikipedia.org/]):::iri
c16([https://ru.wikipedia.org/]):::iri
c13([https://es.wikipedia.org/]):::iri
c17([https://ja.wikipedia.org/]):::iri
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
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v12 -."schema:about".-> v5
v12 --"schema:isPartOf"--> c11
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v13 -."schema:about".-> v5
v13 --"schema:isPartOf"--> c12
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v14 -."schema:about".-> v5
v14 --"schema:isPartOf"--> c13
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v15 -."schema:about".-> v5
v15 --"schema:isPartOf"--> c14
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v16 -."schema:about".-> v5
v16 --"schema:isPartOf"--> c15
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v17 -."schema:about".-> v5
v17 --"schema:isPartOf"--> c16
end
subgraph optional7["(optional)"]
style optional7 fill:#bbf,stroke-dasharray: 5 5;
v18 -."schema:about".-> v5
v18 --"schema:isPartOf"--> c17
end