query-d726a4d35fac1d2bad18b4613d5d2788
title:Properties for Japanese school items SELECT ?prop (Sample(?propLabel) AS ?label) (COUNT(?prop) AS ?count) WHERE { { SELECT DISTINCT ?item ?prop WHERE { hint:Query hint:optimizer "None" . ?item wdt:P11127 ?code; ?p ?propvalue. ?prop wikibase:directClaim ?p . } } . OPTIONAL { ?prop rdfs:label ?propLabel filter (lang(?propLabel) = "ja") } } GROUP BY ?prop ORDER BY DESC(?count)
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
#title:Properties for Japanese school items
SELECT ?prop (Sample(?propLabel) AS ?label) (COUNT(?prop) AS ?count)
WHERE
{
{
SELECT DISTINCT ?item ?prop WHERE {
?item wdt:P11127 ?code; ?p ?propvalue.
?prop wikibase:directClaim ?p .
}
} .
OPTIONAL { ?prop rdfs:label ?propLabel filter (lang(?propLabel) = "ja") }
}
GROUP BY ?prop
ORDER BY DESC(?count)
Query found at
- https://www.wikidata.org/wiki/User:Mzaki
- https://www.wikidata.org/wiki/Wikidata_talk:WikiProject_Japan/%E3%82%B5%E3%83%96%E3%83%97%E3%83%AD%E3%82%B8%E3%82%A7%E3%82%AF%E3%83%88/%E5%AD%A6%E6%A0%A1
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?code")
v9("?count")
v3("?item")
v8("?label")
v5("?p")
v7("?prop"):::projected
v2("?propLabel"):::projected
v6("?propvalue")
v3 --"wdt:P11127"--> v4
v3 -->v5--> v6
v7 --"wikibase:directClaim"--> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v7 -."rdfs:label".-> v2
end
bind2[/"sample(?propLabel)"/]
v2 --o bind2
bind2 --as--o v8
bind3[/"count(?prop)"/]
v7 --o bind3
bind3 --as--o v9