Project:SPARQL/examples

Revision as of 13:02, 14 December 2022 by Drjwbaker (talk | contribs)

SAL

People who signed nomination for SAL elections based on personal knowledge, sorted by frequency of signatures

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 ?SALsignatoryLabel ?SALsignatory (count(*) as ?count) WHERE {
  ?person bnp:P16 ?SALstatement .
  ?SALstatement bnps:P16 ?SALproposed .
  ?SALstatement bnpq:P32 ?SALsignatory .
    SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
    }
}
GROUP BY ?SALsignatoryLabel ?SALsignatory
ORDER BY DESC(?count)

Try it!


People whose elections were proposed to SAL or RAI, including who proposed, seconded, or signed (excluding 'general knowledge' signatures) their proposal for election, seperated by type, and including the date the proposals were made

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 ?SALproposedLabel ?SALsignatorypersonalLabel ?SALsignatorygeneralLabel ?RAIproposedLabel ?RAIsecondedLabel ?date WHERE
{
  {
  ?person bnwdt:P3 bnwd:Q3 .
  ?person bnp:P16 ?SALstatement .
  ?SALstatement bnps:P16 ?SALproposed .
  ?SALstatement bnpq:P32 ?SALsignatorypersonal .
  ?SALstatement bnpq:P1 ?date .
  }
  UNION
  {
  ?person bnwdt:P3 bnwd:Q3 .
  ?person bnp:P7 ?RAIstatement .
  ?RAIstatement bnps:P7 ?RAIproposed .
  OPTIONAL {?RAIstatement bnpq:P8 ?RAIseconded .}
  ?RAIstatement bnpq:P1 ?date .
  }
    SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
    }
}
ORDER BY ?date
# I only got how to do this when I read https://wdqs-tutorial.toolforge.org/index.php/category/simple-queries/qualifiers/ Huge thanks to @Tagishsimon for pointing out my error and forcing me to do it properly :)

Try it!


People whose elections were proposed to SAL linked in a graph to those who signed their nomination for election based on personal knowledge

#People whose elections were proposed to SAL linked in a graph to those who signed their nomination for election based on personal knowledge

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/>

#defaultView:Graph
SELECT ?person ?personLabel ?rgb ?SALsignatory ?SALsignatoryLabel WHERE {
  ?person bnp:P16 ?SALstatement .
  ?SALstatement bnps:P16 ?SALproposed .
  ?SALstatement bnpq:P32 ?SALsignatory .
    SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
    }
  BIND( "7C4DCD" AS ?rgb ) .
}
# I don't know how to use 'edgeLabel' to show the types of interaction, but if you have an idea suggest an edit!

Try it!


People whose election to SAL was proposed and the person who proposed them, with - where known - date of proposal, gender of proposed FSA and proposer, and if elected

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 wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd:  <http://www.wikidata.org/entity/>

SELECT ?FSA ?date ?FSALabel ?FSAgenderLabel ?proposer ?proposerLabel ?proposergenderLabel ?electedLabel
WHERE {  
  ?FSA bnwdt:P16 ?proposer .                                #select proposed FSA and their proposed
    OPTIONAL {?FSA bnwdt:P3 ?FSAgender .}                   #option select gender of proposed FSA
    OPTIONAL {?proposer bnwdt:P3 ?proposergender}           #option select gender of proposer
  ?FSA bnp:P16 ?SALstatement .
  ?SALstatement bnps:P16 ?SALproposed .
    OPTIONAL {?SALstatement bnpq:P1 ?date .}                #option select date of proposal
    OPTIONAL {?SALstatement bnpq:P22 ?elected .}            #option select if elected
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?date

Try it!


People who proposed elections to SAL, sorted by the frequency of individual co-signatories

# people who proposed elections to SAL, sorted by the frequency of individual co-signatories
# e.g. Q137 co-signed proposals from Q136 on the number of occasions recorded in the 'co-signatory_count' column

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 ?SALproposerLabel ?SALproposer ?co_signatoryLabel ?co_signatory (count(?co_signatory) as ?co_signatory_count) WHERE {
  ?person bnp:P16 ?SALstatement .
  ?SALstatement bnps:P16 ?SALproposer .
  ?SALstatement bnpq:P32 ?co_signatory .
    SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
    }
}
GROUP BY ?SALproposerLabel ?SALproposer ?co_signatoryLabel ?co_signatory 
ORDER BY DESC(?co_signatory_count)

Try it!


Work

People, the positions that they held, and when they held them (if known)

