Difference between revisions of "OSM Planet"
Jump to navigation
Jump to search
| Line 57: | Line 57: | ||
== Query Results == | == Query Results == | ||
| − | === | + | === Sophox Queries === |
| − | + | <source lang='bash' highlight='1'> | |
| + | sparqlquery -qp osmplanet.yaml -qn RelationStats -en osm-sophox --param relid=6843452 -f mediawiki | ||
| + | </source> | ||
| + | == RelationStats == | ||
| + | |||
| + | === query === | ||
| + | <source lang='sparql'> | ||
| + | # Get statistics about predicates used in an OSM relation | ||
| + | PREFIX osmrel: <https://www.openstreetmap.org/relation/> | ||
| + | SELECT ?p (COUNT(?o) as ?count) | ||
| + | WHERE { | ||
| + | osmrel:6843452 ?p ?o . | ||
| + | } | ||
| + | GROUP BY ?p | ||
| + | HAVING (?count > 1) | ||
| + | ORDER BY DESC(?count) | ||
| + | |||
| + | </source> | ||
| + | |||
| + | [https://sophox.org?query=%23%20Get%20statistics%20about%20predicates%20used%20in%20an%20OSM%20relation%0APREFIX%20osmrel%3A%20%3Chttps%3A//www.openstreetmap.org/relation/%3E%0ASELECT%20%3Fp%20%28COUNT%28%3Fo%29%20as%20%3Fcount%29%0AWHERE%20%7B%0A%20%20osmrel%3A6843452%20%3Fp%20%3Fo%20.%0A%7D%0AGROUP%20BY%20%3Fp%0AHAVING%20%28%3Fcount%20%3E%201%29%0AORDER%20BY%20DESC%28%3Fcount%29%0A try it!] | ||
| + | === result === | ||
| + | {| class="wikitable" style="text-align: left;" | ||
| + | |+ <!-- caption --> | ||
| + | |- | ||
| + | ! p !! align="right"| count | ||
| + | |- | ||
| + | | https://www.openstreetmap.org/meta/has || align="right"| 186 | ||
| + | |} | ||
=== Sophox Results === | === Sophox Results === | ||
Revision as of 09:21, 20 January 2025
OSM Planet SPARQL Endpoints
This page compares the different SPARQL endpoints available for querying OpenStreetMap (OSM) data.
Configuration for pylodstorage sparqlquery tool
see https://pypi.org/project/pyLodStorage/
installation
pip install pylodstorage
The configuration files need to be in $HOME/.pylodstorage or you have to explicitly give the path with the -ep and -qp options
endpoints.yaml
osm-sophox:
endpoint: https://sophox.org/sparql
website: https://sophox.org
database: virtuoso
method: POST
lang: sparql
prefixes: |
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
PREFIX osmt: <https://wiki.openstreetmap.org/wiki/Key:>
PREFIX osmm: <https://www.openstreetmap.org/meta/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
osm-qlever:
endpoint: https://qlever.cs.uni-freiburg.de/api/osm
website: https://qlever.cs.uni-freiburg.de/osm
database: qlever
method: POST
lang: sparql
prefixes: |
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
PREFIX osmt: <https://wiki.openstreetmap.org/wiki/Key:>
PREFIX osmm: <https://www.openstreetmap.org/meta/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
osmplanet.yaml (or queries.yaml as default)
RelationStats:
endpoint: osm-qlever
param_list:
- name: relid
type: str
default_value: "6843452"
sparql: |
# Get statistics about predicates used in an OSM relation
SELECT ?p (COUNT(?o) as ?count)
WHERE {
osmrel:{{relid}} ?p ?o .
}
GROUP BY ?p
HAVING (?count > 1)
ORDER BY DESC(?count)
Query Results
Sophox Queries
sparqlquery -qp osmplanet.yaml -qn RelationStats -en osm-sophox --param relid=6843452 -f mediawiki
RelationStats
query
# Get statistics about predicates used in an OSM relation
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
SELECT ?p (COUNT(?o) as ?count)
WHERE {
osmrel:6843452 ?p ?o .
}
GROUP BY ?p
HAVING (?count > 1)
ORDER BY DESC(?count)
result
| p | count |
|---|---|
| https://www.openstreetmap.org/meta/has | 186 |