Project:SPARQL/examples: Difference between revisions

Line 1,667: Line 1,667:
             ?wikidata wdt:P625 ?wd_geo .   
             ?wikidata wdt:P625 ?wd_geo .   
         } # /wikidata service     
         } # /wikidata service     
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
ORDER BY ?locationLabel
</sparql>
=== Residences of women participants in Colchester excavations ===
<sparql tryit="1">
#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". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
579

edits