Project:SPARQL/examples: Difference between revisions

From Beyond Notability
(40 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Project:SPARQL/admin | Admin/batch tools queries]]
==SAL and RAI==
==SAL and RAI==


Line 216: Line 218:
PREFIX wd:  <http://www.wikidata.org/entity/>
PREFIX wd:  <http://www.wikidata.org/entity/>


SELECT distinct ?person ?personLabel  ?prop ?propLabel  ?pq_value  ?qual_prop_label ?sal  
SELECT distinct ?person ?personLabel  ?prop ?propLabel  ?pq_value  ?qual_propLabel ?sal  


WHERE {   
WHERE {   
Line 235: Line 237:
          
          
         ?qual_prop wikibase:qualifier ?pq .   
         ?qual_prop wikibase:qualifier ?pq .   
         ?qual_prop rdfs:label ?qual_prop_label. filter(lang(?qual_prop_label)="en-gb") .  
         #?qual_prop rdfs:label ?qual_prop_label. filter(lang(?qual_prop_label)="en-gb") .  
         ?qual_prop wikibase:propertyType ?qual_prop_type
         #?qual_prop wikibase:propertyType ?qual_prop_type
          
          
       } # /qualifiers
       } # /qualifiers


   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
}
}
ORDER BY ?personLabel ?propLabel ?s
ORDER BY ?personLabel ?propLabel ?s
Line 258: Line 260:
PREFIX wd:  <http://www.wikidata.org/entity/>
PREFIX wd:  <http://www.wikidata.org/entity/>


SELECT distinct ?person ?personLabel  ?prop ?propLabel ?prop_type  ?pq_value ?pq_valueLabel ?qual_prop_label ?qual_prop_type ?rai ?s
SELECT distinct ?person ?personLabel  ?prop ?propLabel ?prop_type  ?pq_value ?pq_valueLabel ?qual_propLabel ?qual_prop_type ?rai ?s


WHERE {   
WHERE {   
Line 278: Line 280:
          
          
         ?qual_prop wikibase:qualifier ?pq .   
         ?qual_prop wikibase:qualifier ?pq .   
         ?qual_prop rdfs:label ?qual_prop_label. filter(lang(?qual_prop_label)="en-gb") .  
         #?qual_prop rdfs:label ?qual_prop_label. filter(lang(?qual_prop_label)="en-gb") .  
         ?qual_prop wikibase:propertyType ?qual_prop_type .
         ?qual_prop wikibase:propertyType ?qual_prop_type .
          
          
       } # /qualifiers
       } # /qualifiers


   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
}
}
ORDER BY ?personLabel
ORDER BY ?personLabel
Line 453: Line 455:
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?personLabel ?work_label ?positionLabel ?date_label ?date  
SELECT distinct ?personLabel ?workLabel ?positionLabel ?date_pLabel ?date  
?employerLabel ?organisedLabel ?ofLabel  
?employerLabel ?organisedLabel ?ofLabel ?person
?s ?person ?work ?position ?employer ?organised ?of
#?s ?position  ?of  ?work ?employer ?organised


WHERE {
WHERE {
Line 465: Line 467:
    
    
   ?person ?work_p ?s . # for activity type label
   ?person ?work_p ?s . # for activity type label
   ?work wikibase:claim ?work_p;     
   ?work wikibase:claim ?work_p .   
        rdfs:label ?work_label. filter(lang(?work_label)="en-gb") .   
      
      
     # more about the position
     # more about the position
Line 482: Line 483:
     ?s ?pq ?date .  
     ?s ?pq ?date .  
        
        
       ?qual_prop wikibase:qualifier ?pq;       
       ?date_p wikibase:qualifier ?pq;       
               #wikibase:propertyType ?date_prop_type; # can check date property types if needed
               #wikibase:propertyType ?date_prop_type; # can check date property types if needed
               wikibase:propertyType wikibase:Time ; # nb *does not* include edtf dates but AFAICT there are none in qualifiers.
               wikibase:propertyType wikibase:Time . # nb *does not* include edtf dates but AFAICT there are none in qualifiers.
               rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # what kind of date is it.
               #rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # what kind of date is it.
       } # /dates
       } # /dates
    
    
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
    
    
} # /where
} # /where
Line 553: Line 554:
</sparql>
</sparql>


 
=== Lecturers ===
== Professional Activities and Organisations ==
 
=== Women's service on committees etc (P102) ===


<sparql tryit="1">
<sparql tryit="1">
 
#title:lecturers
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 567: Line 565:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
SELECT distinct ?person ?personLabel  ?positionLabel
?organisedLabel ?ofLabel
?qual_propLabel ?qualLabel
#?position ?of  ?work ?organised  ?date_precision ?qual_prop ?date ?qual ?workLabel
?s


SELECT distinct ?personLabel ?serviceLabel ?qual_propLabel  ?qualLabel  ?service ?qual ?person #?s
WHERE {
WHERE {
   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # women
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
    
 
  # work activities: held position / held position (free text) /  employed as
   ?person bnp:P102 ?s .  # served on P102
   #?person ( bnp:P17|bnp:P48|bnp:P105 ) ?s .
   ?person ?p ?s .   # for claim
    
   ?person ?work_p ?s . # for activity type label
    ?work wikibase:claim ?work_p . 
 
    ?s ?bnps ?position . 
    # freelance and extension lecturing (q701 and q3021)
    { ?s ?bnps bnwd:Q701  . } union { ?s ?bnps bnwd:Q3021 .  }
    
    
  ?claim wikibase:claim ?p;     
    # employer / organised by / of (incl free text).
        wikibase:statementProperty ?ps;
    OPTIONAL { ?s bnpq:P109 ?organised .}
        wikibase:propertyType ?prop_type.  
    OPTIONAL { ?s ( bnpq:P78 | bnpq:P66 ) ?of .}
  # optional { ?s bnpq:P2 ?location . } # do locations separately.
      
      
    ?s ?ps ?service . # service on what
  # dates with precision
      
#  optional {
  optional { #qualifiers, if any
#    ?s (bnpqv:P1 | bnpqv:P27 | bnpqv:P28  ) ?pqv.
    ?s ?pq ?qual .    
#    ?s ?pqq ?pqv . # just gets the uri but doesnt seem to cause dups
        ?qual_prop wikibase:qualifier ?pq.    
#        ?pqv wikibase:timeValue ?date . 
        SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".  
#        ?pqv wikibase:timePrecision ?date_precision .
        ?qual_prop rdfs:label ?qual_propLabel .  # what kind of thing
#    }
        } # /label service
     
      } # /quals
     # qualifiers
    optional {
      ?s ?pq ?qual .  
        ?qual_prop wikibase:qualifier ?pq .
     
      } # /dates
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
 
} # /where


  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb, en". }
ORDER BY ?person ?s 
}
</sparql>


ORDER BY ?personLabel ?s
== Professional Activities and Organisations ==
</sparql>


=== Women's service: information about "of" qualifier, including alternatives for locations===
=== Women's service on committees etc (P102) ===


<sparql tryit="1">
<sparql tryit="1">
#title: query for served on "of" info
# where a women served on committee *of* organisation, need to link to info about the organisation, including location.
# geo data for the location may be in its BN page but is more likely to need to be fetched from wikidata
# todo: check whether there are orgs that don't have location info in BN but do have it in wikidata


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 612: Line 630:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT distinct ?personLabel ?serviceLabel ?of ?ofLabel ?of_location ?of_locationLabel ?of_geo ?of_long ?of_lat ?person #?s


SELECT distinct ?personLabel ?serviceLabel ?qual_propLabel  ?qualLabel  ?qual ?person ?s # ?service
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .}  
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
 
 
   ?person bnp:P102 ?s .   
   ?person bnp:P102 ?s .  # served on P102
    ?s bnps:P102 ?service .
    ?s bnps:P102 ?service .
     ?s bnpq:P78 ?of .
      
 
  optional {  #qualifiers, if any
      #optional { ?of bnwdt:P117 ?of_wikidata. }   #todo
    ?s ?pq ?qual .    
        ?qual_prop wikibase:qualifier ?pq.    
      } # /quals


      optional { ?of bnwdt:P2 ?of_location.  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb, en". }
}


            optional { ?of_location bnwdt:P153 ?bn_of_geo . }
ORDER BY ?personLabel ?s


            optional { ?of_location bnwdt:P117 ?wd_of_loc .
</sparql>
                            bind(iri(concat("http://www.wikidata.org/entity/", str(?wd_of_loc))) as ?wd_of_loc_url) .  
 
                           
=== Women corresponding with individuals ===
                        SERVICE <https://query.wikidata.org/sparql> {
 
                        optional {?wd_of_loc_url wdt:P625 ?wd_of_geo .}  # wikidata geocoords
<sparql tryit="1">
                        } # /wikidata service 
#title:women corresponding with individuals
                    } #/optional location wikidata
 
              } #/optional P2 location.  
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 ?correspondent ?correspondentLabel  ?qualifier_label
?qualifier ?qualifierLabel
 
where
{
  ?person bnwdt:P3 bnwd:Q3 .


      BIND(COALESCE(?bn_of_geo, ?wd_of_geo) AS ?of_geo).  # if we have bn_geo use that, then try wd_geo
  ?person bnp:P73 ?s .
    ?s bnps:P73 ?correspondent . # corresponded with 
    ?correspondent bnwdt:P12 bnwd:Q2137 .  # correspondent is i/o human
    
    
       BIND(geof:longitude(?of_geo) AS ?of_long)
    optional
      BIND(geof:latitude(?of_geo) AS ?of_lat)
       { ?s ?qual_p ?qualifier . 
        ?qual_prop wikibase:qualifier ?qual_p.
        ?qual_prop rdfs:label ?qualifier_label. filter(lang(?qualifier_label)='en') .
      }
    
    
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb, en". }  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
}
ORDER BY ?personLabel ?s
 
ORDER BY ?person
</sparql>
</sparql>


=== Women's service: information about "of" qualifier, including alternatives for locations===


=== All activities for women that have instance of public and professional activities===
<sparql tryit="1">
#title: query for served on "of" info
# where a women served on committee *of* organisation, need to link to info about the organisation, including location.
# geo data for the location may be in its BN page but is more likely to need to be fetched from wikidata
# todo: check whether there are orgs that don't have location info in BN but do have it in wikidata


<sparql tryit="1">
#title:women and PPA
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 660: Line 703:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?person ?personLabel ?ppa_label ?ppa ?ppa_valueLabel ?ppa_value ?s  
SELECT distinct ?personLabel ?serviceLabel ?of ?ofLabel ?of_location ?of_locationLabel ?of_geo ?of_long ?of_lat ?person #?s  
 
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 .
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person ?p ?s .
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .}
 
      ?ppa wikibase:claim ?p;     
  ?person  bnp:P102 ?s . 
        wikibase:statementProperty ?ps.     
    ?s bnps:P102 ?service .
         
    ?s bnpq:P78 ?of .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb".  
                ?ppa rdfs:label ?ppa_label.
            } # /label service
    
    
       ?ppa bnwdt:P12 bnwd:Q151 . # instance of PPA     
       #optional { ?of bnwdt:P117 ?of_wikidata. #todo
     
      # get a bit of detail about the ppa
      ?s ?ps ?ppa_value.


  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
      optional { ?of bnwdt:P2 ?of_location.  
}


order by ?personLabel ?ppa_label
            optional { ?of_location bnwdt:P153 ?bn_of_geo . }
</sparql>


            optional { ?of_location bnwdt:P117 ?wd_of_loc .
                            bind(iri(concat("http://www.wikidata.org/entity/", str(?wd_of_loc))) as ?wd_of_loc_url) .
                           
                        SERVICE <https://query.wikidata.org/sparql> {
                        optional {?wd_of_loc_url wdt:P625 ?wd_of_geo .}  # wikidata geocoords
                        } # /wikidata service 
                    } #/optional location wikidata
              } #/optional P2 location.


===Counts of PPAs for women===
      BIND(COALESCE(?bn_of_geo, ?wd_of_geo) AS ?of_geo).  # if we have bn_geo use that, then try wd_geo
<sparql tryit="1">
 
#title:counting women's instance of PPA
      BIND(geof:longitude(?of_geo) AS ?of_long)
      BIND(geof:latitude(?of_geo)  AS ?of_lat)
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb, en". }
}
ORDER BY ?personLabel ?s
</sparql>
 
 
=== All activities for women that have instance of public and professional activities===
 
<sparql tryit="1">
#title:women and PPA
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 695: Line 751:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?ppa_label ?ppa (count(?ppa) as ?count)
SELECT ?person ?personLabel ?ppa_label ?ppa ?ppa_valueLabel ?ppa_value ?s
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 .
   ?person bnwdt:P3 bnwd:Q3 .
Line 704: Line 760:
            
            
       SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb".  
       SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb".  
                      ?ppa rdfs:label ?ppa_label.       # what kind of thing
                ?ppa rdfs:label ?ppa_label.
                } # /label service
            } # /label service
    
    
       ?ppa bnwdt:P12 bnwd:Q151 . # ahhhh at last      
       ?ppa bnwdt:P12 bnwd:Q151 . # instance of PPA      
        
        
       # get stuff about ?s
       # get a bit of detail about the ppa
       #?s ?ps ?ppa_value.
       ?s ?ps ?ppa_value.


   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
group by ?ppa_label ?ppa


order by desc(?count)
order by ?personLabel ?ppa_label
</sparql>
</sparql>


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


===Counts of PPAs for women===
<sparql tryit="1">
<sparql tryit="1">
# 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
#title:counting women's instance of PPA
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 734: Line 786:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


#defaultView:Graph
SELECT ?ppa_label ?ppa  (count(?ppa) as ?count)
SELECT ?resident ?residentLabel ?region ?regionLabel
WHERE {   
WHERE {   
   ?resident bnwdt:P29 ?residence .
   ?person bnwdt:P3 bnwd:Q3 .
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2035 .}
  ?person ?p ?s .
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2036 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2037 .}
      ?ppa wikibase:claim ?p;     
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2038 .}
        wikibase:statementProperty ?ps.    
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2039 .}
         
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2040 .}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb".  
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2041 .}
                      ?ppa rdfs:label ?ppa_label.       # what kind of thing
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2042 .}
                } # /label service
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q39.}
 
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2534.}
      ?ppa bnwdt:P12 bnwd:Q151 . # ahhhh at last     
  ?residence bnwdt:P33 ?district .
     
  ?district bnwdt:P33 ?county .
      # get stuff about ?s
  ?county bnwdt:P33 ?region .
      #?s ?ps ?ppa_value.
 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
group by ?ppa_label ?ppa
order by desc(?count)
</sparql>
</sparql>


===People whose residence was at one time in the east or south east of England, excluding London===
=== PPA Buckets for Women ===


<sparql tryit="1">
<sparql tryit="1">
#title:ppa buckets (revised February 2024)
# broad PPA grouping categories to use for overviews and analysis within categories
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 766: Line 824:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?resident ?residentLabel ?residenceLabel ?districtLabel ?countyLabel ?regionLabel
SELECT distinct ?person ?personLabel ?ppa_label ?ppa ?bucket
?ppa_value ?ppa_valueLabel
?s
WHERE {   
WHERE {   
   ?resident bnwdt:P29 ?residence .
   ?person bnwdt:P3 bnwd:Q3 .
  ?residence bnwdt:P33 ?district .
  ?person ?p ?s .
  ?district bnwdt:P33 ?county .
   ?county bnwdt:P33 ?region .
      ?ppa wikibase:claim ?p;     
     {?county bnwdt:P33 bnwd:Q67 .}
        wikibase:statementProperty ?ps. 
     UNION
 
     {?county bnwdt:P33 bnwd:Q85 .}
      # note: i think you need rdfs:label (*Label won't work) for the bind()
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
 
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb".  
                      ?ppa rdfs:label ?ppa_label.  
                } # /label service
    
      ?ppa bnwdt:P12 bnwd:Q151 . # i/o ppa     
      # get stuff about ?s
      ?s ?ps ?ppa_value.
 
     # note: it would be possible to write this to use ppa rather than ppa_label
    # BUT then it would be much more opaque and difficult to edit if (when!) we make any changes to the buckets.
     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 ("acknowledged for role", "applicant to", "employed as", "held position", "held position (free text)", "served on"),  "positions" ,
                  if( str(?ppa_label) in ("contributed to", "illustrated in", "work(s) published in"),  "publishing",
                    if( str(?ppa_label) in ("corresponded with", "was fellow of", "was member of"),  "societies",
                      if( str(?ppa_label) in ("benefactor to", "fundraiser for", "founded"),  "charitable" ,
      "none")))))))))
     as ?bucket).
       
 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
}
}
ORDER BY ?regionLabel ?countyLabel ?districtLabel ?residenceLabel
 
order by ?personLabel ?ppa_label
</sparql>
</sparql>


===People whose residence was at one time in North East England or Yorkshire and the Humber===
 
=== Suffrage-related activities ===


<sparql tryit="1">
<sparql tryit="1">
# People whose residence was at one time in North East England or Yorkshire and the Humber
#title:initial query for suffrage activities


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 793: Line 882:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?resident ?residentLabel ?residenceLabel ?districtLabel ?countyLabel ?regionLabel
SELECT distinct ?person ?personLabel ?mainLabel ?sub_Label ?qualLabel ?locationLabel ?date
# ?pq ?sub_ ?qual ?main
?s
 
WHERE {   
WHERE {   
  ?resident bnwdt:P29 ?residence .
  ?residence bnwdt:P33 ?district .
  ?district bnwdt:P33 ?county .
  ?county bnwdt:P33 ?region .
    {?county bnwdt:P33 bnwd:Q72 .}
    UNION
    {?county bnwdt:P33 bnwd:Q200 .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
}
ORDER BY ?regionLabel ?countyLabel ?districtLabel ?residenceLabel
</sparql>


===People not in London with the district, county, and region at which they were once resident (in the UK) listed===
    ?person bnwdt:P3 bnwd:Q3 . #select women
    FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team


<sparql tryit="1">
    ?person ?p ?s .
# People not in London with the district, county, and region at which they were once resident (in the UK) listed
 
      ?s ?sub ?sub_ .
        ?main wikibase:claim ?p.
        ?main wikibase:statementProperty ?sub. 
 
  # sub_ i/o - some do have suffrage activity
  # optional { ?sub_ bnwdt:P12 ?sub_io . ?sub_ bnwdt:P12 bnwd:Q1166 . }


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
  # union
  {
    # a qualifier (anywhere) has i/o suffrage activity
      ?s bnpq:P12 bnwd:Q1166.
    }
 
# what about a main rather than qualifier having i/o suffrage activity? i don't think there are any atm but could be.
# union
#  { # this might find extra linked i/o suffrage but i'm not sure it works.
#    ?sub_ bnwdt:P12 bnwd:Q1166 .
#    }
 
  union
    {
    # does *not* have i/o suffrage activity in any qualifiers  ... slows things right down and doesn't seem to make any difference to results?
    #filter not exists { ?s bnpq:P12 bnwd:Q1166. }
 
    # ... but a qualifier *does* have i/o suffrage activity. i think!
      ?s ?pq ?qual .
        ?qual bnwdt:P12 bnwd:Q1166 .
 
      } # /union
 
  optional {
    # date qualifiers. [assumes no edtf in quals. ] all seem to be p.i.t.
        ?s ?dpq ?date . 
          ?qual_date wikibase:qualifier ?dpq .
          ?qual_date wikibase:propertyType wikibase:Time.
  }
 
  optional { ?s bnpq:P78 ?of. }  # outside the union seems much speedier
 
  optional { ?s bnpq:P2 ?location . }
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
 
}
order by ?personLabel ?mainLabel
</sparql>
 
==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===
 
<sparql tryit="1">
# 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 bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
Line 820: Line 955:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?resident ?residentLabel ?district ?districtLabel ?county ?countyLabel ?region ?regionLabel
#defaultView:Graph
SELECT ?resident ?residentLabel ?region ?regionLabel
WHERE {   
WHERE {   
   ?resident bnwdt:P29 ?residence .
   ?resident bnwdt:P29 ?residence .
Line 838: Line 974:
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
ORDER BY ?regionLabel ?countyLabel ?districtLabel ?residentLabel
</sparql>
</sparql>


===People sorted by the number of places they lived, including the number of cites/towns/villages they lived in===
===People whose residence was at one time in the east or south east of England, excluding London===


<sparql tryit="1">
<sparql tryit="1">
Line 852: Line 987:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?person ?personLabel (count(?resided) as ?residence_count) (count(distinct ?resided) as ?residence_distinct) WHERE {
SELECT ?resident ?residentLabel ?residenceLabel ?districtLabel ?countyLabel ?regionLabel
  ?person bnwdt:P3 bnwd:Q3 ;
WHERE {
        wikibase:statements ?statements .
  ?resident bnwdt:P29 ?residence .
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?residence bnwdt:P33 ?district .
  ?person bnp:P29/bnps:P29 ?resided.
  ?district bnwdt:P33 ?county .
   SERVICE wikibase:label {
   ?county bnwdt:P33 ?region .
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
    {?county bnwdt:P33 bnwd:Q67 .}
  }
    UNION
} group by ?person ?personLabel ?statements order by desc(?residence_count)
    {?county bnwdt:P33 bnwd:Q85 .}
# Credit to @Tagishsimon for helping me figure out the counting logic here
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
}
ORDER BY ?regionLabel ?countyLabel ?districtLabel ?residenceLabel
</sparql>
</sparql>


===Places at which women resided, sorted by how many residences all women had at a given village/town/city/London area===
===People whose residence was at one time in North East England or Yorkshire and the Humber===


<sparql tryit="1">
<sparql tryit="1">
# Places at which women resided, sorted by how many residences all women had at a given village/town/city/London area
# People whose residence was at one time in North East England or Yorkshire and the Humber


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 877: Line 1,014:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?residence ?residenceLabel (count(?residence) as ?residence_count) #count number of places at which women lived
SELECT ?resident ?residentLabel ?residenceLabel ?districtLabel ?countyLabel ?regionLabel
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?resident bnwdt:P29 ?residence .
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?residence bnwdt:P33 ?district .
  ?person bnwdt:P29 ?residence . # select residences
   ?district bnwdt:P33 ?county .
  ?county bnwdt:P33 ?region .
    {?county bnwdt:P33 bnwd:Q72 .}
    UNION
    {?county bnwdt:P33 bnwd:Q200 .}
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
GROUP BY ?residence ?residenceLabel
ORDER BY ?regionLabel ?countyLabel ?districtLabel ?residenceLabel
ORDER BY DESC(?residence_count)
</sparql>
</sparql>


===Districts in which women resided, sorted by how many residences all women had in that district (or equivalent sub-level for non-UK residences)===
===People not in London with the district, county, and region at which they were once resident (in the UK) listed===


<sparql tryit="1">
<sparql tryit="1">
# Districts in which women resided, sorted by how many residences all women had in that district (or equivalent sub-level for non-UK residences)
# 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 bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 901: Line 1,041:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?district ?districtLabel (count(?district) as ?district_count) #count number of districts in which women lived
SELECT ?resident ?residentLabel ?district ?districtLabel ?county ?countyLabel ?region ?regionLabel
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?resident bnwdt:P29 ?residence .
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2035 .}
  ?person bnwdt:P29 ?residence . # select residences
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2036 .}
   ?residence bnwdt:P33 ?district . #select districts
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2037 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2038 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2039 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2040 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2041 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2042 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q39.}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2534.}
   ?residence bnwdt:P33 ?district .
  ?district bnwdt:P33 ?county .
  ?county bnwdt:P33 ?region .
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
GROUP BY ?district ?districtLabel
ORDER BY ?regionLabel ?countyLabel ?districtLabel ?residentLabel
ORDER BY DESC(?district_count)
</sparql>
</sparql>


===Counties in which women resided, sorted by how many residences all women had in that county===
===People sorted by the number of places they lived, including the number of cites/towns/villages they lived in===


<sparql tryit="1">
<sparql tryit="1">
# Counties in which women resided, sorted by how many residences all women had in that county
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 926: Line 1,073:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?county ?countyLabel (count(?county) as ?county_count) #count number of counties in which women lived
SELECT ?person ?personLabel (count(?resided) as ?residence_count) (count(distinct ?resided) as ?residence_distinct) WHERE {
WHERE {
  ?person bnwdt:P3 bnwd:Q3 ;
  ?person bnwdt:P3 bnwd:Q3 . # select women
        wikibase:statements ?statements .
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   ?person bnwdt:P29 ?residence . # select residences
   ?person bnp:P29/bnps:P29 ?resided.
  ?residence bnwdt:P33 ?district . #select districts
   SERVICE wikibase:label {
  ?district bnwdt:P33 ?county . #select counties
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
  }
}
} group by ?person ?personLabel ?statements order by desc(?residence_count)
GROUP BY ?county ?countyLabel
# Credit to @Tagishsimon for helping me figure out the counting logic here
ORDER BY DESC(?county_count)
</sparql>
</sparql>


====Counties of residence for women recorded in CAS Indexes of Archaeological Papers, sorted by how many residences all women had in that county====
===Places at which women resided, sorted by how many residences all women had at a given village/town/city/London area===


<sparql tryit="1">
<sparql tryit="1">
# Counties of residence for women recorded in CAS Indexes of Archaeological Papers, sorted by how many residences all women had in that county
# Places at which women resided, sorted by how many residences all women had at a given village/town/city/London area


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 952: Line 1,098:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?county ?countyLabel (count(?county) as ?county_count) #count number of counties in which women lived  
SELECT ?residence ?residenceLabel (count(?residence) as ?residence_count) #count number of places at which women lived  
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
  ?person bnwdt:P76 bnwd:Q419 . #select women recorded in CAS Indexes of Archaeological Papers
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   ?person bnwdt:P29 ?residence . # select residences
   ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
GROUP BY ?county ?countyLabel
GROUP BY ?residence ?residenceLabel
ORDER BY DESC(?county_count)
ORDER BY DESC(?residence_count)
</sparql>
</sparql>


====Counties of residence for women nominated as FSAs, sorted by how many residences all women had in that county====
===Districts in which women resided, sorted by how many residences all women had in that district (or equivalent sub-level for non-UK residences)===


<sparql tryit="1">
<sparql tryit="1">
# Counties of residence for women nominated as FSAs, sorted by how many residences all women had in that county
# Districts in which women resided, sorted by how many residences all women had in that district (or equivalent sub-level for non-UK residences)


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 979: Line 1,122:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?county ?countyLabel (count(?county) as ?county_count) #count number of counties in which women lived  
SELECT ?district ?districtLabel (count(?district) as ?district_count) #count number of districts in which women lived  
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
  ?person bnwdt:P16 ?signatory . #select women who were nominated for election to FSA
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   ?person bnwdt:P29 ?residence . # select residences
   ?person bnwdt:P29 ?residence . # select residences
   ?residence bnwdt:P33 ?district . #select districts
   ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
GROUP BY ?county ?countyLabel
GROUP BY ?district ?districtLabel
ORDER BY DESC(?county_count)
ORDER BY DESC(?district_count)
</sparql>
</sparql>


====Counties of residence for women nominated to RAI, sorted by how many residences all women had in that county====
===Counties in which women resided, sorted by how many residences all women had in that county===


<sparql tryit="1">
<sparql tryit="1">
# Counties of residence for women nominated to RAI, sorted by how many residences all women had in that county
# Counties in which women resided, sorted by how many residences all women had in that county


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 1,009: Line 1,150:
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
  ?person bnwdt:P7 ?signatory . #select women who were nominated for election to RAI
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   ?person bnwdt:P29 ?residence . # select residences
   ?person bnwdt:P29 ?residence . # select residences
Line 1,020: Line 1,160:
</sparql>
</sparql>


====Counties of residence for women who spoke at RAI meetings, sorted by how many residences all women had in that county====
====Counties of residence for women recorded in CAS Indexes of Archaeological Papers, sorted by how many residences all women had in that county====


<sparql tryit="1">
<sparql tryit="1">
# Counties of residence for women who spoke at RAI meetings, sorted by how many residences all women had in that county
# Counties of residence for women recorded in CAS Indexes of Archaeological Papers, sorted by how many residences all women had in that county


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 1,036: Line 1,176:
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P23 bnwd:Q29 . #select women who spoke at RAI Meeting
   ?person bnwdt:P76 bnwd:Q419 . #select women recorded in CAS Indexes of Archaeological Papers
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   ?person bnwdt:P29 ?residence . # select residences
   ?person bnwdt:P29 ?residence . # select residences
Line 1,047: Line 1,187:
</sparql>
</sparql>


====Counties of residence for women who exhibited at RAI meetings, sorted by how many residences all women had in that county====
====Counties of residence for women nominated as FSAs, sorted by how many residences all women had in that county====


<sparql tryit="1">
<sparql tryit="1">
# Counties of residence for women who exhibited at RAI meetings, sorted by how many residences all women had in that county
# Counties of residence for women nominated as FSAs, sorted by how many residences all women had in that county


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 1,063: Line 1,203:
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P13 bnwd:Q29 . #select women who exhibited at RAI Meeting
   ?person bnwdt:P16 ?signatory . #select women who were nominated for election to FSA
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   ?person bnwdt:P29 ?residence . # select residences
   ?person bnwdt:P29 ?residence . # select residences
Line 1,074: Line 1,214:
</sparql>
</sparql>


====Counties of residence for women recorded in CAS Indexes of Archaeological Papers, on a map====
====Counties of residence for women nominated to RAI, sorted by how many residences all women had in that county====


<sparql tryit="1">
<sparql tryit="1">
# Counties of residence for women nominated to RAI, sorted by how many residences all women had in that county


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 1,086: Line 1,227:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


#defaultView:Map{"hide":["?geo", "?wikidata"]}
SELECT ?county ?countyLabel (count(?county) as ?county_count) #count number of counties in which women lived
#title:Counties of residence for women recorded in CAS Indexes of Archaeological Papers
 
SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo 
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P76 bnwd:Q419 . #select women recorded in CAS Indexes of Archaeological Papers
   ?person bnwdt:P7 ?signatory . #select women who were nominated for election to RAI
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   ?person bnwdt:P29 ?residence . # select residences
   ?person bnwdt:P29 ?residence . # select residences
   ?residence bnwdt:P33 ?district . #select districts
   ?residence bnwdt:P33 ?district . #select districts
   ?district bnwdt:P33 ?county . #select counties
   ?district bnwdt:P33 ?county . #select counties
      optional { ?county bnwdt:P153 ?geo2 .  } # for geocoords added to BN
 
      optional {   
      ?county bnp:P117 ?ws .  # wikidata id P117       
        ?ws bnpq:P14 ?wikidata_url .
        BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata )
 
      SERVICE <https://query.wikidata.org/sparql> {
   
        optional {
          ?wikidata wdt:P625 ?geo1 .
                  BIND(geof:longitude(?geo1) AS ?long)
                  BIND(geof:latitude(?geo1)  AS ?lat)
                } # geocoords if available     
      } # /wikidata service 
      } #/wikidata optional
    BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
GROUP BY ?county ?countyLabel
ORDER BY DESC(?county_count)
</sparql>
</sparql>


====Counties of residence for women nominated as FSAs, on a map====
====Counties of residence for women who spoke at RAI meetings, sorted by how many residences all women had in that county====


<sparql tryit="1">
<sparql tryit="1">
# Counties of residence for women who spoke at RAI meetings, sorted by how many residences all women had in that county


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 1,132: Line 1,254:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


#defaultView:Map{"hide":["?geo", "?wikidata"]}
SELECT ?county ?countyLabel (count(?county) as ?county_count) #count number of counties in which women lived
#title:Counties of residence for women nominated as FSAs
 
SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo 
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P16 ?signatory . #select women who were nominated for election to FSA
   ?person bnwdt:P23 bnwd:Q29 . #select women who spoke at RAI Meeting
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   ?person bnwdt:P29 ?residence . # select residences
   ?person bnwdt:P29 ?residence . # select residences
   ?residence bnwdt:P33 ?district . #select districts
   ?residence bnwdt:P33 ?district . #select districts
   ?district bnwdt:P33 ?county . #select counties
   ?district bnwdt:P33 ?county . #select counties
      optional { ?county bnwdt:P153 ?geo2 .  } # for geocoords added to BN
 
      optional {   
      ?county bnp:P117 ?ws .  # wikidata id P117       
        ?ws bnpq:P14 ?wikidata_url .
        BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata )
 
      SERVICE <https://query.wikidata.org/sparql> {
   
        optional { ?wikidata wdt:P625 ?geo1 . } # geocoords if available     
      } # /wikidata service 
      } #/wikidata optional
    BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
GROUP BY ?county ?countyLabel
ORDER BY DESC(?county_count)
</sparql>
</sparql>


====Counties of residence for women who exhibited at RAI meetings, sorted by how many residences all women had in that county====


==== Counties of residence for women nominated to RAI, on a map ====
<sparql tryit="1">
# Counties of residence for women who exhibited at RAI meetings, sorted by how many residences all women had in that county


<sparql tryit="1">
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,175: Line 1,281:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


#defaultView:Map{"hide":["?geo", "?wikidata"]}
SELECT ?county ?countyLabel (count(?county) as ?county_count) #count number of counties in which women lived
#title:Counties of residence for women nominated to RAI
 
SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo 
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
  ?person bnwdt:P13 bnwd:Q29 . #select women who exhibited at RAI Meeting
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P7 ?signatory . #select women who were nominated for election to RAI
   ?person bnwdt:P29 ?residence . # select residences
   ?person bnwdt:P29 ?residence . # select residences
   ?residence bnwdt:P33 ?district . #select districts
   ?residence bnwdt:P33 ?district . #select districts
   ?district bnwdt:P33 ?county . #select counties
   ?district bnwdt:P33 ?county . #select counties
      optional { ?county bnwdt:P153 ?geo2 . } # for geocoords added to BN
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
 
}
      optional {   
GROUP BY ?county ?countyLabel
      ?county bnp:P117 ?ws .  # wikidata id P117       
ORDER BY DESC(?county_count)
        ?ws bnpq:P14 ?wikidata_url .
</sparql>
        BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata )  
 
      SERVICE <https://query.wikidata.org/sparql> {
   
        optional { ?wikidata wdt:P625 ?geo1 . } # geocoords if available     
      } # /wikidata service 
      } #/wikidata optional


    BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
====Counties of residence for women recorded in CAS Indexes of Archaeological Papers, on a map====
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
}
</sparql>


==== Counties of residence for women who spoke at RAI meetings, on a map====
<sparql tryit="1">


