City or town (E2)

From Mapping DH
language codelabeldescriptionaliasesedit
enCity or townAn entity schema for the class City or town (Q41)edit
PREFIX wdt: <https://mapping-dh.wikibase.cloud/prop/direct/>
PREFIX wd: <https://mapping-dh.wikibase.cloud/entity/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX geo: <http://www.opengis.net/ont/geosparql#>

# This EntitySchema concerns "City or town"
start = @<City_or_town>

# Any instance of the subclass City or town needs: 
<City_or_town> EXTRA wdt:P17 {   

  # "instance of": Q41 (City or town) - exactly one
  wdt:P17 [wd:Q41] ;    

  # "in country": Item of class Q74 - exactly one 
  wdt:P101 {
    wdt:P17 [wd:Q74] 
    };

  # "in state": Item of class Q619 - zero or one 
  wdt:P73 @<state> ? ;

  # "Wikidata ID": external identifier - exactly one
  wdt:P56 xsd:string ;     

  # "coordinate location": string - exactly one
  wdt:P13 geo:wktLiteral ;     

}

<country> EXTRA wdt:P17 {
  wdt:P17 [wd:Q74] ; }

<state> EXTRA wdt:P17 {
  wdt:P17 [wd:Q619] ; }