# People, the positions that they held, and when they held them (if known)

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 ?position ?positionLabel ?date ?startdate ?enddate
WHERE {  
  ?person bnp:P17 ?hadposition .
  ?hadposition bnps:P17 ?position
  OPTIONAL {?hadposition bnpq:P1 ?date .}
  OPTIONAL {?hadposition bnpq:P27 ?startdate .}
  OPTIONAL {?hadposition bnpq:P28 ?enddate .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?positionLabel ?dateLabel

Try it!


===People, the positions that they held, the institution that employed them (if known), and date information (if known)

=

# People, the positions that they held, the institution that employed them (if known), and date information (if known)

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 ?position ?positionLabel ?employer ?employerLabel ?date ?startdate ?enddate
WHERE {  
  ?person bnp:P105 ?hadposition .
  ?hadposition bnps:P105 ?position
  OPTIONAL {?hadposition bnpq:P18 ?employer .}
  OPTIONAL {?hadposition bnpq:P1 ?date .}
  OPTIONAL {?hadposition bnpq:P27 ?startdate .}
  OPTIONAL {?hadposition bnpq:P28 ?enddate .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?positionLabel ?employerLabel

Try it!


Place

People not in London linked as a graph by a NUTS region or country (excluding England) at which they were once resident in the UK

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/>

#defaultView:Graph
SELECT ?resident ?residentLabel ?region ?regionLabel
WHERE {  
  ?resident bnwdt:P29 ?residence .
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q39 .} 
  ?residence bnwdt:P33 ?district .
  ?district bnwdt:P33 ?county .
  ?county bnwdt:P33 ?region .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}

Try it!


People whose residence was at one time in the east or south east of England, excluding London

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 ?resident ?residentLabel ?residenceLabel ?districtLabel ?countyLabel ?regionLabel
WHERE {  
  ?resident bnwdt:P29 ?residence .
  ?residence bnwdt:P33 ?district .
  ?district bnwdt:P33 ?county .
  ?county bnwdt:P33 ?region .
    {?county bnwdt:P33 bnwd:Q67 .}
    UNION
    {?county bnwdt:P33 bnwd:Q85 .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?regionLabel ?countyLabel ?districtLabel ?residenceLabel

Try it!


People not in London with the district, county, and region at which they were once resident (in the UK) listed

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 ?resident ?residentLabel ?district ?districtLabel ?county ?countyLabel ?region ?regionLabel
WHERE {  
  ?resident bnwdt:P29 ?residence .
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q39 .} 
  ?residence bnwdt:P33 ?district .
  ?district bnwdt:P33 ?county .
  ?county bnwdt:P33 ?region .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?regionLabel ?countyLabel ?districtLabel ?residentLabel

Try it!


People sorted by the number of places they lived, including the number of cites/towns/villages they lived in

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 (count(?resided) as ?residence_count) (count(distinct ?resided) as ?residence_distinct) WHERE {
   ?person bnwdt:P3 bnwd:Q3 ;
         wikibase:statements ?statements .
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnp:P29/bnps:P29 ?resided.
  SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
  }
} group by ?person ?personLabel ?statements order by desc(?residence_count)
# Credit to @Tagishsimon for helping me figure out the counting logic here

Try it!


People

Where women in our data are in wikidata, their spouses, fathers, and mothers according to wikidata

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 wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd:  <http://www.wikidata.org/entity/>

SELECT ?person ?personLabel ?item ?WD_spouse ?WD_father ?WD_mother
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnp:P117 ?wikidata_ID . #look for wikidata ID on person page
  ?wikidata_ID bnpq:P14 ?wikidata_url .
  BIND(IRI(REPLACE(?wikidata_url,"https://www.wikidata.org/wiki/","http://www.wikidata.org/entity/")) as ?item ) 
  
  SERVICE <https://query.wikidata.org/sparql> {
        ?item wdt:P21 ?WD_gender. #get gender of person
        OPTIONAL {?item wdt:P22 ?WD_father . } #recall father
        OPTIONAL {?item wdt:P25 ?WD_mother . } #recall mother
        OPTIONAL {?item wdt:P26 ?WD_spouse . } #recall spouse
      }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?personLabel
# with thanks to @tagishsimon for writing this one initially!

Try it!


Women in our data alongside counts of their public and professional activities, sorted by total

## Women in our data alongside counts of their public and professional activities (https://beyond-notability.wikibase.cloud/wiki/Item:Q151)
## Sorted by total PPAs

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
(count(distinct ?exhibitor) as ?exhibitions)
(count(distinct ?position) as ?positions)
(count(distinct ?speaker) as ?spoke)
(count(distinct ?attended) as ?attendance)
(count(distinct ?donorof) as ?donated)
(count(distinct ?wasdelegate) as ?delegate)
(count(distinct ?correspondent) as ?correspondents)
(count(distinct ?fellow) as ?fellowships)
(count(distinct ?collab) as ?collaborations)
(count(distinct ?found) as ?founded)
(count(distinct ?loaned) as ?loans)
(count(distinct ?illustrated) as ?illustrations)
(count(distinct ?sold) as ?sales)
(count(distinct ?served) as ?service)
(count(distinct ?job) as ?employed)
(count(distinct ?fundraiser) as ?fundraisers)
(count(distinct ?publish) as ?published)
(count(distinct ?benefact) as ?benefactor)
(count(distinct ?donor) as ?donor_to)
(count(distinct ?collect) as ?collected)
(count(distinct ?performance) as ?performances)
((?exhibitions + ?positions + ?spoke + ?attendance + ?donated + ?delegate + ?correspondents + ?fellowships + ?collaborations + ?founded + ?loans + ?illustrations + ?sales
 + ?service + ?employed + ?fundraisers + ?published + ?benefactor + ?donor_to + ?collected + ?performances) AS ?PPA_total)

where
{
  ?person bnwdt:P3 bnwd:Q3 .
  optional { ?person bnp:P13 ?exhibitor }
  optional { ?person bnp:P17 ?position }
  optional { ?person bnp:P23 ?speaker }
  optional { ?person bnp:P24 ?attended }
  optional { ?person bnp:P65 ?donorof }
  optional { ?person bnp:P71 ?wasdelegate }
  optional { ?person bnp:P73 ?correspondent }
  optional { ?person bnp:P75 ?fellow }
  optional { ?person bnp:P83 ?collab }
  optional { ?person bnp:P85 ?found }
  optional { ?person bnp:P87 ?loaned }
  optional { ?person bnp:P89 ?illustrated }
  optional { ?person bnp:P99 ?sold }
  optional { ?person bnp:P102 ?served }
  optional { ?person bnp:P105 ?job }
  optional { ?person bnp:P106 ?fundraiser }
  optional { ?person bnp:P107 ?publish }
  optional { ?person bnp:P110 ?benefact }
  optional { ?person bnp:P111 ?donor }
  optional { ?person bnp:P114 ?collect }
  optional { ?person bnp:P120 ?performance }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
group by ?person ?personLabel
ORDER BY DESC (?PPA_total)

Try it!


Women in our data arranged as a network graph by the organisations they were members of

## Women in our data arranged as a network graph by the organisations they were members of
#defaultView:Graph
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
SELECT  ?org ?orgLabel ?rgb ?linkTo ?linkToLabel 
WHERE {  
  ?linkTo bnwdt:P3 bnwd:Q3 .                                #select women
  FILTER NOT EXISTS {?linkTo bnwdt:P4 bnwd:Q12 .}          #filter out project team
  ?linkTo bnwdt:P67 ?org
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". } 
  BIND( "7C4DCD" AS ?rgb ) .

}
ORDER BY ?personLabel

Try it!


IDs

Women in the wiki (excluding the project team) and their corresponding IDs - where they exist - on wikidata, viaf, WorldCat Identities, and the Archaeology Data Service

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 wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd:  <http://www.wikidata.org/entity/>

SELECT ?person ?personLabel ?wikidata_ID ?viaf_ID ?ads_ID ?worldcat_ID 
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 .                                 #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .}            #filter out project team
    OPTIONAL {?person bnwdt:P117 ?wikidata_ID .}             #return wikidata ID
    OPTIONAL {?person bnwdt:P119 ?viaf_ID .}                 #return VIAF ID
    OPTIONAL {?person bnwdt:P34 ?ads_ID .}                   #return Archaeological Data Service ID
    OPTIONAL {?person bnwdt:P118 ?worldcat_ID .}             #return WorldCat Identities ID
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?personLabel

Try it!


People with IDs on wikidata, their date of birth on wikidata, and the source(s) of that information

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 wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd:  <http://www.wikidata.org/entity/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX prov: <http://www.w3.org/ns/prov#>

SELECT ?woman ?womanLabel ?WDitem ?WDdateOfBirth (GROUP_CONCAT(?BirthStatedInEnglish;separator=" | ") AS ?sources)
WHERE {  
  #Select all women
  ?woman bnwdt:P3 bnwd:Q3 .
  #select all women that have a Wikidata link
  ?woman bnwdt:P117 ?Qnumber .    
  
  #create reference to Wikibase entity
  BIND(IRI(concat("http://www.wikidata.org/entity/", ?Qnumber)) as ?WDitem ) 
  #on Wikibase do
  SERVICE <https://query.wikidata.org/sparql> {
        #get the date of birth
        ?WDitem wdt:P569 ?WDdateOfBirth .
        #get the statement of birth
        ?WDitem p:P569 ?Birthstatement .
        #get its node
        ?Birthstatement prov:wasDerivedFrom ?BirthRefnode.
        #get the value of 'Stated in'
        ?BirthRefnode   pr:P248 ?BirthStatedIn.
        #get the english label of the referece 'stated in'
        OPTIONAL {?BirthStatedIn rdfs:label ?BirthStatedInEnglish 
                  FILTER (LANG(?BirthStatedInEnglish) = "en")}.
      } 
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
GROUP BY ?woman ?womanLabel ?WDitem ?WDdateOfBirth
ORDER BY ?womanLabel
# Credit to Maarten Zeinstra for developing this query

Try it!


Admin

Women about whom we have recorded fewer than 3 pieces of information

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 WHERE {
   ?person bnwdt:P3 bnwd:Q3 ;
         wikibase:statements ?statements .
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .}
  FILTER (?statements <3)
  SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
  }
}

Try it!


People for whom their item records is given as 'Mrs'

SELECT ?id ?name
WHERE {  
  ?id rdfs:label ?name .
  FILTER regex(?name, "mrs *", "i") #this line uses regular expression syntax, described at https://regexper.com/#mrs%5Cs*
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}

Try it!


All triples in the wiki, limited to 1000

SELECT ?a ?aLabel ?b ?c WHERE {
    ?a ?b ?c
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
}
LIMIT 1000 #please don't make this number too big as it will slow down the site!

Try it!


All triples in the wiki, represented as a crude graph

#defaultView:Graph
SELECT ?a ?aLabel ?c ?cLabel WHERE {
    ?a ?b ?c
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
}
#note query returns every connection in the wikibase so it may fall over!

Try it!


People whose assigned gender we have been unable to determine and/or confirm

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 wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd:  <http://www.wikidata.org/entity/>

SELECT ?person ?personLabel
WHERE {  
  ?person bnwdt:P3 ?gender .                               
  FILTER NOT EXISTS {?person bnwdt:P3 bnwd:Q3 .}          #filter out people identified as women
  FILTER NOT EXISTS {?person bnwdt:P3 bnwd:Q10 .}          #filter out people identified as men
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?personLabel

Try it!


Tools for batch processing and quality assurance work

All people (by assigned gender), filtering out those already listed as instance of human

# All people (by assigned gender), filtering out those already listed as instance of human

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 wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd:  <http://www.wikidata.org/entity/>

SELECT ?person ?personLabel ?assigned_genderLabel
WHERE {  
  ?person bnwdt:P3 ?assigned_gender .                        #select person
  FILTER NOT EXISTS {?person bnwdt:P12 bnwd:Q2137 .}         #filter out people already listed as instance of human
  FILTER NOT EXISTS {?person bnwdt:P12 bnwd:Q12 .}            #filter out project team
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?personLabel

Try it!


All places (by coordinate location on wikidata), filtering out places already listed as instance of locality

# All places (by coordinate location on wikidata), filtering out places already listed as instance of locality

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 wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd:  <http://www.wikidata.org/entity/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX prov: <http://www.w3.org/ns/prov#>

SELECT ?place ?placeLabel ?WDitem ?WDcoordinate_location

WHERE {  
  ?place bnwdt:P33 ?admin_area .  #select items with 'located in the administrative territorial entity' statements
  ?place bnwdt:P117 ?Qnumber .    #get wikidata ID
  FILTER NOT EXISTS {?place bnwdt:P12 bnwd:Q2147 .}       #filter out places already listed as instance of locality
  
  #create reference to Wikibase entity
  BIND(IRI(concat("http://www.wikidata.org/entity/", ?Qnumber)) as ?WDitem ) 
  #on Wikibase do
  SERVICE <https://query.wikidata.org/sparql> {
        ?WDitem wdt:P625 ?WDcoordinate_location . #get coordinate location on wikidata
      } 
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
GROUP BY ?place ?placeLabel ?WDitem ?WDcoordinate_location
ORDER BY ?placeLabel

Try it!


All items without a P12 (instance of) triple

# All items without a P12 (instance of) triple

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 ?item ?itemLabel WHERE {
   ?item ?b ?c ;
  FILTER NOT EXISTS {?item bnwdt:P12 ?anything .}
  SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
  }
}

Try it!