<sparql tryit="1">
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,218: Line 1,308:


#defaultView:Map{"hide":["?geo", "?wikidata"]}
#defaultView:Map{"hide":["?geo", "?wikidata"]}
#title:Counties of residence for women who spoke at RAI meetings
#title:Counties of residence for women recorded in CAS Indexes of Archaeological Papers


SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo   
SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo   
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
  ?person bnwdt:P76 bnwd:Q419 . #select women recorded in CAS Indexes of Archaeological Papers
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P23 bnwd:Q29 . #select women who spoke at RAI Meeting
   ?person bnwdt:P29 ?residence . # select residences
   ?person bnwdt:P29 ?residence . # select residences
   ?residence bnwdt:P33 ?district . #select districts
   ?residence bnwdt:P33 ?district . #select districts
Line 1,238: Line 1,327:
       SERVICE <https://query.wikidata.org/sparql> {
       SERVICE <https://query.wikidata.org/sparql> {
      
      
         optional { ?wikidata wdt:P625 ?geo1 . } # geocoords if available       
         optional {
          ?wikidata wdt:P625 ?geo1 .  
                  BIND(geof:longitude(?geo1) AS ?long)
                  BIND(geof:latitude(?geo1)  AS ?lat)
                } # geocoords if available       
       } # /wikidata service   
       } # /wikidata service   
       } #/wikidata optional
       } #/wikidata optional
Line 1,246: Line 1,339:
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
</sparql>
</sparql>


==== Counties of residence for women who exhibited at RAI meetings, on a map ====
====Counties of residence for women nominated as FSAs, on a map====


<sparql tryit="1">
<sparql tryit="1">
#title:Counties of residence for women who exhibited at RAI meetings 


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 1,263: Line 1,354:


#defaultView:Map{"hide":["?geo", "?wikidata"]}
#defaultView:Map{"hide":["?geo", "?wikidata"]}
#title:Counties of residence for women nominated as FSAs


SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo   
SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo   
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
  ?person bnwdt:P16 ?signatory . #select women who were nominated for election to FSA
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P13 bnwd:Q29 . #select women who exhibited at RAI Meeting


   ?person bnwdt:P29 ?residence . # select residences
   ?person bnwdt:P29 ?residence . # select residences
Line 1,292: Line 1,384:
</sparql>
</sparql>


==== Counties of residence for women in any of the above five categories, mapped====
 
==== Counties of residence for women nominated to RAI, on a map ====


<sparql tryit="1">
<sparql tryit="1">
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
## IMPORTANT: LIMITATIONS OF THE MAP
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
## Only the top category of activity (layer) can be seen when all are selected (the default)
## To see each layer, you need to deselect all in the layers menu (diamond shaped icon, top right corner of the map) and view one layer at a time. Unfortunately this is the only way to compare them at the moment.
## (But I'll look into how I might be able to improve on this)
 
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 bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
Line 1,309: Line 1,396:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


#title:Counties of residence for women who were nominated for election or had publications recorded or spoke/exhibited at RAI
#defaultView:Map{"hide":["?geo", "?wikidata"]}
#defaultView:Map{"hide":["?geo", "?wikidata"]}
#title:Counties of residence for women nominated to RAI


SELECT distinct ?county ?countyLabel ?wikidata ?geo  ?layer  #?person ?personLabel
SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo   
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   ?person bnwdt:P7 ?signatory . #select women who were nominated for election to RAI
   {
 
    #women who were nominated for election to FSA | RAI
    ?person ( bnp:P16 | bnp:P7 ) ?stmt . 
  }
  union
  {
    # women with publications recorded in indexes of archaeological papers
    ?person bnp:P76 ?stmt .
        ?stmt bnps:P76 bnwd:Q419 .
  }
  union
  {
    # women who spoke|exhibited at RAI Meeting
    ?person (bnp:P23 | bnp:P13) ?stmt . 
      ?stmt (bnps:P23 | bnps:P13) bnwd:Q29 .
  }
 
  # get the p labels for layers
  ?person ?p ?stmt . 
  ?claim wikibase:claim ?p;
        rdfs:label ?layer. filter(lang(?layer)="en-gb").
 
  # get geo stuff
   ?person bnwdt:P29 ?residence . # select residences
   ?person bnwdt:P29 ?residence . # select residences
   ?residence bnwdt:P33 ?district . #select districts
   ?residence bnwdt:P33 ?district . #select districts
Line 1,351: Line 1,416:
    
    
       SERVICE <https://query.wikidata.org/sparql> {
       SERVICE <https://query.wikidata.org/sparql> {
   
         optional { ?wikidata wdt:P625 ?geo1 . } # geocoords if available       
         optional { ?wikidata wdt:P625 ?geo1 . } # geocoords if available       
       } # /wikidata service   
       } # /wikidata service   
       } #/wikidata optional
       } #/wikidata optional


     BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use it, if not try geo2
     BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
order by ?layer
</sparql>
</sparql>


===Regions in which women resided, sorted by how many residences all women had in that region===
==== Counties of residence for women who spoke at RAI meetings, on a map====


<sparql tryit="1">
<sparql tryit="1">
# Regions in which women resided, sorted by how many residences all women had in that region
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,374: Line 1,438:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?region ?regionLabel (count(?region) as ?region_count) #count number of regions in which women lived
#defaultView:Map{"hide":["?geo", "?wikidata"]}
#title:Counties of residence for women who spoke at RAI meetings
 
SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo 
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P23 bnwd:Q29 . #select women who spoke at RAI Meeting
   ?person bnwdt:P29 ?residence . # select residences
   ?person bnwdt:P29 ?residence . # select residences
   ?residence bnwdt:P33 ?district . #select districts
   ?residence bnwdt:P33 ?district . #select districts
   ?district bnwdt:P33 ?county . #select counties
   ?district bnwdt:P33 ?county . #select counties
  ?county bnwdt:P33 ?region . #select region
      optional { ?county bnwdt:P153 ?geo2 . } # for geocoords added to BN
   FILTER NOT EXISTS {?region bnwdt:P117 "Q145" .} #filter out UK (where UK is sub-region of NI)
    
      optional {    
      ?county bnp:P117 ?ws .  # wikidata id P117       
        ?ws bnpq:P14 ?wikidata_url .
        BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata )
 
      SERVICE <https://query.wikidata.org/sparql> {
   
        optional { ?wikidata wdt:P625 ?geo1 . } # geocoords if available     
      } # /wikidata service 
      } #/wikidata optional
 
    BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
GROUP BY ?region ?regionLabel
 
ORDER BY DESC(?region_count)
</sparql>
</sparql>


==== Counties of residence for women who exhibited at RAI meetings, on a map ====


=== Women living in London during the 1890s ===
<sparql tryit="1">
#title:Counties of residence for women who exhibited at RAI meetings 


<sparql tryit="1">
#title:Women living in 1890s London
# Query for women living in (greater) london in the 1890s
# 1 row per person per address per date, could be reduced to 1 row per person if preferred.
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,404: Line 1,483:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT distinct ?personLabel ?date_label ?date ?person ?address ?address_item ?londonLabel ?geo ?long ?lat
#defaultView:Map{"hide":["?geo", "?wikidata"]}


SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo 
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # women
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnp:P29 ?s .   # resided at
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
    ?s bnps:P29 ?london .
  ?person bnwdt:P13 bnwd:Q29 . #select women who exhibited at RAI Meeting
      ?london bnwdt:P33+ bnwd:Q322 . # in Q322 greater london.


    # optional street address (text)
  ?person bnwdt:P29 ?residence . # select residences
   optional {
   ?residence bnwdt:P33 ?district . #select districts
    ?s bnpq:P31 ?address .
   ?district bnwdt:P33 ?county . #select counties
    }
      optional { ?county bnwdt:P153 ?geo2 . } # for geocoords added to BN
   # optional street address (item)
    
  optional {
      optional {     
    ?s bnpq:P100 ?address_item .
      ?county bnp:P117 ?ws . # wikidata id P117       
    }  
        ?ws bnpq:P14 ?wikidata_url .
 
        BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata )
   # dates. About 30? not dated.
 
    #optional {
      SERVICE <https://query.wikidata.org/sparql> {
     ?s ?pq ?date .
      
    # ?date wikibase:timeValue ?date_value. # if you don't want date label this should work instead
        optional { ?wikidata wdt:P625 ?geo1 . } # geocoords if available     
     
      } # /wikidata service 
      ?qual_prop wikibase:qualifier ?pq;
      } #/wikidata optional
              wikibase:propertyType wikibase:Time ; # nb excludes edtf dates
              rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # what kind of date is it.
     # } # /dates
 
    # filter 1890-1899 
  FILTER("1890-01-01"^^xsd:dateTime <= ?date && ?date < "1899-12-31"^^xsd:dateTime).


    BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
    
    
  # address geocoordinates
  optional {
    ?s ?pqq ?geo .
        ?qual_geo wikibase:qualifier ?pqq;
                  wikibase:propertyType wikibase:GlobeCoordinate.
        BIND(geof:longitude(?geo) AS ?long)
        BIND(geof:latitude(?geo)  AS ?lat)
            }
  # todo booth codes
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
ORDER BY ?person ?date
</sparql>
</sparql>


=== Where did women who published in Folklore/Folk-lore Record live? ===
==== Counties of residence for women in any of the above five categories, mapped====


<sparql tryit="1">
<sparql tryit="1">
# Map of all places of residence for women who had publications in Folklore/Folk-lore Record
 
## IMPORTANT: LIMITATIONS OF THE MAP
## Only the top category of activity (layer) can be seen when all are selected (the default)
## To see each layer, you need to deselect all in the layers menu (diamond shaped icon, top right corner of the map) and view one layer at a time. Unfortunately this is the only way to compare them at the moment.
## (But I'll look into how I might be able to improve on this)
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,464: Line 1,530:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


#defaultView:Map{"hide":["?geo", "?count"]}
#title:Counties of residence for women who were nominated for election or had publications recorded or spoke/exhibited at RAI
#defaultView:Map{"hide":["?geo", "?wikidata"]}


SELECT  ?person ?personLabel ?residenceLabel ?residence ?geo (count( ?person) as ?count) #(concat(str(?count), " publication") as ?count_lbl)
SELECT distinct ?county ?countyLabel ?wikidata ?geo ?layer #?person ?personLabel
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . # select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   ?person bnwdt:P76 bnwd:Q419 . # people with publications listed in indexes of archaeological papers. [262]
  ?person bnp:P76 ?s .
   {
    
    #women who were nominated for election to FSA | RAI
   ## works published in P101. folklore / folk-lore record q487 q490
    ?person ( bnp:P16 | bnp:P7 ) ?stmt .  
      ?s bnpq:P101 ?in .  
  }
      {?s bnpq:P101 bnwd:Q487 } union { ?s bnpq:P101 bnwd:Q490 . }
  union
      # why does above pick up these two journals as well?  
  {
       FILTER ( ?in not in ( bnwd:Q665 , bnwd:Q636 ) ) .  
    # women with publications recorded in indexes of archaeological papers  
    ?person bnp:P76 ?stmt .
        ?stmt bnps:P76 bnwd:Q419 .
   }
  union
   {
    # women who spoke|exhibited at RAI Meeting
    ?person (bnp:P23 | bnp:P13) ?stmt .
      ?stmt (bnps:P23 | bnps:P13) bnwd:Q29 .
  }
 
  # get the p labels for layers
  ?person ?p ?stmt . 
  ?claim wikibase:claim ?p;
        rdfs:label ?layer. filter(lang(?layer)="en-gb").
 
  # get geo stuff
  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
       optional { ?county bnwdt:P153 ?geo2 . } # for geocoords added to BN
    
    
  ?person bnwdt:P29  ?residence .
       optional {    
       optional { ?residence bnwdt:P153 ?geo2 .  } # for geocoords added to BN
       ?county bnp:P117 ?ws .  # wikidata id P117      
 
  optional {
   
       ?residence bnp:P117 ?ws .  # wikidata id P117
           
         ?ws bnpq:P14 ?wikidata_url .
         ?ws bnpq:P14 ?wikidata_url .
         BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata )  
         BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata )  
    
    
      SERVICE <https://query.wikidata.org/sparql> {
      SERVICE <https://query.wikidata.org/sparql> {
   
        optional { ?wikidata wdt:P625 ?geo1 . } # geocoords if available    
      optional {?wikidata wdt:P625 ?geo1 . } # geocoords if available
       } # /wikidata service   
        
      } #/wikidata optional
      } # /wikidata service   
    } #/wikidata optional


     BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
     BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use it, if not try geo2
 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
group by ?person ?personLabel ?residenceLabel ?residence ?geo
order by ?layer
ORDER BY ?geo
</sparql>
</sparql>


===Regions in which women resided, sorted by how many residences all women had in that region===


=== BN people and other things located near Devizes ===
<sparql tryit="1">
# Regions in which women resided, sorted by how many residences all women had in that region


<sparql tryit="1">
## testing use of geof:distance
#title:BN items located within 30 km of Devizes, Wiltshire
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,517: Line 1,594:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
#defaultView:Map
 
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?wikidata ?wd_geo ?wd_long ?wd_lat 
SELECT ?region ?regionLabel (count(?region) as ?region_count) #count number of regions in which women lived
WHERE {   
WHERE {   
    
   ?person bnwdt:P3 bnwd:Q3 . # select women
  {?item bnwdt:P29  ?location . } # resided at location
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   #union
   ?person bnwdt:P29 ?residence . # select residences
  #{?location bnwdt:P12 bnwd:Q2147 .} # OR location has instance of locality. is there a way to get this in the same structure?
   ?residence bnwdt:P33 ?district . #select districts
  union
   ?district bnwdt:P33 ?county . #select counties
   {?item bnwdt:P2  ?location . } # item has property P2 location
   ?county bnwdt:P33 ?region . #select region
   # any other possibles ?  
  FILTER NOT EXISTS {?region bnwdt:P117 "Q145" .} #filter out UK (where UK is sub-region of NI)
 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
  ## limit to places in admin territory p33 england q617. (keep numbers down to avoid wikidata timing out) 
}
  ?location bnwdt:P33+ bnwd:Q617.
GROUP BY ?region ?regionLabel
   ?location bnwdt:P117 ?ws . # wikidata id 
ORDER BY DESC(?region_count)
    
    bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
        SERVICE <https://query.wikidata.org/sparql> {
            wd:Q1026699 wdt:P625 ?start. # devizes coordinates
            ?wikidata wdt:P625 ?wd_geo .
                      #BIND(geof:longitude(?wd_geo) AS ?wd_long) .
                      #BIND(geof:latitude(?wd_geo)  AS ?wd_lat) .
              FILTER(geof:distance(?wd_geo, ?start) < 30). # < 30 km from ?start. 
        } # /wikidata service   
 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
}
ORDER BY ?locationLabel
</sparql>
</sparql>


=== BN items near a chosen location ===
 
=== Women living in London during the 1890s ===


<sparql tryit="1">
<sparql tryit="1">
 
#title:Women living in 1890s London
#title:a map of BN items near a chosen starting point in the UK
# Query for women living in (greater) london in the 1890s
#defaultView:Map
# 1 row per person per address per date, could be reduced to 1 row per person if preferred.
 
## create a thingy for the start point change the Qxxx ID in the following PREFIX var_start line to chosen location. 
## **MUST** a) be in UK and b) have a wikidata item that has coordinate location!
 
PREFIX var_start: <https://beyond-notability.wikibase.cloud/entity/Q5>  # (Q5=sheffield)
 
## to change the distance you can edit the filter(?distance < xx) line near the end of the query.
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,568: Line 1,625:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


## TODO is there a way to get the location itemLabel and use it in the map title...
SELECT distinct ?personLabel ?date_label ?date ?person ?address ?address_item ?londonLabel ?geo ?long ?lat


SELECT distinct  ?item ?itemLabel ?locationLabel ?location ?wikidata ?wd_geo  ?distance #?wd_long ?wd_lat 
WHERE {   
WHERE {   
   var_start: bnwdt:P117 ?start_wd_id .
   ?person bnwdt:P3 bnwd:Q3 . # women
  bind(iri(concat("http://www.wikidata.org/entity/", str(?start_wd_id))) as ?start_wd) .  
   ?person bnp:P29 ?s .   # resided at
    
    ?s bnps:P29 ?london .  
  {?item bnwdt:P29 ?location . } # resided at location
      ?london bnwdt:P33+ bnwd:Q322 .  # in Q322 greater london.  
  union
  {?item bnwdt:P2  ?location . } # item has property P2 location
  # other possibles ?
 
  ## limit to places in admin territory p33 uk q1741 seems ok. put it back to england q617 if there are any timeout problems. (keep numbers down to avoid wikidata timing out)
  ?location bnwdt:P33+ bnwd:Q1741.
  ?location bnwdt:P117 ?ws .  # wikidata id 
    bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
 
        SERVICE <https://query.wikidata.org/sparql> {
            ?start_wd wdt:P625 ?start. # start_wd coordinates.
            ?wikidata wdt:P625 ?wd_geo .
        } # /wikidata service 
 
    #BIND(geof:longitude(?wd_geo) AS ?wd_long) .
    #BIND(geof:latitude(?wd_geo)  AS ?wd_lat) . 
    bind(geof:distance(?wd_geo, ?start) as ?distance).  


     FILTER(?distance < 40). # < xx km from start_wd
    # optional street address (text)
    
  optional {
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
    ?s bnpq:P31 ?address .
}
    }
ORDER BY ?locationLabel
  # optional street address (item)
 
  optional {
</sparql>
    ?s bnpq:P100 ?address_item .
 
    }   
=== Locations of BN excavations ===
 
  # dates. About 30? not dated.
    #optional {
    ?s ?pq ?date .
     # ?date wikibase:timeValue ?date_value. # if you don't want date label this should work instead
     
      ?qual_prop wikibase:qualifier ?pq;
              wikibase:propertyType wikibase:Time ; # nb excludes edtf dates
              rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # what kind of date is it.
    #  } # /dates
 
    # filter 1890-1899 
  FILTER("1890-01-01"^^xsd:dateTime <= ?date && ?date < "1899-12-31"^^xsd:dateTime).
 
 
  # address geocoordinates
  optional {
    ?s ?pqq ?geo .
        ?qual_geo wikibase:qualifier ?pqq;
                  wikibase:propertyType wikibase:GlobeCoordinate.
        BIND(geof:longitude(?geo) AS ?long)
        BIND(geof:latitude(?geo)  AS ?lat)
            }
 
   # todo booth codes
 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
ORDER BY ?person ?date
 
</sparql>
 
==== Map of Women living in 1890s London ====


<sparql tryit="1">
<sparql tryit="1">
#title:Locations of BN excavations
#title:Women living in 1890s London
# Query for women living in (greater) london in the 1890s
# 1 row per person per address per date, could be reduced to 1 row per person if preferred.
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,613: Line 1,686:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
#defaultView:Map
#defaultView:Map
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?wikidata ?wd_geo 
SELECT distinct ?personLabel ?date_label ?date ?person ?address ?address_item ?londonLabel ?geo ?long ?lat
 
WHERE {   
WHERE {   
   ?item bnwdt:P12 bnwd:Q38 .
   ?person bnwdt:P3 bnwd:Q3 . # women
   ?item bnwdt:P2  ?location . # item has property P2 location
   ?person bnp:P29 ?s .  # resided at
   ?location bnwdt:P117 ?ws .  # and has wikidata id 
     ?s bnps:P29 ?london .  
 
      ?london bnwdt:P33+ bnwd:Q322 . # in Q322 greater london.  
     bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
        SERVICE <https://query.wikidata.org/sparql> {
            wd:Q1026699 wdt:P625 ?start. # devizes coordinates
            ?wikidata wdt:P625 ?wd_geo .  
        } # /wikidata service   
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
ORDER BY ?locationLabel
</sparql>


=== Locations of historic houses ===
    # optional street address (text)
  optional {
    ?s bnpq:P31 ?address .
    }
  # optional street address (item)
  optional {
    ?s bnpq:P100 ?address_item .
    }   
 
  # dates. About 30? not dated.
    #optional {
    ?s ?pq ?date .
    # ?date wikibase:timeValue ?date_value. # if you don't want date label this should work instead
     
      ?qual_prop wikibase:qualifier ?pq;
              wikibase:propertyType wikibase:Time ; # nb excludes edtf dates
              rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # what kind of date is it.
    #  } # /dates
 
    # filter 1890-1899 
  FILTER("1890-01-01"^^xsd:dateTime <= ?date && ?date < "1899-12-31"^^xsd:dateTime).


<sparql tryit="1">
#title:locations of BN historic houses
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:Map
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?wikidata ?wd_geo 
WHERE { 
  ?item bnwdt:P12 bnwd:Q2961 .
  ?item bnwdt:P2  ?location .  # item has property P2 location
    
    
   ?location bnwdt:P117 ?ws . # wikidata id 
   # address geocoordinates
 
  optional {
    bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
    ?s ?pqq ?geo .
         SERVICE <https://query.wikidata.org/sparql> {
        ?qual_geo wikibase:qualifier ?pqq;
             wd:Q1026699 wdt:P625 ?start. # devizes coordinates
                  wikibase:propertyType wikibase:GlobeCoordinate.
            ?wikidata wdt:P625 ?wd_geo .    
        BIND(geof:longitude(?geo) AS ?long)  
        } # /wikidata service   
         BIND(geof:latitude(?geo)  AS ?lat)
 
             }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
 
   # todo booth codes
 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
ORDER BY ?locationLabel
ORDER BY ?person ?date
</sparql>
</sparql>


==People==
=== Where did women who published in Folklore/Folk-lore Record live? ===
 
===Women with their family name at birth and family name after marriage===


<sparql tryit="1">
<sparql tryit="1">
# Women with their family name at birth and family name after marriage
# Map of all places of residence for women who had publications in Folklore/Folk-lore Record
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,676: Line 1,747:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


#defaultView:Map{"hide":["?geo", "?count"]}


SELECT ?person ?personLabel ?birthname ?marriedname
SELECT ?person ?personLabel ?residenceLabel ?residence ?geo (count( ?person) as ?count)  #(concat(str(?count), " publication") as ?count_lbl)
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . #select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   OPTIONAL {?person bnwdt:P140 ?birthname .} #look for birth name
   ?person bnwdt:P76 bnwd:Q419 . # people with publications listed in indexes of archaeological papers. [262]
   OPTIONAL {?person bnwdt:P141 ?marriedname .} #look for married name
  ?person bnp:P76 ?s . 
 
  ## works published in P101. folklore / folk-lore record q487 q490
      ?s bnpq:P101 ?in .
      {?s bnpq:P101 bnwd:Q487 } union { ?s bnpq:P101 bnwd:Q490 . }
      # why does above pick up these two journals as well?
      FILTER ( ?in not in ( bnwd:Q665 , bnwd:Q636 ) ) .
 
  ?person bnwdt:P29  ?residence .  
      optional { ?residence bnwdt:P153 ?geo2 .  } # for geocoords added to BN
 
  optional {
   
      ?residence bnp:P117 ?ws .  # wikidata id P117
           
        ?ws bnpq:P14 ?wikidata_url .
        BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata )
    
      SERVICE <https://query.wikidata.org/sparql> {
   
      optional {?wikidata wdt:P625 ?geo1 . } # geocoords if available
     
      } # /wikidata service 
    } #/wikidata optional
 
    BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
    
    
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
ORDER BY ?personLabel
group by ?person ?personLabel ?residenceLabel ?residence ?geo
ORDER BY ?geo
</sparql>
</sparql>


=== Women with family name at birth, married name and count of married names===
 
=== BN people and other things located near Devizes ===


<sparql tryit="1">
<sparql tryit="1">
# Women with their family name at birth, family name after marriage and count of married names
## testing use of geof:distance
 
#title:BN items located within 30 km of Devizes, Wiltshire
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,701: Line 1,800:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
 
#defaultView:Map
SELECT ?person ?personLabel ?birthname 
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?wikidata ?wd_geo ?wd_long ?wd_lat 
        (GROUP_CONCAT(DISTINCT ?marriedname; SEPARATOR=", ") AS ?marriednames)
        (COUNT(?marriedname) AS ?marriedcount)
 
WHERE {   
WHERE {   
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
    
    
   OPTIONAL {?person bnwdt:P140 ?birthname .} #look for birth name
   {?item bnwdt:P29  ?location . } # resided at location
   OPTIONAL {?person bnwdt:P141 ?marriedname .} #look for married name
  #union
  #{?location bnwdt:P12 bnwd:Q2147 .} # OR location has instance of locality. is there a way to get this in the same structure?
  union
   {?item bnwdt:P2  ?location . } # item has property P2 location
  # any other possibles ?
 
  ## limit to places in admin territory p33 england q617. (keep numbers down to avoid wikidata timing out) 
  ?location bnwdt:P33+ bnwd:Q617.
  ?location bnwdt:P117 ?ws .  # wikidata id 
 
    bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
        SERVICE <https://query.wikidata.org/sparql> {
            wd:Q1026699 wdt:P625 ?start. # devizes coordinates
            ?wikidata wdt:P625 ?wd_geo .
                      #BIND(geof:longitude(?wd_geo) AS ?wd_long) .
                      #BIND(geof:latitude(?wd_geo)  AS ?wd_lat) .
              FILTER(geof:distance(?wd_geo, ?start) < 30). # < 30 km from ?start. 
        } # /wikidata service   
    
    
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
}
}
group by ?person ?personLabel ?birthname
ORDER BY ?locationLabel
ORDER BY ?personLabel
</sparql>
</sparql>


===Where women in our data are in wikidata, their spouses, fathers, and mothers according to wikidata===
=== BN items near a chosen location ===


<sparql tryit="1">
<sparql tryit="1">
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
#title:a map of BN items near a chosen starting point in the UK
WHERE { 
#defaultView:Map
  ?person bnwdt:P3 bnwd:Q3 . #select women
 
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
## create a thingy for the start point change the Qxxx ID in the following PREFIX var_start line to chosen location.
  ?person bnp:P117 ?wikidata_ID . #look for wikidata ID on person page
## **MUST** a) be in UK and b) have a wikidata item that has coordinate location!
  ?wikidata_ID bnpq:P14 ?wikidata_url .
 
  BIND(IRI(REPLACE(?wikidata_url,"https://www.wikidata.org/wiki/","http://www.wikidata.org/entity/")) as ?item )
PREFIX var_start: <https://beyond-notability.wikibase.cloud/entity/Q5> # (Q5=sheffield)
 
  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!
</sparql>


===Women in our data alongside counts of their public and professional activities, sorted by total===
## to change the distance you can edit the filter(?distance < xx) line near the end of the query.
 
<sparql tryit="1">
## 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 bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 1,767: Line 1,851:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


select ?person ?personLabel
## TODO is there a way to get the location itemLabel and use it in the map title...
(count(distinct ?exhibitor) as ?exhibitions)
 
(count(distinct ?position) as ?positions)
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?wikidata ?wd_geo  ?distance #?wd_long ?wd_lat 
(count(distinct ?speaker) as ?spoke)
WHERE { 
(count(distinct ?attended) as ?attendance)
  var_start: bnwdt:P117 ?start_wd_id .
(count(distinct ?donorof) as ?donated)
  bind(iri(concat("http://www.wikidata.org/entity/", str(?start_wd_id))) as ?start_wd) .
(count(distinct ?wasdelegate) as ?delegate)
 
(count(distinct ?correspondent) as ?correspondents)
  {?item bnwdt:P29  ?location . } # resided at location
(count(distinct ?fellow) as ?fellowships)
  union
(count(distinct ?collab) as ?collaborations)
  {?item bnwdt:P2  ?location . } # item has property P2 location
(count(distinct ?found) as ?founded)
  # other possibles ?  
(count(distinct ?loaned) as ?loans)
 
(count(distinct ?illustrated) as ?illustrations)
  ## limit to places in admin territory p33 uk q1741 seems ok. put it back to england q617 if there are any timeout problems. (keep numbers down to avoid wikidata timing out)  
(count(distinct ?sold) as ?sales)
  ?location bnwdt:P33+ bnwd:Q1741.
(count(distinct ?served) as ?service)
  ?location bnwdt:P117 ?ws .  # wikidata id 
(count(distinct ?job) as ?employed)
    bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
(count(distinct ?fundraiser) as ?fundraisers)
 
(count(distinct ?publish) as ?published)
        SERVICE <https://query.wikidata.org/sparql> {
(count(distinct ?benefact) as ?benefactor)
            ?start_wd wdt:P625 ?start. # start_wd coordinates.
(count(distinct ?donor) as ?donor_to)
            ?wikidata wdt:P625 ?wd_geo .
(count(distinct ?collect) as ?collected)
        } # /wikidata service 
(count(distinct ?performance) as ?performances)
 
((?exhibitions + ?positions + ?spoke + ?attendance + ?donated + ?delegate + ?correspondents + ?fellowships + ?collaborations + ?founded + ?loans + ?illustrations + ?sales
    #BIND(geof:longitude(?wd_geo) AS ?wd_long) .
+ ?service + ?employed + ?fundraisers + ?published + ?benefactor + ?donor_to + ?collected + ?performances) AS ?PPA_total)
    #BIND(geof:latitude(?wd_geo) AS ?wd_lat)
    bind(geof:distance(?wd_geo, ?start) as ?distance).


where
    FILTER(?distance < 40). # < xx km from start_wd
{
    
  ?person bnwdt:P3 bnwd:Q3 .
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
   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 ?locationLabel
ORDER BY DESC (?PPA_total)
 
</sparql>
</sparql>


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


<sparql tryit="1">
<sparql tryit="1">
## Women in our data arranged as a network graph by the organisations they were members of
#title:Locations of BN excavations
#defaultView:Graph
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
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 bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
SELECT ?org ?orgLabel ?rgb ?linkTo ?linkToLabel
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:Map
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?adminterr ?wikidata ?wd_geo
WHERE {   
WHERE {   
   ?linkTo bnwdt:P3 bnwd:Q3 .                               #select women
   ?item bnwdt:P12 bnwd:Q38 .
   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". }  
  ?item bnwdt:P2  ?location .  # item has property P2 location
   BIND( "7C4DCD" AS ?rgb ) .
 
   optional { ?location bnwdt:P33 ?adminterr .
              ?adminterr bnwdt:P117 ?wsa .  # and has wikidata id 
 
            bind(iri(concat("http://www.wikidata.org/entity/", str(?wsa))) as ?wikidataa) .
              SERVICE <https://query.wikidata.org/sparql> {
              ?wikidataa wdt:P625 ?wd_geo2 .  
            } # /wikidata service   
          }
 
  optional {
   ?location bnwdt:P117 ?ws .  # and has wikidata id 
 
    bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
        SERVICE <https://query.wikidata.org/sparql> {
            ?wikidata wdt:P625 ?wd_geo1 . 
        } # /wikidata service   
    }
  }
  union
  {
 
  filter not exists {?item bnwdt:P2  ?location . } # item doesn't have property P2 location
 
  optional {
   ?item bnwdt:P117 ?wikidata_id .  # but has wikidata id 
  bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
 
  SERVICE <https://query.wikidata.org/sparql> {
              ?wikidata wdt:P625 ?wd_geo1 . 
            } # /wikidata service   
    }


  }
  BIND(COALESCE(?wd_geo1, ?wd_geo2) AS ?wd_geo).  # if geo1 available use that, then try geo2
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
}
ORDER BY ?personLabel
ORDER BY ?locationLabel
</sparql>
</sparql>


===Membership of organisations by women, sorted by how many women were members of a given organisation===
=== Locations of archaeological sites ===


<sparql tryit="1">
<sparql tryit="1">
# Membership of organisations by women, sorted by how many women were members of a given organisation
#title:Locations of BN archaeological sites
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,853: Line 1,955:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
#defaultView:Map
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?adminterrLabel ?adminterr ?wikidata ?wd_geo
WHERE { 
  ?item bnwdt:P12 bnwd:Q86 .
 
  { 
    ?item bnwdt:P2  ?location .  # item has property P2 location
 
  optional { ?location bnwdt:P33 ?adminterr .
              ?adminterr bnwdt:P117 ?wsa .  # and has wikidata id 
 
            bind(iri(concat("http://www.wikidata.org/entity/", str(?wsa))) as ?wikidataa) .
              SERVICE <https://query.wikidata.org/sparql> {
              ?wikidataa wdt:P625 ?wd_geo2 . 
            } # /wikidata service   
          }
 
  optional {
  ?location bnwdt:P117 ?ws .  # and has wikidata id 
 
    bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
        SERVICE <https://query.wikidata.org/sparql> {
            ?wikidata wdt:P625 ?wd_geo1 . 
        } # /wikidata service   
  }
   
    }
 
  union
 
  {
      filter not exists {?item bnwdt:P2  ?location . } # item doesn't have property P2 location


SELECT ?organisation ?organisationLabel (count(?organisation) as ?organisation_count) #count number of organisations that women were members of
 
WHERE { 
  ?item bnwdt:P117 ?wikidata_id .  # but has wikidata id 
   ?person bnwdt:P3 bnwd:Q3 . # select women
  bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
 
   ?person bnwdt:P67 ?organisation . # selection people who were members of organisations and what those organisations were
   SERVICE <https://query.wikidata.org/sparql> {
   FILTER NOT EXISTS {?person bnwdt:P67 bnwd:Q35 .} # filter out Royal Archaeological Institute
              ?wikidata wdt:P625 ?wd_geo1 .   # which has geo coords
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
            } # /wikidata service   
  }
   
   BIND(COALESCE(?wd_geo1, ?wd_geo2) AS ?wd_geo). # if geo1 available use that, then try geo2
    
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
}
}
GROUP BY ?organisation ?organisationLabel
ORDER BY ?locationLabel
ORDER BY DESC(?organisation_count)
</sparql>
</sparql>


 
=== Locations of historic houses ===
 
==Education==
 
===Women educated at a tertiary educational institution located in Oxford or Cambridge===


<sparql tryit="1">
<sparql tryit="1">
# Women educated at a tertiary educational institution located in Oxford or Cambridge
#title:locations of BN historic houses
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,882: Line 2,015:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
#defaultView:Map
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?wikidata ?wd_geo 
WHERE { 
  ?item bnwdt:P12 bnwd:Q2961 .
  {
  ?item bnwdt:P2  ?location .  # item has property P2 location
 
 
  optional { ?location bnwdt:P33 ?adminterr .
              ?adminterr bnwdt:P117 ?wsa .  # and has wikidata id 
 
            bind(iri(concat("http://www.wikidata.org/entity/", str(?wsa))) as ?wikidataa) .
              SERVICE <https://query.wikidata.org/sparql> {
              ?wikidataa wdt:P625 ?wd_geo2 . 
            } # /wikidata service   
          }
 
  optional {
  ?location bnwdt:P117 ?ws .  # and has wikidata id 
 
    bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
        SERVICE <https://query.wikidata.org/sparql> {
            ?wikidata wdt:P625 ?wd_geo1 . 
        } # /wikidata service   
  }


