query-7919700f81b9c9b461d2ff3a40b59579
TODO
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?article (group_concat(?P31Label;separator="; ") as ?P31) where
{
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "sco.wikipedia.org";
wikibase:api "Generator";
mwapi:generator "categorymembers";
mwapi:gcmtitle "Category:Pages that wis written by a body that's mither tongue isna Scots" ; # specifically here
mwapi:gcmprop "ids|title|type";
mwapi:gcmlimit "max".
# out
?article wikibase:apiOutput mwapi:title. # en-wikipedia article / category name
?item wikibase:apiOutputItem mwapi:item. # wikidata QId for the article
}
filter(bound(?item))
optional {?item wdt:P31 ?P31 . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?item rdfs:label ?itemLabel .
?P31 rdfs:label ?P31Label . }
} group by ?item ?itemLabel ?article
Query found at
- https://www.wikidata.org/wiki/User:Lirazelf/Learning
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2021/09
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?P31")
v5("?P31Label"):::projected
v2("?article"):::projected
v1("?item"):::projected
v4("?itemLabel"):::projected
c18(["mwapi:item"]):::iri
c14(["max"]):::literal
c10(["Category:Pages that wis written by a body that's mither tongue isna Scots"]):::literal
c8(["categorymembers"]):::literal
c2(["bd:serviceParam"]):::iri
c22(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c16(["mwapi:title"]):::iri
c12(["ids|title|type"]):::literal
c4(["sco.wikipedia.org"]):::literal
c6(["Generator"]):::literal
f0[["bound(?item)"]]
f0 --> v1
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c2 --"mwapi:endpoint"--> c4
c2 --"mwapi:api"--> c6
c2 --"mwapi:generator"--> c8
c2 --"mwapi:gcmtitle"--> c10
c2 --"mwapi:gcmprop"--> c12
c2 --"mwapi:gcmlimit"--> c14
v2 --"mwapi:apiOutput"--> c16
v1 --"mwapi:apiOutputItem"--> c18
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P31".-> v6
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c2 --"mwapi:language"--> c22
v1 --"rdfs:label"--> v4
v6 --"rdfs:label"--> v5
end
bind2[/"?P31Label"/]
v5 --o bind2
bind2 --as--o v6