Project:SPARQL/examples: Difference between revisions

From Beyond Notability
Line 1,988: Line 1,988:
   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
   ?person bnwdt:P117 ?wikidata_ID . #look for wikidata ID on person page
  ?wikidata_ID bnpq:P14 ?wikidata_url .
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) 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> {
       # get English language wikipedia articles in wikidata entries, where listed
       # get English language wikipedia articles in wikidata entries, where listed
Line 2,029: Line 2,029:
   filter not exists {?person bnwdt:P15 ?bn_dod . } # *don't* have P15 date of death
   filter not exists {?person bnwdt:P15 ?bn_dod . } # *don't* have P15 date of death
    
    
   ?person bnp:P117 ?wikidata_ID . #look for wikidata ID on person page
   ?person bnwdt:P117 ?wikidata_ID . #look for wikidata ID on person page
  ?wikidata_ID bnpq:P14 ?wikidata_url .
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?item) .
  BIND(IRI(REPLACE(?wikidata_url,"https://www.wikidata.org/wiki/","http://www.wikidata.org/entity/")) as ?item )  
 
    
    
   SERVICE <https://query.wikidata.org/sparql> {
   SERVICE <https://query.wikidata.org/sparql> {
Line 2,065: Line 2,065:
   filter not exists {?person bnwdt:P26 ?bn_dob . } # *don't* have P15 date of death
   filter not exists {?person bnwdt:P26 ?bn_dob . } # *don't* have P15 date of death
    
    
   ?person bnp:P117 ?wikidata_ID . #look for wikidata ID on person page
   ?person bnwdt:P117 ?wikidata_ID . #look for wikidata ID on person page
  ?wikidata_ID bnpq:P14 ?wikidata_url .
    bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) as ?wikidata) .
  BIND(IRI(REPLACE(?wikidata_url,"https://www.wikidata.org/wiki/","http://www.wikidata.org/entity/")) as ?item )  
 
 
   SERVICE <https://query.wikidata.org/sparql> {
   SERVICE <https://query.wikidata.org/sparql> {
         ?item wdt:P21 ?WD_gender. #get gender of person
         ?item wdt:P21 ?WD_gender. #get gender of person
Line 2,100: Line 2,099:
     #?person bnwdt:P75 bnwd:Q8. # limit to FSAs if the full set times out.
     #?person bnwdt:P75 bnwd:Q8. # limit to FSAs if the full set times out.
    
    
     ?person bnp:P117 ?wikidata_ID . #get wikidata ID
     ?person bnwdt:P117 ?wikidata_ID . #get wikidata ID
     ?wikidata_ID bnpq:P14 ?wikidata_url .
     bind(iri(concat("http://www.wikidata.org/entity/", str(?wikidata_ID))) 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> {
      
      
3,427

edits