SELECT ?woman ?womanLabel ?educationalinstitution ?educationalinstitutionLabel ?location ?locationLabel
  }
WHERE {
  union
   {?woman bnwdt:P3 bnwd:Q3 . #filter women
  {
   ?woman bnwdt:P94 ?educationalinstitution . #find 'educated at' statement
    
   ?educationalinstitution bnwdt:P12 bnwd:Q2914 . #filter to tertiary educational institutions
  filter not exists {?item bnwdt:P2  ?location . } # item doesn't have property P2 location
  ?educationalinstitution bnwdt:P2 ?location . #find location of educational institution
 
   ?location rdfs:label ?locationLabel .  
   ?item bnwdt:P117 ?wikidata_id . # but has wikidata id 
   bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
 
  SERVICE <https://query.wikidata.org/sparql> {
              ?wikidata wdt:P625 ?wd_geo1 .  
            } # /wikidata service   
 
  }
 
   BIND(COALESCE(?wd_geo1, ?wd_geo2) AS ?wd_geo). # if geo1 available use that, then try geo2 
           
             
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
  FILTER(LANG(?locationLabel) = "en") .
}
  FILTER(regex(?locationLabel, "oxford", "i")) .}
ORDER BY ?locationLabel
  UNION
</sparql>
  {?woman bnwdt:P3 bnwd:Q3 . #filter women
  ?woman bnwdt:P94 ?educationalinstitution . #find 'educated at' statement
  ?educationalinstitution bnwdt:P12 bnwd:Q2914 . #filter to tertiary educational institutions
  ?educationalinstitution bnwdt:P2 ?location . #find location of educational institution
  ?location rdfs:label ?locationLabel .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
  FILTER(LANG(?locationLabel) = "en") .
  FILTER(regex(?locationLabel, "Cambridge$", "i")) .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
ORDER BY ?womanLabel
</sparql>


 
=== Residences of women participants in Colchester excavations ===
=== Women who were FSAs who went to Oxford or Cambridge colleges ===


<sparql tryit="1">
<sparql tryit="1">
#how many women who were FSAs went to Oxford or Cambridge colleges?
#title:Excavations at Colchester: where women participants lived
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,920: Line 2,076:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
#defaultView:Map
 
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?person ?personLabel ?resided ?residedLabel ?wd_geo
SELECT ?person ?personLabel ?college ?collegeLabel ?universityLabel
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . #select women
   values (?item) { (bnwd:Q90) }  # q90 colchester 
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
 
  ?item bnwdt:P12 bnwd:Q38 .
  ?item bnwdt:P2  ?location .  # item has property P2 location
 
  ?item (bnwdt:P36 | bnwdt:P37 ) ?person .
  #optional { ?item bnwdt:P36 ?director . }
  #optional { ?item bnwdt:P37 ?member . }
 
   optional { ?person bnwdt:P29 ?resided .
              ?resided bnwdt:P117 ?wsa . # and has wikidata id 
    
    
  ?person bnwdt:P75 bnwd:Q8. # only BN subjects having a FSA
            bind(iri(concat("http://www.wikidata.org/entity/", str(?wsa))) as ?wikidataa) .
              SERVICE <https://query.wikidata.org/sparql> {
              ?wikidataa wdt:P625 ?wd_geo .  
            } # /wikidata service   
          }
    
    
  # educated at (P94) part of (P4) cambridge (Q1181) oxford (Q364)
  ?person bnwdt:P94 ?college . 
  ?college bnwdt:P4 ?university .
  FILTER ( ?university in ( bnwd:Q1181 , bnwd:Q364 ) )
    
    
   SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
}
}
order by ?personLabel ?collegeLabel
ORDER BY ?locationLabel
</sparql>
</sparql>


=== All women who went to tertiary education institutions and dates where available ===
=== IWD 2024 Map of five women's places ===


<sparql tryit="1">
<sparql tryit="1">
## how many places for the five women can I get on a map? a slightly ridiculous query.
#title:Four stories, five women, many places for #IWD2024
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,951: Line 2,116:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT ?person ?personLabel ?college ?collegeLabel ?university ?universityLabel ?date ?date_label
#defaultView:Map{"hide":["?geo"],"layer":"?person", "markercluster":true }
 
SELECT distinct ?person ?personLabel ?propLabel ?placeLabel  ?geo  ?loc2Label (year(?date) as ?year)


WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . #select women
 
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  VALUES (?person) {(bnwd:Q894) (bnwd:Q462) (bnwd:Q549) (bnwd:Q921) (bnwd:Q1053) }  #
  ?person ( bnp:P29 | bnp:P94  | bnp:P23 | bnp:P13 | bnp:P120  ) ?s .
 
  ?s  ( bnps:P29 | bnps:P94  | bnps:P23 | bnps:P13 | bnps:P120   )  ?place .
 
  ?person ?p ?s .
      ?prop wikibase:claim ?p;     
        wikibase:statementProperty ?ps. 
 
      optional { ?s ( bnpq:P1 | bnpq:P27 ) ?date . }
      #optional { ?s bnpq:P31 ?street . }
  # LOLplaces
  #1 geocoords in quals for place itself - should be detailed geo added manually, cf London district geocoords which =main P153
  #2 wikdiata geocoords for place
  #3 geocoords in quals for linked place
  #4 wikidata geocoords for linked place
  #5 wikidata geocoords in place P2 qual
  #6 `of` qual geocoords
  #7 `of` P2 wikidata geocoords
  #8 `of` wikidata geocoords
  #9 place main geocoords - likely to be broad london postal districts so should be last resort
  #10 linked place main geocoords
 
 
      optional { ?s bnpq:P153 ?geo1 . } # place has geocoords directly *in qualifier*
    
      optional { ?place bnwdt:P2 ?linked_p1 . # linked place has geocoords *in qualifier* (this is primarily for SAL?)
                    ?linked_p1 bnp:P2 ?llp_s .
                        ?llp_s bnps:P2 ?llp_p1.
                        ?llp_s bnpq:P153 ?geo2 .
                }
 
      optional { ?place bnwdt:P117 ?pws .  # place has wikidata page that has geoocords (main P625, not anywhere else)
                  bind(iri(concat("http://www.wikidata.org/entity/", str(?pws))) as ?pwikidata) .
                  SERVICE <https://query.wikidata.org/sparql> {
                    ?pwikidata wdt:P625 ?geo3 .
                  }       
                } 
    
    
  # note: academic degree is P59. possible extra info?
      optional { ?place bnwdt:P2 ?linked_p2 . # linked place has wikidata geocoords
  ?person bnp:P94 ?s .  # educated at
                    ?linked_p2 bnwdt:P117 ?lws .  # wikidata id P117
    ?s bnps:P94 ?college .
                    bind(iri(concat("http://www.wikidata.org/entity/", str(?lws))) as ?lwikidata) .
    optional {?college bnwdt:P4 ?university . } # a few ?college aren't part of (P4) a ?university
                    SERVICE <https://query.wikidata.org/sparql> {
  ?college bnwdt:P12 bnwd:Q2914 .  # tertiary ed inst
                      ?lwikidata wdt:P625 ?geo4 .  
                    }
                }
    
    
  # dates.  
      optional { ?s bnpq:P2 ?qp1 . # P2 qualifier location has wikidata geocoords
    optional {
                    ?qp1 bnwdt:P117 ?qws .  
    ?s ?pq ?date .      
                    bind(iri(concat("http://www.wikidata.org/entity/", str(?qws))) as ?qwikidata) .
      ?qual_prop wikibase:qualifier ?pq;
                    SERVICE <https://query.wikidata.org/sparql> {
              wikibase:propertyType wikibase:Time ; # nb excludes edtf dates
                      ?qwikidata wdt:P625 ?geo5 .
              rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # what kind of date is it.
                    }
       } # /dates
                }
   
 
      optional { ?s bnpq:P78 ?ofp1 . # 'of' (organisation) has geocoords in P2 qualifier
                    ?ofp1 bnp:P2 ?ofp1_s .
                    ?ofp1_s bnps:P2 ?ofp1_p .
                    ?ofp1_s bnpq:P153 ?geo6 . } 
 
      optional { ?s bnpq:P78 ?ofp2 . # 'of' (organisation) P2 location has wikidata geocoords
                    ?ofp2 bnwdt:P2 ?ofp2_p .
                      ?ofp2_p bnwdt:P117 ?ofl2ws .
                      bind(iri(concat("http://www.wikidata.org/entity/", str(?ofl2ws))) as ?ofl2wikidata) .
                      SERVICE <https://query.wikidata.org/sparql> {
                      ?ofl2wikidata wdt:P625 ?geo7 .  }           
              } 
 
      optional { ?s bnpq:P78 ?ofp3 .  # 'of' (organisation) has wikidata geocoords
                    ?ofp3 bnwdt:P117 ?ofpws .  # wikidata id P117
                    bind(iri(concat("http://www.wikidata.org/entity/", str(?ofpws))) as ?ofpwikidata) .
                    SERVICE <https://query.wikidata.org/sparql> {
                      ?ofpwikidata wdt:P625 ?geo8 .  }
                }
 
      optional { ?place bnwdt:P153 ?geo9 .  } # main geocoords  (mainly london postal districts - should be last resort as v broad.)
 
 
       optional { ?place bnwdt:P2 ?linked_p10 . # linked place main geocoords
                    ?linked_p10 bnwdt:P153 ?geo10 .
                }
 
  BIND(COALESCE(?geo1, ?geo2, ?geo3, ?geo4, ?geo5, ?geo6, ?geo7, ?geo8, ?geo9, ?geo10) AS ?geo).  # if geo1 available use that, then geo2, etc, in order of preference
 
  bind(coalesce(?linked_p1, ?linked_p2, ?qp1, ?ofp1, ?ofp2, ?ofp3 ) as ?loc2). # hopefully get extra context where place is just sthg like "meeting". though exactly what will be variable!
    
    
   SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
}
}
order by ?personLabel ?collegeLabel ?date
 
order by ?personLabel ?date ?placeLabel


</sparql>
</sparql>


==People==


=== Academic degrees ===
===Women with their family name at birth and family name after marriage===


<sparql tryit="1">
<sparql tryit="1">
# Fetch academic degrees for women, with date and conferring institution where available
# Women with their family name at birth and family name after marriage
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,993: Line 2,231:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?person ?personLabel ?degree ?degreeLabel ?by ?byLabel ?date ?date_label


SELECT ?person ?personLabel ?birthname ?marriedname
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . #select women
   ?person bnwdt:P3 bnwd:Q3 . #select women
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  OPTIONAL {?person bnwdt:P140 ?birthname .} #look for birth name
  OPTIONAL {?person bnwdt:P141 ?marriedname .} #look for married name
    
    
  # academic degree = P59.
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
  ?person bnp:P59 ?s . 
    ?s bnps:P59 ?degree . # type of degree
 
  # optional qualifiers for degree
 
  # P61 conferred by
    optional { ?s bnpq:P61 ?by . }
 
  # date with type
    optional {
    ?s ?pq ?date .     
      ?qual_prop wikibase:qualifier ?pq;
              wikibase:propertyType wikibase:Time ; # nb excludes edtf dates
              rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # kind of date
      } # /dates
     
   SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
}
}
order by ?personLabel ?date ?degreeLabel
ORDER BY ?personLabel
</sparql>
</sparql>


==IDs==
=== Women with family name at birth, married name and count of married names===


===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===
<sparql tryit="1">
# Women with their family name at birth, family name after marriage and count of married names


<sparql tryit="1">
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 2,036: Line 2,257:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
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
SELECT ?person ?personLabel ?birthname 
        (GROUP_CONCAT(DISTINCT ?marriedname; SEPARATOR=", ") AS ?marriednames)
        (COUNT(?marriedname) AS ?marriedcount)
 
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 .                                 #select women
   ?person bnwdt:P3 bnwd:Q3 . #select women
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .}           #filter out project team
   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:P140 ?birthname .} #look for birth name
    OPTIONAL {?person bnwdt:P34 ?ads_ID .}                   #return Archaeological Data Service ID
  OPTIONAL {?person bnwdt:P141 ?marriedname .} #look for married name
    OPTIONAL {?person bnwdt:P118 ?worldcat_ID .}            #return WorldCat Identities ID
 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
}
}
group by ?person ?personLabel ?birthname
ORDER BY ?personLabel
ORDER BY ?personLabel
</sparql>
</sparql>


===FSAs in the wiki (excluding the project team) and their corresponding IDs - where they exist - on wikidata, viaf, WorldCat Identities, and the Archaeology Data Service===
===Where women in our data are in wikidata, their spouses, fathers, and mothers according to wikidata===


<sparql tryit="1">
<sparql tryit="1">
Line 2,065: Line 2,288:
PREFIX wd:  <http://www.wikidata.org/entity/>
PREFIX wd:  <http://www.wikidata.org/entity/>


SELECT ?person ?personLabel ?wikidata_ID ?viaf_ID ?ads_ID ?worldcat_ID
SELECT ?person ?personLabel ?item ?WD_spouse ?WD_father ?WD_mother
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 .                                 #select women
   ?person bnwdt:P3 bnwd:Q3 . #select women
  ?person bnwdt:P16 ?FSA .                                  #select FSA
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .}           #filter out project team
  ?person bnp:P117 ?wikidata_ID . #look for wikidata ID on person page
    OPTIONAL {?person bnwdt:P117 ?wikidata_ID .}            #return wikidata ID
  ?wikidata_ID bnpq:P14 ?wikidata_url .
    OPTIONAL {?person bnwdt:P119 ?viaf_ID .}                 #return VIAF ID
  BIND(IRI(REPLACE(?wikidata_url,"https://www.wikidata.org/wiki/","http://www.wikidata.org/entity/")) as ?item )
    OPTIONAL {?person bnwdt:P34 ?ads_ID .}                   #return Archaeological Data Service ID
 
    OPTIONAL {?person bnwdt:P118 ?worldcat_ID .}             #return WorldCat Identities ID
  SERVICE <https://query.wikidata.org/sparql> {
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
        ?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
ORDER BY ?personLabel
# with thanks to @tagishsimon for writing this one initially!
</sparql>
</sparql>


===People with IDs on wikidata, their date of birth on wikidata, and the source(s) of that information===
===Women in our data alongside counts of their public and professional activities, sorted by total===


<sparql tryit="1">
<sparql tryit="1">
## 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 bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 2,089: Line 2,322:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
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)
select ?person ?personLabel
WHERE { 
(count(distinct ?exhibitor) as ?exhibitions)
  #Select all women
(count(distinct ?position) as ?positions)
  ?woman bnwdt:P3 bnwd:Q3 .
(count(distinct ?speaker) as ?spoke)
  #select all women that have a Wikidata link
(count(distinct ?attended) as ?attendance)
  ?woman bnwdt:P117 ?Qnumber .   
(count(distinct ?donorof) as ?donated)
 
(count(distinct ?wasdelegate) as ?delegate)
  #create reference to Wikibase entity
(count(distinct ?correspondent) as ?correspondents)
  BIND(IRI(concat("http://www.wikidata.org/entity/", ?Qnumber)) as ?WDitem )  
(count(distinct ?fellow) as ?fellowships)
  #on Wikibase do
(count(distinct ?collab) as ?collaborations)
  SERVICE <https://query.wikidata.org/sparql> {
(count(distinct ?found) as ?founded)
        #get the date of birth
(count(distinct ?loaned) as ?loans)
        ?WDitem wdt:P569 ?WDdateOfBirth .
(count(distinct ?illustrated) as ?illustrations)
        #get the statement of birth
(count(distinct ?sold) as ?sales)
        ?WDitem p:P569 ?Birthstatement .
(count(distinct ?served) as ?service)
        #get its node
(count(distinct ?job) as ?employed)
        ?Birthstatement prov:wasDerivedFrom ?BirthRefnode.
(count(distinct ?fundraiser) as ?fundraisers)
        #get the value of 'Stated in'
(count(distinct ?publish) as ?published)
        ?BirthRefnode  pr:P248 ?BirthStatedIn.
(count(distinct ?benefact) as ?benefactor)
        #get the english label of the referece 'stated in'
(count(distinct ?donor) as ?donor_to)
        OPTIONAL {?BirthStatedIn rdfs:label ?BirthStatedInEnglish
(count(distinct ?collect) as ?collected)
                  FILTER (LANG(?BirthStatedInEnglish) = "en")}.
(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)
  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
</sparql>


=== Which women in the wikibase have Wikipedia articles, according to Wikidata?===
where
 
{
<sparql tryit="1">
  ?person bnwdt:P3 bnwd:Q3 .
 
  optional { ?person bnp:P13 ?exhibitor }
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
  optional { ?person bnp:P17 ?position }
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
  optional { ?person bnp:P23 ?speaker }
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
  optional { ?person bnp:P24 ?attended }
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
  optional { ?person bnp:P65 ?donorof }
PREFIX bnp: <https://beyond-notability.wikibase.cloud/prop/>
  optional { ?person bnp:P71 ?wasdelegate }
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
  optional { ?person bnp:P73 ?correspondent }
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
  optional { ?person bnp:P75 ?fellow }
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
  optional { ?person bnp:P83 ?collab }
PREFIX wd: <http://www.wikidata.org/entity/>
  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)
</sparql>


SELECT ?person ?personLabel ?wikidata ?wikipedia
===Women in our data arranged as a network graph by the organisations they were members of===
WHERE { 
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team


   ?person bnwdt:P117 ?wikidata_ID . #look for wikidata ID on person page
<sparql tryit="1">
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
## 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 ) .


  SERVICE <https://query.wikidata.org/sparql> {
      # get English language wikipedia articles in wikidata entries, where listed
        OPTIONAL {
          ?wikipedia schema:about ?wikidata .
          ?wikipedia schema:inLanguage 'en' .
          FILTER (SUBSTR(str(?wikipedia), 1, 25) = 'https://en.wikipedia.org/')
        } 
      } 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
}
}
ORDER BY ?personLabel
ORDER BY ?personLabel
</sparql>
</sparql>


 
===Membership of organisations by women, sorted by how many women were members of a given organisation===
=== Women with no date of death in our wikibase who have a date of death on Wikidata===


<sparql tryit="1">
<sparql tryit="1">
# Women who have no date of death in our wikibase and have a date of death on Wikidata
# Membership of organisations by women, sorted by how many women were members of a given organisation


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 2,176: Line 2,409:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
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  ?wd_dod
SELECT ?organisation ?organisationLabel (count(?organisation) as ?organisation_count) #count number of organisations that women were members of
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . #select women
   ?person bnwdt:P3 bnwd:Q3 . # select women
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   ?person bnwdt:P67 ?organisation . # selection people who were members of organisations and what those organisations were
   filter not exists {?person bnwdt:P15 ?bn_dod . } # *don't* have P15 date of death
   FILTER NOT EXISTS {?person bnwdt:P67 bnwd:Q35 .} # filter out Royal Archaeological Institute
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
   ?person bnwdt:P117 ?wikidata_ID . #look for wikidata ID on person page
}
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?item) .
GROUP BY ?organisation ?organisationLabel
ORDER BY DESC(?organisation_count)
</sparql>
 
 


 
==Education==
  SERVICE <https://query.wikidata.org/sparql> {
        ?item wdt:P21 ?WD_gender. #get gender of person
        ?item wdt:P570 ?wd_dod .  #date of death on Wikidata P570
      }
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
}
ORDER BY ?personLabel
</sparql>


=== Women with no date of birth in our wikibase who have a date of birth in Wikidata===
===Women educated at a tertiary educational institution located in Oxford or Cambridge===


<sparql tryit="1">
<sparql tryit="1">
# Women who have no date of birth in our wikibase and have a date of birth on Wikidata
# Women educated at a tertiary educational institution located in Oxford or Cambridge


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 2,212: Line 2,438:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
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  ?wd_dob
SELECT ?woman ?womanLabel ?educationalinstitution ?educationalinstitutionLabel ?location ?locationLabel
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . #select women
   {?woman bnwdt:P3 bnwd:Q3 . #filter women
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   ?woman bnwdt:P94 ?educationalinstitution . #find 'educated at' statement
  ?educationalinstitution bnwdt:P12 bnwd:Q2914 . #filter to tertiary educational institutions
   filter not exists {?person bnwdt:P26 ?bn_dob . } # *don't* have P15 date of death
   ?educationalinstitution bnwdt:P2 ?location . #find location of educational institution
 
   ?location rdfs:label ?locationLabel .  
   ?person bnwdt:P117 ?wikidata_ID . #look for wikidata ID on person page
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?item) .
  FILTER(LANG(?locationLabel) = "en") .
 
  FILTER(regex(?locationLabel, "oxford", "i")) .}
   SERVICE <https://query.wikidata.org/sparql> {
  UNION
        ?item wdt:P21 ?WD_gender. #get gender of person
  {?woman bnwdt:P3 bnwd:Q3 . #filter women
        ?item wdt:P569 ?wd_dob . #date of birth on Wikidata P569
   ?woman bnwdt:P94 ?educationalinstitution . #find 'educated at' statement
      }
  ?educationalinstitution bnwdt:P12 bnwd:Q2914 . #filter to tertiary educational institutions
    
  ?educationalinstitution bnwdt:P2 ?location . #find location of educational institution
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
  ?location rdfs:label ?locationLabel .  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
   FILTER(LANG(?locationLabel) = "en") .
  FILTER(regex(?locationLabel, "Cambridge$", "i")) .}
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
}
ORDER BY ?personLabel
ORDER BY ?womanLabel
</sparql>
</sparql>


=== All external IDs on Wikidata for Women ===
 
=== Women who were FSAs who went to Oxford or Cambridge colleges ===


<sparql tryit="1">
<sparql tryit="1">
# Query to fetch all available External IDs on Wikidata for FSAs
#how many women who were FSAs went to Oxford or Cambridge colleges?
# NB this will take a while, but it should finish.
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 2,248: Line 2,477:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?person ?personLabel ?wikidata ?p ?id_no ?id_label
SELECT ?person ?personLabel ?college ?collegeLabel ?universityLabel
WHERE { 
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
 
  ?person bnwdt:P75 bnwd:Q8. # only BN subjects having a FSA
 
  # educated at (P94) part of (P4) cambridge (Q1181) oxford (Q364)


WHERE {
  ?person bnwdt:P94 ?college .
    ?person bnwdt:P3 bnwd:Q3 . #select women 
  ?college bnwdt:P4 ?university .  
    #?person bnwdt:P75 bnwd:Q8. # limit to FSAs if the full set times out.
 
    ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .


    SERVICE <https://query.wikidata.org/sparql> {
  FILTER ( ?university in ( bnwd:Q1181 , bnwd:Q364 ) )
   
 
    ?wikidata ?p ?s .   
   SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
      ?prop wikibase:claim ?p;   
            wikibase:statementProperty ?ps; # NB rather than statementValue
            wikibase:propertyType wikibase:ExternalId. # quicker than filter.
     
      ?prop rdfs:label ?id_label. filter(lang(?id_label)="en") . # ident name
     
          ?s ?ps ?id_no . # id value
 
      # filter by property type
      #filter(?prop_type in (wikibase:ExternalId ) ) .
    } 
     
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
}
}
           
order by ?personLabel ?collegeLabel
order by ?personLabel ?id_label ?id_no
 
</sparql>
</sparql>


=== What external IDs are available in Wikidata for women in the BN database? ===
=== All women who went to tertiary education institutions and dates where available ===


<sparql tryit="1">
<sparql tryit="1">
# All the external IDs on BN women's Wikidata pages, with counts and descriptions
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 2,292: Line 2,507:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT ?p ?id_label ?id_description  (count(?p) as ?count)
SELECT ?person ?personLabel ?college ?collegeLabel ?university ?universityLabel ?date ?date_label


WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . #select women
   ?person bnwdt:P3 bnwd:Q3 . #select women
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P117 ?wikidata_ID . # wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
    
    
    SERVICE <https://query.wikidata.org/sparql> {
  # note: academic degree is P59. possible extra info?
    ?wikidata ?p ?s .
  ?person bnp:P94 ?s .  # educated at
          ?prop wikibase:claim ?p;  
    ?s bnps:P94 ?college .
              wikibase:propertyType wikibase:ExternalId;
    optional {?college bnwdt:P4 ?university . } # a few ?college aren't part of (P4) a ?university
              rdfs:label ?id_label. filter(lang(?id_label)="en") .  
  ?college bnwdt:P12 bnwd:Q2914 .   # tertiary ed inst
      ?prop schema:description ?id_description .  
 
      filter(lang(?id_description) = "en") .   
  # dates.
      } 
    optional {
     
    ?s ?pq ?date .      
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en, en-gb". }  
      ?qual_prop wikibase:qualifier ?pq;
              wikibase:propertyType wikibase:Time ; # nb excludes edtf dates
              rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # what kind of date is it.
      } # /dates
   
 
   SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
}
}
group by ?p ?id_label ?id_description
order by ?personLabel ?collegeLabel ?date
ORDER BY desc(?count)


</sparql>
</sparql>


=== Women with ODNB IDs in Wikidata ===
 
=== Academic degrees ===


<sparql tryit="1">
<sparql tryit="1">
# BN women with ODNB biography IDs on Wikidata, with links to the bios
# Fetch academic degrees for women, with date and conferring institution where available
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 2,335: Line 2,552:
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?person ?personLabel ?wikidata ?url
SELECT distinct ?person ?personLabel ?degree ?degreeLabel ?by ?byLabel ?date ?date_label


WHERE {
WHERE {
    ?person bnwdt:P3 bnwd:Q3 . #select women   
  ?person bnwdt:P3 bnwd:Q3 . #select women
   
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
    ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
    
    
     SERVICE <https://query.wikidata.org/sparql> {
  # academic degree = P59.
   
  ?person bnp:P59 ?s . 
    # P1415 Oxford Dictionary of National Biography ID | P6829 Dictionary of Irish Biography ID | P1648 Dictionary of Welsh Biography ID
     ?s bnps:P59 ?degree . # type of degree
     ?wikidata wdt:P1415 ?id .   
 
 
  # optional qualifiers for degree
     # odnb link
 
    BIND(IRI(concat("https://doi.org/10.1093/ref:odnb/", ?id)) as ?url ) .
  # P61 conferred by
   
     optional { ?s bnpq:P61 ?by . }
    }
 
     
   # date with type
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
    optional {
     ?s ?pq ?date .     
      ?qual_prop wikibase:qualifier ?pq;
              wikibase:propertyType wikibase:Time ; # nb excludes edtf dates
              rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # kind of date
      } # /dates
     
   SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
}
}
           
order by ?personLabel ?date ?degreeLabel
order by ?personLabel ?id
</sparql>
</sparql>


=== Women with National Portrait Gallery links via Wikidata ===
==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===


<sparql tryit="1">
<sparql tryit="1">
# Query to fetch National Portrait Gallery IDs on Wikidata for BN women, with links
# NB this may be a bit slow...
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 2,371: Line 2,592:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
PREFIX wd: <http://www.wikidata.org/entity/>


SELECT distinct ?person ?personLabel ?wikidata ?id_no ?npg_url
SELECT ?person ?personLabel ?wikidata_ID ?viaf_ID ?ads_ID ?worldcat_ID
 
WHERE {
WHERE {
  ?person bnwdt:P3 bnwd:Q3 .                                 #select women
    ?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
     ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
     OPTIONAL {?person bnwdt:P119 ?viaf_ID .}                #return VIAF ID
     bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
     OPTIONAL {?person bnwdt:P34 ?ads_ID .}                  #return Archaeological Data Service ID
 
    OPTIONAL {?person bnwdt:P118 ?worldcat_ID .}            #return WorldCat Identities ID
     SERVICE <https://query.wikidata.org/sparql> {
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   
    ?wikidata ?p ?s .   
      ?prop wikibase:claim ?p;   
            wikibase:statementProperty ?ps;
            wikibase:propertyType wikibase:ExternalId.  
   
          ?s ps:P1816 ?id_no . # id value
      # npg link
          BIND(IRI(concat("https://www.npg.org.uk/collections/search/person/", ?id_no)) as ?npg_url ) .
    } 
     
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
}
}
           
ORDER BY ?personLabel
order by ?personLabel ?id_no
</sparql>
</sparql>


=== Which BN properties map on to Wikidata properties? ===
===FSAs in the wiki (excluding the project team) and their corresponding IDs - where they exist - on wikidata, viaf, WorldCat Identities, and the Archaeology Data Service===


<sparql tryit="1">
<sparql tryit="1">
## **NOTES**
## a few properties have a linked wikidata "Q" rather than "P" ID. These will unfortunately not link correctly to Wikidata so wd_label/wd_description won't be present.
## a few other properties may have wikidata=yes but no wd_label and/or wd_description. This could be because the property on Wikidata has been deleted (eg performed at).
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 2,415: Line 2,618:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
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 DISTINCT ?property (if(bound(?wikidata_id), "yes", "no") as ?has_wikidata)  ?bn_label ?wd_label ?bn_description
SELECT ?person ?personLabel ?wikidata_ID ?viaf_ID ?ads_ID ?worldcat_ID
  ?wd_description ?wikidata ?bn_propertyType
WHERE {
 
   ?person bnwdt:P3 bnwd:Q3 .                                #select women
WHERE {
  ?person bnwdt:P16 ?FSA .                                   #select FSA
   ?property a wikibase:Property ;
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .}            #filter out project team
              wikibase:propertyType ?bn_propertyType . # datatype
    OPTIONAL {?person bnwdt:P117 ?wikidata_ID .}            #return wikidata ID
    OPTIONAL {?person bnwdt:P119 ?viaf_ID .}                 #return VIAF ID
  service wikibase:label {
     OPTIONAL {?person bnwdt:P34 ?ads_ID .}                  #return Archaeological Data Service ID
            bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".  
    OPTIONAL {?person bnwdt:P118 ?worldcat_ID .}            #return WorldCat Identities ID
            ?property rdfs:label ?bn_label .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
            ?property schema:description ?bn_description .
                            }
    # wikidata P117 
     optional {  
            ?property bnwdt:P117 ?wikidata_id .  
                bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
 
            SERVICE <https://query.wikidata.org/sparql> {
                    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".  
                            ?wikidata schema:description ?wd_description .
                            ?wikidata rdfs:label ?wd_label .
                    } # / label service
              } # /wikidata service 
          } #/wikidata optional
}
}
order by ?bn_label
ORDER BY ?personLabel
</sparql>
</sparql>


==== Of these, which are properties for public and professional activities? ====
===People with IDs on wikidata, their date of birth on wikidata, and the source(s) of that information===


<sparql tryit="1">
<sparql tryit="1">
# which properties have corresponding wikidata IDs, restricted to instance of PPA (P12 / Q151)
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
 
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
## **NOTES**
## a few properties have a linked wikidata "Q" rather than "P" ID. These will unfortunately not link correctly to Wikidata so wd_label/wd_description won't be present.
## a few other properties may have wikidata=yes but no wd_label and/or wd_description. This could be because the property on Wikidata has been deleted (eg performed at).
 
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 bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
Line 2,460: Line 2,645:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
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 DISTINCT ?property (if(bound(?wikidata_id), "yes", "no") as ?has_wikidata) ?bn_label ?wd_label ?bn_description
SELECT ?woman ?womanLabel ?WDitem ?WDdateOfBirth (GROUP_CONCAT(?BirthStatedInEnglish;separator=" | ") AS ?sources)
  ?wd_description ?wikidata ?bn_propertyType
WHERE {
 
   #Select all women
WHERE {
  ?woman bnwdt:P3 bnwd:Q3 .
   ?property a wikibase:Property ;
  #select all women that have a Wikidata link
              wikibase:propertyType ?bn_propertyType . # datatype
  ?woman bnwdt:P117 ?Qnumber .  
  service wikibase:label { 
            bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".
            ?property rdfs:label ?bn_label .
            ?property schema:description ?bn_description .
                            }
    # wikidata P117 
    optional { ?property bnwdt:P117 ?wikidata_id .  
                bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
 
            SERVICE <https://query.wikidata.org/sparql> {
                    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".
                            ?wikidata schema:description ?wd_description .
                            ?wikidata rdfs:label ?wd_label .
                    } # / label service
              } # /wikidata service 
          } #/wikidata optional
    
    
    ?property bnwdt:P12 bnwd:Q151. # instance of PPA
  #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". }
}
}
order by ?bn_label
GROUP BY ?woman ?womanLabel ?WDitem ?WDdateOfBirth
ORDER BY ?womanLabel
# Credit to Maarten Zeinstra for developing this query
</sparql>
</sparql>


=== BN Men in Wikidata ===
=== Which women in the wikibase have Wikipedia articles, according to Wikidata?===


<sparql tryit="1">
<sparql tryit="1">
#title: BN men in Wikidata
# a starting point to get the basic query set up; can easily add more variables...


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 2,504: Line 2,693:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
PREFIX wd: <http://www.wikidata.org/entity/>


SELECT distinct ?person ?personLabel ?wikidata ?wd_dob ?wd_dod ?odnb_url ?wikipedia
SELECT ?person ?personLabel ?wikidata ?wikipedia
WHERE { 
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team


WHERE {
   ?person bnwdt:P117 ?wikidata_ID . #look for wikidata ID on person page
    ?person bnwdt:P3 bnwd:Q10 . #select men    
 
    ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
     bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
     bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
 
    SERVICE <https://query.wikidata.org/sparql> {
   
      optional { 
        # P1415 Oxford Dictionary of National Biography ID | couls also add  P6829 Dictionary of Irish Biography ID | P1648 Dictionary of Welsh Biography ID
        ?wikidata wdt:P1415 ?odnb_id . 


        # odnb link
 
        BIND(IRI(concat("https://doi.org/10.1093/ref:odnb/", ?odnb_id)) as ?odnb_url ) .
  SERVICE <https://query.wikidata.org/sparql> {
        } #/ odnb
       # get English language wikipedia articles in wikidata entries, where listed
        
        # English language wikipedia articles in wikidata entries, where listed
         OPTIONAL {
         OPTIONAL {
           ?wikipedia schema:about ?wikidata .
           ?wikipedia schema:about ?wikidata .
Line 2,531: Line 2,712:
           FILTER (SUBSTR(str(?wikipedia), 1, 25) = 'https://en.wikipedia.org/')
           FILTER (SUBSTR(str(?wikipedia), 1, 25) = 'https://en.wikipedia.org/')
         }   
         }   
        
       }   
        optional { ?wikidata wdt:P569 ?wd_dob . } #date of birth on Wikidata P569
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
        optional { ?wikidata wdt:P570 ?wd_dod . #date of death on Wikidata P570
    }  #/ wikidata
     
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
}
}
           
