Improve whatsX queries
@@ -602,6 +602,8 @@ export function generateWhatsAroundQuery(latitude, longitude) {
?location_geo geo:distanceValue ?location_geoDistance.
}
FILTER NOT EXISTS { ?result won:hasFlag won:NoHintForCounterpart }
+ FILTER NOT EXISTS { ?result won:hasFlag won:WhatsNew }
+ FILTER NOT EXISTS { ?result won:hasFlag won:WhatsAround }
}
}
UNION {
@@ -624,6 +626,8 @@ export function generateWhatsAroundQuery(latitude, longitude) {
?location_geo geo:distanceValue ?location_geoDistance.
}
FILTER NOT EXISTS { ?result won:hasFlag won:NoHintForCounterpart }
+ FILTER NOT EXISTS { ?result won:hasFlag won:WhatsNew }
+ FILTER NOT EXISTS { ?result won:hasFlag won:WhatsAround }
}
}
}
@@ -635,18 +639,20 @@ 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 ?score WHERE {
- BIND ((YEAR(?created) - 1970) * 315360000
+ SELECT DISTINCT ?result ((YEAR(?created) - 1970) * 315360000
+ MONTH(?created) * 26280000
+ DAY(?created) * 86400
+ HOURS(?created) * 3600
+ MINUTES(?created) * 60
+ SECONDS(?created)
as ?score)
+ WHERE {
?result <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> won:Need.
?result won:isInState won:Active .
?result dct:created ?created.
FILTER NOT EXISTS { ?result won:hasFlag won:NoHintForCounterpart }
+ FILTER NOT EXISTS { ?result won:hasFlag won:WhatsNew }
+ FILTER NOT EXISTS { ?result won:hasFlag won:WhatsAround }
}
- ORDER BY DESC(?score)`;
+ ORDER BY DESC(?created)`;
}
