query-fb738f0332873429beb340a749f40c76
23:09, 5 January 2020 (UTC)) talk (Doc TaxonHi! I want to list the sitelink to English and to German Wikipedia, but the columns are empty. I only need the plain lemma like "Rafael Nadal". What can I do? ?article doesn't work:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?sitelink_en ?sitelink_de ?ATP_Kennung (GROUP_CONCAT(?sitey;SEPARATOR=' ') AS ?sites) {
OPTIONAL { ?item wdt:P536 ?ATP_Kennung. }
?article schema:about ?item ; schema:isPartOf <https://en.wikipedia.org/> ; schema:name ?sitelink_en .
?article schema:about ?item ; schema:isPartOf <https://de.wikipedia.org/> ; schema:name ?sitelink_de .
?site schema:about ?item .
BIND(STRAFTER(STRBEFORE(STR(?site),'.org'),'//') AS ?sitex)
BIND(STRBEFORE(?sitex,'.') AS ?sitey)
SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en,[AUTO_LANGUAGE]". }
}
GROUP BY ?item ?itemLabel ?sitelink_en ?sitelink_de ?ATP_Kennung ?sitelinks
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?ATP_Kennung"):::projected
v3("?article")
v1("?item"):::projected
v6("?site")
v5("?sitelink_de"):::projected
v4("?sitelink_en"):::projected
v9("?sites")
v7("?sitex")
v8("?sitey"):::projected
c6([https://de.wikipedia.org/]):::iri
c4([https://en.wikipedia.org/]):::iri
c8(["bd:serviceParam"]):::iri
c10(["de,en,#91;AUTO_LANGUAGE#93;"]):::literal
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P536".-> v2
end
v3 --"schema:about"--> v1
v3 --"schema:isPartOf"--> c4
v3 --"schema:name"--> v4
v3 --"schema:about"--> v1
v3 --"schema:isPartOf"--> c6
v3 --"schema:name"--> v5
v6 --"schema:about"--> v1
bind0[/"substring-after(substring-before(str(?site),'.org'),'//')"/]
v6 --o bind0
bind0 --as--o v7
bind1[/"substring-before(?sitex,'.')"/]
v7 --o bind1
bind1 --as--o v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end
bind3[/"?sitey"/]
v8 --o bind3
bind3 --as--o v9