ORDER BY ?personLabel
order by ?personLabel  
 
</sparql>
</sparql>


=== What sort of info Wikidata has about BN men ===
 
=== Women with no date of death in our wikibase who have a date of death on Wikidata===


<sparql tryit="1">
<sparql tryit="1">
 
# Women who have no date of death in our wikibase and have a date of death on Wikidata
#title: what info is there for BN men in Wikidata
#counts of properties (excluding external IDs, of which there are gazillions) (Counts are overall and some people might have more than one.)
#at time of writing there are 198 linked men.


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 2,558: Line 2,732:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
PREFIX wd: <http://www.wikidata.org/entity/>


SELECT ?prop_label ?prop (count(?prop) as ?count)
SELECT ?person ?personLabel  ?wd_dod
WHERE { 
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  filter not exists {?person bnwdt:P15 ?bn_dod . } # *don't* have P15 date of death
 
  ?person bnwdt:P117 ?wikidata_ID . #look for wikidata ID on person page
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?item) .


WHERE {
    ?person bnwdt:P3 bnwd:Q10 . #select men 211.
    ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
    
    
    SERVICE <https://query.wikidata.org/sparql> {    
  SERVICE <https://query.wikidata.org/sparql> {
         ?wikidata ?p ?s .
         ?item wdt:P21 ?WD_gender. #get gender of person
            ?prop wikibase:claim ?p;
        ?item wdt:P570 ?wd_dod . #date of death on Wikidata P570
                wikibase:propertyType ?prop_type ;
       }
                wikibase:statementProperty ?ps.    
 
            ?prop rdfs:label ?prop_label. filter(lang(?prop_label)="en") .
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
        filter(?prop_type in (wikibase:Time, wikibase:WikibaseItem ) ) .
      # also a few quantity, string, monolingualtext
        
    } #/ wikidata
     
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
}
}
group by ?prop_label  ?prop     
ORDER BY ?personLabel
order by ?prop_label
 
</sparql>
</sparql>


=== BN Men in Wikidata: men who proposed elections to SAL/RAI ===
=== Women with no date of birth in our wikibase who have a date of birth in Wikidata===


<sparql tryit="1">
<sparql tryit="1">
#title:Men who proposed for SAL/RAI elections who are in Wikidata
# Women who have no date of birth in our wikibase and have a date of birth on Wikidata  


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 2,599: Line 2,768:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
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 distinct ?proposerLabel ?proposer ?wikidata ?odnb_url ?wikipedia ?wd_dob ?wd_dod
SELECT ?person ?personLabel  ?wd_dob  
WHERE {
WHERE {
   ?person (bnp:P16 | bnp:P7) ?s . # proposed to either SAL or RAI
   ?person bnwdt:P3 bnwd:Q3 . #select women
   ?s (bnps:P16 | bnps:P7) ?proposer .
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
    ?proposer bnwdt:P3 bnwd:Q10 .
  filter not exists {?person bnwdt:P26 ?bn_dob . } # *don't* have P15 date of death
    
    
    ?proposer bnwdt:P117 ?wikidata_ID . #get wikidata ID
  ?person bnwdt:P117 ?wikidata_ID . #look for wikidata ID on person page
     bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .  
     bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?item) .
 
  SERVICE <https://query.wikidata.org/sparql> {
        ?item wdt:P21 ?WD_gender. #get gender of person
        ?item wdt:P569 ?wd_dob .  #date of birth on Wikidata P569
      }
    
    
    SERVICE <https://query.wikidata.org/sparql> {
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   
}
      optional { 
ORDER BY ?personLabel
        # P1415 Oxford Dictionary of National Biography ID
</sparql>
        ?wikidata wdt:P1415 ?odnb_id . 
 
        BIND(IRI(concat("https://doi.org/10.1093/ref:odnb/", ?odnb_id)) as ?odnb_url ) . # make odnb link
=== All external IDs on Wikidata for Women ===
        } #/ odnb
 
     
<sparql tryit="1">
        # could also add:    P6829 Dictionary of Irish Biography ID | P1648 Dictionary of Welsh Biography ID
# Query to fetch all available External IDs on Wikidata for FSAs
     
# NB this will take a while, but it should finish.
        # English language wikipedia articles in wikidata entries, where listed
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
        OPTIONAL {
          ?wikipedia schema:about ?wikidata .
          ?wikipedia schema:inLanguage 'en' .
          FILTER (SUBSTR(str(?wikipedia), 1, 25) = 'https://en.wikipedia.org/')
        } 
     
        # there will be a few duplicates here...
        optional { ?wikidata wdt:P569 ?wd_dob . } #date of birth on Wikidata P569
        optional { ?wikidata wdt:P570 ?wd_dod . }  #date of death on Wikidata P570
    }  #/ wikidata service
     
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
}
ORDER BY ?proposerLabel
</sparql>
 
==== Male proposers who have occupations data in Wikidata====
 
<sparql tryit="1">
#title:Men who proposed for SAL/RAI elections who have occupation(s) in wikidata
# with occupation labels, which was slightly trickier than expected
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
Line 2,650: Line 2,803:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
SELECT distinct ?person ?personLabel ?wikidata ?p ?id_no ?id_label


SELECT distinct ?personLabel ?proposerLabel
(group_concat(distinct ?wd_label; SEPARATOR="; ") as ?proposer_occupations)
?wikidata ?person ?proposer
WHERE {
WHERE {
  ?person (bnp:P16 | bnp:P7) ?s . # proposed to either SAL or RAI
    ?person bnwdt:P3 bnwd:Q3 . #select women    
   ?s (bnps:P16 | bnps:P7) ?proposer .
     #?person bnwdt:P75 bnwd:Q8. # limit to FSAs if the full set times out.
     ?proposer bnwdt:P3 bnwd:Q10 .
 
 
     ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
     ?proposer bnwdt:P117 ?wikidata_ID . #get wikidata ID
     bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
     bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .  
 
 
     SERVICE <https://query.wikidata.org/sparql> {
     SERVICE <https://query.wikidata.org/sparql> {
        ?wikidata wdt:P106 ?wd_occupation .  
   
        # automatic *Label doesn't work with a federated query; this works instead.     
    ?wikidata ?p ?s .  
        SERVICE wikibase:label {
      ?prop wikibase:claim ?p;  
              bd:serviceParam wikibase:language "en".  
            wikibase:statementProperty ?ps; # NB rather than statementValue
              ?wd_occupation rdfs:label ?wd_label.  
            wikibase:propertyType wikibase:ExternalId. # quicker than filter.
              }
     
     }  #/ wikidata service
      ?prop rdfs:label ?id_label. filter(lang(?id_label)="en") . # ident name
     
          ?s ?ps ?id_no . # id value
 
      # filter by property type
      #filter(?prop_type in (wikibase:ExternalId ) ) .
     }   
        
        
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
}
           
order by ?personLabel ?id_label ?id_no


}
group by ?personLabel ?proposerLabel ?wikidata ?person ?proposer
ORDER BY  ?proposerLabel ?person
</sparql>
</sparql>


=== BN Men in Wikidata: Spouses ===
=== What external IDs are available in Wikidata for women in the BN database? ===


<sparql tryit="1">
<sparql tryit="1">
#title: BN spouses who are in Wikidata
# All the external IDs on BN women's Wikidata pages, with counts and descriptions
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 2,690: Line 2,848:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
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 distinct ?spouse ?spouseLabel ?wikidata ?odnb_url ?wikipedia ?wd_dob ?wd_dod
SELECT ?p ?id_label ?id_description (count(?p) as ?count)
WHERE {
 
   ?person bnwdt:P3 bnwd:Q3.
WHERE {
   ?person bnwdt:P41 ?spouse .
   ?person bnwdt:P3 bnwd:Q3 . #select women
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team


    ?spouse bnwdt:P117 ?wikidata_ID . #get wikidata ID
  ?person bnwdt:P117 ?wikidata_ID . # wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .  
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
    
    
    SERVICE <https://query.wikidata.org/sparql> {
    SERVICE <https://query.wikidata.org/sparql> {
   
    ?wikidata ?p ?s .
      optional { 
          ?prop wikibase:claim ?p;   
        # P1415 Oxford Dictionary of National Biography ID
              wikibase:propertyType wikibase:ExternalId; 
       
              rdfs:label ?id_label. filter(lang(?id_label)="en") .  
        ?wikidata wdt:P1415 ?odnb_id .  
      ?prop schema:description ?id_description .  
        BIND(IRI(concat("https://doi.org/10.1093/ref:odnb/", ?odnb_id)) as ?odnb_url ) . # make odnb link
      filter(lang(?id_description) = "en") .  
        } #/ odnb
      }   
     
        # couls also add:     P6829 Dictionary of Irish Biography ID | P1648 Dictionary of Welsh Biography ID
     
        # English language wikipedia articles in wikidata entries, where listed
        OPTIONAL {
          ?wikipedia schema:about ?wikidata .
          ?wikipedia schema:inLanguage 'en' .
          FILTER (SUBSTR(str(?wikipedia), 1, 25) = 'https://en.wikipedia.org/')
        } 
     
        optional { ?wikidata wdt:P569 ?wd_dob . } #date of birth on Wikidata P569
        optional { ?wikidata wdt:P570 ?wd_dod . }  #date of death on Wikidata P570
    #/ wikidata service
        
        
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en, en-gb". }  
}
group by ?p ?id_label ?id_description
ORDER BY desc(?count)


}
ORDER BY  ?proposerLabel
</sparql>
</sparql>


=== Archaeological sites/Historic houses and their owners/operators in Wikidata ===
=== Women with ODNB IDs in Wikidata ===


<sparql tryit="1">
<sparql tryit="1">
#title:archaeological sites/historic houses in wikidata
# BN women with ODNB biography IDs on Wikidata, with links to the bios


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 2,740: Line 2,888:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?item ?itemLabel ?instanceLabel ?wikidata ?wd_owner_label ?wd_operator_label ?wd_member_label  #?wd_owner ?wd_operator
SELECT distinct ?person ?personLabel ?wikidata ?url


WHERE {
WHERE {
    ?person bnwdt:P3 bnwd:Q3 . #select women 
   
    ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
    
    
  { ?item bnwdt:P12 bnwd:Q86 . } # instance of archaeological site
    SERVICE <https://query.wikidata.org/sparql> {
  union
   
  { ?item bnwdt:P12 bnwd:Q2961 . } # instance of historic house
    # P1415 Oxford Dictionary of National Biography ID | P6829 Dictionary of Irish Biography ID | P1648 Dictionary of Welsh Biography ID
 
    ?wikidata wdt:P1415 ?id .   
  ?item bnwdt:P12 ?instance # which instance of is it
 
  filter ( ?instance in (bnwd:Q86, bnwd:Q2961) ) . # (need filter as a few have multiple instance of)
     # odnb link
 
     BIND(IRI(concat("https://doi.org/10.1093/ref:odnb/", ?id)) as ?url ) .
     ?item bnwdt:P117 ?wikidata_id .
   
     bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
    
           
     SERVICE <https://query.wikidata.org/sparql> {
        
        
      optional { ?wikidata wdt:P127 ?wd_owner  .} # can be individuals and multiple.
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
      optional { ?wikidata wdt:P137 ?wd_operator . }
}
     
           
      optional { ?wikidata wdt:P463 ?wd_member . }
order by ?personLabel ?id
     
      ## at least some had *both* owned by *and* operator, but not always the case.
      ## owned by P127 / operator P137 
      ## English Heritage Q936287  National Trust (Q333515)
      ## member of P463  Historic Houses Association (Q5773523)
     
      # automatic *Label doesn't work with a federated query; rdfs:label instead.     
        SERVICE wikibase:label {
              bd:serviceParam wikibase:language "en".
              ?wd_owner rdfs:label ?wd_owner_label.
              ?wd_operator rdfs:label ?wd_operator_label.
              ?wd_member rdfs:label ?wd_member_label.
              }
      } 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
}
order by ?itemLabel
 
</sparql>
</sparql>


==== And which are owned/operated by English Heritage/National Trust or belong to Historic Houses Association ====
=== Women with National Portrait Gallery links via Wikidata ===


<sparql tryit="1">
<sparql tryit="1">
 
# Query to fetch National Portrait Gallery IDs on Wikidata for BN women, with links
# archaeological site or historic house.  
# NB this may be a bit slow...
# pull together via Wikidata which ones are owned/operated by 1) English Heritage 2) National Trust  or 3) affiliated to Historic Houses association
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 2,795: Line 2,927:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?item ?itemLabel ?instanceLabel ?wikidata ?wd_owner_label ?wd_operator_label ?wd_member_label  #?wd_owner ?wd_operator
SELECT distinct ?person ?personLabel ?wikidata ?id_no ?npg_url


WHERE {
WHERE {
    ?person bnwdt:P3 bnwd:Q3 . #select women   
    
    
  { ?item bnwdt:P12 bnwd:Q86 . }
    ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
  union
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
  { ?item bnwdt:P12 bnwd:Q2961 . }
    
    
   ?item bnwdt:P12 ?instance .
    SERVICE <https://query.wikidata.org/sparql> {
  filter ( ?instance in (bnwd:Q86, bnwd:Q2961) ) .
   
    ?wikidata ?p ?s .    
  ?item bnwdt:P117 ?wikidata_id .  
      ?prop wikibase:claim ?p;   
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
            wikibase:statementProperty ?ps;
               
            wikibase:propertyType wikibase:ExternalId.  
    SERVICE <https://query.wikidata.org/sparql> {
   
          ?s ps:P1816 ?id_no . # id value
      # npg link
          BIND(IRI(concat("https://www.npg.org.uk/collections/search/person/", ?id_no)) as ?npg_url ) .
    } 
     
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }
}
           
order by ?personLabel ?id_no
</sparql>


      optional { ?wikidata wdt:P127 ?wd_owner .}
=== Which BN properties map on to Wikidata properties? ===
      optional { ?wikidata wdt:P137 ?wd_operator . }
      optional { ?wikidata wdt:P463 ?wd_member . }


      # filter: owner or operator = EH/NT / member of HHA
<sparql tryit="1">
        filter ( ?wd_owner in (wd:Q936287, wd:Q333515) ||
                ?wd_operator in (wd:Q936287, wd:Q333515) ||
                ?wd_member = wd:Q5773523 ) .


      ## owned by P127 / operator P137 
## **NOTES**
      ## ENglish Heritage Q936287  National Trust (Q333515)
## a few properties have a linked wikidata "Q" rather than "P" ID. These will unfortunately not link correctly to Wikidata so wd_label/wd_description won't be present.
      ## member of P463  Historic Houses Association (Q5773523)
## a few other properties may have wikidata=yes but no wd_label and/or wd_description. This could be because the property on Wikidata has been deleted (eg performed at).
           
      SERVICE wikibase:label {
              bd:serviceParam wikibase:language "en".  
              ?wd_owner rdfs:label ?wd_owner_label.  
              ?wd_operator rdfs:label ?wd_operator_label.
              ?wd_member rdfs:label ?wd_member_label.
              }
      } 
           
  #} # /optional for wikidata ID
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}


order by ?itemLabel
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/>


</sparql>
SELECT DISTINCT ?property (if(bound(?wikidata_id), "yes", "no") as ?has_wikidata)  ?bn_label ?wd_label ?bn_description
  ?wd_description ?wikidata ?bn_propertyType


==Fishing Expeditions==
WHERE {
  ?property a wikibase:Property ;
              wikibase:propertyType ?bn_propertyType . # datatype
  service wikibase:label { 
            bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".
            ?property rdfs:label ?bn_label .
            ?property schema:description ?bn_description .
                            }
    # wikidata P117 
    optional {
            ?property bnwdt:P117 ?wikidata_id .
                bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .


===All properties in use in the wikibase with property type, label and description (if present)===
            SERVICE <https://query.wikidata.org/sparql> {
                    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".
                            ?wikidata schema:description ?wd_description .
                            ?wikidata rdfs:label ?wd_label .
                    } # / label service
              } # /wikidata service 
          } #/wikidata optional
}
order by ?bn_label
</sparql>
 
==== Of these, which are properties for public and professional activities? ====


<sparql tryit="1">
<sparql tryit="1">
# query for information about properties that are being used in the wikibase
# which properties have corresponding wikidata IDs, restricted to instance of PPA (P12 / Q151)
 
## **NOTES**
## a few properties have a linked wikidata "Q" rather than "P" ID. These will unfortunately not link correctly to Wikidata so wd_label/wd_description won't be present.
## a few other properties may have wikidata=yes but no wd_label and/or wd_description. This could be because the property on Wikidata has been deleted (eg performed at).


## fyi: not actually necessary to declare these properties
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bnp: <https://beyond-notability.wikibase.cloud/prop/>
PREFIX schema: <http://schema.org/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT DISTINCT
SELECT DISTINCT ?property (if(bound(?wikidata_id), "yes", "no") as ?has_wikidata) ?bn_label ?wd_label ?bn_description
  ?property
   ?wd_description ?wikidata ?bn_propertyType
  ?propertyType
  ?propertyLabel 
  (group_concat(?propertyAltLabel; separator=" | ") as ?propertyAltLabels)
   ?propertyDescription


WHERE {
WHERE {
   ?property a wikibase:Property ;
   ?property a wikibase:Property ;
               rdfs:label ?propertyLabel ; # label
               wikibase:propertyType ?bn_propertyType . # datatype
              wikibase:propertyType ?propertyType . # datatype
  service wikibase:label
            bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".
            ?property rdfs:label ?bn_label .
            ?property schema:description ?bn_description .
                            }
    # wikidata P117 
    optional { ?property bnwdt:P117 ?wikidata_id .
                bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .


  # add alternative labels if present (can be multiple)
            SERVICE <https://query.wikidata.org/sparql> {
  OPTIONAL { ?property skos:altLabel ?propertyAltLabel . }
                    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".  
 
                            ?wikidata schema:description ?wd_description .
  # add description if present
                            ?wikidata rdfs:label ?wd_label .  
  OPTIONAL {  
                    } # / label service
        SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".
              } # /wikidata service 
          ?property schema:description ?propertyDescription .
          } #/wikidata optional
        }
  }  
    
    
  FILTER(LANG(?propertyLabel) = 'en-gb')
    ?property bnwdt:P12 bnwd:Q151. # instance of PPA
  # fix label language dups; but Q why doesn't SERVICE work?
  # A: https://en.wikibooks.org/wiki/SPARQL/FILTER#FILTER_on_values_in_Labels
  # nb a few objects found with en-gb label missing
 
}
}
group by ?property ?propertyLabel ?propertyType ?propertyDescription
order by ?bn_label
order by ?propertyLabel
</sparql>


</sparql>




=== All the Things for Organisations ===
=== Archaeological sites/Historic houses and their owners/operators in Wikidata ===


<sparql tryit="1">
<sparql tryit="1">
#title:archaeological sites/historic houses in wikidata


# Exploratory query to get all info on an item page including qualifiers (but not references) for each organisation (Q2316) in the wikibase
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
# Initially this *only* fetched organisations that specifically have the instance of Q2316: I didn't realise for a while how many organisations don't directly reference Q2316.
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
Line 2,905: Line 3,061:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


select distinct ?item ?itemLabel  
SELECT distinct ?item ?itemLabel ?instanceLabel ?wikidata ?wd_owner_label ?wd_operator_label ?wd_member_label #?wd_owner ?wd_operator
?prop ?propLabel ?prop_type
?stmt_value ?stmt_valueLabel
?qual_prop ?qual_value ?qual_label ?qual_prop_type
?statement


where {
WHERE {   
 
?item bnwdt:P12+ bnwd:Q2316 . # instance of organisation or descendants of (excluding instance of organisation itself)
 
  # get all the things about ?item 
    ?item ?p ?statement . 
    
    
  # to get item Label without using service. couple of missing en-gb labels somewhere
  { ?item bnwdt:P12 bnwd:Q86 . } # instance of archaeological site
  # ?item rdfs:label ?item_label . filter(lang(?item_label)="en-gb") .  
  union
  { ?item bnwdt:P12 bnwd:Q2961 . } # instance of historic house
    
    
  ?item bnwdt:P12 ?instance .  # which instance of is it
  filter ( ?instance in (bnwd:Q86, bnwd:Q2961) ) . # (need filter as a few have multiple instance of)
    
    
  # get stuff about ?p
     ?item bnwdt:P117 ?wikidata_id .
     ?prop wikibase:claim ?p; 
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
            wikibase:statementProperty ?ps;  # "Links property entity to statement simple value predicate"
           
        #wikibase:statementValue ?psv; # "Links property entity to statement full value predicate"   
    SERVICE <https://query.wikidata.org/sparql> {
            wikibase:propertyType ?prop_type.         
     
 
      optional { ?wikidata wdt:P127 ?wd_owner  .} # can be individuals and multiple.
  # get stuff about ?statement
      optional { ?wikidata wdt:P137 ?wd_operator . }
    ?statement ?ps ?stmt_value.  
        
 
      optional { ?wikidata wdt:P463 ?wd_member . }
   # get any qualifiers
     
  optional {
      ## at least some had *both* owned by *and* operator, but not always the case.
     ?statement ?qual_p ?qual_value . 
      ## owned by P127 / operator P137    
    ?qual_prop wikibase:qualifier ?qual_p;
      ## English Heritage Q936287  National Trust (Q333515)
          wikibase:propertyType ?qual_prop_type ;
      ## member of P463  Historic Houses Association (Q5773523)
          rdfs:label ?qual_label. filter(lang(?qual_label)='en-gb') .  
     
    }
      # automatic *Label doesn't work with a federated query; rdfs:label instead.      
 
        SERVICE wikibase:label {
#  OPTIONAL { ?item skos:altLabel ?alt_label . }   
              bd:serviceParam wikibase:language "en".
    
              ?wd_owner rdfs:label ?wd_owner_label.  
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
              ?wd_operator rdfs:label ?wd_operator_label.
 
              ?wd_member rdfs:label ?wd_member_label.
              }
      }   
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
}
}
 
order by ?itemLabel
order by ?item_label ?prop_label


</sparql>
</sparql>


==== And which are owned/operated by English Heritage/National Trust or belong to Historic Houses Association ====


===Working with property paths: organisations and locations===
<sparql tryit="1">


<sparql tryit="1">
# archaeological site or historic house.  
## problem: sometimes you need to follow property paths using */+ for (eg) locations. BUT this can lead to several results to choose between and they aren't necessarily returned in the "right" order.  
# pull together via Wikidata which ones are owned/operated by 1) English Heritage 2) National Trust  or 3) affiliated to Historic Houses association
## how to determine the "distance" along the path of each result?
## https://stackoverflow.com/questions/61984052/wikidata-get-the-full-subhierachy-of-one-class-as-well-as-all-nodes
## > you can get the distance of a class with SELECT ?cls (count(?tmp) as ?distance) WHERE {  ?cls wdt:P279* ?tmp .  ?tmp wdt:P279+ wd:Q2095 . } group by ?cls order by asc(?distance) - though there might be corner cases like cycles in the hierarchy resp. multiple paths


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 2,966: Line 3,116:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?item ?itemLabel ?location ?locationLabel (count(?item) as ?distance)
SELECT distinct ?item ?itemLabel ?instanceLabel ?wikidata ?wd_owner_label ?wd_operator_label ?wd_member_label  #?wd_owner ?wd_operator
 
WHERE {   
WHERE {   
   ?item bnwdt:P12 bnwd:Q2316 . # instance of organisation.
    
   ?item bnwdt:P2* ?tmp .
  { ?item bnwdt:P12 bnwd:Q86 . }
  ?tmp bnwdt:P2+ ?location . # P2=30. P2+=34
  union
  { ?item bnwdt:P12 bnwd:Q2961 . }
    
  ?item bnwdt:P12 ?instance .  
  filter ( ?instance in (bnwd:Q86, bnwd:Q2961) ) .
  ?item bnwdt:P117 ?wikidata_id .
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
               
    SERVICE <https://query.wikidata.org/sparql> {


  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb, en". }  
      optional { ?wikidata wdt:P127 ?wd_owner .}
}
      optional { ?wikidata wdt:P137 ?wd_operator . }
group by ?item ?itemLabel  ?location ?locationLabel
      optional { ?wikidata wdt:P463 ?wd_member . }
ORDER BY ?item ?distance
</sparql>


=== Working with property paths: instance of [CAVEAT: experimental, probably wrong]===
      # filter: owner or operator = EH/NT / member of HHA
        filter ( ?wd_owner in (wd:Q936287, wd:Q333515) ||
                ?wd_operator in (wd:Q936287, wd:Q333515) ||
                ?wd_member = wd:Q5773523 ) .


<sparql tryit="1">
      ## owned by P127 / operator P137 
# an attempt to adapt the query above following paths for locations of organisations for (more complex) instance of
      ## ENglish Heritage Q936287  National Trust (Q333515)  
# ref https://stackoverflow.com/questions/61984052/wikidata-get-the-full-subhierachy-of-one-class-as-well-as-all-nodes
      ## member of P463  Historic Houses Association (Q5773523)
# distance is in the right *order* so it should be usable for some purposes, but the starting number = number of levels rather than 1. also jumps if there are siblings somewhere along the path.
           
 
      SERVICE wikibase:label {
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
              bd:serviceParam wikibase:language "en".  
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
              ?wd_owner rdfs:label ?wd_owner_label.  
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
              ?wd_operator rdfs:label ?wd_operator_label.
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
              ?wd_member rdfs:label ?wd_member_label.
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/>
           
  #} # /optional for wikidata ID
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
 
order by ?itemLabel
 
</sparql>


SELECT ?item ?itemLabel ?instance_of ?instance_ofLabel  (count(?item) as ?distance)
WHERE { 
  ?item bnwdt:P12* ?tmp .  # instance of anything.
  ?tmp bnwdt:P12+ ?instance_of . # P2=30. P2+=34


  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb, en". }
}
group by ?item ?itemLabel  ?instance_of ?instance_ofLabel
ORDER BY ?item ?distance


</sparql>
== Men ==


==Dates==


===All the Dates for Women FSAs===
=== BN Men in Wikidata ===


<sparql tryit="1">
<sparql tryit="1">
#title:fishing for dates for FSAs
 
# union query to get [hopefully] every date associated with women FSAs including main dates and qualifier dates
#title: BN men in Wikidata
# a starting point to get the basic query set up; can easily add more variables...


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 3,023: Line 3,184:
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?person ?personLabel ?prop_label ?qualLabel ?qual_dateLabel ?date_value  ?
SELECT distinct ?person ?personLabel ?wikidata ?whos_who ?odnb_url ?wikipedia ?wd_dob ?wd_dod ?wd_stmts
#?prop ?qual


WHERE {
WHERE {
    ?person bnwdt:P3 bnwd:Q10 . #select men 
 
    ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
    
    
  ?person bnwdt:P3 bnwd:Q3 . #select women
    SERVICE <https://query.wikidata.org/sparql> {
  ?person bnwdt:P75 bnwd:Q8. # find only BN subjects having a FSA
 
 
      ?wikidata   wikibase:statements ?wd_stmts .
  # get stuff about ?person    
 
  ?person ?p ?s .  
      optional { 
 
         # P1415 Oxford Dictionary of National Biography ID | couls also add  P6829 Dictionary of Irish Biography ID | P1648 Dictionary of Welsh Biography ID
      # get stuff about ?p .
        ?wikidata wdt:P1415 ?odnb_id .  
      ?prop wikibase:claim ?p;   
         wikibase:statementProperty ?ps ; 
        wikibase:statementValue ?psv .   
      ?prop wikibase:propertyType ?date_prop_type .
      ?prop rdfs:label ?prop_label. filter(lang(?prop_label)="en-gb") .
 


# main dates
        # odnb link
 
        BIND(IRI(concat("https://doi.org/10.1093/ref:odnb/", ?odnb_id)) as ?odnb_url ) .
  # get dates detail via ?s and psv
         } #/ odnb
  # gets edtf dates in simplified std wiki date format?
     
  # https://github.com/ProfessionalWiki/WikibaseEdtf 
         # English language wikipedia articles in wikidata entries, where listed
      ?s ?psv ?wdv .
         OPTIONAL {
         ?wdv wikibase:timeValue ?date_value .
           ?wikipedia schema:about ?wikidata .
 
           ?wikipedia schema:inLanguage 'en' .
  } # /main dates
           FILTER (SUBSTR(str(?wikipedia), 1, 25) = 'https://en.wikipedia.org/')
 
        }   
  UNION
       
 
             
  { # qualifier dates
      optional { ?wikidata wdt:P4789 ?whos .
   
                  bind(iri(concat("https://www.ukwhoswho.com/view/article/oupww/whoswho/", ?whos)) as ?whos_who) .
  # direct value (usually item) for the property
                } # P4789 Who's Who
         ?s ?ps ?qual.
   
  # date qualifiers. [assumes no edtf in quals. ]
         ?s ?pq ?date_value . 
           ?qual_date wikibase:qualifier ?pq .
           ?qual_date wikibase:propertyType wikibase:Time.  
           ?qual_date rdfs:label ?date_qual_label . filter(lang(?date_qual_label)="en") .
     
  # /qual dates
 
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
 
} # /where
 
ORDER BY ?person ?prop_label ?date_value


        optional { ?wikidata wdt:P569 ?wd_dob . } #date of birth on Wikidata P569
        optional { ?wikidata wdt:P570 ?wd_dod . }  #date of death on Wikidata P570
    }  #/ wikidata
     
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }
}
           
order by ?personLabel
</sparql>
</sparql>


===Fetch any of multiple kinds of EDTF date for a woman===
=== What sort of info Wikidata has about BN men ===


<sparql tryit="1">
<sparql tryit="1">
# a union query to fetch stuff for multiple properties, in this case dates recorded in EDTF which need slightly different handling from PIT dates
 
# main dates only; pretty sure there are no EDTF in qualifiers.  
#title: what info is there for BN men in Wikidata
# updated to get date property labels
#counts of properties (excluding external IDs, of which there are gazillions) (Counts are overall and some people might have more than one.)
#at time of writing there are 198 linked men.


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 3,089: Line 3,242:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
SELECT ?prop_label ?prop (count(?prop) as ?count)


SELECT  ?person ?personLabel ?date_edtf ?date_prop ?date_label ?s
WHERE {
    ?person bnwdt:P3 bnwd:Q10 . #select men 211.


WHERE { ?person bnwdt:P3 bnwd:Q3 .  
    ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
      FILTER NOT EXISTS { ?person bnwdt:P4 bnwd:Q12 . }
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
   
 
      ## can do this union first but makes no difference to results except possibly a bit slower.
    SERVICE <https://query.wikidata.org/sparql> {    
      #?person ( bnp:P131 | bnp:P132 | bnp:P133  ) ?s .
        ?wikidata ?p ?s .
       #   ?s ( bnps:P131 | bnps:P132 | bnps:P133 ) ?date_edtf .
            ?prop wikibase:claim ?p;
                wikibase:propertyType ?prop_type ;
                wikibase:statementProperty ?ps.    
            ?prop rdfs:label ?prop_label. filter(lang(?prop_label)="en") .  
        filter(?prop_type in (wikibase:Time, wikibase:WikibaseItem ) ) .  
      # also a few quantity, string, monolingualtext
     
    }  #/ wikidata
        
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }
}
group by ?prop_label ?prop     
order by ?prop_label


      ?person ?p ?s . # so you can get the statement id and date prop label
</sparql>
          ?claim wikibase:claim ?p;     
                rdfs:label ?date_label. filter(lang(?date_label)="en") .       


          ?s ?date_prop ?date_edtf .
=== BN Men in Wikidata: men who proposed elections to SAL/RAI ===
             
    ## filter for edtf dates
    ## docs: https://github.com/ProfessionalWiki/WikibaseEdtf
 
    FILTER ( datatype(?date_edtf) = xsd:edtf  ) .
           
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }
    }
 
ORDER BY ?personLabel
 
</sparql>
 
===Full values: dates ===


<sparql tryit="1">
<sparql tryit="1">
 
#title:Men who proposed for SAL/RAI elections who are in Wikidata
# query for full values to access the timeValue and timePrecision of a date, in this case a date of birth.
 
## why is a more complex query needed?
## simple value for a date doesn't differentiate between (eg) "1880" and "1 January 1880"; both are returned as 1 January 1880 (and SELECT DISTINCT will collapse them into a single result)
## there are 14 codes for precision from billion years to second. 7: century, 8: decade, 9: year, 10: month, 11: day
## NB additional bnpsv: prefix
## https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format#Value_representation


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 3,136: Line 3,283:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>


SELECT DISTINCT ?item ?itemLabel ?date ?precision
SELECT distinct ?proposerLabel ?proposer ?wikidata ?odnb_url ?wikipedia ?wd_dob ?wd_dod
WHERE {
WHERE {
   ?item bnp:P26  ?statement. # date of birth (precision of these varies quite a bit)
   ?person (bnp:P16 | bnp:P7) ?s . # proposed to either SAL or RAI
  ?statement bnpsv:P26 ?valueNode.
  ?s (bnps:P16 | bnps:P7) ?proposer .
   ?valueNode wikibase:timeValue ?date.
    ?proposer bnwdt:P3 bnwd:Q10 .
  ?valueNode wikibase:timePrecision ?precision.
    
    ?proposer bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .  
    
    
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    SERVICE <https://query.wikidata.org/sparql> {
}
   
ORDER BY ?date
      optional { 
 
        # P1415 Oxford Dictionary of National Biography ID
</sparql>
        ?wikidata wdt:P1415 ?odnb_id . 
 
        BIND(IRI(concat("https://doi.org/10.1093/ref:odnb/", ?odnb_id)) as ?odnb_url ) . # make odnb link
=== Any main level date for women ===
        } #/ odnb
     
        # could also add:    P6829 Dictionary of Irish Biography ID | P1648 Dictionary of Welsh Biography ID
     
        # English language wikipedia articles in wikidata entries, where listed
        OPTIONAL {
          ?wikipedia schema:about ?wikidata .
          ?wikipedia schema:inLanguage 'en' .
          FILTER (SUBSTR(str(?wikipedia), 1, 25) = 'https://en.wikipedia.org/')
        } 
     
        # there will be a few duplicates here...
        optional { ?wikidata wdt:P569 ?wd_dob . } #date of birth on Wikidata P569
        optional { ?wikidata wdt:P570 ?wd_dod . }  #date of death on Wikidata P570
    }  #/ wikidata service
     
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
}
ORDER BY ?proposerLabel
</sparql>
 
