query-7febc4a826b2383b488008ecaad3e0fb
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 ?sitelink ?country_code
?en_sitelink ?de_sitelink ?es_sitelink ?it_sitelink ?fr_sitelink ?ru_sitelink ?ja_sitelink
WHERE {
VALUES ?ATP_player_ID { "AC58" }
VALUES ?Wikipedia_code { "de" } # Code for Wikipedia version
# Find the player
?player wdt:P536 ?ATP_player_ID.
# Find the Wikipedia, its language(s), and sitelink for the Wikipedia
BIND (URI(CONCAT("https://", ?Wikipedia_code, ".wikipedia.org/")) AS ?Wikipedia)
OPTIONAL {
?sitelink schema:about ?player.
?sitelink schema:isPartOf ?Wikipedia.
}
# Find player's label in the language(s)
OPTIONAL {
VALUES ?language_code { "de" } # Language code for player label
?player rdfs:label ?playerLabel.
FILTER (LANG(?playerLabel) = ?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
v4("?Wikipedia_code")
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
v8("?language_code")
v5("?player"):::projected
v1("?playerLabel"):::projected
v8("?represents")
v17("?ru_sitelink"):::projected
v7("?sitelink"):::projected
c9([https://de.wikipedia.org/]):::iri
c12([https://fr.wikipedia.org/]):::iri
c11([https://it.wikipedia.org/]):::iri
c8([https://en.wikipedia.org/]):::iri
c13([https://ru.wikipedia.org/]):::iri
c10([https://es.wikipedia.org/]):::iri
c14([https://ja.wikipedia.org/]):::iri
bind0[/VALUES ?ATP_player_ID/]
bind0-->v3
bind00(["AC58"])
bind00 --> bind0
bind1[/VALUES ?Wikipedia_code/]
bind1-->v4
bind10(["de"])
bind10 --> bind1
v5 --"wdt:P536"--> v3
bind2[/"concat('https://',?Wikipedia_code,'.wikipedia.org/')"/]
v4 --o bind2
bind2 --as--o v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v7 -."schema:about".-> v5
v7 --"schema:isPartOf"--> v6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
bind3[/VALUES ?language_code/]
bind3-->v8
bind30(["de"])
bind30 --> bind3
v5 -."rdfs:label".-> v1
end
subgraph optional2["(optional)"]
style optional2 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 optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v12 -."schema:about".-> v5
v12 --"schema:isPartOf"--> c8
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v13 -."schema:about".-> v5
v13 --"schema:isPartOf"--> c9
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v14 -."schema:about".-> v5
v14 --"schema:isPartOf"--> c10
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v15 -."schema:about".-> v5
v15 --"schema:isPartOf"--> c11
end
subgraph optional7["(optional)"]
style optional7 fill:#bbf,stroke-dasharray: 5 5;
v16 -."schema:about".-> v5
v16 --"schema:isPartOf"--> c12
end
subgraph optional8["(optional)"]
style optional8 fill:#bbf,stroke-dasharray: 5 5;
v17 -."schema:about".-> v5
v17 --"schema:isPartOf"--> c13
end
subgraph optional9["(optional)"]
style optional9 fill:#bbf,stroke-dasharray: 5 5;
v18 -."schema:about".-> v5
v18 --"schema:isPartOf"--> c14
end