Skip to content

Commit

Permalink
fix geo literal mapping for tweets, add geosearch example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
QuarksToQuasars committed Oct 24, 2018
1 parent 615107c commit 5a7bc55
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
31 changes: 29 additions & 2 deletions geiser-demo/README.md
Expand Up @@ -36,7 +36,34 @@ python send-json-transformation-request.py -l 1000 \
--routingKey jsontransformation-v1.rdfwriter-v1.#
```

##Query Example
##Query Examples

###Simple Query
```
python sparql-direct-exchange-example.py 'SELECT * WHERE {?a ?b ?c} LIMIT 10'
```
```

###Query with geo-search service
The following query returns the top concepts/keywords of tweets in a 10km circular distance around `48.99905508#8.37371461`:

```
python sparql-direct-exchange-example.py '
PREFIX geoliteral: <http://www.bigdata.com/rdf/geospatial/literals/v1#>
PREFIX geo: <http://www.bigdata.com/rdf/geospatial#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT ?subject (count(DISTINCT ?tweet) as ?number) WHERE {
?tweet a sioc:Post.
?tweet dcterms:place/<http://geovocab.org/geometry#geometry> ?geometry.
?tweet dcterms:subject ?subject.
SERVICE geo:search {
?geometry geo:search "inCircle" ;
geo:searchDatatype geoliteral:lat-lon ;
geo:predicate <http://www.w3.org/2003/01/geo/wgs84_pos#lat-lon> ;
geo:spatialCircleCenter "48.99905508#8.37371461" ;
geo:spatialCircleRadius "10" . # default unit: Kilometers
}
}GROUP BY ?subject
'
```

Expand Up @@ -18,6 +18,9 @@
},
"dct:place": {
"@type": "@id"
},
"wgs84:lat-lon": {
"@type": "geoliteral:lat-lon"
}
},
"@id": ("http://www.projekt-geiser.de/tweets/fest/"+ (.id | tostring)),
Expand All @@ -38,7 +41,7 @@
"geom:geometry":{
"@type": "geom:Geometry" ,
"@id": ("http://www.projekt-geiser.de/tweets/location/"+ (.place?.id? | tostring)+"/geometry"),
"geoliteral:lat-lon": ((.coordinates?.coordinates?[0] |tostring)+"#"+(.coordinates?.coordinates?[1] |tostring)) ,
"wgs84:lat-lon": ((.coordinates?.coordinates?[1] |tostring)+"#"+(.coordinates?.coordinates?[0] |tostring)) ,
"wgs84:lat": (.coordinates?.coordinates?[1]) ,
"wgs84:long": (.coordinates?.coordinates?[0])
}
Expand Down

0 comments on commit 5a7bc55

Please sign in to comment.