==== Male proposers who have occupations data in Wikidata====


<sparql tryit="1">
<sparql tryit="1">
# a query to get all types of main date for women
#title:Men who proposed for SAL/RAI elections who have occupation(s) in wikidata
# with occupation labels, which was slightly trickier than expected


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 3,163: Line 3,334:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
SELECT DISTINCT ?person ?personLabel ?date_label  ?date ?date_prop_type ?date_prop ?link_prop


SELECT distinct ?personLabel ?proposerLabel
(group_concat(distinct ?wd_label; SEPARATOR="; ") as ?proposer_occupations)
?wikidata ?person ?proposer
WHERE {
WHERE {
  ?person (bnp:P16 | bnp:P7) ?s . # proposed to either SAL or RAI
  ?s (bnps:P16 | bnps:P7) ?proposer .
    ?proposer bnwdt:P3 bnwd:Q10 .
    
    
  ?person bnwdt:P3 bnwd:Q3 . # women
    ?proposer bnwdt:P117 ?wikidata_ID . #get wikidata ID
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .}     
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .  
    
    
  ?person ?p ?s .
    SERVICE <https://query.wikidata.org/sparql> {
 
        ?wikidata wdt:P106 ?wd_occupation .
      ?date_prop wikibase:claim ?p;  
        # automatic *Label doesn't work with a federated query; this works instead.     
         wikibase:statementValue ?psv ; 
         SERVICE wikibase:label {
        wikibase:propertyType ?date_prop_type; # property type = wikibase:Time OR wikibase:Edtf
              bd:serviceParam wikibase:language "en".
        rdfs:label ?date_label. filter(lang(?date_label)="en-gb") . # what kind of date it is
              ?wd_occupation rdfs:label ?wd_label.  
              }
    }  #/ wikidata service
     
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }


        # direct link to relevant section of page
        BIND (REPLACE(STR(?date_prop), "^.*/([^/]*)$", "$1") as ?pid).
        bind(iri(concat(str(?person), "#", ?pid)) as ?link_prop ) . 
     
      ?s ?psv ?wdv . # for the date value
        ?wdv wikibase:timeValue ?date .  #timeValue gets pit and edtf
    #  ?wdv wikibase:timePrecision ?date_precision .  # optional
 
  # nb also possible to filter either/or time/edtf by property type
  # filter(?date_prop_type in (wikibase:Edtf, wikibase:Time ) ) . 
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
}
ORDER BY ?personLabel ?date
group by ?personLabel ?proposerLabel ?wikidata ?person ?proposer
 
ORDER BY ?proposerLabel ?person
</sparql>
</sparql>


=== Counting Dates===
=== BN Men in Wikidata: Spouses ===


<sparql tryit="1">
<sparql tryit="1">
# count distinct dates for women (who have at least one)
#title: BN spouses who are in Wikidata
# uncomment HAVING line for women with only one
 
# CAVEAT: there may be some discrepancies between dates shown on wiki pages and dates returned by sparql
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 3,209: Line 3,374:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT ?person ?personLabel (COUNT(DISTINCT ?date_value) as ?count)
SELECT distinct ?spouse ?spouseLabel  ?wikidata ?odnb_url ?wikipedia ?wd_dob ?wd_dod
WHERE {
  ?person bnwdt:P3 bnwd:Q3.
  ?person bnwdt:P41 ?spouse .


WHERE {
    ?spouse bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .  
{  # main dates
 
  ?person bnwdt:P3 bnwd:Q3 . # women 
  ?person ?p ?s .        
      ?s ?date_prop ?wdv .
        ?wdv wikibase:timeValue ?date_value .
  } # /main dates
    
    
  UNION
    SERVICE <https://query.wikidata.org/sparql> {
 
  { # qualifier dates
      
      
    ?person bnwdt:P3 bnwd:Q3 .  
      optional { 
     ?person ?p ?s .  
        # P1415 Oxford Dictionary of National Biography ID
       ?s ?date_prop ?pqv .
       
        ?pqv wikibase:timeValue ?date_value.
        ?wikidata wdt:P1415 ?odnb_id . 
    }  # /qual dates
        BIND(IRI(concat("https://doi.org/10.1093/ref:odnb/", ?odnb_id)) as ?odnb_url ) . # make odnb link
    
        } #/ odnb
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". }  
     
 
        # couls also add:     P6829 Dictionary of Irish Biography ID | P1648 Dictionary of Welsh Biography ID
} # /where
     
GROUP BY ?person ?personLabel
        # English language wikipedia articles in wikidata entries, where listed
# HAVING(?count=1)
        OPTIONAL {
          ?wikipedia schema:about ?wikidata .
          ?wikipedia schema:inLanguage 'en' .
          FILTER (SUBSTR(str(?wikipedia), 1, 25) = 'https://en.wikipedia.org/')
        } 
        
        optional { ?wikidata wdt:P569 ?wd_dob . } #date of birth on Wikidata P569
        optional { ?wikidata wdt:P570 ?wd_dod . }  #date of death on Wikidata P570
    }  #/ wikidata service
     
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  


ORDER BY ?count ?person
}
ORDER BY ?proposerLabel
</sparql>
</sparql>


=== Start dates that might not have accompanying end dates ===
 
=== BN Men who proposed, seconded or signed for Women in SAL/RAI/RHS elections, with counts and wikidata IDs ===


<sparql tryit="1">
<sparql tryit="1">
#title:Women with start dates that might not have accompanying end dates
#title:Men who supported women (at least twice) for SAL/RAI/RHS election with Wikidata IDs
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 3,254: Line 3,425:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?personLabel ?prop_label ?start_date (if(bound(?end_date), "yes", "no") as ?has_end_date) ?person ?
# p155, p156 - signed rhs
#(group_concat(?other_date_label; SEPARATOR=" | ") as ?other_dates)
# p32, p82  - signed sal|
# p8 rai seconded
 
SELECT ?supporterLabel ?supporter ?wikidata (count(?supporter) as ?supported)


WHERE {
WHERE {
   ?person bnwdt:P3 bnwd:Q3 .
 
 
   ?person bnwdt:P3 bnwd:Q3 .  
  # need to find start times anywhere and get prop label so use claim.
  ?person ?p ?s .
  ?claim wikibase:claim ?p;     
        rdfs:label ?prop_label. filter(lang(?prop_label)="en") . 
   
# pretty sure start time is qualifier only... 
# get start dates
# then optional end dates
# can only see end time/pit associated, and the only pit with start time is not relevant, but can't be sure that'll always be true.
# optional other that excludes both start/end but lists any other date types
    
    
     ?s bnpq:P27 ?start_date . # get start dates
  { 
    ?person (  bnp:P155 | bnp:P156 | bnp:P16 | bnp:P7 ) ?s .  #
      ?s ( bnps:P155 | bnps:P156 | bnps:P16 | bnps:P7 ) ?supporter  . # proposed SAL/RAI / signed RHS
      #?s ?prop ?supporter .
    }
  #  union for qualifiers
  union
  {
  ?person ?p ?s .
     ?s (  bnpq:P156 | bnpq:P155 | bnpq:P32 | bnpq:P82 | bnpq:P8 ) ?supporter .  
    #?s ?prop ?supporter .
  }
    
    
     optional {?s bnpq:P28 ?end_date .} # check for end dates
     ?supporter bnwdt:P3 bnwd:Q10 .  # male
 
#  optional {
#      ?s ?pq ?other_date . # could there be any other associated dates?
     
#      ?qual_prop wikibase:qualifier ?pq;     
#            wikibase:propertyType wikibase:Time ; # nb *does not* include edtf dates but AFAICT there are none in qualifiers.
  #             rdfs:label ?other_date_label . filter(lang(?other_date_label)="en-gb") . # what kind of date is it.
    
    
        # drop both start and end this time. idk if there could be a faster way to do this?
    optional {
#       filter not exists { ?s (bnpq:P27 | bnpq:P28) ?other_date . }
       ?supporter bnwdt:P117 ?wikidata_ID . #get wikidata ID
 
      bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .  
#  } # / optional other dates
      }
 
     
  # filter(!bound(?end_date)). # to filter out rows with an end date
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
    
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". }  
group by ?supporterLabel ?supporter ?wikidata
 
having (?supported>2)
}  
ORDER BY desc(?supported) desc(?wikidata)
 
ORDER BY ?personLabel ?prop_label ?start_date
</sparql>
</sparql>


==Fishing Expeditions==


=== End dates that might not accompanying start dates ===
===All properties in use in the wikibase with property type, label and description (if present)===


<sparql tryit="1">
<sparql tryit="1">
#title:Women with end dates that might not have accompanying start dates
# query for information about properties that are being used in the wikibase
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
 
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
## fyi: not actually necessary to declare these properties
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bnp: <https://beyond-notability.wikibase.cloud/prop/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX schema: <http://schema.org/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?personLabel ?prop_label ?end_date 
SELECT DISTINCT
(if(bound(?start_date), "yes", "no") as ?has_start_date)  
  ?property
(group_concat(?other_date_label; SEPARATOR=" | ") as ?other_dates)  
  ?propertyType
?person ?s
  ?propertyLabel  
  (group_concat(?propertyAltLabel; separator=" | ") as ?propertyAltLabels)
  ?propertyDescription


WHERE {
WHERE {
   ?person bnwdt:P3 bnwd:Q3 .
   ?property a wikibase:Property ;
  ?person ?p ?s .
              rdfs:label ?propertyLabel ; # label
  ?claim wikibase:claim ?p;      
              wikibase:propertyType ?propertyType . # datatype
        rdfs:label ?prop_label. filter(lang(?prop_label)="en") .
 
   
  # add alternative labels if present (can be multiple)
# get end dates
   OPTIONAL { ?property skos:altLabel ?propertyAltLabel . }  
# then optional start dates
# can only see start time/pit associated, and in fact the only pit with start time is not relevant, but can't be sure that'll always be true.
# so an optional other that excludes both start/end but lists any other date types with group_concat
    
    ?s bnpq:P28 ?end_date . # get end dates
 
    optional {?s bnpq:P27 ?start_date .} # check for start dates


    optional {
  # add description if present
         ?s ?pq ?other_date . # could there be any other associated dates?
  OPTIONAL {  
        ?qual_prop wikibase:qualifier ?pq;     
         SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".
              wikibase:propertyType wikibase:Time ; # nb *does not* include edtf dates but AFAICT there are none in qualifiers.
          ?property schema:description ?propertyDescription .
              rdfs:label ?other_date_label . filter(lang(?other_date_label)="en-gb") . # what kind of date
        }
        # drop both start and end. idk if there could be a faster way to do this?
  }  
        filter not exists { ?s (bnpq:P27 | bnpq:P28) ?other_date . }
    
    
  } # / optional other dates
   FILTER(LANG(?propertyLabel) = 'en-gb')  
    
  # fix label language dups; but Q why doesn't SERVICE work?
#  filter(!bound(?start_date)). # to filter out rows with a start date (77 atm)
   # A: https://en.wikibooks.org/wiki/SPARQL/FILTER#FILTER_on_values_in_Labels
    
   # nb a few objects found with en-gb label missing
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". }
    
}


group by ?personLabel ?prop_label ?end_date ?start_date ?has_start_date ?person ?
}
group by ?property ?propertyLabel ?propertyType ?propertyDescription
order by ?propertyLabel


ORDER BY ?personLabel ?prop_label ?end_date
</sparql>
</sparql>


==Admin==


===Women about whom we have recorded fewer than 3 pieces of information===
=== All the Things for Organisations ===


<sparql tryit="1">
<sparql tryit="1">
# Exploratory query to get all info on an item page including qualifiers (but not references) for each organisation (Q2316) in the wikibase
# Initially this *only* fetched organisations that specifically have the instance of Q2316: I didn't realise for a while how many organisations don't directly reference Q2316.
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 3,368: Line 3,526:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?person ?personLabel ?statements WHERE {
select distinct ?item ?itemLabel
  ?person bnwdt:P3 bnwd:Q3 ;
?prop ?propLabel ?prop_type
        wikibase:statements ?statements .
?stmt_value ?stmt_valueLabel
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .}
?qual_prop  ?qual_value ?qual_label ?qual_prop_type
  FILTER (?statements <3)
?statement
  SERVICE wikibase:label {
 
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
where {
  }
}
</sparql>


===People for whom their item records is given as 'Mrs'===
?item bnwdt:P12+ bnwd:Q2316  . # instance of organisation or descendants of (excluding instance of organisation itself)


<sparql tryit="1">
  # get all the things about ?item 
SELECT ?id ?name
    ?item ?p ?statement . 
WHERE {
 
   ?id rdfs:label ?name .
  # to get item Label without using service. couple of missing en-gb labels somewhere
  FILTER regex(?name, "mrs *", "i") #this line uses regular expression syntax, described at https://regexper.com/#mrs%5Cs*
  # ?item rdfs:label ?item_label . filter(lang(?item_label)="en-gb") .
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
 
 
  # get stuff about ?p
    ?prop wikibase:claim ?p; 
            wikibase:statementProperty ?ps;  # "Links property entity to statement simple value predicate"
        #wikibase:statementValue ?psv; # "Links property entity to statement full value predicate"   
            wikibase:propertyType ?prop_type.       
 
  # get stuff about ?statement
    ?statement ?ps ?stmt_value.
 
  # get any qualifiers
  optional {  
    ?statement ?qual_p ?qual_value .    
    ?qual_prop wikibase:qualifier ?qual_p;
          wikibase:propertyType ?qual_prop_type ;
          rdfs:label ?qual_label. filter(lang(?qual_label)='en-gb') .
    }
 
# OPTIONAL { ?item skos:altLabel ?alt_label .
    
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
 
}
}
</sparql>


===All triples in the wiki, limited to 1000===
order by ?item_label ?prop_label


<sparql tryit="1">
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!
</sparql>
</sparql>


===All triples in the wiki, represented as a crude graph===
 
=== One woman ===


<sparql tryit="1">
<sparql tryit="1">
#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!
</sparql>
===People whose assigned gender we have been unable to determine and/or confirm===


<sparql tryit="1">
#title:All About a Woman
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 3,421: Line 3,583:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
 
SELECT distinct ?propLabel ?spsLabel ?qual_propLabel ?pqsLabel ?link ?s
# ?main_date ?main_precision ?qual_date ?qual_precision   
# ?prop ?sps ?pqs ?pq
 
WHERE
{
  VALUES (?person) {(bnwd:Q569)}  # add (bnwd:Qxxx) if you want more than one person. 
  ?person ?p ?s . 
 
    ?prop wikibase:claim ?p;   
        wikibase:statementProperty ?ps;  #  simple value
        wikibase:statementValue ?psv. #  full value   
 
  # exclude external IDs
  # filter not exists { ?prop wikibase:propertyType wikibase:ExternalId . }
 
      ?s ?ps ?sps.
 
    # full date via ?psv
      OPTIONAL {
          ?s ?psv ?spsv .
              ?spsv wikibase:timeValue ?main_date .
              ?spsv wikibase:timePrecision ?main_precision .
      }


SELECT ?person ?personLabel
    # qualifiers.
WHERE { 
 
  ?person bnwdt:P3 ?gender .                              
      optional {
  FILTER NOT EXISTS {?person bnwdt:P3 bnwd:Q3 .}          #filter out people identified as women
        ?s ?pq ?pqs .         
  FILTER NOT EXISTS {?person bnwdt:P3 bnwd:Q10 .}          #filter out people identified as men
          ?qual_prop wikibase:qualifier ?pq . 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
          ?qual_prop wikibase:qualifierValue ?pqp .  
       
          optional {  
            # full date via ?pqp
            ?s ?pqp ?qv .
            ?qv wikibase:timeValue ?qual_date.
            ?qv wikibase:timePrecision ?qual_precision.  
          }
    }
 
  # direct link to property
         BIND (REPLACE(STR(?prop), "^.*/([^/]*)$", "$1") as ?pid).
        bind(iri(concat(str(?person), "#", ?pid)) as ?link ) .
 
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
       
}
}
ORDER BY ?personLabel
order by ?propLabel ?s
 
</sparql>
</sparql>


===People who have a spouse statement and - optionally - marriage date statements for checking if there is any misalignment with 'Spouse not in wikibase' statements===
===Working with property paths: organisations and locations===


<sparql tryit="1">
<sparql tryit="1">
# people who have a spouse statement and - optionally - marriage date statements for checking if there is any misalignment with 'Spouse not in wikibase' statements
## problem: sometimes you need to follow property paths using */+ for (eg) locations. BUT this can lead to several results to choose between and they aren't necessarily returned in the "right" order.
## how to determine the "distance" along the path of each result?
## https://stackoverflow.com/questions/61984052/wikidata-get-the-full-subhierachy-of-one-class-as-well-as-all-nodes
## > you can get the distance of a class with SELECT ?cls (count(?tmp) as ?distance) WHERE {  ?cls wdt:P279* ?tmp .  ?tmp wdt:P279+ wd:Q2095 . } group by ?cls order by asc(?distance) - though there might be corner cases like cycles in the hierarchy resp. multiple paths


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 3,447: Line 3,653:
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>


SELECT ?person ?personLabel ?spouse ?spouseLabel ?edtfmarriagespouse ?edtfmarriagespouseLabel ?PITmarriagespouse ?PITmarriagespouseLabel WHERE {
SELECT ?item ?itemLabel ?location ?locationLabel (count(?item) as ?distance)
   ?person bnwdt:P41 ?spouse .
WHERE {
  OPTIONAL {?person bnp:P132 ?edtfmarriagestatement .
   ?item bnwdt:P12 bnwd:Q2316 . # instance of organisation.
   ?edtfmarriagestatement bnps:P132 ?edtfmarriagedate .
   ?item bnwdt:P2* ?tmp .
   ?edtfmarriagestatement bnpq:P41 ?edtfmarriagespouse .}
   ?tmp bnwdt:P2+ ?location . # P2=30. P2+=34
  OPTIONAL {?person bnp:P130 ?PITmarriagestatement .
 
  ?PITmarriagestatement bnps:P130 ?PITmarriagedate .
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb, en". }  
   ?PITmarriagestatement bnpq:P41 ?PITmarriagespouse .}
    SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
    }
}
}
ORDER BY DESC(?edtfmarriagespouseLabel) DESC(?PITmarriagespouseLabel)
group by ?item ?itemLabel  ?location ?locationLabel
ORDER BY ?item ?distance
</sparql>
</sparql>


=== Compare uses of item v free text ===
=== Working with property paths: instance of [CAVEAT: experimental, probably wrong]===


<sparql tryit="1">
<sparql tryit="1">
# A number of properties have "item" and "free text" versions; a query to fetches both versions in each case to facilitate comparison of their uses.
# an attempt to adapt the query above following paths for locations of organisations for (more complex) instance of
# ref https://stackoverflow.com/questions/61984052/wikidata-get-the-full-subhierachy-of-one-class-as-well-as-all-nodes
# distance is in the right *order* so it should be usable for some purposes, but the starting number = number of levels rather than 1. also jumps if there are siblings somewhere along the path.


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 3,474: Line 3,679:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?itemLabel ?prop_label ?qual_label ?qual_value ?qual_valueLabel ?item ?qual_prop
SELECT ?item ?itemLabel ?instance_of ?instance_ofLabel  (count(?item) as ?distance)
WHERE { 
  ?item bnwdt:P12* ?tmp .  # instance of anything.
  ?tmp bnwdt:P12+ ?instance_of . # P2=30. P2+=34


# most of these are used in qualifiers - only P72, P71 and P88 found in main (and only a handful of uses of free text?)
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb, en". }  
#?item (  bnp:P88|bnp:P91 | bnp:P72|bnp:P71) ?s .
 
## the pairs
#P21 evidence (free text) / P20 evidence (item)
#P79 item exhibited / P80 item exhibited (free text)
#P78 of / P66 of (free text)
#P91 specific reference information / P88 specific reference information (free text)
#P31 street address (free text) / P100 street address (item)
#P72 was delegate at (free text) / P71 was delegate at (item)
 
WHERE {
 
  ?item ?p ?s .
 
  ?prop wikibase:claim ?p;     
        rdfs:label ?prop_label. filter(lang(?prop_label)="en-gb") . 
   
   ?s ( bnpq:P21|bnpq:P20 | bnpq:P80|bnpq:P79 | bnpq:P66|bnpq:P78 | bnpq:P88|bnpq:P91 | bnpq:P31|bnpq:P100 | bnpq:P72|bnpq:P71 ) ?qual_value .
 
  ?s ?qual_p ?qual_value . 
    ?qual_prop wikibase:qualifier ?qual_p;
          wikibase:propertyType ?qual_prop_type ;
          rdfs:label ?qual_label. filter(lang(?qual_label)='en-gb') .
 
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
order by ?qual_label ?prop_label ?itemLabel
group by ?item ?itemLabel  ?instance_of ?instance_ofLabel
ORDER BY ?item ?distance


</sparql>
</sparql>


=== Missing language labels ===
==Dates==
 
===All the Dates for Women FSAs===


<sparql tryit="1">
<sparql tryit="1">
 
#title:fishing for dates for FSAs
# query to check for any items/properties which don't have "en" labels. [currently not an issue but retained for reference.]
# union query to get [hopefully] every date associated with women FSAs including main dates and qualifier dates


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 3,526: Line 3,710:
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT  
SELECT distinct ?person ?personLabel ?prop_label ?qualLabel ?qual_dateLabel ?date_value ?s    
  ?item ?itemLabel
#?prop ?qual
   (group_concat(distinct ?language) as ?languages)
  (count(distinct ?rdfs_label) as ?count) # TIL: where you put distinct matters! 


WHERE {
WHERE {
  ?item ?p ?s.
  ?item rdfs:label ?rdfs_label .  # rdfs item label (1 per language).
    
    
  BIND(LANG(?rdfs_label) as ?language) .  # get 2 letter language codes
  ?person bnwdt:P3 bnwd:Q3 . #select women
 
  ?person bnwdt:P75 bnwd:Q8. # find only BN subjects having a FSA
  #optional { ?item rdfs:label ?engb . filter(lang(?engb)="en-gb").  }
 
  #optional { ?item rdfs:label ?en . filter(lang(?en)="en").  } 
   # get stuff about ?person 
 
  ?person ?p ?s .  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en-gb, en". }
}
group by ?item  ?itemLabel
HAVING (?count<2)
order by ?item
 
</sparql>
 
=== Statements that contain both a date *and* an unknown value date===
 
<sparql tryit="1">
# A query to look for statements containing an <unknown value> date *and* a date
# caveat: not yet completely sure if it will work in all cases for main dates
 
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 ?main_label ?qualLabel ?subLabel
(group_concat(distinct ?date_prop) as ?dates) 
(count (distinct(isBLANK(?t))) as ?tcount) 
?s
 
# using isBlank() in select creates true/false, then count distinct finds any in a group having >1.
 
WHERE
{
  {
   # qualifiers. [qualifiers need to include ?s in the group by]
  ?item ?p ?s.
    
    
  # labels
      # get stuff about ?p .
  ?s ?subp ?sub .
      ?prop wikibase:claim ?p;    
  ?qual wikibase:claim ?p;
        wikibase:statementProperty ?ps ; 
        wikibase:statementProperty ?subp.
        wikibase:statementValue ?psv .   
      ?prop wikibase:propertyType ?date_prop_type .
      ?prop rdfs:label ?prop_label. filter(lang(?prop_label)="en-gb") .  
    
    
    ?s ?pq ?t .


    ?date_prop wikibase:qualifier ?pq ;
{  # main dates
            wikibase:propertyType ?date_prop_type .
 
    filter(?date_prop_type in (wikibase:Time, wikibase:Edtf) ).  
  # get dates detail via ?s and psv
   }
  # gets edtf dates in simplified std wiki date format?
  # https://github.com/ProfessionalWiki/WikibaseEdtf 
      ?s ?psv ?wdv .
        ?wdv wikibase:timeValue ?date_value .
 
   } # /main dates
 
   UNION
   UNION
  {
  # main [excluding ?s from group by this time]
  ?item ?p ?sm.
  ?sm ?ps ?t .
   
  ?date_prop wikibase:claim ?p.
  ?date_prop wikibase:statementProperty ?ps.
  ?date_prop wikibase:propertyType ?date_prop_type .
  ?date_prop rdfs:label ?main_label .  filter(lang(?main_label)="en-gb") .
   
  filter(?date_prop_type in (wikibase:Time, wikibase:Edtf) ).
  }
    
    
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en_gb" }
   { # qualifier dates
}
   
  # direct value (usually item) for the property
        ?s ?ps ?qual.
   
  # date qualifiers. [assumes no edtf in quals. ]
        ?s ?pq ?date_value . 
          ?qual_date wikibase:qualifier ?pq .
          ?qual_date wikibase:propertyType wikibase:Time.
          ?qual_date rdfs:label ?date_qual_label . filter(lang(?date_qual_label)="en") .
     
  }  # /qual dates
 
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
 
} # /where


group by ?item ?itemLabel ?s ?qualLabel ?subLabel  ?main_label
ORDER BY ?person ?prop_label ?date_value
having (?tcount >1 )  # comment out to get everything
 
ORDER BY ?itemLabel ?main_label ?qualLabel ?subLabel ?date_prop


</sparql>
</sparql>


 
===Fetch any of multiple kinds of EDTF date for a woman===
=== Women with no dates===


<sparql tryit="1">
<sparql tryit="1">
 
# a union query to fetch stuff for multiple properties, in this case dates recorded in EDTF which need slightly different handling from PIT dates
# Query for women with no dates
# main dates only; pretty sure there are no EDTF in qualifiers.
# WIP: at present this includes <unknown value> dates as well as no dates at all [eg Miss Keyser Q2622]
# updated to get date property labels
# 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 3,627: Line 3,776:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?person ?personLabel (count(?date_value) as ?count)
SELECT ?person ?personLabel ?date_edtf ?date_prop ?date_label ?s


WHERE {
WHERE { ?person bnwdt:P3 bnwd:Q3 .  
      FILTER NOT EXISTS { ?person bnwdt:P4 bnwd:Q12 . }
{  # main dates
   
 
      ## can do this union first but makes no difference to results except possibly a bit slower.
  ?person bnwdt:P3 bnwd:Q3 . # women 
      #?person ( bnp:P131 | bnp:P132 | bnp:P133  ) ?s .
  optional {  
      #  ?s ( bnps:P131 | bnps:P132 | bnps:P133  ) ?date_edtf .
    ?person ?p ?s .        
 
      ?s ?date_prop ?wdv .
      ?person ?p ?s . # so you can get the statement id and date prop label
        ?wdv wikibase:timeValue ?date_value .
          ?claim wikibase:claim ?p;        
 
                rdfs:label ?date_label. filter(lang(?date_label)="en") .       
} # /main dates
 
 
          ?s ?date_prop ?date_edtf .
  UNION
             
    
     ## filter for edtf dates
  { # qualifier dates
    ## docs: https://github.com/ProfessionalWiki/WikibaseEdtf
   
 
    ?person bnwdt:P3 bnwd:Q3 .  
    FILTER ( datatype(?date_edtf) = xsd:edtf ) .
  optional {
           
    ?person ?p ?s .  
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
       ?s ?date_prop ?pqv .
    }
        ?pqv wikibase:timeValue ?date_value. }
 
      
ORDER BY ?personLabel
  }  # /qual dates
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". }  
 
} # /where
group by ?person ?personLabel
having (?count=0)
ORDER BY ?person


</sparql>
</sparql>


 
===Full values: dates ===
=== Women with more than X statements but no date of birth/death===


<sparql tryit="1">
<sparql tryit="1">


#title:women with n>X statements but no date of birth/death
# query for full values to access the timeValue and timePrecision of a date, in this case a date of birth.
# CAVEAT this currently finds some women who do in fact have dates, because of WQS bug
# updated to add extra info


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
## why is a more complex query needed?
## simple value for a date doesn't differentiate between (eg) "1880" and "1 January 1880"; both are returned as 1 January 1880 (and SELECT DISTINCT will collapse them into a single result)
## there are 14 codes for precision from billion years to second. 7: century, 8: decade, 9: year, 10: month, 11: day
## NB additional bnpsv: prefix
## https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format#Value_representation
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
Line 3,681: Line 3,823:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>


 
SELECT DISTINCT ?item ?itemLabel ?date ?precision
SELECT distinct ?person ?personLabel ?statements ?dob ?dod
(if(bound(?SALproposed), "yes", "") as ?FSA)
(if(bound(?RAIproposed), "yes", "") as ?RAI)
(if(bound(?resided), "yes", "") as ?residence) 
(if(bound(?main_date), "yes", "") as ?other_maindate)
(if(bound(?qual_d), "yes", "") as ?qual_date)
 
WHERE {
WHERE {
  ?person bnwdt:P3 bnwd:Q3 ;
  ?item bnp:P26  ?statement. # date of birth (precision of these varies quite a bit)
        wikibase:statements ?statements .
  ?statement bnpsv:P26 ?valueNode.
   FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .}
  ?valueNode wikibase:timeValue ?date.
   ?valueNode wikibase:timePrecision ?precision.
    
    
  optional { ?person bnwdt:P15 ?dod .  }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  optional { ?person bnwdt:P26 ?dob .  }
 
   optional { # was elected FSA. comment out optional lines to get FSAs only...
    ?person bnp:P16 ?s .
        ?s bnps:P16 ?SALproposed .
        ?s bnpq:P22 bnwd:Q36 .  # successful Q36. will you end up with 2 rows if there's a successful and unsuccessful?
  } #/optional fsa
 
  optional { # was elected RAI. only one unsuccessful, so just ignore that bit.
    ?person bnwdt:P7 ?RAIproposed .
  }
 
  optional { ?person bnwdt:P29 ?resided . } # place of residence
 
  optional {
    # main dates, apart from birth and death: P133 (widowed) P132 (married edtf) P131 (had child) P130 (married pit)   
    ?person ( bnwdt:P130 | bnwdt:P131 | bnwdt:P132 | bnwdt:P133 ) ?main_date .
    } # /optional main dates
 
  optional {
    # qualifier dates 
    ?person ?p ?s .   
      ?s ?date_prop ?pqv .
        ?pqv wikibase:timeValue ?qual_d.
    } #/ optional qual dates
 
  FILTER (?statements >10) . # can adjust n statements here...
 
  FILTER (NOT EXISTS { ?person bnwdt:P15 ?dod .} || NOT EXISTS { ?person bnwdt:P26 ?dob .  } ) . # EITHER no date of birth OR no date of death. or swap with following line...
  #FILTER (NOT EXISTS { ?person bnwdt:P15 ?dod .} && NOT EXISTS { ?person bnwdt:P26 ?dob .  } ) . # no date of birth AND no date of death
   
  SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
  }
}
}
order by ?personLabel
ORDER BY ?date


</sparql>
</sparql>


=== Places of residence that lack instance of locality===
=== Any main level date for women ===


<sparql tryit="1">
<sparql tryit="1">
# a query to get all types of main date for women
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 3,745: Line 3,850:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>


SELECT distinct ?residence ?residenceLabel ?inst ?instLabel
SELECT DISTINCT ?person ?personLabel ?date_label  ?date ?date_prop_type ?date_prop ?link_prop
WHERE { 
  ?resident bnwdt:P29 ?residence . # resided at
  filter not exists { ?residence bnwdt:P12 bnwd:Q2147 . } # that doesn't have instance of locality


  optional {?residence bnwdt:P12 ?inst .} # does it have instance of anything?   
WHERE {
      ## Note: some have Q618 territory of the British Empire, which also lacks any instance of at present
 
  ?person bnwdt:P3 bnwd:Q3 . # women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .}    
 
  ?person ?p ?s .
 
      ?date_prop wikibase:claim ?p;   
        wikibase:statementValue ?psv ;  
        wikibase:propertyType ?date_prop_type; # property type = wikibase:Time OR wikibase:Edtf
        rdfs:label ?date_label. filter(lang(?date_label)="en-gb") . # what kind of date it is


   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
        # direct link to relevant section of page
        BIND (REPLACE(STR(?date_prop), "^.*/([^/]*)$", "$1") as ?pid).
        bind(iri(concat(str(?person), "#", ?pid)) as ?link_prop ) . 
     
      ?s ?psv ?wdv . # for the date value
        ?wdv wikibase:timeValue ?date .  #timeValue gets pit and edtf
    #  ?wdv wikibase:timePrecision ?date_precision .  # optional
 
  # nb also possible to filter either/or time/edtf by property type
   # filter(?date_prop_type in (wikibase:Edtf, wikibase:Time ) ) . 
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
}
ORDER BY ?residenceLabel
ORDER BY ?personLabel ?date
 
</sparql>
</sparql>


=== Locations that don't have Wikidata links or their Wikidata pages lack geocoordinates===
=== Counting Dates===


<sparql tryit="1">
<sparql tryit="1">
# count distinct dates for women (who have at least one)
# uncomment HAVING line for women with only one
# CAVEAT: there may be some discrepancies between dates shown on wiki pages and dates returned by sparql
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 3,769: Line 3,896:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT ?person ?personLabel (COUNT(DISTINCT ?date_value) as ?count)


SELECT distinct ?locationLabel ?location ?wikidata ?wd_geo ?instanceLabel ?bn_geo
WHERE {
WHERE {   
   
 
{  # main dates
  {?item bnwdt:P29 ?location . } # resided at
 
  union
  ?person bnwdt:P3 bnwd:Q3 . # women 
  {?location bnwdt:P12 bnwd:Q2147 .} # OR has instance of locality
  ?person ?p ?s .       
  union
      ?s ?date_prop ?wdv .
  {?item bnwdt:P2  ?location . } # OR location P2
        ?wdv wikibase:timeValue ?date_value .
  # any other possibles ?
  } # /main dates
    
    
   optional { ?location bnwdt:P12 ?instance .  } # check instance of
   UNION
    
    
  optional {     
  { # qualifier dates
      ?location bnwdt:P117 ?ws . # wikidata id       
      
       
    ?person bnwdt:P3 bnwd:Q3 . 
        bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
    ?person ?p ?s .  
 
      ?s ?date_prop ?pqv .
 
         ?pqv wikibase:timeValue ?date_value.
         SERVICE <https://query.wikidata.org/sparql> {
     } # /qual dates
          optional {?wikidata wdt:P625 ?wd_geo .}  # does the wikidata page have geocoords?
        } # /wikidata service 
     } #/wikidata optional
    
    
  filter (!bound(?wd_geo) ). # no geocoords in wikidata. some may have coords in BN...
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". }
    
    
  optional { ?location bnwdt:P153 ?bn_geo .  } # so check for coords in BN
} # /where
  ##filter (!bound(?bn_geo)) . # uncomment to filter those out as well
GROUP BY ?person ?personLabel
 
# HAVING(?count=1)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
ORDER BY ?wikidata ?locationLabel


ORDER BY ?count ?person
</sparql>
</sparql>


=== Archaeological sites that don't have National Heritage England list numbers ===
=== Start dates that might not have accompanying end dates ===


<sparql tryit="1">
<sparql tryit="1">
#title:archaeological sites without National Heritage numbers
#title:Women with start dates that might not have accompanying end dates
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 3,816: Line 3,941:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT ?item ?itemLabel ?location ?locationLabel
SELECT distinct ?personLabel ?prop_label ?start_date  (if(bound(?end_date), "yes", "no") as ?has_end_date) ?person ?s 
(if(bound(?locEngland), "yes", "") as ?inEngland)
#(group_concat(?other_date_label; SEPARATOR=" | ") as ?other_dates)


WHERE {
WHERE {
   ?item bnwdt:P12 bnwd:Q86 . # item instance of archaeological site
   ?person bnwdt:P3 bnwd:Q3 .
    
 
   filter not exists {?item bnwdt:P129 ?thing } # without NH list number
  # need to find start times anywhere and get prop label so use claim.
 
   ?person ?p ?s .
  optional { ?item bnwdt:P2 ?location } # location if it has one
   ?claim wikibase:claim ?p;     
   optional { ?item bnwdt:P2 ?locEngland .
        rdfs:label ?prop_label. filter(lang(?prop_label)="en") .   
              ?locEngland bnwdt:P33+ bnwd:Q617.
   
          } # is the location in England
# pretty sure start time is qualifier only... 
 
# get start dates
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
# then optional end dates
}
# can only see end time/pit associated, and the only pit with start time is not relevant, but can't be sure that'll always be true.
  # optional other that excludes both start/end but lists any other date types
    
    ?s bnpq:P27 ?start_date . # get start dates
 
    optional {?s bnpq:P28 ?end_date .} # check for end dates


order by ?itemLabel
#  optional {
#      ?s ?pq ?other_date . # could there be any other associated dates?
     
#      ?qual_prop wikibase:qualifier ?pq;     
#            wikibase:propertyType wikibase:Time ; # nb *does not* include edtf dates but AFAICT there are none in qualifiers.
#            rdfs:label ?other_date_label . filter(lang(?other_date_label)="en-gb") . # what kind of date is it.
 
        # drop both start and end this time. idk if there could be a faster way to do this?
#      filter not exists { ?s (bnpq:P27 | bnpq:P28) ?other_date .  }
 
#  } # / optional other dates
 
  # filter(!bound(?end_date)). # to filter out rows with an end date
 
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". }
 
}


ORDER BY ?personLabel ?prop_label ?start_date
</sparql>
</sparql>


=== Date of latest edit for every item, according to WQS ===
 
=== End dates that might not accompanying start dates ===


<sparql tryit="1">
<sparql tryit="1">
#title:latest edits dates for wikibase items
#title:Women with end dates that might not have accompanying start dates
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
## because of WQS disappearing data bugs this may not always match the latest edit in the page history
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
 
SELECT ?item ?date ?dateLabel
WHERE {
  ?item wikibase:timestamp ?date .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
order by ?date
 
</sparql>
 
=== Wikidata ID is a URL ===
 
<sparql tryit="1">
 
#title:check for accidental use of URL instead of wikidata ID
## all checked and fixed at 18/12/23 but adding the query in case it recurs
 
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 bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
Line 3,867: Line 3,998:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?personLabel ?prop_label ?end_date 
(if(bound(?start_date), "yes", "no") as ?has_start_date) 
(group_concat(?other_date_label; SEPARATOR=" | ") as ?other_dates)
?person ?s


SELECT distinct ?item ?itemLabel ?wd_http
WHERE {
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 .
  ?person ?p ?s .
  ?claim wikibase:claim ?p;     
        rdfs:label ?prop_label. filter(lang(?prop_label)="en") . 
   
# get end dates
# then optional start dates
# can only see start time/pit associated, and in fact the only pit with start time is not relevant, but can't be sure that'll always be true.
  # so an optional other that excludes both start/end but lists any other date types with group_concat
    
    
  ?item bnwdt:P117 ?wd_http . # wikidata id       
    ?s bnpq:P28 ?end_date . # get end dates
    
    
  filter(strstarts(str(?wd_http), "http")).
    optional {?s bnpq:P27 ?start_date .} # check for start dates
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
}
ORDER BY ?itemLabel
</sparql>


=== Wikidata URL is not a URL ===
    optional {
 
        ?s ?pq ?other_date . # could there be any other associated dates?
<sparql tryit="1">
        ?qual_prop wikibase:qualifier ?pq;     
#title:check for wikidata URLs that don't start with http. could still be other problems!
              wikibase:propertyType wikibase:Time ; # nb *does not* include edtf dates but AFAICT there are none in qualifiers.
## all checked and fixed at 18/12/23 but adding the query in case of any recurring issues
              rdfs:label ?other_date_label . filter(lang(?other_date_label)="en-gb") . # what kind of date
        # drop both start and end. idk if there could be a faster way to do this?
        filter not exists { ?s (bnpq:P27 | bnpq:P28) ?other_date .  }
 
  } # / optional other dates
 
# filter(!bound(?start_date)). # to filter out rows with a start date (77 atm)
 
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". }
 
}


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
group by  ?personLabel ?prop_label ?end_date ?start_date ?has_start_date ?person ?s 
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/>


 
ORDER BY ?personLabel ?prop_label ?end_date
SELECT distinct ?item ?itemLabel ?wd_url
WHERE { 
 
  ?item bnp:P117 ?ws .  # wikidata id       
    ?ws bnpq:P14 ?wd_url .
  filter(!strstarts(str(?wd_url), "http")).
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
ORDER BY ?itemLabel
</sparql>
</sparql>


=== Oxford and Cambridge academic degrees potential date problems ===
=== Women having children ===


<sparql tryit="1">
<sparql tryit="1">
#title:academic degree Oxford/Cambridge date issues
#title:women having children
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 3,919: Line 4,053:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?personLabel ?degreeLabel ?byLabel ?subjectLabel
# lol defaultView:Timeline{"hide":["?s", "?date_prec", ""]}
?date ?date_label ?s ?person #?subject ?degree ?by ?university
 
# P131 had child in / P45 child
# a handful of P45 named children don't have dob though probably have dob in wikidata
 
SELECT distinct ?person ?personLabel ?childLabel ?date_value ?date_prec ?had_child_edtf ?note  
?s
 
where {
 
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
 
  # had child in (unnamed children)
  ?person bnp:P131 ?s .
      ?s bnps:P131 ?had_child_edtf . # keep the edtf date for reference, though i think you can just use the time value/prec with these.


WHERE { 
  # get dates detail via ?s and psv
   ?person bnwdt:P3 bnwd:Q3 . #select women
   # gets edtf dates in std wiki date format
  # https://github.com/ProfessionalWiki/WikibaseEdtf 
      ?s ?psv ?wdv .
        ?wdv wikibase:timeValue ?date_value .
        ?wdv wikibase:timePrecision ?date_prec .
    
    
   # academic degree = P59.  
   # filter edtf date.
   ?person bnp:P59 ?s . 
   FILTER ( datatype(?had_child_edtf) = xsd:edtf ) . #shows only the raw EDTF string from the query results
    ?s bnps:P59 ?degree . # type of degree
 
 
   # interesting, when you put this after wikibase:timeValue it seems to get every timey-wimey statement for women who have had child in ? (but only one)
   # optional qualifiers for degree
   #?person bnwdt:P131 ?had_child .   
 
      
  # P60 subject
  # not much added in quals for had child. only maybe note P47. some have sourcing circumstances.
    optional { ?s bnpq:P60 ?subject}
   optional { ?s bnpq:P47 ?note . } #
 
   # P61 conferred by
    ?s bnpq:P61 ?by .
    
  # date with type
     ?s ?pq ?date .     
      ?qual_prop wikibase:qualifier ?pq;
              wikibase:propertyType wikibase:Time ; # nb excludes edtf dates
              rdfs:label ?date_label . filter(lang(?date_label)="en") . # what kind of date is it.
     
# filter: (cambridge (Q1181) and before 1948) OR (oxford (Q364) and before 1920)
    
  filter( ( year(?date)<1920 && ?by=bnwd:Q364 ) || ( year(?date)<1948 && ?by=bnwd:Q1181 ) )
 
     
  SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
}
order by ?byLabel ?personLabel ?date ?degreeLabel
</sparql>


=== Position held: item v free text ===
   }  
 
   union
<sparql tryit="1">
# held position job titles item v held position free text
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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
 
SELECT
?work_label  ?positionLabel ?position (count(*) as ?count)
 
WHERE {
 
  ?person bnwdt:P3 bnwd:Q3 . # women
 
  # get work activities: held position / held position (free text) /  employed as
  ?person ( bnp:P17|bnp:P48 ) ?s . 
 
  ?person ?work_p ?s . # for work type label
  ?work wikibase:claim ?work_p;     
        rdfs:label ?work_label. filter(lang(?work_label)="en") . 
   
    # more about the position
    ?s ( bnps:P17|bnps:P48 ) ?position . 
 
  FILTER( !isBLANK(?position)  ) . # filter out <unknown value>
 
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
group by ?work_label  ?positionLabel ?position
order by lcase(str(?positionLabel))
</sparql>
 
==== Women with position held free text ====
 
<sparql tryit="1">
# held position free text job titles
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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
 
SELECT ?person ?personLabel ?positionLabel
 
WHERE {
 
  ?person bnwdt:P3 bnwd:Q3 . # women
 
  # held position (free text)
  ?person bnwdt:P48  ?position . 
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
order by ?personLabel ?positionLabel
</sparql>
 
==Tools for batch processing and quality assurance work==
 
===All people (by assigned gender), filtering out those already listed as instance of human===
 
<sparql tryit="1">
# 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
</sparql>
 
===All places (by coordinate location on wikidata), filtering out places already listed as instance of locality===
 
<sparql tryit="1">
# 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
</sparql>
 
===All items without a P12 (instance of) triple===
 
<sparql tryit="1">
#title:nearly all items without P12 (instance of)
#NB: the query will only find items that have at least one statement; this excludes a small number of Qs and a larger number (~35) of Ps.
#see separate query to find items without any statements
 
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 ?item ?itemLabel
WHERE {
  ?item ?b ?c .
      ?prop wikibase:claim ?b;   
            wikibase:statementProperty ?ps.
      # ?prop wikibase:propertyType wikibase:WikibaseItem. # limit to P & Q Items. not necessary; only the claim is needed.
      # weirdness: it still causes some things that are definitely WikibaseItem to be dropped and idk why.
 
  FILTER NOT EXISTS {?item bnwdt:P12 ?instance .}
 
## FILTER(STRSTARTS(STR(?item), "https://beyond-notability.wikibase.cloud/entity/P")) . # uncomment to limit to P Properties
## FILTER(STRSTARTS(STR(?item), "https://beyond-notability.wikibase.cloud/entity/Q")) .  # or limit to Q items
 
  SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb".
  }
}
</sparql>
 
===Counts of items for each value of the property "instance of" (P12)===
 
<sparql tryit="1">
 
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  ?value ?valueLabel  (count(*) as ?count)
WHERE { 
 
  VALUES (?p) { (bnwdt:P12) } 
 
  ?s ?p ?value.
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
 
}
GROUP BY ?value ?valueLabel
 
ORDER BY lcase(?valueLabel) # order by is case sensitive
# or to order by count
# order by ?count
 
</sparql>
 
===Get all items (with 'instance of' statement) for duplicate checking in OpenRefine===
 
<sparql tryit="1">
# Get all items (with 'instance of' statement) for duplicate checking in OpenRefine
 
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 bnwdt:P12 ?anything .
  SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb".
  }
}
 
ORDER BY ?itemLabel
</sparql>
 
===All uses of <unknown value>===
 
<sparql tryit="1">
# Query to look for uses of <unknown value> (now including qualifiers)
 
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  ?item ?itemLabel  ?mainLabel ?sub_Label ?unknown_value_forLabel  ?unknown_value_for ?t
WHERE
{
{
  # qualifiers
  ?item ?p ?s.
 
  ?s ?sub ?sub_ .
  ?main wikibase:claim ?p.
  ?main wikibase:statementProperty ?sub. 
 
  ?s ?pq ?t .
 
  ?unknown_value_for wikibase:qualifier ?pq . 
  FILTER( isBLANK(?t)  ) . # filter for <unknown value>
   }
   UNION
   {
   {
  # top level
  # named children (are any in both sections??? from dates looks possible a couple might be [wherry / hodgson])
  ?item ?p ?s.
  ?person bnp:P45 ?s.
  ?s ?ps ?t .
        ?s bnps:P45 ?child .
 
      optional { ?child bnp:P26 ?ss .
  ?unknown_value_for wikibase:claim ?p.
                    ?ss bnps:P26 ?dob .  
  ?unknown_value_for wikibase:statementProperty ?ps.
                    ?ss ?psv ?wdv .
   
                        ?wdv wikibase:timeValue ?date_value .
  FILTER( isBLANK(?t) ) .
                        ?wdv wikibase:timePrecision ?date_prec .
              }
   }
   }
    
    
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
 
}
}
ORDER BY ?itemLabel ?unknown_value_forLabel
</sparql>
=== Items without any statements ===
<sparql tryit="1">
#title:items with 0 statements
# NB: because of the WQS disappearing data bugs, a few of the items might in reality have n>0 statements. Some may be intentionally empty.
SELECT distinct ?item  ?itemLabel
WHERE {
  ?item wikibase:statements 0 .


  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
order by ?person ?date_value
 
}
order by ?item
</sparql>
</sparql>

Revision as of 14:30, 9 April 2024

Admin/batch tools queries

SAL and RAI

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

# 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,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,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,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 elections were proposed to RAI linked in a graph to those who proposed and seconded their nomination for election

# People whose elections were proposed to RAI linked in a graph to those who proposed and seconded their nomination for election

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 ?RAIproposed ?RAIproposedLabel ?RAIseconded ?RAIsecondedLabel WHERE
{
  ?person bnwdt:P3 bnwd:Q3 .
  ?person bnp:P7 ?RAIstatement .
  ?RAIstatement bnps:P7 ?RAIproposed .
  OPTIONAL {?RAIstatement bnpq:P8 ?RAIseconded .}
    SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb".
    }
BIND( "7C4DCD" AS ?rgb ) .
}

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,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,en".
    }
}
GROUP BY ?SALproposerLabel ?SALproposer ?co_signatoryLabel ?co_signatory 
ORDER BY DESC(?co_signatory_count)

