query-d05ae148ab504824f6155a51af16d521

rq turtle/ttl

Getting object by nameSo I have this query for cities with properties (population, area).

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q515.
      {
        ?item p:P1082 ?statement1.
        ?statement1 (psv:P1082/wikibase:quantityAmount) ?numericQuantity.
      }
      UNION
      {
        ?item p:P2046 ?statement2.
        ?statement2 (psv:P2046/wikibase:quantityAmount) ?numericQuantity.
      }
    }
    LIMIT 10
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item"):::projected v4("?numericQuantity") v2("?statement0") v3("?statement1") v5("?statement2") a1((" ")) a2((" ")) a3((" ")) c2(["bd:serviceParam"]):::iri c8(["wd:Q515"]):::iri c4(["#91;AUTO_LANGUAGE#93;"]):::literal subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end v1 --"p:P31"--> v2 v2 --"p:statement/P31"--> a1 a1 --"p:direct/P279"--> c8 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"p:P2046"--> v5 v5 --"p:statement/value/P2046"--> a3 a3 --"wikibase:quantityAmount"--> v4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"p:P1082"--> v3 v3 --"p:statement/value/P1082"--> a2 a2 --"wikibase:quantityAmount"--> v4 end union0r <== or ==> union0l end