query-42ef3c49430e8c5edf1b3090bf0dfd68
TODO
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 p: <http://www.wikidata.org/prop/>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?place ?placeLabel ?elev ?ulabel #?unit ?prepr ?ulabel_ #?sense ?lexeme ?form
WHERE {
{
SELECT ?place ?elev_st ?elev ?unit ?ulabel_ (SAMPLE(?prepr_) AS ?prepr) #?sense ?form ?lexeme
WHERE {
{
SELECT ?place (SAMPLE(?elev_st_) AS ?elev_st)
WHERE {
#?place wdt:P17 wd:Q34 . # Reduce the working set.
#?place wdt:P31 wd:Q8502 .
?place p:P2044 ?elev_st_ .
?elev_st_ a wikibase:BestRank .
}
GROUP BY ?place
LIMIT 100
}
?elev_st psv:P2044 [ wikibase:quantityAmount ?elev; wikibase:quantityUnit ?unit ] .
?unit rdfs:label ?ulabel_. FILTER(LANG(?ulabel_)="sv")
OPTIONAL {
?sense wdt:P5137 ?unit .
?lexeme ontolex:sense ?sense .
?lexeme ontolex:lexicalForm ?form.
?lexeme dct:language wd:Q9027 .
?form wikibase:grammaticalFeature wd:Q146786 .
?form ontolex:representation ?prepr_ .
}
}
GROUP BY ?place ?elev_st ?elev ?unit ?ulabel_ #?sense ?form ?lexeme
} BIND(IF(ABS(?elev) >= 2, ?prepr, ?ulabel_) AS ?ulabel)
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,en" }
}
Query found at
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2022/11
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/en
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/es
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/fr
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?elev"):::projected
v4("?elev_st")
v3("?elev_st_")
v9("?form")
v8("?lexeme")
v2("?place"):::projected
v11("?prepr")
v10("?prepr_")
v7("?sense")
v12("?ulabel"):::projected
v1("?ulabel_")
v6("?unit")
a1((" "))
c15(["wd:Q146786"]):::iri
c4(["wikibase:BestRank"]):::iri
c13(["wd:Q9027"]):::iri
c18(["bd:serviceParam"]):::iri
c20(["sv,en"]):::literal
f0[["?ulabel_ = 'sv'"]]
f0 --> v1
v2 --"p:P2044"--> v3
v3 --"a"--> c4
bind2[/"sample(?elev_st_)"/]
v3 --o bind2
bind2 --as--o v4
a1 --"wikibase:quantityAmount"--> v5
a1 --"wikibase:quantityUnit"--> v6
v4 --"p:statement/value/P2044"--> a1
v6 --"rdfs:label"--> v1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:direct/P5137".-> v6
v8 --"ontolex:sense"--> v7
v8 --"ontolex:lexicalForm"--> v9
v8 --"dct:language"--> c13
v9 --"wikibase:grammaticalFeature"--> c15
v9 --"ontolex:representation"--> v10
end
bind4[/"sample(?prepr_)"/]
v10 --o bind4
bind4 --as--o v11
bind5[/"if(numeric-abs(?elev) >= '2^^xsd:integer',?prepr,?ulabel_)"/]
v5 --o bind5
v11 --o bind5
v1 --o bind5
bind5 --as--o v12
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c18 --"wikibase:language"--> c20
end