query-1e0c857ee3a8d75eedb38d6318ead39f
Height of 10 randomized lighthouses SELECT DISTINCT ?item ?name ?height ?quantityUnitLabel WHERE { ?item wdt:P31 wd:Q39715 ; p:P2048 ?statement; wdt:P2048 ?height. OPTIONAL { ?item rdfs:label ?name. FILTER(LANG(?name) = "en") } ?statement a wikibase:BestRank; ps:P2048 ?height; psv:P2048 ?quantityValue. ?quantityValue wikibase:quantityUnit ?quantityUnit. ?quantityUnit rdfs:label ?quantityUnitLabel. FILTER(LANG(?quantityUnitLabel) = "en")
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
} ORDER BY RAND() LIMIT 10
Use at
- https://query.wikidata.org/sparql
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 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#>
#Height of 10 randomized lighthouses
SELECT DISTINCT ?item ?name ?height ?quantityUnitLabel
WHERE
{
?item wdt:P31 wd:Q39715 ;
p:P2048 ?statement;
wdt:P2048 ?height.
OPTIONAL {
?item rdfs:label ?name.
FILTER(LANG(?name) = "en")
}
?statement a wikibase:BestRank;
ps:P2048 ?height;
psv:P2048 ?quantityValue.
?quantityValue wikibase:quantityUnit ?quantityUnit.
?quantityUnit rdfs:label ?quantityUnitLabel.
FILTER(LANG(?quantityUnitLabel) = "en")
# SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY RAND()
LIMIT 10
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?height"):::projected
v3("?item"):::projected
v2("?name"):::projected
v7("?quantityUnit")
v1("?quantityUnitLabel"):::projected
v6("?quantityValue")
v4("?statement")
c8(["wikibase:BestRank"]):::iri
c3(["wd:Q39715"]):::iri
f0[["?quantityUnitLabel = 'en'"]]
f0 --> v1
v3 --"p:direct/P31"--> c3
v3 --"p:P2048"--> v4
v3 --"p:direct/P2048"--> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."rdfs:label".-> v2
end
v4 --"a"--> c8
v4 --"p:statement/P2048"--> v5
v4 --"p:statement/value/P2048"--> v6
v6 --"wikibase:quantityUnit"--> v7
v7 --"rdfs:label"--> v1