Try it!


Women who are listed as Fellows of the Society of Antiquaries of London (FSAs) on our wikibase and who are on Wikidata, but are not listed as FSAs on Wikidata

# Women who are listed as Fellows of the Society of Antiquaries of London (FSAs) on our wikibase and who are on Wikidata, but are not listed as FSAs on 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
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  
  ?person bnwdt:P75 bnwd:Q8. # find only BN subjects having a FSA (h/t @Tagishsimon)

  ?person bnwdt:P117 ?wikidata_ID . #look for wikidata ID on person page
  bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?item) .

  SERVICE <https://query.wikidata.org/sparql> {
        ?item wdt:P21 ?WD_gender. #get gender of person
        FILTER NOT EXISTS {?item wdt:P166 wd:Q26196499 . } #not FSA on Wikidata
      }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". } 
}
ORDER BY ?personLabel

Try it!


Women's interactions with SAL (Q1 and Q8)

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 distinct ?person ?personLabel  ?prop ?propLabel   ?pq_value  ?qual_propLabel  ?sal 

WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # women
  ?person ?p ?s .

      ?prop wikibase:claim ?p;      
         wikibase:statementProperty ?ps;   
         wikibase:statementValue ?psv;
         wikibase:propertyType ?prop_type.    
    
      # union query to get both q8 and q1 
      { ?s ?ps bnwd:Q8 . }  union { ?s ?ps bnwd:Q1 . }
       ?s ?ps ?sal.
   
       optional { 
         ?s ?pq ?pq_value .   
         
         ?qual_prop wikibase:qualifier ?pq .   
         #?qual_prop rdfs:label ?qual_prop_label. filter(lang(?qual_prop_label)="en-gb") . 
         #?qual_prop wikibase:propertyType ?qual_prop_type
         
       } # /qualifiers

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
}
ORDER BY ?personLabel ?propLabel ?s

Try it!


Women's interactions with RAI (Q35 and Q29)

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 distinct ?person ?personLabel  ?prop ?propLabel ?prop_type  ?pq_value ?pq_valueLabel ?qual_propLabel ?qual_prop_type ?rai ?s

WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # women
  ?person ?p ?s .

      ?prop wikibase:claim ?p;      
         wikibase:statementProperty ?ps;   
         wikibase:statementValue ?psv;
         wikibase:propertyType ?prop_type.    
    
      # to get both q35 and q29 
      { ?s ?ps bnwd:Q35 . }  union { ?s ?ps bnwd:Q29 . }
       ?s ?ps ?rai.

       # qualifiers. 
       optional { 
         ?s ?pq ?pq_value .   
         
         ?qual_prop wikibase:qualifier ?pq .   
         #?qual_prop rdfs:label ?qual_prop_label. filter(lang(?qual_prop_label)="en-gb") . 
         ?qual_prop wikibase:propertyType ?qual_prop_type .
         
       } # /qualifiers

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
}
ORDER BY ?personLabel

Try it!


FSAs who didn't interact with SAL [in Q1 or Q8] apart from record of election

#title: FSAs with no record of interacting with SAL in Q1 / Q8
# only active engagements like spoke at, corresponded with, etc, and excluding P75 "was fellow of" and P5 "archives at".
# WIP: to update with other SAL records as I work through queries for them. Plus caveat that there may be other sources of interaction not recorded in the database!

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 distinct ?person ?personLabel
(if(bound(?sal), "yes", "no") as ?q1_q8_interaction)

WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # women
  ?person bnwdt:P16 ?whatever . # FSAs
  
  # optional query FSAs who do have record of interaction.
   optional {   
     ?person ?p ?s .
  
      ?prop wikibase:claim ?p;      
         wikibase:statementProperty ?ps.    

      # union query to get both q8 and q1  but *drop* fellow of q8 p75 and p5 q8 archives at (Q712; catalogue says archives bequeathed by another person)
      { ?s ?ps bnwd:Q8 . filter not exists { ?s (bnps:P75|bnps:P5) ?anything . } }  
      union 
      { ?s ?ps bnwd:Q1 . }
       ?s ?ps ?sal.
     
   } #/optional union.   
  
  # to filter out interacters completely uncomment the next line and comment out if(bound) in select
  # filter(!bound(?sal)).

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?q1_q8_interaction  ?personLabel

Try it!


RAI members who didn't interact with RAI [in Q29 or Q35] apart from record of election

#title: RAIs with no record of interacting with RAI in Q29/Q35
# only active engagements like spoke at, corresponded with, etc, and excluding P67 "was member of" 
# WIP: to update with other RAI records as I work through queries for them. Plus caveat that there may be other sources of interaction not recorded in the database.

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 distinct ?person ?personLabel 
(if(bound(?rai), "yes", "no") as ?interaction)

WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # women
  ?person bnwdt:P7 ?rai_elected .
  
  # optional query RAIs who do have record of interaction.
   optional {   
     ?person ?p ?s .
  
      ?prop wikibase:claim ?p;      
         wikibase:statementProperty ?ps.    

      # union query to get both q8 and q1  but *drop* member of p67. a couple of rogue P75 # to get both q35 and q29 
      { ?s ?ps bnwd:Q35 . filter not exists { ?s (bnps:P67|bnps:P75) ?member . } }  
      union 
      { ?s ?ps bnwd:Q29 . }
       ?s ?ps ?rai.
     
   } #/optional union.   
  
  # to filter out the interacters completely uncomment the next line and comment out if(bound) in select
  # filter(!bound(?rai)).

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}

ORDER BY ?interaction  ?personLabel

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 . #using 'held position' for roles not at institutions that typically employed people on a formal, longstanding basis.
  ?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 . #using 'employed as' for roles at institutions that typically employed people on a formal, longstanding basis.
  ?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!


Women and their work activities, with employers/organisations and dates

# query for women's different kinds of work activity, with employer/organisation and dates where available

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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT distinct ?personLabel ?workLabel ?positionLabel ?date_pLabel ?date 
?employerLabel ?organisedLabel ?ofLabel ?person
#?s  ?position  ?of  ?work ?employer ?organised

WHERE {
    
  ?person bnwdt:P3 bnwd:Q3 . # women
  
  # get work activities: held position / held position (free text) /  employed as
  ?person ( bnp:P17|bnp:P48|bnp:P105 ) ?s .  
  
  ?person ?work_p ?s . # for activity type label
  ?work wikibase:claim ?work_p .  
    
    # more about the position
    ?s ( bnps:P17|bnps:P48|bnps:P105 ) ?position .  
    # employer / organised by / of (incl free text). TODO: check whether these are mutually exclusive; could make this a union.
    # for position held, employer>of [ontology day discussion 13/9/23]
    OPTIONAL { ?s bnpq:P18 ?employer .}  
    OPTIONAL { ?s bnpq:P109 ?organised .}
    OPTIONAL { ?s ( bnpq:P78 | bnpq:P66 ) ?of .}
 
   # optional { ?s bnpq:P2 ?location . } # sometimes there is location and no employer/org/of 
    
  # dates
    optional {
    ?s ?pq ?date . 
      
      ?date_p wikibase:qualifier ?pq;      
              #wikibase:propertyType ?date_prop_type; # can check date property types if needed
              wikibase:propertyType wikibase:Time . # nb *does not* include edtf dates but AFAICT there are none in qualifiers.
              #rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # what kind of date is it.
      } # /dates
   
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
  
} # /where

ORDER BY ?person

Try it!


Women with publications listed in indexes of archaeological papers circa 1870 - 1907

# Women with publications listed in indexes of archaeological papers by journal 

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
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P76 bnwd:Q419 . # select people with publications listed in indexes of archaeological papers
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?personLabel

Try it!


Women with publications in indexes of archaeological papers, listed by name of journal

# Women with publications listed in indexes of archaeological papers circa 1870 - 1907 

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  ?inLabel ?personLabel ?in ?person
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P76 bnwd:Q419 . # select people with publications listed in indexes of archaeological papers
  
  ?person bnp:P76 ?s .  
    #?s ?p ?fish . 
    # anything of note apart from recorded in? some P83 collaborated with. a few dates; a few text notes. 
  
  ## works published in P101
    #optional { 
      ?s bnpq:P101 ?in . 
    #}
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?inLabel ?personLabel

Try it!


Lecturers

#title:lecturers
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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT distinct ?person ?personLabel  ?positionLabel 
?organisedLabel ?ofLabel 
?qual_propLabel ?qualLabel
#?position ?of  ?work ?organised  ?date_precision ?qual_prop ?date ?qual ?workLabel
?s

WHERE {
    
  ?person bnwdt:P3 bnwd:Q3 . # women
  
  # work activities: held position / held position (free text) /  employed as
  #?person ( bnp:P17|bnp:P48|bnp:P105 ) ?s .  
  
  ?person ?work_p ?s . # for activity type label
    ?work wikibase:claim ?work_p .  

    ?s ?bnps ?position .  
    # freelance and extension lecturing (q701 and q3021)
    { ?s ?bnps bnwd:Q701  . } union { ?s ?bnps bnwd:Q3021 .  }
  
    # employer / organised by / of (incl free text). 
    OPTIONAL { ?s bnpq:P109 ?organised .}
    OPTIONAL { ?s ( bnpq:P78 | bnpq:P66 ) ?of .}
 
   # optional { ?s bnpq:P2 ?location . } # do locations separately.
    
  # dates with precision
 #   optional {
 #     ?s (bnpqv:P1 | bnpqv:P27 | bnpqv:P28  ) ?pqv.
 #     ?s ?pqq ?pqv . # just gets the uri but doesnt seem to cause dups
 #        ?pqv wikibase:timeValue ?date .  
 #        ?pqv wikibase:timePrecision ?date_precision .
 #     }
      
    # qualifiers
    optional {
      ?s ?pq ?qual .   
         ?qual_prop wikibase:qualifier ?pq .  
      
      } # /dates
   
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
  
} # /where

ORDER BY ?person ?s

Try it!


Professional Activities and Organisations

Women's service on committees etc (P102)

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 ?personLabel ?serviceLabel ?qual_propLabel  ?qualLabel   ?qual ?person ?s # ?service
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   
  ?person bnp:P102 ?s .   # served on P102
     ?s bnps:P102 ?service .
    
   optional {  #qualifiers, if any
     ?s ?pq ?qual .      
        ?qual_prop wikibase:qualifier ?pq.      
      } # /quals

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb, en". } 
}

ORDER BY ?personLabel ?s

Try it!


Women corresponding with individuals

#title:women corresponding with individuals

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 ?correspondent ?correspondentLabel  ?qualifier_label 
?qualifier ?qualifierLabel

where
{
  ?person bnwdt:P3 bnwd:Q3 .

  ?person bnp:P73 ?s .
    ?s bnps:P73 ?correspondent . # corresponded with  
    ?correspondent bnwdt:P12 bnwd:Q2137 .  # correspondent is i/o human
  
     optional
      { ?s ?qual_p ?qualifier .   
        ?qual_prop wikibase:qualifier ?qual_p.
        ?qual_prop rdfs:label ?qualifier_label. filter(lang(?qualifier_label)='en') .
       }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}

ORDER BY ?person

Try it!


Women's service: information about "of" qualifier, including alternatives for locations

#title: query for served on "of" info
# where a women served on committee *of* organisation, need to link to info about the organisation, including location.
# geo data for the location may be in its BN page but is more likely to need to be fetched from wikidata
# todo: check whether there are orgs that don't have location info in BN but do have it in 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/>

SELECT distinct ?personLabel ?serviceLabel ?of ?ofLabel ?of_location ?of_locationLabel ?of_geo ?of_long ?of_lat ?person #?s 

WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} 
  
  ?person  bnp:P102 ?s .   
    ?s bnps:P102 ?service .
    ?s bnpq:P78 ?of .
  
      #optional { ?of bnwdt:P117 ?of_wikidata.  }   #todo

      optional { ?of bnwdt:P2 ?of_location. 

            optional { ?of_location bnwdt:P153 ?bn_of_geo . }

            optional { ?of_location bnwdt:P117 ?wd_of_loc .
                             bind(iri(concat("http://www.wikidata.org/entity/", str(?wd_of_loc))) as ?wd_of_loc_url) . 
                            
                        SERVICE <https://query.wikidata.org/sparql> {
                        optional {?wd_of_loc_url wdt:P625 ?wd_of_geo .}   # wikidata geocoords
                         } # /wikidata service   
                     } #/optional location wikidata
               } #/optional P2 location. 

      BIND(COALESCE(?bn_of_geo, ?wd_of_geo) AS ?of_geo).  # if we have bn_geo use that, then try wd_geo
  
      BIND(geof:longitude(?of_geo) AS ?of_long) 
      BIND(geof:latitude(?of_geo)  AS ?of_lat)
  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb, en". } 
}
ORDER BY ?personLabel ?s

Try it!


All activities for women that have instance of public and professional activities

#title:women and 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 ?person ?personLabel ?ppa_label ?ppa ?ppa_valueLabel ?ppa_value ?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.
             } # /label service
  
      ?ppa bnwdt:P12 bnwd:Q151 . # instance of PPA      
       
      # get a bit of detail about the ppa 
      ?s ?ps ?ppa_value.

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}

order by ?personLabel ?ppa_label

Try it!


Counts of PPAs for women

#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)

Try it!


PPA Buckets for Women

#title:ppa buckets (revised February 2024)
# broad PPA grouping categories to use for overviews and analysis within categories

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.   
   
      # note: i think you need rdfs:label (*Label won't work) for the bind()

      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". 
                       ?ppa rdfs:label ?ppa_label. 
                } # /label service
  
      ?ppa bnwdt:P12 bnwd:Q151 . # i/o ppa      
 
      # get stuff about ?s 
      ?s ?ps ?ppa_value.
  
    # note: it would be possible to write this to use ppa rather than ppa_label
    # BUT then it would be much more opaque and difficult to edit if (when!) we make any changes to the buckets.
    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 ("acknowledged for role", "applicant to", "employed as", "held position", "held position (free text)", "served on"),   "positions" ,
                   if( str(?ppa_label) in ("contributed to", "illustrated in", "work(s) published in"),  "publishing",
                     if( str(?ppa_label) in ("corresponded with", "was fellow of", "was member of"),  "societies",
                       if( str(?ppa_label) in ("benefactor to", "fundraiser for", "founded"),  "charitable" ,
       "none")))))))))
    as ?bucket).
        

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
}

order by ?personLabel ?ppa_label

Try it!


Suffrage-related activities

#title:initial query for suffrage activities

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 ?mainLabel ?sub_Label ?qualLabel ?locationLabel ?date 
# ?pq ?sub_ ?qual ?main 
?s

WHERE {  

    ?person bnwdt:P3 bnwd:Q3 . #select women
    FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team

    ?person ?p ?s .
  
      ?s ?sub ?sub_ .
        ?main wikibase:claim ?p.
        ?main wikibase:statementProperty ?sub.   
  
  # sub_ i/o - some do have suffrage activity
  #  optional { ?sub_ bnwdt:P12 ?sub_io . ?sub_ bnwdt:P12 bnwd:Q1166 . }

  # union
   { 
    # a qualifier (anywhere) has i/o suffrage activity
       ?s bnpq:P12 bnwd:Q1166.
    }

# what about a main rather than qualifier having i/o suffrage activity? i don't think there are any atm but could be.
# union
 #   { # this might find extra linked i/o suffrage but i'm not sure it works.
 #     ?sub_ bnwdt:P12 bnwd:Q1166 .
 #     }

  union
    {
     # does *not* have i/o suffrage activity in any qualifiers  ... slows things right down and doesn't seem to make any difference to results?
     #filter not exists { ?s bnpq:P12 bnwd:Q1166. }
  
     # ... but a qualifier *does* have i/o suffrage activity. i think!
      ?s ?pq ?qual .
        ?qual bnwdt:P12 bnwd:Q1166 .

      } # /union
  
  optional { 
    # date qualifiers. [assumes no edtf in quals. ] all seem to be p.i.t. 
        ?s ?dpq ?date .   
          ?qual_date wikibase:qualifier ?dpq .
          ?qual_date wikibase:propertyType wikibase:Time. 
  }
  
  optional { ?s bnpq:P78 ?of. }  # outside the union seems much speedier
  
  optional { ?s bnpq:P2 ?location . }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }

}
order by ?personLabel ?mainLabel

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

# 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:Q2035 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2036 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2037 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2038 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2039 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2040 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2041 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2042 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q39.}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2534.} 
  ?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 whose residence was at one time in North East England or Yorkshire and the Humber

# People whose residence was at one time in North East England or Yorkshire and the Humber

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:Q72 .}
    UNION
    {?county bnwdt:P33 bnwd:Q200 .}
  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

# 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:Q2035 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2036 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2037 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2038 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2039 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2040 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2041 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2042 .}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q39.}
    FILTER NOT EXISTS {?resident bnwdt:P29 bnwd:Q2534.} 
  ?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!


Places at which women resided, sorted by how many residences all women had at a given village/town/city/London area

# Places at which women resided, sorted by how many residences all women had at a given village/town/city/London area

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 ?residence ?residenceLabel (count(?residence) as ?residence_count) #count number of places at which women lived 
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P29 ?residence . # select residences
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
GROUP BY ?residence ?residenceLabel
ORDER BY DESC(?residence_count)

Try it!


Districts in which women resided, sorted by how many residences all women had in that district (or equivalent sub-level for non-UK residences)

# Districts in which women resided, sorted by how many residences all women had in that district (or equivalent sub-level for non-UK residences)

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 ?district ?districtLabel (count(?district) as ?district_count) #count number of districts in which women lived 
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
GROUP BY ?district ?districtLabel
ORDER BY DESC(?district_count)

Try it!


Counties in which women resided, sorted by how many residences all women had in that county

# Counties in which women resided, sorted by how many residences all women had in that county

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 ?county ?countyLabel (count(?county) as ?county_count) #count number of counties in which women lived 
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
GROUP BY ?county ?countyLabel
ORDER BY DESC(?county_count)

Try it!


Counties of residence for women recorded in CAS Indexes of Archaeological Papers, sorted by how many residences all women had in that county

# Counties of residence for women recorded in CAS Indexes of Archaeological Papers, sorted by how many residences all women had in that county

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 ?county ?countyLabel (count(?county) as ?county_count) #count number of counties in which women lived 
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  ?person bnwdt:P76 bnwd:Q419 . #select women recorded in CAS Indexes of Archaeological Papers
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
GROUP BY ?county ?countyLabel
ORDER BY DESC(?county_count)

Try it!


Counties of residence for women nominated as FSAs, sorted by how many residences all women had in that county

# Counties of residence for women nominated as FSAs, sorted by how many residences all women had in that county

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 ?county ?countyLabel (count(?county) as ?county_count) #count number of counties in which women lived 
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  ?person bnwdt:P16 ?signatory . #select women who were nominated for election to FSA
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
GROUP BY ?county ?countyLabel
ORDER BY DESC(?county_count)

Try it!


Counties of residence for women nominated to RAI, sorted by how many residences all women had in that county

# Counties of residence for women nominated to RAI, sorted by how many residences all women had in that county

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 ?county ?countyLabel (count(?county) as ?county_count) #count number of counties in which women lived 
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  ?person bnwdt:P7 ?signatory . #select women who were nominated for election to RAI
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
GROUP BY ?county ?countyLabel
ORDER BY DESC(?county_count)

Try it!


Counties of residence for women who spoke at RAI meetings, sorted by how many residences all women had in that county

