query-e012c06a6c58334081d7cf05a17d9949
.Jens Ohlig by suggestion. Following a on Mastodon and on TwitterOriginally posted
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:ImageGrid
SELECT ?animal ?deLemmas ?frLemmas ?image
WHERE {
{
SELECT ?animal ?animalLabel ?deLemmas ?frLemmas WHERE {
{
SELECT ?animal (STRLANG(GROUP_CONCAT(?deLemma; separator = "/"), "de") AS ?deLemmas) (STRLANG(GROUP_CONCAT(?frLemma; separator = "/"), "fr") AS ?frLemmas) WHERE {
?de dct:language wd:Q188;
wikibase:lexicalCategory wd:Q1084;
wikibase:lemma ?deLemma;
wdt:P5185 wd:Q1775415;
ontolex:sense [ wdt:P5137 ?animal ].
?fr dct:language wd:Q150;
wikibase:lexicalCategory wd:Q1084;
wikibase:lemma ?frLemma;
wdt:P5185 wd:Q499327;
ontolex:sense [ wdt:P5137 ?animal ].
?animal wdt:P279+ wd:Q729.
}
GROUP BY ?animal
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
}
BIND(CONCAT("haswbstatement:P180=", STRAFTER(STR(?animal), STR(wd:))) AS ?search)
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Search";
wikibase:endpoint "commons.wikimedia.org";
mwapi:srsearch ?search;
mwapi:srnamespace "6"; # NS_FILE
mwapi:srlimit "max".
?title wikibase:apiOutput mwapi:title.
}
BIND(IRI(CONCAT("http://commons.wikimedia.org/wiki/Special:FilePath/", STRAFTER(?title, "File:"))) AS ?image)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?_anon_42b5416610844a34809f33a099ae9de126864")
v7("?_anon_42b5416610844a34809f33a099ae9de126865")
v3("?animal"):::projected
v1("?de")
v2("?deLemma")
v8("?deLemmas"):::projected
v4("?fr")
v5("?frLemma")
v9("?frLemmas"):::projected
v12("?image"):::projected
v10("?search")
v11("?title")
a1((" "))
a2((" "))
c13(["wd:Q729"]):::iri
c15(["bd:serviceParam"]):::iri
c4(["wd:Q1084"]):::iri
c20(["Search"]):::literal
c10(["wd:Q150"]):::iri
c22(["commons.wikimedia.org"]):::literal
c11(["wd:Q499327"]):::iri
c27(["max"]):::literal
c7(["wd:Q1775415"]):::iri
c25(["6"]):::literal
c17(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c29(["mwapi:title"]):::iri
c2(["wd:Q188"]):::iri
v1 --"dct:language"--> c2
v1 --"mwapi:lexicalCategory"--> c4
v1 --"mwapi:lemma"--> v2
v1 --"wdt:P5185"--> c7
a1 --"wdt:P5137"--> v3
v1 --"ontolex:sense"--> a1
v4 --"dct:language"--> c10
v4 --"mwapi:lexicalCategory"--> c4
v4 --"mwapi:lemma"--> v5
v4 --"wdt:P5185"--> c11
a2 --"wdt:P5137"--> v3
v4 --"ontolex:sense"--> a2
v3 --"wdt:P279"--> c13
bind2[/"?deLemma"/]
v2 --o bind2
bind2 --as--o v6
bind3[/"?frLemma"/]
v5 --o bind3
bind3 --as--o v7
bind4[/"STRLANG(,'de')"/]
null --o bind4
bind4 --as--o v8
bind5[/"STRLANG(,'fr')"/]
null --o bind5
bind5 --as--o v9
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c15 --"mwapi:language"--> c17
end
bind6[/"concat('haswbstatement:P180=',substring-after(str(?animal),str('wd:')))"/]
v3 --o bind6
bind6 --as--o v10
subgraph s2["http://wikiba.se/ontology#mwapi"]
style s2 stroke-width:4px;
c15 --"mwapi:api"--> c20
c15 --"mwapi:endpoint"--> c22
c15 --"mwapi:srsearch"--> v10
c15 --"mwapi:srnamespace"--> c25
c15 --"mwapi:srlimit"--> c27
v11 --"mwapi:apiOutput"--> c29
end
bind7[/"concat('http://commons.wikimedia.org/wiki/Special:FilePath/',substring-after(?title,'File:'))"/]
v11 --o bind7
bind7 --as--o v12