Difference between revisions of "OSM Planet"

From BITPlan Wiki
Jump to navigation Jump to search
Line 1: Line 1:
= SPARQL Endpoints =
+
= OSM Planet SPARQL Endpoints =
* https://sophox.org/
+
This page compares the different SPARQL endpoints available for querying OpenStreetMap (OSM) data.
* https://qlever.cs.uni-freiburg.de/osm-planet
 
  
<source lang='SPARQL'>
+
== Configuration ==
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
+
=== endpoints.yaml ===
 +
<syntaxhighlight lang='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#>
  
SELECT *
+
osm-qlever:
WHERE {
+
  endpoint: https://qlever.cs.uni-freiburg.de/api/osm
  osmrel:6843452 ?p ?o .
+
  website: https://qlever.cs.uni-freiburg.de/osm
}  
+
  database: qlever
LIMIT 10
+
  method: POST
</source>
+
  lang: sparql
[https://qlever.cs.uni-freiburg.de/osm-planet/zXu0VA?exec=true try it!]
+
  prefixes: |
https://qlever.cs.uni-freiburg.de/osm-planet/Ok3PU1?exec=true
+
    PREFIX osmrel: <https://www.openstreetmap.org/relation/>
[[Category:SPARQL]]
+
    PREFIX osmt: <https://wiki.openstreetmap.org/wiki/Key:>
 +
    PREFIX osmm: <https://www.openstreetmap.org/meta/>
 +
    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
 +
</syntaxhighlight>
 +
 
 +
=== osmplanet.yaml ===
 +
<syntaxhighlight lang='yaml'>
 +
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)
 +
</syntaxhighlight>
 +
 
 +
== Query Results ==
 +
=== Qlever Results ===
 +
{{sparqlquery -qp osmplanet.yaml -qn RelationStats -en osm-qlever --param relid=6843452 -f mediawiki}}
 +
 
 +
=== Sophox Results ===
 +
{{sparqlquery -qp osmplanet.yaml -qn RelationStats -en osm-sophox --param relid=6843452 -f mediawiki}}
 +
 
 +
== See Also ==
 +
* [https://wiki.openstreetmap.org/wiki/Sophox Sophox]
 +
* [https://qlever.cs.uni-freiburg.de/osm Qlever OSM]
 +
* [https://wiki.bitplan.com/index.php?title=OSM_Planet OSM Planet]

Revision as of 10:16, 20 January 2025

OSM Planet SPARQL Endpoints

This page compares the different SPARQL endpoints available for querying OpenStreetMap (OSM) data.

Configuration

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

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

Qlever Results

Template:Sparqlquery -qp osmplanet.yaml -qn RelationStats -en osm-qlever --param relid=6843452 -f mediawiki

Sophox Results

Template:Sparqlquery -qp osmplanet.yaml -qn RelationStats -en osm-sophox --param relid=6843452 -f mediawiki

See Also