Database Reference
In-Depth Information
7. admin:hasPlaceName 'Merea';
8. geosparql:hasGeometry ?merea_geom.
9. ?pub a mm:Pub ;
10. geosparql:hasGeometry ?pub_geom.
11. ?pub_geom geosparql:sfWithin ?merea_geom.
12. }
13. }
Line 4 selects unique answers to the query, as returned in the ?pub variable. For
simplicity, we assume that all Merea Maps' data (both administrative regions and
topographic) can be accessed from one big graph as stated in line 5. The instance
0001 (which is a Country with place name “Merea,” lines 6 and 7) has a geometry
stored in the variable ?merea _ geom (line 8). Lines 9 and 10 find instances of the
class Pub with a geometry to be stored in the variable ?pub _ geom . Finally, in
line 11, the GeoSPARQL sfWithin function is applied between the values in the
?pub _ geom and ?merea _ geom variables.
Instead of having to find the geometries of each spatial object and using a function
to compare them, the query rewriting of GeoSPARQL allows you to query the two
spatial objects directly using a spatial relation. So, you can write this simpler query,
and behind the scenes, it will be rewritten into the previous query:
1. prefix geosparql: < http://www.opengis.net/def/geosparql/ >
2. prefix mm: < http://mereamaps.gov.me/topo/ >
3. prefix admin: < http://mereamaps.gov.me/administrativeRegions/ >
4. select distinct ?pub where {
5. ?pub geosparql:sf-within < http://data.mereamaps.gov.me/0001 >.
6. }
7.}
8.3.5 u Sing SparQl to v alidate d ata
The other important use of SPARQL is to validate data. When preparing RDF
datasets, Merea Maps wants to make certain that they have not missed any data.
For example, if a new set of houses is built in Ash Fleet, data needs to be gath-
ered so that they are all assigned a house number, street name, and postcodes.
Since RDFS is based on the open world assumption “just because you haven't
said it, doesn't mean it isn't true,” if one house is missing its house number,
the data will still be valid under RDFS. The reasoner simply concludes that the
house has a number; we just do not know what it is. To catch such problems in the
data, we can use SPARQL to check that every house does indeed have a known
house number.
The general model for validating data is to specify some ontology for express-
ing rules and constraints on the data and use it in combination with SPARQL to
query the data to see if the constraints hold. Currently, there are two competing ways
to validate RDF data: SPIN 6 and the Pellet Integrity Constraints Validator 7 (ICV).
SPIN is an RDF vocabulary for specifying business rules and constraints, which has
been published as a W3C member submission (Knublauch, 2011) and is supported
Search WWH ::




Custom Search