improve whats queries
@@ -627,7 +627,8 @@ export function generateWhatsAroundQuery(latitude, longitude) {
PREFIX geo: <http://www.bigdata.com/rdf/geospatial#>
PREFIX geoliteral: <http://www.bigdata.com/rdf/geospatial/literals/v1#>
SELECT DISTINCT ?result ?score WHERE {
- bind (if(?location_geoDistance = 0, 1, 1/?location_geoDistance) as ?score)
+ VALUES ?radius { 10 }
+ BIND ((?radius-?location_geoDistance)/?radius as ?score)
?result <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> won:Need.
?result won:isInState won:Active .
?result won:seeks?/(won:hasLocation|s:jobLocation|s:location|s:fromLocation|s:toLocation) ?location.
@@ -637,9 +638,10 @@ export function generateWhatsAroundQuery(latitude, longitude) {
?location_geo geo:searchDatatype geoliteral:lat-lon.
?location_geo geo:predicate won:geoSpatial.
?location_geo geo:spatialCircleCenter "${latitude}#${longitude}".
- ?location_geo geo:spatialCircleRadius "10".
+ ?location_geo geo:spatialCircleRadius ?radius.
?location_geo geo:distanceValue ?location_geoDistance.
}
+ FILTER(?location_geoDistance < ?radius)
FILTER NOT EXISTS { ?result won:hasFlag won:NoHintForCounterpart }
FILTER NOT EXISTS { ?result won:hasFlag won:WhatsNew }
FILTER NOT EXISTS { ?result won:hasFlag won:WhatsAround }
@@ -650,8 +652,8 @@ export function generateWhatsNewQuery() {
return `PREFIX won: <http://purl.org/webofneeds/model#>
PREFIX s: <http://schema.org/>
PREFIX dct: <http://purl.org/dc/terms/>
- SELECT DISTINCT ?result ((YEAR(?created) - 1970) * 315360000
- + MONTH(?created) * 26280000
+ SELECT DISTINCT ?result ((YEAR(?created) - 1970) * 40000000
+ + MONTH(?created) * 3000000
+ DAY(?created) * 86400
+ HOURS(?created) * 3600
+ MINUTES(?created) * 60
