Project:SPARQL/examples: Difference between revisions

Line 2,010: Line 2,010:
   #8 `of` wikidata geocoords
   #8 `of` wikidata geocoords
   #9 place main geocoords - likely to be broad london postal districts so should be last resort
   #9 place main geocoords - likely to be broad london postal districts so should be last resort
  #10 linked place main geocoords
    
    
    
    
Line 2,063: Line 2,064:
                 }
                 }
    
    
       optional { ?place bnwdt:P153 ?geo9 .  } # geocoords in BN as main (mainly london postal districts - should be last resort as v broad.)
       optional { ?place bnwdt:P153 ?geo9 .  } # main geocoords (mainly london postal districts - should be last resort as v broad.)


   BIND(COALESCE(?geo1, ?geo2, ?geo3, ?geo4, ?geo5, ?geo6, ?geo7, ?geo8, ?geo9) AS ?geo).  # if geo1 available use that, then try geo2, and so on
 
      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!
   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". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }  
}
}


579

edits