Navigation auf uzh.ch
Blazegraph DB is a high-performance graph database that is compatible with RDF and SPARQL. At SARI, we use Blazegraph DB in order to store data for all our projects. One important feature that we have recently integrated into our instances of Blazegraph DB is support for geospatial data. Enabling this support adds two prefixes that can be used:
PREFIX geoliteral: <http://www.bigdata.com/rdf/geospatial/literals/v1#> PREFIX geo: <http://www.bigdata.com/rdf/geospatial#> |
In the blazegraph, geospatial data may be presented through one of two data types:
Enabling geospatial data support allows us to make geospatial SPARQL queries. In particular, we can use such queries to get locations that are within a given perimeter. This can be done as follows:
SELECT * WHERE { #start of query SERVICE geo:search { ?nearbyplace geo:search [shape] . ?nearbyplace geo:predicate [pred] . ?nearbyplace geo:searchDatatype [type] . ?nearbyplace geo:spatialCircleCenter [center] . # required if [shape] is "inCircle" ?nearbyplace geo:spatialCircleRadius [radius] . # required if [shape] is "inCircle", default unit: Kilometers ?nearbyplace geo:spatialRectangleSouthWest [sw] . # required if [shape] is "inRectangle" ?nearbyplace geo:spatialRectangleNorthEast [ne] . # required if [shape] is "inRectangle" ?nearbyplace geo:timeStart [time_start] . # required if [type] is geoliteral:lat-lon-time ?nearbyplace geo:timeEnd [time_end] . # required if [type] is geoliteral:lat-lon-time } #rest of query } |
such that:
For example, in the context of BSO, such a query can be used in order to get images that have been taken near a given image:
SELECT ?nearbyimg WHERE { #beginning of query <https://resource.swissartresearch.net/artwork/zbz-990113960470205508> crm:P128_carries ?work . ?work crm:P138_represents ?place . ?place crm:P168_place_is_defined_by ?coords . FILTER ( datatype(?coords) = geoliteral:lat-lon) . SERVICE geo:search { ?nearbyplace geo:search "inCircle" . # circular search ?nearbyplace geo:predicate crm:P168_place_is_defined_by . # the coordinate entities have the predicate P168_place_is_defined_by ?nearbyplace geo:searchDatatype geoliteral:lat-lon . # the type we are using is geoliteral:lat-lon ?nearbyplace geo:spatialCircleCenter ?coords . # we set the center of the search area to the coordinates of the image zbz- 990113960470205508 ?nearbyplace geo:spatialCircleRadius "50" . # the radius in km } ?nearbyimg crm:P128_carries ?nearbywork . ?nearbywork crm:P138_represents ?nearbyplace . } LIMIT 100 |
Using this feature, we can leverage geographic data in order to introduce new ways of searching for images and objects in the BSO research portal, thus enhancing the overall search experience. One feature that is already online is the display of images that are geographically close to a given image on the image’s page. Other features could be added in the future, for instance to display artists that worked in geographic proximity to other artists at given moments in time.
Author: Andre Ghattas