Database Reference
In-Depth Information
and then use the GRAPH keyword within the query itself to indicate the graph to
which we are referring. Querying multiple graphs at the same time allows us to
aggregate data. For example, the following query will return administrative districts:
1. prefix admin: < http://data.mereamaps.gov.me/administrativeRegions/ >
2. prefix geo: < http://www.w3.org/2003/01/geo/wgs84_pos# >
3.
4. select distinct ?graph_id ?property ?hasValue
5. from < http://data.mereamaps.gov.me/administrativeRegions.rdf >
6. from named < http://data.mereamaps.gov.me/administrativeRegions.rdf >
7. from named < http://postcodes.mm.gov.me >
8. where
9. {
10. graph < http://data.mereamaps.gov.me/administrativeRegions.rdf >
11. {
12. ?city a admin:District;
13.
geo:lat ?lat;
14.
geo:long ?long.
15. }.
16. graph < http://postcodes.mm.gov.me >
17. {
18. ?city geo:lat ?lat;
19.
geo:long ?long.
20. }.
21. graph ?graph_id
22. {
23. ?city geo:lat ?lat;
24.
geo:long ?long;
25.
?property ?hasValue.
26. }
27. }
This query asks for unique solutions of the graph URI, any property and any
value of that property to be returned (line 4) from the named graphs of Merea Maps'
administrative regions RDF graph (line 6) and the Merean Mail postcodes RDF
graph (line 7), where the solution meets the criteria that in the administrative regions
graph, the resource is a city with a certain latitude and longitude (lines 11-15), and
in the postcodes graph, it has the same latitude and longitude (lines 16-20). Finally,
lines 21-26 allow the return of all the information (any property and its value) from
each graph about those districts present in both the administrative regions and post-
codes dataset.
8.3.3 SparQl aSk, conStruct, and deScribe
The SPARQL keyword ASK returns true or false depending on whether there are
any matches to the query. For example, the following asks if Medina is in the admin-
istrative region of North Merea:
Search WWH ::




Custom Search