query-d1aec087da3e0709889cbd5295039a7d
TODO
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 schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?item ?language ?topicSitelink ?code ?article ?label
WHERE {
{
SELECT ?topic ?item ?itemLink WHERE {
VALUES ?topic {wd:Q1071518} .
?item wdt:P31 wd:Q10876391.
?item wdt:P856 ?itemLink .
}
}.
?item wdt:P407 ?lang .
BIND(SUBSTR(STR(?lang), 32 ) AS ?language)
BIND(STRAFTER(STRBEFORE(STR(?itemLink), "."),"//") AS ?code)
OPTIONAL {
{
SELECT ?topic ?item ?itemLink WHERE {
VALUES ?topic {wd:Q1071518} .
?item wdt:P31 wd:Q10876391.
?item wdt:P856 ?itemLink .
}
}.
?topicSitelink schema:isPartOf ?itemLink;
schema:about ?topic.
BIND(replace(wikibase:decodeUri(STRAFTER(STR(?topicSitelink), "wiki/" )),"_"," ") AS ?article)
}
OPTIONAL{ ?topic rdfs:label ?label filter (lang(?label) = ?code).}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?article"):::projected
v8("?code"):::projected
v4("?item"):::projected
v5("?itemLink")
v1("?label"):::projected
v6("?lang")
v7("?language"):::projected
v8("?topic")
v8("?topicSitelink"):::projected
c2(["wd:Q10876391"]):::iri
bind0[/VALUES ?topic/]
bind0-->v8
bind00(["wd:Q1071518"])
bind00 --> bind0
v4 --"wdt:P31"--> c2
v4 --"wdt:P856"--> v5
v4 --"wdt:P407"--> v6
bind1[/"substring(str(?lang),'32^^xsd:integer')"/]
v6 --o bind1
bind1 --as--o v7
bind2[/"substring-after(substring-before(str(?itemLink),'.'),'//')"/]
v5 --o bind2
bind2 --as--o v8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
bind3[/VALUES ?topic/]
bind3-->v8
bind30(["wd:Q1071518"])
bind30 --> bind3
v4 -."wdt:P31".-> c2
v4 --"wdt:P856"--> v5
v8 --"schema:isPartOf"--> v5
v8 --"schema:about"--> v8
bind4[/"replace(http://wikiba.se/ontology#decodeUri(substring-after(str(?topicSitelink),'wiki/')),'_',' ')"/]
v8 --o bind4
bind4 --as--o v9
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v8 -."rdfs:label".-> v1
end