Home › SPARQL
Every query needs at least one FROM (or FROM NAMED);
the processor fetches those documents and queries over them. Only THIS wrapper's
documents are permitted, and relative IRIs resolve against the wrapper root —
so the same query works on any deployment:
FROM </wfs?s={service}&type=/inspire/{theme}/{version}%23{Class}&bbox=W,S,E,N>
— a bounding-box document, feature type named by its RDF class URI
(the s= value URL-encoded)FROM </wfs?s={service}&typenames={prefix}:{Type}&bbox=…>
— the same, addressed by the native WFS typename instead. Use this for
services whose types are not INSPIRE-namespacedFROM </wfs?s={service}&id={featureid}>
— one feature's documentFROM </inspire/{theme}/{version}>,
FROM </vocab/{name}>
— the vocabularies themselves (classes, properties, definitions and
multilingual labels), queryable like any other graph&count= / &offset= page a large answer;
&time= requests a Memento of itSeveral FROM clauses merge into one graph. A #
inside a FROM IRI must be written %23.
The processor registers the GeoSPARQL 1.1 function suite
(OGC 22-047r1).
Functions operate on geo:wktLiteral and geo:gmlLiteral
typed literals — the form produced by all data sources here. Common functions
relevant to this dataset:
geof:metricArea(?g) — geodesic area in m²geof:metricLength(?g) — geodesic length in mgeof:metricDistance(?a, ?b) — geodesic distance in mgeof:centroid(?g) — returns a geo:wktLiteral POINTTopological relations (DE-9IM / Simple Features) return a boolean for a pair of geometries:
geof:sfEquals(?a, ?b) — topologically equalgeof:sfTouches(?a, ?b) — boundaries meet, interiors do notgeof:sfCrosses(?a, ?b) — interiors cross (e.g. a bridge line over a watercourse)geof:sfIntersects(?a, ?b) — not disjointgeof:sfContains(?a, ?b) — ?a contains ?bUse PREFIX geof: <http://www.opengis.net/def/function/geosparql/>.
A non-standard helper returns a geometry's topological dimension as an integer
(0 point, 1 curve, 2 surface):
fn:dimension(?g) — mirrors JTS getDimension();
test for curve/area with fn:dimension(?g) = 1 / = 2Use PREFIX fn: <https://inspirewrap.ontologycentral.com/vocab/fn#>.
These reproduce the ATKIS SK50 styling-rule predicates
(mdl:geo_crosses → geof:sfCrosses,
mdl:geo_isArea → fn:dimension(?g) = 2, etc.).
See the example dropdown above for working queries.