summaryrefslogtreecommitdiff
path: root/create-data.js
diff options
context:
space:
mode:
authorIanMJB <ianmjb@gmail.com>2014-09-12 15:59:44 +0100
committerIanMJB <ianmjb@gmail.com>2014-09-12 15:59:44 +0100
commitab0ebc8eb5e9fd2e70c9685d710b148686dceb6c (patch)
treeced8f7ebcf3a01c4b7d59ea39c5c71b6fcd739dc /create-data.js
parent25046fb610d1198c8c1fbc511e6538c4af48ba42 (diff)
downloadleaflet-soton-ab0ebc8eb5e9fd2e70c9685d710b148686dceb6c.tar
leaflet-soton-ab0ebc8eb5e9fd2e70c9685d710b148686dceb6c.tar.gz
Magic with recommended entrances.
Diffstat (limited to 'create-data.js')
-rwxr-xr-xcreate-data.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/create-data.js b/create-data.js
index 2cd3353..6ba0408 100755
--- a/create-data.js
+++ b/create-data.js
@@ -321,6 +321,9 @@ function processBuildingParts(buildingParts, callback) {
findRoomContents(part, workstations, callback);
},
function(callback) {
+ getRecommendedEntrances(part, callback);
+ },
+ function(callback) {
findRoomImages(part, callback);
}],
callback);
@@ -1130,6 +1133,43 @@ SELECT * WHERE {\
});
}
+function getRecommendedEntrances(part, callback) {
+ var query = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\
+ PREFIX portals: <http://purl.org/openorg/portals/>\
+ PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>\
+ SELECT ?portal WHERE {\
+ ?uri portals:recommendedBuildingEntrance ?portal\
+ FILTER (\
+ ?uri = <URI>\
+ )\
+ }";
+
+ query = query.replace("URI", part.properties.uri);
+
+ sparqlQuery(query, function(err, data) {
+ if (err) {
+ console.error("error in getRecommended Entrance");
+ console.error("query " + query);
+ console.error(err);
+ }
+
+ part.properties.recommendedEntrances = portals = [];
+
+ data.results.bindings.forEach(function(portal) {
+ if ('error-message' in portal) {
+ console.error("error in portals");
+ console.error(JSON.stringify(feature));
+ console.error("query:\n" + query);
+ return;
+ }
+
+ portals.push(portal.portal.value);
+ });
+
+ callback(null, portals);
+ });
+}
+
// workstations
function getUniWorkstations(workstations, callback) {