query-134eab87ae2693d6f494faed6185a8cc

rq turtle/ttl

country (P17),  location (P276),  located in the administrative territorial entity (P131),  image (P18),  instance of (P31): PropertiesDeveloping enhanced map query:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT DISTINCT  (?foundingEra as ?layer) ?socLabel ?soc ?coord ?socBegan ?socURI ?socLoc WHERE {  

 { {?soc wdt:P31 wd:Q12160242 } UNION {  ?soc wdt:P31 wd:Q1797187 } }  .
  { ?soc wdt:P571 ?socBegan; BIND(IF(BOUND(?socBegan),year(?socBegan),1945) AS ?socBeganYr). }.    
  BIND( IF (?socBeganYr < 1800, "1 pre-1800", 
            IF (?socBeganYr < 1850, "2 pre-1850", 
                IF (?socBeganYr < 1900, "3 pre-1900", 
                    IF (?socBeganYr < 1915, "4 pre-WW1", 
                        IF (?socBeganYr < 1946, "5 inter-war", 
                            IF (?socBeganYr < 1990, "6 Post WW2", "7 Recent")))))) 
       AS ?foundingEra).
  optional { ?soc wdt:P18 ?socURI } .
  optional { ?soc wdt:P131 ?socLocAQ. 
             ?socLocAQ rdfs:label ?socLocA. FILTER(LANG(?socLocA) = "en"). 
             ?socLocAQ wdt:P625 ?coord. } .
  optional { ?soc wdt:P740 ?socLocFQ. 
             ?socLocFQ rdfs:label ?socLocF. FILTER(LANG(?socLocF) = "en"). 
             ?socLocFQ wdt:P625 ?coord. } .
  optional { ?soc wdt:P276 ?socLocPQ. 
             ?socLocPQ rdfs:label ?socLocP. FILTER(LANG(?socLocP) = "en"). 
             ?socLocPQ wdt:P625 ?coord.} .
  optional { ?soc wdt:P937 ?socLocWLQ. 
             ?socLocWLQ rdfs:label ?socLocWL. FILTER(LANG(?socLocWL) = "en"). 
             ?socLocWLQ wdt:P625 ?coord. } .
  optional { ?soc wdt:P17 ?socCountryQ. 
             ?socCountryQ rdfs:label ?socCountry. FILTER(LANG(?socCountry) = "en").
             ?socCountryQ wdt:P625 ?coord. } .
  BIND(IF(BOUND(?socLocP),?socLocP,?socLocA) AS ?socLoc).
  BIND(IF(BOUND(?socLoc),?socLoc,?socLocF) AS ?socLoc).
  BIND(IF(BOUND(?socLoc),?socLoc,?socLocWL) AS ?socLoc).
  BIND(IF(BOUND(?socLoc),?socLoc,?socCountry) AS ?socLoc).
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?foundingEra ?socLabel LIMIT 3000

Query found at