# Counties of residence for women who spoke at RAI meetings, sorted by how many residences all women had in that county

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 ?county ?countyLabel (count(?county) as ?county_count) #count number of counties in which women lived 
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  ?person bnwdt:P23 bnwd:Q29 . #select women who spoke at RAI Meeting
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
GROUP BY ?county ?countyLabel
ORDER BY DESC(?county_count)

Try it!


Counties of residence for women who exhibited at RAI meetings, sorted by how many residences all women had in that county

# Counties of residence for women who exhibited at RAI meetings, sorted by how many residences all women had in that county

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 ?county ?countyLabel (count(?county) as ?county_count) #count number of counties in which women lived 
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  ?person bnwdt:P13 bnwd:Q29 . #select women who exhibited at RAI Meeting
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
GROUP BY ?county ?countyLabel
ORDER BY DESC(?county_count)

Try it!


Counties of residence for women recorded in CAS Indexes of Archaeological Papers, on a map

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:Map{"hide":["?geo", "?wikidata"]}
#title:Counties of residence for women recorded in CAS Indexes of Archaeological Papers

SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo  
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  ?person bnwdt:P76 bnwd:Q419 . #select women recorded in CAS Indexes of Archaeological Papers
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
      optional { ?county bnwdt:P153 ?geo2 .  } # for geocoords added to BN
  
      optional {     
       ?county bnp:P117 ?ws .  # wikidata id P117        
         ?ws bnpq:P14 ?wikidata_url .
         BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata ) 
  
      SERVICE <https://query.wikidata.org/sparql> {
    
         optional {
           ?wikidata wdt:P625 ?geo1 . 
                  BIND(geof:longitude(?geo1) AS ?long)
                  BIND(geof:latitude(?geo1)  AS ?lat)
                } # geocoords if available      
       } # /wikidata service   
       } #/wikidata optional

    BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}

Try it!


Counties of residence for women nominated as FSAs, on a map

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:Map{"hide":["?geo", "?wikidata"]}
#title:Counties of residence for women nominated as FSAs

SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo  
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  ?person bnwdt:P16 ?signatory . #select women who were nominated for election to FSA
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team

  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
      optional { ?county bnwdt:P153 ?geo2 .  } # for geocoords added to BN
  
      optional {     
       ?county bnp:P117 ?ws .  # wikidata id P117        
         ?ws bnpq:P14 ?wikidata_url .
         BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata ) 
  
      SERVICE <https://query.wikidata.org/sparql> {
    
         optional { ?wikidata wdt:P625 ?geo1 . } # geocoords if available      
       } # /wikidata service   
       } #/wikidata optional

    BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}

Try it!


Counties of residence for women nominated to RAI, on a map

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:Map{"hide":["?geo", "?wikidata"]}
#title:Counties of residence for women nominated to RAI

SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo  
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P7 ?signatory . #select women who were nominated for election to RAI

  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
      optional { ?county bnwdt:P153 ?geo2 .  } # for geocoords added to BN
  
      optional {     
       ?county bnp:P117 ?ws .  # wikidata id P117        
         ?ws bnpq:P14 ?wikidata_url .
         BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata ) 
  
      SERVICE <https://query.wikidata.org/sparql> {
    
         optional { ?wikidata wdt:P625 ?geo1 . } # geocoords if available      
       } # /wikidata service   
       } #/wikidata optional

    BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}

Try it!


Counties of residence for women who spoke at RAI meetings, on a map

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:Map{"hide":["?geo", "?wikidata"]}
#title:Counties of residence for women who spoke at RAI meetings

SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo  
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   ?person bnwdt:P23 bnwd:Q29 . #select women who spoke at RAI Meeting

  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
      optional { ?county bnwdt:P153 ?geo2 .  } # for geocoords added to BN
  
      optional {     
       ?county bnp:P117 ?ws .  # wikidata id P117        
         ?ws bnpq:P14 ?wikidata_url .
         BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata ) 
  
      SERVICE <https://query.wikidata.org/sparql> {
    
         optional { ?wikidata wdt:P625 ?geo1 . } # geocoords if available      
       } # /wikidata service   
       } #/wikidata optional

    BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}

Try it!


Counties of residence for women who exhibited at RAI meetings, on a map

#title:Counties of residence for women who exhibited at RAI meetings  

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:Map{"hide":["?geo", "?wikidata"]}

SELECT distinct ?person ?personLabel ?county ?countyLabel ?wikidata ?geo  
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P13 bnwd:Q29 . #select women who exhibited at RAI Meeting

  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
      optional { ?county bnwdt:P153 ?geo2 .  } # for geocoords added to BN
  
      optional {     
       ?county bnp:P117 ?ws .  # wikidata id P117        
         ?ws bnpq:P14 ?wikidata_url .
         BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata ) 
  
      SERVICE <https://query.wikidata.org/sparql> {
    
         optional { ?wikidata wdt:P625 ?geo1 . } # geocoords if available      
       } # /wikidata service   
       } #/wikidata optional

    BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}

Try it!


Counties of residence for women in any of the above five categories, mapped

## IMPORTANT: LIMITATIONS OF THE MAP
## Only the top category of activity (layer) can be seen when all are selected (the default)
## To see each layer, you need to deselect all in the layers menu (diamond shaped icon, top right corner of the map) and view one layer at a time. Unfortunately this is the only way to compare them at the moment.
## (But I'll look into how I might be able to improve on this)

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

#title:Counties of residence for women who were nominated for election or had publications recorded or spoke/exhibited at RAI
#defaultView:Map{"hide":["?geo", "?wikidata"]}

SELECT distinct  ?county ?countyLabel ?wikidata ?geo  ?layer  #?person ?personLabel 
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
 
  {
    #women who were nominated for election to FSA | RAI 
    ?person ( bnp:P16 | bnp:P7 ) ?stmt .   
  }
  union
  {
    # women with publications recorded in indexes of archaeological papers 
    ?person bnp:P76 ?stmt . 
        ?stmt bnps:P76 bnwd:Q419 .
  }
  union
  {
    # women who spoke|exhibited at RAI Meeting
    ?person (bnp:P23 | bnp:P13) ?stmt .  
       ?stmt (bnps:P23 | bnps:P13) bnwd:Q29 . 
  }
  
  # get the p labels for layers
  ?person ?p ?stmt .  
  ?claim wikibase:claim ?p;
        rdfs:label ?layer. filter(lang(?layer)="en-gb").
   
  # get geo stuff
  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
      optional { ?county bnwdt:P153 ?geo2 .  } # for geocoords added to BN
  
      optional {     
       ?county bnp:P117 ?ws .  # wikidata id P117        
         ?ws bnpq:P14 ?wikidata_url .
         BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata ) 
  
      SERVICE <https://query.wikidata.org/sparql> {
         optional { ?wikidata wdt:P625 ?geo1 . } # geocoords if available      
       } # /wikidata service   
       } #/wikidata optional

    BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use it, if not try geo2
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
order by ?layer

Try it!


Regions in which women resided, sorted by how many residences all women had in that region

# Regions in which women resided, sorted by how many residences all women had in that region

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 ?region ?regionLabel (count(?region) as ?region_count) #count number of regions in which women lived 
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P29 ?residence . # select residences
  ?residence bnwdt:P33 ?district . #select districts
  ?district bnwdt:P33 ?county . #select counties
  ?county bnwdt:P33 ?region . #select region
  FILTER NOT EXISTS {?region bnwdt:P117 "Q145" .} #filter out UK (where UK is sub-region of NI)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
GROUP BY ?region ?regionLabel
ORDER BY DESC(?region_count)

Try it!


Women living in London during the 1890s

#title:Women living in 1890s London
# Query for women living in (greater) london in the 1890s 
# 1 row per person per address per date, could be reduced to 1 row per person if preferred.
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 ?personLabel ?date_label ?date ?person ?address ?address_item ?londonLabel ?geo ?long ?lat

WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # women
  ?person bnp:P29 ?s .   # resided at
    ?s bnps:P29 ?london . 
      ?london bnwdt:P33+ bnwd:Q322 .  # in Q322 greater london. 

    # optional street address (text)
  optional {
    ?s bnpq:P31 ?address .
    }
  # optional street address (item)
  optional {
    ?s bnpq:P100 ?address_item .
    }    

  # dates. About 30? not dated.
    #optional {
    ?s ?pq ?date . 
     # ?date wikibase:timeValue ?date_value. # if you don't want date label this should work instead
      
      ?qual_prop wikibase:qualifier ?pq;
              wikibase:propertyType wikibase:Time ; # nb excludes edtf dates
              rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # what kind of date is it.
    #  } # /dates
   
    # filter 1890-1899   
  FILTER("1890-01-01"^^xsd:dateTime <= ?date && ?date < "1899-12-31"^^xsd:dateTime).

  
  # address geocoordinates 
   optional { 
     ?s ?pqq ?geo .
        ?qual_geo wikibase:qualifier ?pqq;
                  wikibase:propertyType wikibase:GlobeCoordinate.
         BIND(geof:longitude(?geo) AS ?long) 
         BIND(geof:latitude(?geo)  AS ?lat)
             }

  # todo booth codes

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?person ?date

Try it!


Map of Women living in 1890s London

#title:Women living in 1890s London
# Query for women living in (greater) london in the 1890s 
# 1 row per person per address per date, could be reduced to 1 row per person if preferred.
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:Map
SELECT distinct ?personLabel ?date_label ?date ?person ?address ?address_item ?londonLabel ?geo ?long ?lat

WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # women
  ?person bnp:P29 ?s .   # resided at
    ?s bnps:P29 ?london . 
      ?london bnwdt:P33+ bnwd:Q322 .  # in Q322 greater london. 

    # optional street address (text)
  optional {
    ?s bnpq:P31 ?address .
    }
  # optional street address (item)
  optional {
    ?s bnpq:P100 ?address_item .
    }    

  # dates. About 30? not dated.
    #optional {
    ?s ?pq ?date . 
     # ?date wikibase:timeValue ?date_value. # if you don't want date label this should work instead
      
      ?qual_prop wikibase:qualifier ?pq;
              wikibase:propertyType wikibase:Time ; # nb excludes edtf dates
              rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # what kind of date is it.
    #  } # /dates
   
    # filter 1890-1899   
  FILTER("1890-01-01"^^xsd:dateTime <= ?date && ?date < "1899-12-31"^^xsd:dateTime).

  
  # address geocoordinates 
   optional { 
     ?s ?pqq ?geo .
        ?qual_geo wikibase:qualifier ?pqq;
                  wikibase:propertyType wikibase:GlobeCoordinate.
         BIND(geof:longitude(?geo) AS ?long) 
         BIND(geof:latitude(?geo)  AS ?lat)
             }

  # todo booth codes

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?person ?date

Try it!


Where did women who published in Folklore/Folk-lore Record live?

# Map of all places of residence for women who had publications in Folklore/Folk-lore Record 
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:Map{"hide":["?geo", "?count"]}

SELECT  ?person ?personLabel ?residenceLabel ?residence ?geo (count( ?person) as ?count)  #(concat(str(?count), " publication") as ?count_lbl)
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P76 bnwd:Q419 . # people with publications listed in indexes of archaeological papers. [262] 
  ?person bnp:P76 ?s .  
  
  ## works published in P101. folklore / folk-lore record q487 q490
      ?s bnpq:P101 ?in . 
      {?s bnpq:P101 bnwd:Q487 } union { ?s bnpq:P101 bnwd:Q490 . }
      # why does above pick up these two journals as well? 
      FILTER ( ?in not in ( bnwd:Q665 , bnwd:Q636 ) ) . 
  
  ?person bnwdt:P29  ?residence . 
      optional { ?residence bnwdt:P153 ?geo2 .  } # for geocoords added to BN

   optional {
     
       ?residence bnp:P117 ?ws .  # wikidata id P117
            
         ?ws bnpq:P14 ?wikidata_url .
         BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata ) 
  
       SERVICE <https://query.wikidata.org/sparql> {
    
       optional {?wikidata wdt:P625 ?geo1 .  } # geocoords if available
       
      } # /wikidata service   
    } #/wikidata optional

    BIND(COALESCE(?geo1, ?geo2) AS ?geo).  # if geo1 available use that, then try geo2
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
group by ?person ?personLabel ?residenceLabel ?residence ?geo 
ORDER BY ?geo

Try it!


BN people and other things located near Devizes

## testing use of geof:distance
#title:BN items located within 30 km of Devizes, Wiltshire
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:Map
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?wikidata ?wd_geo ?wd_long ?wd_lat  
WHERE {  
  
  {?item bnwdt:P29  ?location . } # resided at location
  #union
  #{?location bnwdt:P12 bnwd:Q2147 .} # OR location has instance of locality. is there a way to get this in the same structure?
  union
  {?item bnwdt:P2  ?location . } # item has property P2 location
  # any other possibles ? 
  
  ## limit to places in admin territory p33 england q617. (keep numbers down to avoid wikidata timing out)  
  ?location bnwdt:P33+ bnwd:Q617.
  ?location bnwdt:P117 ?ws .  # wikidata id   
  
    bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
         SERVICE <https://query.wikidata.org/sparql> {
             wd:Q1026699 wdt:P625 ?start. # devizes coordinates
             ?wikidata wdt:P625 ?wd_geo .
                      #BIND(geof:longitude(?wd_geo) AS ?wd_long) .
                      #BIND(geof:latitude(?wd_geo)  AS ?wd_lat) .
              FILTER(geof:distance(?wd_geo, ?start) < 30). # < 30 km from ?start.   
         } # /wikidata service     
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
}
ORDER BY ?locationLabel

Try it!


BN items near a chosen location

#title:a map of BN items near a chosen starting point in the UK
#defaultView:Map

## create a thingy for the start point change the Qxxx ID in the following PREFIX var_start line to chosen location.  
## **MUST** a) be in UK and b) have a wikidata item that has coordinate location!

PREFIX var_start: <https://beyond-notability.wikibase.cloud/entity/Q5>  # (Q5=sheffield)

## to change the distance you can edit the filter(?distance < xx) line near the end of the query.

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

## TODO is there a way to get the location itemLabel and use it in the map title...

SELECT distinct  ?item ?itemLabel ?locationLabel ?location ?wikidata ?wd_geo  ?distance #?wd_long ?wd_lat  
WHERE {  
  var_start: bnwdt:P117 ?start_wd_id .
  bind(iri(concat("http://www.wikidata.org/entity/", str(?start_wd_id))) as ?start_wd) . 
  
  {?item bnwdt:P29  ?location . } # resided at location
  union
  {?item bnwdt:P2  ?location . } # item has property P2 location
  # other possibles ? 
  
  ## limit to places in admin territory p33 uk q1741 seems ok. put it back to england q617 if there are any timeout problems. (keep numbers down to avoid wikidata timing out) 
  ?location bnwdt:P33+ bnwd:Q1741.
  ?location bnwdt:P117 ?ws .  # wikidata id   
    bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
  
         SERVICE <https://query.wikidata.org/sparql> {
             ?start_wd wdt:P625 ?start. # start_wd coordinates. 
             ?wikidata wdt:P625 ?wd_geo . 
         } # /wikidata service  
  
     #BIND(geof:longitude(?wd_geo) AS ?wd_long) .
     #BIND(geof:latitude(?wd_geo)  AS ?wd_lat) .  
     bind(geof:distance(?wd_geo, ?start) as ?distance). 

     FILTER(?distance < 40). # < xx km from start_wd
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
}
ORDER BY ?locationLabel

Try it!


Locations of BN excavations

#title:Locations of BN excavations
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:Map
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?adminterr ?wikidata ?wd_geo 
WHERE {  
  ?item bnwdt:P12 bnwd:Q38 .

  {
  ?item bnwdt:P2  ?location .  # item has property P2 location
  
  optional { ?location bnwdt:P33 ?adminterr . 
               ?adminterr bnwdt:P117 ?wsa .  # and has wikidata id   
  
            bind(iri(concat("http://www.wikidata.org/entity/", str(?wsa))) as ?wikidataa) .
               SERVICE <https://query.wikidata.org/sparql> {
               ?wikidataa wdt:P625 ?wd_geo2 .   
             } # /wikidata service     
           }
  
  optional {
  ?location bnwdt:P117 ?ws .  # and has wikidata id   
  
    bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
         SERVICE <https://query.wikidata.org/sparql> {
             ?wikidata wdt:P625 ?wd_geo1 .   
         } # /wikidata service     
    }
  }
  union
  {
   
  filter not exists {?item bnwdt:P2  ?location . } # item doesn't have property P2 location

  optional {
  ?item bnwdt:P117 ?wikidata_id .  # but has wikidata id   
  bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
  
  SERVICE <https://query.wikidata.org/sparql> {
               ?wikidata wdt:P625 ?wd_geo1 .   
             } # /wikidata service     
    }

   }
  BIND(COALESCE(?wd_geo1, ?wd_geo2) AS ?wd_geo).  # if geo1 available use that, then try geo2
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
}
ORDER BY ?locationLabel

Try it!


Locations of archaeological sites

#title:Locations of BN archaeological sites
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:Map
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?adminterrLabel ?adminterr ?wikidata ?wd_geo 
WHERE {  
  ?item bnwdt:P12 bnwd:Q86 .
  
  {  
    ?item bnwdt:P2  ?location .  # item has property P2 location
  
  optional { ?location bnwdt:P33 ?adminterr . 
               ?adminterr bnwdt:P117 ?wsa .  # and has wikidata id   
  
            bind(iri(concat("http://www.wikidata.org/entity/", str(?wsa))) as ?wikidataa) .
               SERVICE <https://query.wikidata.org/sparql> {
               ?wikidataa wdt:P625 ?wd_geo2 .   
             } # /wikidata service     
           }
  
  optional {
  ?location bnwdt:P117 ?ws .  # and has wikidata id   
  
    bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
         SERVICE <https://query.wikidata.org/sparql> {
             ?wikidata wdt:P625 ?wd_geo1 .  
         } # /wikidata service     
  }
    
    }
  
  union
  
  {
      filter not exists {?item bnwdt:P2  ?location . } # item doesn't have property P2 location


  ?item bnwdt:P117 ?wikidata_id .  # but has wikidata id   
  bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
  
  SERVICE <https://query.wikidata.org/sparql> {
               ?wikidata wdt:P625 ?wd_geo1 .   # which has geo coords 
             } # /wikidata service     
   }
    
  BIND(COALESCE(?wd_geo1, ?wd_geo2) AS ?wd_geo).  # if geo1 available use that, then try geo2
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
}
ORDER BY ?locationLabel

Try it!


Locations of historic houses

#title:locations of BN historic houses
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:Map
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?wikidata ?wd_geo   
WHERE {  
  ?item bnwdt:P12 bnwd:Q2961 .
  {
  ?item bnwdt:P2  ?location .  # item has property P2 location
  
  
  optional { ?location bnwdt:P33 ?adminterr . 
               ?adminterr bnwdt:P117 ?wsa .  # and has wikidata id   
  
            bind(iri(concat("http://www.wikidata.org/entity/", str(?wsa))) as ?wikidataa) .
               SERVICE <https://query.wikidata.org/sparql> {
               ?wikidataa wdt:P625 ?wd_geo2 .   
             } # /wikidata service     
           }
  
  optional {
  ?location bnwdt:P117 ?ws .  # and has wikidata id   
  
    bind(iri(concat("http://www.wikidata.org/entity/", str(?ws))) as ?wikidata) .
         SERVICE <https://query.wikidata.org/sparql> {
             ?wikidata wdt:P625 ?wd_geo1 .   
         } # /wikidata service     
  }

   }
   union
   {
  
  filter not exists {?item bnwdt:P2  ?location . } # item doesn't have property P2 location

  ?item bnwdt:P117 ?wikidata_id .  # but has wikidata id   
  bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
  
  SERVICE <https://query.wikidata.org/sparql> {
               ?wikidata wdt:P625 ?wd_geo1 .   
             } # /wikidata service     
 

   }
  
  BIND(COALESCE(?wd_geo1, ?wd_geo2) AS ?wd_geo).  # if geo1 available use that, then try geo2   
            
              
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
}
ORDER BY ?locationLabel

Try it!


Residences of women participants in Colchester excavations

#title:Excavations at Colchester: where women participants lived
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:Map
SELECT distinct ?item ?itemLabel ?locationLabel ?location ?person ?personLabel ?resided ?residedLabel ?wd_geo
WHERE {  
  values (?item) { (bnwd:Q90) }   # q90 colchester  
  
  ?item bnwdt:P12 bnwd:Q38 . 
  ?item bnwdt:P2  ?location .  # item has property P2 location
  
  ?item (bnwdt:P36 | bnwdt:P37 ) ?person .
  #optional { ?item bnwdt:P36 ?director . }
  #optional { ?item bnwdt:P37 ?member . }
  
  optional { ?person bnwdt:P29 ?resided . 
               ?resided bnwdt:P117 ?wsa .  # and has wikidata id   
  
            bind(iri(concat("http://www.wikidata.org/entity/", str(?wsa))) as ?wikidataa) .
               SERVICE <https://query.wikidata.org/sparql> {
               ?wikidataa wdt:P625 ?wd_geo .   
             } # /wikidata service     
           }
  
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
}
ORDER BY ?locationLabel

Try it!


IWD 2024 Map of five women's places

## how many places for the five women can I get on a map? a slightly ridiculous query.

#title:Four stories, five women, many places for #IWD2024 
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:Map{"hide":["?geo"],"layer":"?person", "markercluster":true }

SELECT distinct ?person ?personLabel  ?propLabel ?placeLabel  ?geo  ?loc2Label (year(?date) as ?year) 

WHERE {  

   VALUES (?person) {(bnwd:Q894) (bnwd:Q462) (bnwd:Q549) (bnwd:Q921) (bnwd:Q1053) }  #
   ?person ( bnp:P29 | bnp:P94  | bnp:P23 | bnp:P13 | bnp:P120   ) ?s .
  
   ?s  ( bnps:P29 | bnps:P94  | bnps:P23 | bnps:P13 | bnps:P120   )  ?place . 

   ?person ?p ?s .
      ?prop wikibase:claim ?p;      
         wikibase:statementProperty ?ps.  

      optional { ?s ( bnpq:P1 | bnpq:P27 ) ?date . }
      #optional { ?s bnpq:P31 ?street . }
 
  # LOLplaces
  #1 geocoords in quals for place itself - should be detailed geo added manually, cf London district geocoords which =main P153
  #2 wikdiata geocoords for place
  #3 geocoords in quals for linked place
  #4 wikidata geocoords for linked place
  #5 wikidata geocoords in place P2 qual
  #6 `of` qual geocoords
  #7 `of` P2 wikidata geocoords
  #8 `of` wikidata geocoords
  #9 place main geocoords - likely to be broad london postal districts so should be last resort
  #10 linked place main geocoords
  
  
      optional { ?s bnpq:P153 ?geo1 . } # place has geocoords directly *in qualifier*
  
      optional { ?place bnwdt:P2 ?linked_p1 . # linked place has geocoords *in qualifier* (this is primarily for SAL?)
                     ?linked_p1 bnp:P2 ?llp_s .
                        ?llp_s bnps:P2 ?llp_p1.
                        ?llp_s bnpq:P153 ?geo2 .
                }
  
      optional { ?place bnwdt:P117 ?pws .  # place has wikidata page that has geoocords (main P625, not anywhere else)
                   bind(iri(concat("http://www.wikidata.org/entity/", str(?pws))) as ?pwikidata) .
                   SERVICE <https://query.wikidata.org/sparql> {
                     ?pwikidata wdt:P625 ?geo3 . 
                  }        
                }   
  
      optional { ?place bnwdt:P2 ?linked_p2 .  # linked place has wikidata geocoords
                    ?linked_p2 bnwdt:P117 ?lws .  # wikidata id P117
                     bind(iri(concat("http://www.wikidata.org/entity/", str(?lws))) as ?lwikidata) .
                     SERVICE <https://query.wikidata.org/sparql> {
                      ?lwikidata wdt:P625 ?geo4 . 
                     }
                }
   
      optional { ?s bnpq:P2 ?qp1 . # P2 qualifier location has wikidata geocoords
                     ?qp1 bnwdt:P117 ?qws . 
                     bind(iri(concat("http://www.wikidata.org/entity/", str(?qws))) as ?qwikidata) .
                     SERVICE <https://query.wikidata.org/sparql> {
                      ?qwikidata wdt:P625 ?geo5 . 
                     } 
                 }
  
      optional { ?s bnpq:P78 ?ofp1 . # 'of' (organisation) has geocoords in P2 qualifier
                    ?ofp1 bnp:P2 ?ofp1_s .
                     ?ofp1_s bnps:P2 ?ofp1_p .
                     ?ofp1_s bnpq:P153 ?geo6 . }  
  
      optional { ?s bnpq:P78 ?ofp2 . # 'of' (organisation) P2 location has wikidata geocoords
                    ?ofp2 bnwdt:P2 ?ofp2_p .
                       ?ofp2_p bnwdt:P117 ?ofl2ws .
                       bind(iri(concat("http://www.wikidata.org/entity/", str(?ofl2ws))) as ?ofl2wikidata) .
                       SERVICE <https://query.wikidata.org/sparql> {
                      ?ofl2wikidata wdt:P625 ?geo7 .  }            
              }  
  
      optional { ?s bnpq:P78 ?ofp3 .   # 'of' (organisation) has wikidata geocoords
                    ?ofp3 bnwdt:P117 ?ofpws .  # wikidata id P117
                     bind(iri(concat("http://www.wikidata.org/entity/", str(?ofpws))) as ?ofpwikidata) .
                     SERVICE <https://query.wikidata.org/sparql> {
                      ?ofpwikidata wdt:P625 ?geo8 .  }
                }
  
      optional { ?place bnwdt:P153 ?geo9 .  } # main geocoords  (mainly london postal districts - should be last resort as v broad.)


      optional { ?place bnwdt:P2 ?linked_p10 . # linked place main geocoords
                     ?linked_p10 bnwdt:P153 ?geo10 .
                }

  BIND(COALESCE(?geo1, ?geo2, ?geo3, ?geo4, ?geo5, ?geo6, ?geo7, ?geo8, ?geo9, ?geo10) AS ?geo).  # if geo1 available use that, then geo2, etc, in order of preference
  
  bind(coalesce(?linked_p1, ?linked_p2, ?qp1, ?ofp1, ?ofp2, ?ofp3 ) as ?loc2). # hopefully get extra context where place is just sthg like "meeting". though exactly what will be variable!
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". } 
}

order by ?personLabel ?date ?placeLabel

Try it!


People

Women with their family name at birth and family name after marriage

# Women with their family name at birth and family name after marriage

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 ?birthname ?marriedname
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  OPTIONAL {?person bnwdt:P140 ?birthname .} #look for birth name
  OPTIONAL {?person bnwdt:P141 ?marriedname .} #look for married name
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
}
ORDER BY ?personLabel

Try it!


Women with family name at birth, married name and count of married names

# Women with their family name at birth, family name after marriage and count of married names

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 ?birthname   
        (GROUP_CONCAT(DISTINCT ?marriedname; SEPARATOR=", ") AS ?marriednames) 
        (COUNT(?marriedname) AS ?marriedcount)

WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  
  OPTIONAL {?person bnwdt:P140 ?birthname .} #look for birth name
  OPTIONAL {?person bnwdt:P141 ?marriedname .} #look for married name
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
}
group by ?person ?personLabel ?birthname
ORDER BY ?personLabel

Try it!


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!


Membership of organisations by women, sorted by how many women were members of a given organisation

# Membership of organisations by women, sorted by how many women were members of a given organisation

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 ?organisation ?organisationLabel (count(?organisation) as ?organisation_count) #count number of organisations that women were members of
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  ?person bnwdt:P67 ?organisation . # selection people who were members of organisations and what those organisations were
  FILTER NOT EXISTS {?person bnwdt:P67 bnwd:Q35 .} # filter out Royal Archaeological Institute
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
GROUP BY ?organisation ?organisationLabel
ORDER BY DESC(?organisation_count)

Try it!



Education

Women educated at a tertiary educational institution located in Oxford or Cambridge

# Women educated at a tertiary educational institution located in Oxford or Cambridge

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 ?woman ?womanLabel ?educationalinstitution ?educationalinstitutionLabel ?location ?locationLabel
WHERE {  
  {?woman bnwdt:P3 bnwd:Q3 . #filter women
  ?woman bnwdt:P94 ?educationalinstitution . #find 'educated at' statement
  ?educationalinstitution bnwdt:P12 bnwd:Q2914 . #filter to tertiary educational institutions
  ?educationalinstitution bnwdt:P2 ?location . #find location of educational institution
  ?location rdfs:label ?locationLabel . 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
  FILTER(LANG(?locationLabel) = "en") .
  FILTER(regex(?locationLabel, "oxford", "i")) .}
  UNION
  {?woman bnwdt:P3 bnwd:Q3 . #filter women
  ?woman bnwdt:P94 ?educationalinstitution . #find 'educated at' statement
  ?educationalinstitution bnwdt:P12 bnwd:Q2914 . #filter to tertiary educational institutions
  ?educationalinstitution bnwdt:P2 ?location . #find location of educational institution
  ?location rdfs:label ?locationLabel . 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
  FILTER(LANG(?locationLabel) = "en") .
  FILTER(regex(?locationLabel, "Cambridge$", "i")) .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
ORDER BY ?womanLabel

Try it!


Women who were FSAs who went to Oxford or Cambridge colleges

#how many women who were FSAs went to Oxford or Cambridge colleges?

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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>

SELECT ?person ?personLabel ?college ?collegeLabel ?universityLabel
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  
  ?person bnwdt:P75 bnwd:Q8. # only BN subjects having a FSA 
  
  # educated at (P94) part of (P4) cambridge (Q1181) oxford (Q364) 

  ?person bnwdt:P94 ?college .  
  ?college bnwdt:P4 ?university . 

  FILTER ( ?university in ( bnwd:Q1181 , bnwd:Q364 ) )
  
  SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
}
order by ?personLabel ?collegeLabel

Try it!


All women who went to tertiary education institutions and dates where available

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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT ?person ?personLabel ?college ?collegeLabel ?university ?universityLabel ?date ?date_label

WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  
  # note: academic degree is P59. possible extra info?
  ?person bnp:P94 ?s .  # educated at
    ?s bnps:P94 ?college .
    optional {?college bnwdt:P4 ?university . } # a few ?college aren't part of (P4) a ?university
   ?college bnwdt:P12 bnwd:Q2914 .   # tertiary ed inst
   
  # dates. 
    optional {
    ?s ?pq ?date .       
      ?qual_prop wikibase:qualifier ?pq;
              wikibase:propertyType wikibase:Time ; # nb excludes edtf dates
              rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # what kind of date is it.
      } # /dates
     
  
  SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
}
order by ?personLabel ?collegeLabel ?date

Try it!


Academic degrees

# Fetch academic degrees for women, with date and conferring institution where available
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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT distinct ?person ?personLabel ?degree ?degreeLabel ?by ?byLabel ?date ?date_label 

WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
  
  # academic degree = P59. 
  ?person bnp:P59 ?s .  
    ?s bnps:P59 ?degree . # type of degree
  
  # optional qualifiers for degree
  
  # P61 conferred by
    optional { ?s bnpq:P61 ?by . }
  
  # date with type
    optional {
    ?s ?pq ?date .       
      ?qual_prop wikibase:qualifier ?pq;
              wikibase:propertyType wikibase:Time ; # nb excludes edtf dates
              rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # kind of date
      } # /dates
      
  SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
}
order by ?personLabel ?date ?degreeLabel

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!


FSAs 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
  ?person bnwdt:P16 ?FSA .                                   #select FSA
  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!


Which women in the wikibase have Wikipedia articles, 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 ?wikidata ?wikipedia
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team

  ?person bnwdt:P117 ?wikidata_ID . #look for wikidata ID on person page
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .


  SERVICE <https://query.wikidata.org/sparql> {
      # get English language wikipedia articles in wikidata entries, where listed
        OPTIONAL {
          ?wikipedia schema:about ?wikidata .
          ?wikipedia schema:inLanguage 'en' .
          FILTER (SUBSTR(str(?wikipedia), 1, 25) = 'https://en.wikipedia.org/')
        }  
      }  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?personLabel

Try it!


Women with no date of death in our wikibase who have a date of death on Wikidata

# Women who have no date of death in our wikibase and have a date of death on 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  ?wd_dod
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
 
  filter not exists {?person bnwdt:P15 ?bn_dod . } # *don't* have P15 date of death
  
  ?person bnwdt:P117 ?wikidata_ID . #look for wikidata ID on person page
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?item) .

  
  SERVICE <https://query.wikidata.org/sparql> {
        ?item wdt:P21 ?WD_gender. #get gender of person
        ?item wdt:P570 ?wd_dod .  #date of death on Wikidata P570
      }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?personLabel

Try it!


Women with no date of birth in our wikibase who have a date of birth in Wikidata

# Women who have no date of birth in our wikibase and have a date of birth on 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  ?wd_dob 
WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
 
  filter not exists {?person bnwdt:P26 ?bn_dob . } # *don't* have P15 date of death
  
  ?person bnwdt:P117 ?wikidata_ID . #look for wikidata ID on person page
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?item) .

  SERVICE <https://query.wikidata.org/sparql> {
        ?item wdt:P21 ?WD_gender. #get gender of person
        ?item wdt:P569 ?wd_dob .  #date of birth on Wikidata P569
      }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}
ORDER BY ?personLabel

Try it!


All external IDs on Wikidata for Women

# Query to fetch all available External IDs on Wikidata for FSAs
# NB this will take a while, but it should finish.
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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT distinct ?person ?personLabel ?wikidata ?p ?id_no ?id_label

WHERE {
    ?person bnwdt:P3 bnwd:Q3 . #select women   
    #?person bnwdt:P75 bnwd:Q8. # limit to FSAs if the full set times out.
   
    ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .

    SERVICE <https://query.wikidata.org/sparql> {
    
    ?wikidata ?p ?s .    
       ?prop wikibase:claim ?p;    	 
             wikibase:statementProperty ?ps; # NB rather than statementValue
             wikibase:propertyType wikibase:ExternalId. # quicker than filter.
      
       ?prop rdfs:label ?id_label. filter(lang(?id_label)="en") . # ident name
      
          ?s ?ps ?id_no . # id value

       # filter by property type 
       #filter(?prop_type in (wikibase:ExternalId ) ) . 
     }  
       
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". } 
}
             
order by ?personLabel ?id_label ?id_no

Try it!


What external IDs are available in Wikidata for women in the BN database?

