linked-data-reactor
Version:
Linked Data Reactor
31 lines (30 loc) • 857 B
JavaScript
class DBpediaQuery{
constructor() {
/*jshint multistr: true */
this.prefixes='\
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> \
PREFIX foaf: <http://xmlns.com/foaf/0.1/> \
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> \
';
this.query='';
}
getPrefixes() {
return this.prefixes;
}
getCoordinates (uris) {
let output = [];
uris.forEach(function(uri) {
output.push('<' + uri + '>');
});
/*jshint multistr: true */
this.query='\
SELECT DISTINCT ?s SAMPLE(?lat) AS ?lat SAMPLE(?long) AS ?long WHERE { \
?s geo:lat ?lat . \
?s geo:long ?long . \
FILTER (?s IN ('+ output.join(',') +') ) \
}';
return this.query;
}
}
export default DBpediaQuery;
;