Project:SPARQL/examples: Difference between revisions

Line 682: Line 682:


order by ?personLabel ?ppa_label
order by ?personLabel ?ppa_label
</sparql>
===Counts of PPAs for women===
<sparql tryit="1">
#title:counting women's instance of PPA
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
PREFIX bnp: <https://beyond-notability.wikibase.cloud/prop/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
SELECT  ?ppa_label ?ppa  (count(?ppa) as ?count)
WHERE { 
  ?person bnwdt:P3 bnwd:Q3 .
  ?person ?p ?s . 
      ?ppa wikibase:claim ?p;     
        wikibase:statementProperty ?ps.     
         
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb".
                      ?ppa rdfs:label ?ppa_label.      # what kind of thing
                } # /label service
 
      ?ppa bnwdt:P12 bnwd:Q151 . # ahhhh at last     
     
      # get stuff about ?s
      #?s ?ps ?ppa_value.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
}
group by ?ppa_label ?ppa
order by desc(?count)
</sparql>
</sparql>


586

edits