query: PREFIX wikibase: <http://wikiba.se/ontology#>
  PREFIX wd: <http://www.wikidata.org/entity/> 
  PREFIX wdt: <http://www.wikidata.org/prop/direct/>
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  PREFIX p: <http://www.wikidata.org/prop/>
  PREFIX v: <http://www.wikidata.org/prop/statement/>
  
  SELECT ?p ?pLabel ?state ?stateLabel ?id2016 ?geonames ?OSM ?id2011 ?post ?Vicnames ?NSWgnr ?Qldplaces ?image WHERE {
  
     OPTIONAL {
       ?state wdt:P31/wdt:P279* wd:Q178712 .
       ?p wdt:P131 ?state.                      # ASGS 2016
     }
  
     ?p wdt:P17 wd:Q408 .
     #?c wdt:P279* wd:Q82794 .
     ?p wdt:P31 wd:Q3257686 .
     OPTIONAL {?p wdt:P18  ?image.}                      # image (option)
     OPTIONAL {?p wdt:P4093 ?id2016.}                      # ASGS 2016
     OPTIONAL {?p wdt:P4014 ?id2011.}                      # ASGS 2011
     OPTIONAL {?p wdt:P281 ?post.}                      # ASGS 2016
     OPTIONAL {?p wdt:P1566 ?geonames.}                      # ASGS 2016
     OPTIONAL {?p wdt:P402 ?OSM.}                      # ASGS 2016
    
     OPTIONAL {?p wdt:P3471 ?Vicnames.}                      # ASGS 2016
     OPTIONAL {?p wdt:P3517 ?NSWgnr.}                      # ASGS 2016
     OPTIONAL {?p wdt:P3257 ?Qldplaces.}                      # ASGS 2016
    
    
     SERVICE wikibase:label {
      bd:serviceParam wikibase:language "en" .
     }
   }
  LIMIT 10000