Project:SPARQL/examples: Difference between revisions

Line 753: Line 753:


order by desc(?count)
order by desc(?count)
</sparql>
=== PPA Buckets ===
<sparql tryit="1">
#title:first draft of ppa buckets January 2024
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 distinct ?person ?personLabel ?ppa_label ?ppa ?bucket
?ppa_value ?ppa_valueLabel
?s
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 . # i/o ppa     
      # get stuff about ?s
      ?s ?ps ?ppa_value.
 
  bind(
      if( str(?ppa_label) in ("attended", "exhibited at", "organiser of", "performed at", "spoke at", "was delegate at (free text)", "was delegate at (item)" ), "events",
          if( str(?ppa_label) in ("curated (item)", "donor to", "loaner to", "recovered (free text)", "seller to", "was collector of", "was donor of" ), "collections",
            if( str(?ppa_label) in ("educated at"),  "education" ,
                if( str(?ppa_label) in ("election to Council of CAS proposed by", "election to RAI proposed by", "election to SAL proposed by", "proposed election to RHS signed by (personal)"),  "elections" ,
                      if( str(?ppa_label) in ("Member of Committee for Archaeological Fieldwork", "President of Committee for Archaeological Fieldwork", "director of archaeological fieldwork", "director of expedition", "member of excavation during archaeological fieldwork", "member of expedition", "travelled overseas for"
),  "fieldwork" ,
                        if( str(?ppa_label) in ("applicant to", "employed as", "held position", "held position (free text)"),  "positions" ,
                            if( str(?ppa_label) in ("contributed to", "editor", "illustrated in", "published with", "work(s) published in"),  "publishing" ,
                              if( str(?ppa_label) in ("served on", "was fellow of", "was member of"),  "societies",
                                  if( str(?ppa_label) in ("benefactor to", "fundraiser for"),  "charity" ,
      "tbd")))))))))
    as ?bucket).
       
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
order by ?personLabel ?ppa_label
</sparql>
</sparql>


579

edits