Project:SPARQL/admin: Difference between revisions

(moved admin/QC queries into a new page)
 
Line 597: Line 597:
}
}
order by ?byLabel ?personLabel ?date ?degreeLabel
order by ?byLabel ?personLabel ?date ?degreeLabel
</sparql>
==== More potential problems with dates ====
<sparql tryit="1">
#title:academic degree Oxford/Cambridge potential date issues (again)
# looking for cases where there might be a date problem but there isn't a queryable date
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/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
SELECT distinct ?personLabel ?degreeLabel ?note ?byLabel ?link
WHERE { 
  ?person bnwdt:P3 bnwd:Q3 . #select women
 
  # academic degree = P59.
  ?person bnp:P59 ?s . 
    ?s bnps:P59 ?degree . # type of degree
 
  # optional qualifiers for degree
 
  # P60 subject
  #  optional { ?s bnpq:P60 ?subject}
 
  # P61 conferred by
    ?s bnpq:P61 ?by . 
 
  filter ( ?by=bnwd:Q1181 || ?by=bnwd:Q364 ).
 
  # date
  optional { ?s (bnpq:P1 | bnpq:P27 | bnpq:P28 ) ?date . }
  filter not exists { ?s (bnpq:P1 | bnpq:P27 | bnpq:P28 ) ?date .}
 
  ?s bnpq:P47 ?note . 
 
  # direct link to relevant statement
  BIND (REPLACE(STR(?s), "^.*/([^/]*)$", "$1") as ?sid).
    # for some grrr reason the first dash is replaced with a $ in the html id.
  bind(replace(?sid, "^(Q\\d+)-", "$1\\$") as ?pid) .
  bind(iri(concat(str(?person), "#", ?pid)) as ?link )
       
  SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
}
order by ?personLabel ?date ?degreeLabel
</sparql>
</sparql>


583

edits