# All the external IDs on BN women's Wikidata pages, with counts and descriptions
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 ?p ?id_label ?id_description  (count(?p) as ?count)

WHERE {  
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team

  ?person bnwdt:P117 ?wikidata_ID . # wikidata ID
     bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
  
     SERVICE <https://query.wikidata.org/sparql> {
     ?wikidata ?p ?s .
          ?prop wikibase:claim ?p;    	 
               wikibase:propertyType wikibase:ExternalId;  
               rdfs:label ?id_label. filter(lang(?id_label)="en") . 
       ?prop schema:description ?id_description . 
       filter(lang(?id_description) = "en") .    
       }  
       
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en, en-gb". } 
}
group by ?p ?id_label ?id_description 
ORDER BY desc(?count)

Try it!


Women with ODNB IDs in Wikidata

# BN women with ODNB biography IDs on Wikidata, with links to the bios

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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT distinct ?person ?personLabel ?wikidata ?url

WHERE {
    ?person bnwdt:P3 bnwd:Q3 . #select women   
    
    ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
  
    SERVICE <https://query.wikidata.org/sparql> {
    
    # P1415	Oxford Dictionary of National Biography ID | P6829	Dictionary of Irish Biography ID | P1648	Dictionary of Welsh Biography ID
    ?wikidata wdt:P1415 ?id .   

    # odnb link
    BIND(IRI(concat("https://doi.org/10.1093/ref:odnb/", ?id)) as ?url ) .
    
     }  
       
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". } 
}
             
order by ?personLabel ?id

Try it!


Women with National Portrait Gallery links via Wikidata

# Query to fetch National Portrait Gallery IDs on Wikidata for BN women, with links
# NB this may be a bit slow...
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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT distinct ?person ?personLabel ?wikidata ?id_no ?npg_url

WHERE {
    ?person bnwdt:P3 bnwd:Q3 . #select women    
  
    ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
  
    SERVICE <https://query.wikidata.org/sparql> {
    
    ?wikidata ?p ?s .    
       ?prop wikibase:claim ?p;    	 
             wikibase:statementProperty ?ps; 
             wikibase:propertyType wikibase:ExternalId. 
     
          ?s ps:P1816 ?id_no . # id value
      # npg link
          BIND(IRI(concat("https://www.npg.org.uk/collections/search/person/", ?id_no)) as ?npg_url ) .
     }  
       
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". } 
}
             
order by ?personLabel ?id_no

Try it!


Which BN properties map on to Wikidata properties?

## **NOTES** 
## a few properties have a linked wikidata "Q" rather than "P" ID. These will unfortunately not link correctly to Wikidata so wd_label/wd_description won't be present.
## a few other properties may have wikidata=yes but no wd_label and/or wd_description. This could be because the property on Wikidata has been deleted (eg performed at).

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 ?property (if(bound(?wikidata_id), "yes", "no") as ?has_wikidata)  ?bn_label ?wd_label ?bn_description
  ?wd_description ?wikidata ?bn_propertyType

WHERE {
  ?property a wikibase:Property ;
              wikibase:propertyType ?bn_propertyType . # datatype
 
   service wikibase:label {  
            bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". 
            ?property rdfs:label ?bn_label .
            ?property schema:description ?bn_description .
                             }
    # wikidata P117  
    optional { 
            ?property bnwdt:P117 ?wikidata_id . 
                bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .

             SERVICE <https://query.wikidata.org/sparql> {
                    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". 
                            ?wikidata schema:description ?wd_description .
                            ?wikidata rdfs:label ?wd_label . 
                     } # / label service
               } # /wikidata service   
           } #/wikidata optional
}
order by ?bn_label

Try it!


Of these, which are properties for public and professional activities?

# which properties have corresponding wikidata IDs, restricted to instance of PPA (P12 / Q151)

## **NOTES** 
## a few properties have a linked wikidata "Q" rather than "P" ID. These will unfortunately not link correctly to Wikidata so wd_label/wd_description won't be present.
## a few other properties may have wikidata=yes but no wd_label and/or wd_description. This could be because the property on Wikidata has been deleted (eg performed at).

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 ?property (if(bound(?wikidata_id), "yes", "no") as ?has_wikidata)  ?bn_label ?wd_label ?bn_description
  ?wd_description ?wikidata ?bn_propertyType

WHERE {
  ?property a wikibase:Property ;
              wikibase:propertyType ?bn_propertyType . # datatype
 
   service wikibase:label {  
            bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". 
            ?property rdfs:label ?bn_label .
            ?property schema:description ?bn_description .
                             }
    # wikidata P117  
    optional { ?property bnwdt:P117 ?wikidata_id . 
                 bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) . 

             SERVICE <https://query.wikidata.org/sparql> {
                    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". 
                            ?wikidata schema:description ?wd_description .
                            ?wikidata rdfs:label ?wd_label . 
                     } # / label service
               } # /wikidata service   
           } #/wikidata optional
  
    ?property bnwdt:P12 bnwd:Q151. # instance of PPA
}
order by ?bn_label

Try it!



Archaeological sites/Historic houses and their owners/operators in Wikidata

#title:archaeological sites/historic houses in 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/>

SELECT distinct ?item ?itemLabel ?instanceLabel ?wikidata ?wd_owner_label ?wd_operator_label ?wd_member_label  #?wd_owner ?wd_operator

WHERE {  
  
  { ?item bnwdt:P12 bnwd:Q86 . } # instance of archaeological site
  union
  { ?item bnwdt:P12 bnwd:Q2961 . } # instance of historic house
   
   ?item bnwdt:P12 ?instance .   # which instance of is it
   filter ( ?instance in (bnwd:Q86, bnwd:Q2961) ) . # (need filter as a few have multiple instance of)
  
    ?item bnwdt:P117 ?wikidata_id . 
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
             
     SERVICE <https://query.wikidata.org/sparql> {
       
      optional { ?wikidata wdt:P127 ?wd_owner  .} # can be individuals and multiple.
      optional { ?wikidata wdt:P137 ?wd_operator . }
       
       optional { ?wikidata wdt:P463 ?wd_member . }
       
       ## at least some had *both* owned by *and* operator, but not always the case.
       ## owned by P127 / operator P137   
       ## English Heritage Q936287  National Trust (Q333515) 
       ## member of P463   Historic Houses Association (Q5773523) 
       
       # automatic *Label doesn't work with a federated query; rdfs:label instead.      
         SERVICE wikibase:label { 
              bd:serviceParam wikibase:language "en". 
              ?wd_owner rdfs:label ?wd_owner_label. 
              ?wd_operator rdfs:label ?wd_operator_label.
              ?wd_member rdfs:label ?wd_member_label.
              } 
       }  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
}
order by ?itemLabel

Try it!


And which are owned/operated by English Heritage/National Trust or belong to Historic Houses Association

# archaeological site or historic house. 
# pull together via Wikidata which ones are owned/operated by 1) English Heritage 2) National Trust  or 3) affiliated to Historic Houses association

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 ?item ?itemLabel ?instanceLabel ?wikidata ?wd_owner_label ?wd_operator_label ?wd_member_label  #?wd_owner ?wd_operator

WHERE {  
  
  { ?item bnwdt:P12 bnwd:Q86 . }
  union
  { ?item bnwdt:P12 bnwd:Q2961 . }
  
   ?item bnwdt:P12 ?instance . 
   filter ( ?instance in (bnwd:Q86, bnwd:Q2961) ) .
 
   ?item bnwdt:P117 ?wikidata_id . 
     bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_id))) as ?wikidata) .
                
     SERVICE <https://query.wikidata.org/sparql> {

      optional { ?wikidata wdt:P127 ?wd_owner .}
      optional { ?wikidata wdt:P137 ?wd_operator . }
      optional { ?wikidata wdt:P463 ?wd_member . }

      # filter: owner or operator = EH/NT / member of HHA
        filter ( ?wd_owner in (wd:Q936287, wd:Q333515) || 
                 ?wd_operator in (wd:Q936287, wd:Q333515) ||
                 ?wd_member = wd:Q5773523 ) .

       ## owned by P127 / operator P137   
       ## ENglish Heritage Q936287  National Trust (Q333515) 
       ## member of P463   Historic Houses Association (Q5773523) 
             
       SERVICE wikibase:label { 
              bd:serviceParam wikibase:language "en". 
              ?wd_owner rdfs:label ?wd_owner_label. 
              ?wd_operator rdfs:label ?wd_operator_label.
              ?wd_member rdfs:label ?wd_member_label.
              } 
       }  
             
   #} # /optional for wikidata ID
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
}

order by ?itemLabel

Try it!



Men

BN Men in Wikidata

#title: BN men in Wikidata
# a starting point to get the basic query set up; can easily add more variables...

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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT distinct ?person ?personLabel ?wikidata ?whos_who ?odnb_url ?wikipedia ?wd_dob ?wd_dod ?wd_stmts

WHERE {
    ?person bnwdt:P3 bnwd:Q10 . #select men   
   
    ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
  
    SERVICE <https://query.wikidata.org/sparql> {

      ?wikidata   wikibase:statements ?wd_stmts .

       optional {   
         # P1415	Oxford Dictionary of National Biography ID | couls also add  P6829	Dictionary of Irish Biography ID | P1648	Dictionary of Welsh Biography ID
        ?wikidata wdt:P1415 ?odnb_id .   

        # odnb link
        BIND(IRI(concat("https://doi.org/10.1093/ref:odnb/", ?odnb_id)) as ?odnb_url ) .
        } #/ odnb
      
        # English language wikipedia articles in wikidata entries, where listed
        OPTIONAL {
          ?wikipedia schema:about ?wikidata .
          ?wikipedia schema:inLanguage 'en' .
          FILTER (SUBSTR(str(?wikipedia), 1, 25) = 'https://en.wikipedia.org/')
        }  
        
              
       optional { ?wikidata wdt:P4789 ?whos . 
                  bind(iri(concat("https://www.ukwhoswho.com/view/article/oupww/whoswho/", ?whos)) as ?whos_who) .
                 } # P4789 Who's Who

        optional { ?wikidata wdt:P569 ?wd_dob . } #date of birth on Wikidata P569
        optional { ?wikidata wdt:P570 ?wd_dod . }  #date of death on Wikidata P570 
 
     }  #/ wikidata
       
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". } 
}
             
order by ?personLabel

Try it!


What sort of info Wikidata has about BN men

#title: what info is there for BN men in Wikidata
#counts of properties (excluding external IDs, of which there are gazillions) (Counts are overall and some people might have more than one.)
#at time of writing there are 198 linked men.

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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT ?prop_label ?prop (count(?prop) as ?count)

WHERE {
    ?person bnwdt:P3 bnwd:Q10 . #select men 211.

    ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
  
    SERVICE <https://query.wikidata.org/sparql> {      
        ?wikidata ?p ?s .
            ?prop wikibase:claim ?p; 
                 wikibase:propertyType ?prop_type ;
                 wikibase:statementProperty ?ps.     
            ?prop rdfs:label ?prop_label. filter(lang(?prop_label)="en") . 
        filter(?prop_type in (wikibase:Time, wikibase:WikibaseItem ) ) . 
      # also a few quantity, string, monolingualtext
      
     }  #/ wikidata
       
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". } 
}
group by ?prop_label  ?prop       
order by ?prop_label

Try it!


BN Men in Wikidata: men who proposed elections to SAL/RAI

#title:Men who proposed for SAL/RAI elections who are in 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/>

SELECT distinct ?proposerLabel ?proposer ?wikidata ?odnb_url ?wikipedia ?wd_dob ?wd_dod
WHERE {
  ?person (bnp:P16 | bnp:P7) ?s . # proposed to either SAL or RAI
  ?s (bnps:P16 | bnps:P7) ?proposer .
    ?proposer bnwdt:P3 bnwd:Q10 .
  
    ?proposer bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) . 
  
    SERVICE <https://query.wikidata.org/sparql> {
    
       optional {   
         # P1415	Oxford Dictionary of National Biography ID 
         ?wikidata wdt:P1415 ?odnb_id .   
         BIND(IRI(concat("https://doi.org/10.1093/ref:odnb/", ?odnb_id)) as ?odnb_url ) . # make odnb link
         } #/ odnb
      
         # could also add:     P6829	Dictionary of Irish Biography ID | P1648	Dictionary of Welsh Biography ID
      
        # English language wikipedia articles in wikidata entries, where listed
        OPTIONAL {
          ?wikipedia schema:about ?wikidata .
          ?wikipedia schema:inLanguage 'en' .
          FILTER (SUBSTR(str(?wikipedia), 1, 25) = 'https://en.wikipedia.org/')
        }  
      
        # there will be a few duplicates here...
        optional { ?wikidata wdt:P569 ?wd_dob . } #date of birth on Wikidata P569
        optional { ?wikidata wdt:P570 ?wd_dod . }  #date of death on Wikidata P570 
 
     }  #/ wikidata service
       
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". } 
}
ORDER BY  ?proposerLabel

Try it!


Male proposers who have occupations data in Wikidata

#title:Men who proposed for SAL/RAI elections who have occupation(s) in wikidata
# with occupation labels, which was slightly trickier than expected

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 ?personLabel ?proposerLabel 
(group_concat(distinct ?wd_label; SEPARATOR="; ") as ?proposer_occupations) 
?wikidata ?person ?proposer
WHERE {
  ?person (bnp:P16 | bnp:P7) ?s . # proposed to either SAL or RAI
  ?s (bnps:P16 | bnps:P7) ?proposer .
    ?proposer bnwdt:P3 bnwd:Q10 .
  
    ?proposer bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) . 
  
    SERVICE <https://query.wikidata.org/sparql> {
         ?wikidata wdt:P106 ?wd_occupation . 
        # automatic *Label doesn't work with a federated query; this works instead.      
         SERVICE wikibase:label { 
              bd:serviceParam wikibase:language "en". 
              ?wd_occupation rdfs:label ?wd_label. 
              } 
     }  #/ wikidata service
       
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". } 

}
group by ?personLabel ?proposerLabel ?wikidata ?person ?proposer 
ORDER BY  ?proposerLabel ?person

Try it!


BN Men in Wikidata: Spouses

#title: BN spouses who are in 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/>

SELECT distinct ?spouse ?spouseLabel  ?wikidata ?odnb_url ?wikipedia ?wd_dob ?wd_dod
WHERE {
  ?person bnwdt:P3 bnwd:Q3.
  ?person bnwdt:P41 ?spouse .

    ?spouse bnwdt:P117 ?wikidata_ID . #get wikidata ID
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) . 
  
    SERVICE <https://query.wikidata.org/sparql> {
    
       optional {   
         # P1415	Oxford Dictionary of National Biography ID 
        
         ?wikidata wdt:P1415 ?odnb_id .   
         BIND(IRI(concat("https://doi.org/10.1093/ref:odnb/", ?odnb_id)) as ?odnb_url ) . # make odnb link
         } #/ odnb
      
         # couls also add:     P6829	Dictionary of Irish Biography ID | P1648	Dictionary of Welsh Biography ID
      
        # English language wikipedia articles in wikidata entries, where listed
        OPTIONAL {
          ?wikipedia schema:about ?wikidata .
          ?wikipedia schema:inLanguage 'en' .
          FILTER (SUBSTR(str(?wikipedia), 1, 25) = 'https://en.wikipedia.org/')
        }  
      
        optional { ?wikidata wdt:P569 ?wd_dob . } #date of birth on Wikidata P569
        optional { ?wikidata wdt:P570 ?wd_dod . }  #date of death on Wikidata P570 
 
     }  #/ wikidata service
       
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". } 

}
ORDER BY  ?proposerLabel

Try it!


BN Men who proposed, seconded or signed for Women in SAL/RAI/RHS elections, with counts and wikidata IDs

#title:Men who supported women (at least twice) for SAL/RAI/RHS election with Wikidata IDs

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

# p155, p156 - signed rhs
# p32, p82  - signed sal|
# p8 rai seconded

SELECT  ?supporterLabel ?supporter  ?wikidata (count(?supporter) as ?supported)

WHERE {

  ?person bnwdt:P3 bnwd:Q3 . 
  
  {  
    ?person (  bnp:P155 | bnp:P156 | bnp:P16 | bnp:P7 ) ?s .  #
      ?s ( bnps:P155 | bnps:P156 | bnps:P16 | bnps:P7 ) ?supporter  . # proposed SAL/RAI / signed RHS
      #?s ?prop ?supporter . 
    }
  #  union for qualifiers
  union
  {
  ?person ?p ?s .
     ?s (  bnpq:P156 | bnpq:P155 | bnpq:P32 | bnpq:P82 | bnpq:P8 ) ?supporter . 
     #?s ?prop ?supporter .
  }
  
    ?supporter bnwdt:P3 bnwd:Q10 .  # male
  
    optional {
      ?supporter bnwdt:P117 ?wikidata_ID . #get wikidata ID
      bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) . 
      }
       
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". } 
}
group by ?supporterLabel ?supporter ?wikidata
having (?supported>2)
ORDER BY desc(?supported) desc(?wikidata)

Try it!


Fishing Expeditions

All properties in use in the wikibase with property type, label and description (if present)

# query for information about properties that are being used in the wikibase

## fyi: not actually necessary to declare these properties
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX schema: <http://schema.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

SELECT DISTINCT
  ?property
  ?propertyType
  ?propertyLabel  
  (group_concat(?propertyAltLabel; separator=" | ") as ?propertyAltLabels)
  ?propertyDescription

WHERE {
  ?property a wikibase:Property ;
              rdfs:label ?propertyLabel ; # label
              wikibase:propertyType ?propertyType . # datatype

  # add alternative labels if present (can be multiple)
  OPTIONAL { ?property skos:altLabel ?propertyAltLabel . } 

  # add description if present
  OPTIONAL { 
        SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".
          ?property schema:description ?propertyDescription .
        }
   } 
  
  FILTER(LANG(?propertyLabel) = 'en-gb') 
  # fix label language dups; but Q why doesn't SERVICE work? 
  # A: https://en.wikibooks.org/wiki/SPARQL/FILTER#FILTER_on_values_in_Labels
  # nb a few objects found with en-gb label missing 

}
group by ?property ?propertyLabel ?propertyType ?propertyDescription
order by ?propertyLabel

Try it!


All the Things for Organisations

# Exploratory query to get all info on an item page including qualifiers (but not references) for each organisation (Q2316) in the wikibase
# Initially this *only* fetched organisations that specifically have the instance of Q2316: I didn't realise for a while how many organisations don't directly reference Q2316. 
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 ?item ?itemLabel 
?prop ?propLabel ?prop_type
?stmt_value ?stmt_valueLabel 
?qual_prop  ?qual_value ?qual_label ?qual_prop_type
?statement

where {

?item bnwdt:P12+ bnwd:Q2316  . # instance of organisation or descendants of (excluding instance of organisation itself)

  # get all the things about ?item   
    ?item ?p ?statement .   
  
   # to get item Label without using service. couple of missing en-gb labels somewhere
   # ?item rdfs:label ?item_label . filter(lang(?item_label)="en-gb") . 
   
  
  # get stuff about ?p 
    ?prop wikibase:claim ?p;   
            wikibase:statementProperty ?ps;  # "Links property entity to statement simple value predicate"
 	        #wikibase:statementValue ?psv; # "Links property entity to statement full value predicate"    
            wikibase:propertyType ?prop_type.        

   # get stuff about ?statement 
     ?statement ?ps ?stmt_value. 
   
  # get any qualifiers
   optional { 
     ?statement ?qual_p ?qual_value .   
     ?qual_prop wikibase:qualifier ?qual_p;
           wikibase:propertyType ?qual_prop_type ;
           rdfs:label ?qual_label. filter(lang(?qual_label)='en-gb') . 
    }
  
 #  OPTIONAL { ?item skos:altLabel ?alt_label . }  
  
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
  
}

order by ?item_label ?prop_label

Try it!


One woman

#title:All About a Woman
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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT distinct ?propLabel ?spsLabel ?qual_propLabel ?pqsLabel ?link ?s 
# ?main_date ?main_precision ?qual_date ?qual_precision    
# ?prop ?sps ?pqs ?pq 

WHERE
{
   VALUES (?person) {(bnwd:Q569)}  # add (bnwd:Qxxx) if you want more than one person.  
   ?person ?p ?s .  

     ?prop wikibase:claim ?p;    
         wikibase:statementProperty ?ps;  #  simple value 	 
         wikibase:statementValue ?psv. #  full value    
  
   # exclude external IDs
   # filter not exists { ?prop wikibase:propertyType wikibase:ExternalId . }
   
      ?s ?ps ?sps.
   
    # full date via ?psv 
      OPTIONAL {
           ?s ?psv ?spsv .
               ?spsv wikibase:timeValue ?main_date .
               ?spsv wikibase:timePrecision ?main_precision .
       }

    # qualifiers. 
   
      optional { 
         ?s ?pq ?pqs .           
           ?qual_prop wikibase:qualifier ?pq .   
           ?qual_prop wikibase:qualifierValue ?pqp . 
         
          optional { 
            # full date via ?pqp
            ?s ?pqp ?qv .
            ?qv wikibase:timeValue ?qual_date.
            ?qv wikibase:timePrecision ?qual_precision. 
          }
     }
  
  # direct link to property
         BIND (REPLACE(STR(?prop), "^.*/([^/]*)$", "$1") as ?pid).
         bind(iri(concat(str(?person), "#", ?pid)) as ?link ) . 
   
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
        
}
order by ?propLabel ?s

Try it!


Working with property paths: organisations and locations

## problem: sometimes you need to follow property paths using */+ for (eg) locations. BUT this can lead to several results to choose between and they aren't necessarily returned in the "right" order. 
## how to determine the "distance" along the path of each result?
## https://stackoverflow.com/questions/61984052/wikidata-get-the-full-subhierachy-of-one-class-as-well-as-all-nodes
## > you can get the distance of a class with SELECT ?cls (count(?tmp) as ?distance) WHERE {   ?cls wdt:P279* ?tmp .   ?tmp wdt:P279+ wd:Q2095 . } group by ?cls order by asc(?distance) - though there might be corner cases like cycles in the hierarchy resp. multiple paths

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 ?location ?locationLabel (count(?item) as ?distance)
WHERE {  
  ?item bnwdt:P12 bnwd:Q2316 .  # instance of organisation.
  ?item bnwdt:P2* ?tmp .
  ?tmp bnwdt:P2+ ?location . # P2=30. P2+=34

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb, en". } 
}
group by ?item ?itemLabel  ?location ?locationLabel
ORDER BY ?item ?distance

Try it!


Working with property paths: instance of [CAVEAT: experimental, probably wrong]

# an attempt to adapt the query above following paths for locations of organisations for (more complex) instance of 
# ref https://stackoverflow.com/questions/61984052/wikidata-get-the-full-subhierachy-of-one-class-as-well-as-all-nodes
# distance is in the right *order* so it should be usable for some purposes, but the starting number = number of levels rather than 1. also jumps if there are siblings somewhere along the path.

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 ?instance_of ?instance_ofLabel  (count(?item) as ?distance) 
WHERE {  
  ?item bnwdt:P12* ?tmp .  # instance of anything.
  ?tmp bnwdt:P12+ ?instance_of . # P2=30. P2+=34

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb, en". } 
}
group by ?item ?itemLabel  ?instance_of ?instance_ofLabel 
ORDER BY ?item ?distance

Try it!


Dates

All the Dates for Women FSAs

#title:fishing for dates for FSAs
# union query to get [hopefully] every date associated with women FSAs including main dates and qualifier dates

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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT distinct ?person ?personLabel ?prop_label ?qualLabel ?qual_dateLabel ?date_value  ?s   
#?prop ?qual 

WHERE {
  
   ?person bnwdt:P3 bnwd:Q3 . #select women
   ?person bnwdt:P75 bnwd:Q8. # find only BN subjects having a FSA 
   
   # get stuff about ?person   
   ?person ?p ?s .   
   
      # get stuff about ?p .
      ?prop wikibase:claim ?p;     
         wikibase:statementProperty ?ps ;  	 
         wikibase:statementValue ?psv .    
      ?prop wikibase:propertyType ?date_prop_type .
      ?prop rdfs:label ?prop_label. filter(lang(?prop_label)="en-gb") . 
   

 {  # main dates
   
  # get dates detail via ?s and psv
  # gets edtf dates in simplified std wiki date format?
  # https://github.com/ProfessionalWiki/WikibaseEdtf   
      ?s ?psv ?wdv .
        ?wdv wikibase:timeValue ?date_value .
  
  } # /main dates
  
  UNION
  
  { # qualifier dates
     
   # direct value (usually item) for the property
        ?s ?ps ?qual.
     
  # date qualifiers. [assumes no edtf in quals. ]
        ?s ?pq ?date_value .   
          ?qual_date wikibase:qualifier ?pq .
          ?qual_date wikibase:propertyType wikibase:Time. 
          ?qual_date rdfs:label ?date_qual_label . filter(lang(?date_qual_label)="en") . 
      
  }  # /qual dates
  
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } 
  
} # /where

ORDER BY ?person ?prop_label ?date_value

Try it!


Fetch any of multiple kinds of EDTF date for a woman

# a union query to fetch stuff for multiple properties, in this case dates recorded in EDTF which need slightly different handling from PIT dates
# main dates only; pretty sure there are no EDTF in qualifiers. 
# updated to get date property labels

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 ?date_edtf ?date_prop ?date_label ?s

WHERE { ?person bnwdt:P3 bnwd:Q3 . 
       FILTER NOT EXISTS { ?person bnwdt:P4 bnwd:Q12 . } 
     
       ## can do this union first but makes no difference to results except possibly a bit slower.
       #?person ( bnp:P131 | bnp:P132 | bnp:P133  ) ?s .
       #   ?s ( bnps:P131 | bnps:P132 | bnps:P133  ) ?date_edtf .

       ?person ?p ?s . # so you can get the statement id and date prop label
           ?claim wikibase:claim ?p;       
                 rdfs:label ?date_label. filter(lang(?date_label)="en") .        

           ?s ?date_prop ?date_edtf .
              
    ## filter for edtf dates
    ## docs: https://github.com/ProfessionalWiki/WikibaseEdtf

    FILTER ( datatype(?date_edtf) = xsd:edtf  ) .
             
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". } 
     }	

ORDER BY ?personLabel

Try it!


Full values: dates

# query for full values to access the timeValue and timePrecision of a date, in this case a date of birth. 

## why is a more complex query needed?
## simple value for a date doesn't differentiate between (eg) "1880" and "1 January 1880"; both are returned as 1 January 1880 (and SELECT DISTINCT will collapse them into a single result)
## there are 14 codes for precision from billion years to second. 7: century, 8: decade, 9: year, 10: month, 11: day
## NB additional bnpsv: prefix
## https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format#Value_representation

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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>

SELECT DISTINCT ?item ?itemLabel ?date ?precision 
WHERE {
  ?item bnp:P26  ?statement. # date of birth (precision of these varies quite a bit)
  ?statement bnpsv:P26 ?valueNode.
  ?valueNode wikibase:timeValue ?date.
  ?valueNode wikibase:timePrecision ?precision.
  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?date

Try it!


Any main level date for women

# a query to get all types of main date for women

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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>

SELECT DISTINCT ?person ?personLabel ?date_label  ?date ?date_prop_type ?date_prop ?link_prop

WHERE {
  
  ?person bnwdt:P3 bnwd:Q3 . # women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .}      
  
   ?person ?p ?s .
   
      ?date_prop wikibase:claim ?p;    	
         wikibase:statementValue ?psv ;  
         wikibase:propertyType ?date_prop_type; # property type = wikibase:Time OR wikibase:Edtf
         rdfs:label ?date_label. filter(lang(?date_label)="en-gb") . # what kind of date it is

         # direct link to relevant section of page
         BIND (REPLACE(STR(?date_prop), "^.*/([^/]*)$", "$1") as ?pid).
         bind(iri(concat(str(?person), "#", ?pid)) as ?link_prop ) .   
      
      ?s ?psv ?wdv . # for the date value
        ?wdv wikibase:timeValue ?date .  #timeValue gets pit and edtf
     #  ?wdv wikibase:timePrecision ?date_precision .  # optional
  
  # nb also possible to filter either/or time/edtf by property type
  # filter(?date_prop_type in (wikibase:Edtf, wikibase:Time ) ) .  
  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?personLabel ?date

Try it!


Counting Dates

# count distinct dates for women (who have at least one)
# uncomment HAVING line for women with only one
# CAVEAT: there may be some discrepancies between dates shown on wiki pages and dates returned by sparql
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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT ?person ?personLabel (COUNT(DISTINCT ?date_value) as ?count) 

WHERE {
 
 {  # main dates
   
   ?person bnwdt:P3 bnwd:Q3 . # women   
   ?person ?p ?s .         
      ?s ?date_prop ?wdv .
        ?wdv wikibase:timeValue ?date_value .
   } # /main dates
  
  UNION
  
  { # qualifier dates
    
    ?person bnwdt:P3 bnwd:Q3 .   
    ?person ?p ?s .    
      ?s ?date_prop ?pqv .
         ?pqv wikibase:timeValue ?date_value.
    }  # /qual dates
  
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". } 
  
} # /where
GROUP BY ?person ?personLabel 
# HAVING(?count=1)

ORDER BY ?count ?person

Try it!


Start dates that might not have accompanying end dates

#title:Women with start dates that might not have accompanying end dates
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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT distinct ?personLabel ?prop_label ?start_date  (if(bound(?end_date), "yes", "no") as ?has_end_date) ?person ?s  
#(group_concat(?other_date_label; SEPARATOR=" | ") as ?other_dates)

WHERE {
  ?person bnwdt:P3 bnwd:Q3 .
   
  # need to find start times anywhere and get prop label so use claim. 
  ?person ?p ?s . 
  ?claim wikibase:claim ?p;       
         rdfs:label ?prop_label. filter(lang(?prop_label)="en") .  
    
# pretty sure start time is qualifier only...  
 # get start dates 
 # then optional end dates 
 # can only see end time/pit associated, and the only pit with start time is not relevant, but can't be sure that'll always be true.
 # optional other that excludes both start/end but lists any other date types
  
     ?s bnpq:P27 ?start_date . # get start dates
  
    optional {?s bnpq:P28 ?end_date .} # check for end dates

 #   optional {
 #       ?s ?pq ?other_date . # could there be any other associated dates?
      
 #       ?qual_prop wikibase:qualifier ?pq;      
 #             wikibase:propertyType wikibase:Time ; # nb *does not* include edtf dates but AFAICT there are none in qualifiers.
 #             rdfs:label ?other_date_label . filter(lang(?other_date_label)="en-gb") . # what kind of date is it.
  
        # drop both start and end this time. idk if there could be a faster way to do this?
 #       filter not exists { ?s (bnpq:P27 | bnpq:P28) ?other_date .  }
  
 #  } # / optional other dates
  
  # filter(!bound(?end_date)). # to filter out rows with an end date
  
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". } 
  
} 

ORDER BY ?personLabel ?prop_label ?start_date

Try it!


End dates that might not accompanying start dates

#title:Women with end dates that might not have accompanying start dates
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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>

SELECT distinct ?personLabel ?prop_label ?end_date  
(if(bound(?start_date), "yes", "no") as ?has_start_date)  
(group_concat(?other_date_label; SEPARATOR=" | ") as ?other_dates) 
?person ?s

WHERE {
  ?person bnwdt:P3 bnwd:Q3 .
  ?person ?p ?s . 
  ?claim wikibase:claim ?p;       
         rdfs:label ?prop_label. filter(lang(?prop_label)="en") .  
    
 # get end dates 
 # then optional start dates 
 # can only see start time/pit associated, and in fact the only pit with start time is not relevant, but can't be sure that'll always be true.
 # so an optional other that excludes both start/end but lists any other date types with group_concat
  
     ?s bnpq:P28 ?end_date . # get end dates
  
    optional {?s bnpq:P27 ?start_date .} # check for start dates

    optional {
        ?s ?pq ?other_date . # could there be any other associated dates?
        ?qual_prop wikibase:qualifier ?pq;      
              wikibase:propertyType wikibase:Time ; # nb *does not* include edtf dates but AFAICT there are none in qualifiers.
              rdfs:label ?other_date_label . filter(lang(?other_date_label)="en-gb") . # what kind of date 
        # drop both start and end. idk if there could be a faster way to do this?
        filter not exists { ?s (bnpq:P27 | bnpq:P28) ?other_date .  }
  
   } # / optional other dates
  
 #  filter(!bound(?start_date)). # to filter out rows with a start date (77 atm)
  
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". } 
  
} 

group by  ?personLabel ?prop_label ?end_date ?start_date ?has_start_date ?person ?s  

ORDER BY ?personLabel ?prop_label ?end_date

Try it!


Women having children

#title:women having children
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/>

# lol defaultView:Timeline{"hide":["?s", "?date_prec", ""]} 

# P131 had child in / P45 child 
# a handful of P45 named children don't have dob though probably have dob in wikidata 

SELECT distinct ?person ?personLabel ?childLabel ?date_value ?date_prec ?had_child_edtf ?note  
?s

where {

  ?person bnwdt:P3 bnwd:Q3 . # select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
   
{   
  # had child in (unnamed children)
  ?person bnp:P131 ?s .
      ?s bnps:P131 ?had_child_edtf . # keep the edtf date for reference, though i think you can just use the time value/prec with these.

  # get dates detail via ?s and psv
  # gets edtf dates in std wiki date format
  # https://github.com/ProfessionalWiki/WikibaseEdtf   
      ?s ?psv ?wdv .
        ?wdv wikibase:timeValue ?date_value .
        ?wdv wikibase:timePrecision ?date_prec .
  
  # filter edtf date.
  FILTER ( datatype(?had_child_edtf) = xsd:edtf ) . #shows only the raw EDTF string from the query results

  # interesting, when you put this after wikibase:timeValue it seems to get every timey-wimey statement for women who have had child in ? (but only one)
  #?person bnwdt:P131 ?had_child .   
    
   # not much added in quals for had child. only maybe note P47. some have sourcing circumstances.
   optional { ?s bnpq:P47 ?note .  } # 

  } 
  union 
  {
  # named children (are any in both sections??? from dates looks possible a couple might be [wherry / hodgson])
   ?person bnp:P45 ?s.
        ?s bnps:P45 ?child .
      optional { ?child bnp:P26 ?ss .
                    ?ss bnps:P26 ?dob . 
                     ?ss ?psv ?wdv .
                        ?wdv wikibase:timeValue ?date_value .
                        ?wdv wikibase:timePrecision ?date_prec .
               }
  }
  
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
}

order by ?person ?date_value

Try it!