Project:SPARQL/examples: Difference between revisions

Line 1,849: Line 1,849:
# Query for women with no dates
# Query for women with no dates
# WIP: at present this includes <unknown value> dates as well as no dates at all [eg Miss Keyser Q2622]
# WIP: at present this includes <unknown value> dates as well as no dates at all [eg Miss Keyser Q2622]
# CAVEAT: the WQS bug means there are likely to be some women in results who do, in fact, have at least one date.


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 1,892: Line 1,893:
having (?count=0)
having (?count=0)
ORDER BY ?person
ORDER BY ?person
</sparql>
=== Women with more than X statements but no date of birth/death===
<sparql tryit="1">
# Query to find women with n>X statements (currently 10) but no date of birth/death
# CAVEAT this currently finds some women who do have dates because of WQS bug, eg Jane Ellen Harrison Q911
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 ?person ?personLabel ?statements ?dob ?dod
WHERE {
  ?person bnwdt:P3 bnwd:Q3 ;
        wikibase:statements ?statements .
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .}
 
  optional { ?person bnwdt:P15 ?dod .  }
  optional { ?person bnwdt:P26 ?dob .  }
 
  FILTER (?statements >10) . # can adjust n statements here...
 
  FILTER (NOT EXISTS { ?person bnwdt:P15 ?dod .} || NOT EXISTS { ?person bnwdt:P26 ?dob .  } ) . # can adjust filter to look for dob/dod separately
 
  SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
  }
}
order by ?personLabel


</sparql>
</sparql>
579

edits