query-d1edaefd3f7a9e039fcedf40b2ac4490

rq turtle/ttl

Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100 Population of cities and towns in Denmark and their OSM relation id

This shows a simple OR using VALUES and a variable

SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } VALUES ?town_or_city { wd:Q3957 wd:Q515 } ?city (wdt:P31/(wdt:P279*)) ?town_or_city; wdt:P17 wd:Q35. OPTIONAL { ?city wdt:P1082 ?population. } OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. } } LIMIT 100

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Population of cities and towns in Denmark and their OSM relation id
# This shows a simple OR using VALUES and a variable
SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
  VALUES ?town_or_city {
    wd:Q3957
    wd:Q515
  }
  ?city (wdt:P31/(wdt:P279*)) ?town_or_city;
    wdt:P17 wd:Q35.
  OPTIONAL { ?city wdt:P1082 ?population. }
  OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. }
}
LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?OSM_relation_ID"):::projected v2("?city"):::projected v3("?population"):::projected v1("?town_or_city") a1((" ")) c2(["bd:serviceParam"]):::iri c8(["wd:Q35"]):::iri c4(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end bind0[/VALUES ?town_or_city/] bind0-->v1 bind00(["wd:Q3957"]) bind00 --> bind0 bind01(["wd:Q515"]) bind01 --> bind0 v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> v1 v2 --"wdt:P17"--> c8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P1082".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P402".-> v4 end