diff --git a/.circleci/config.yml b/.circleci/config.yml
index 935bb7b..702ab27 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -33,7 +33,7 @@ jobs:
machine:
enabled: true
steps:
- - run: ssh -o "StrictHostKeyChecking no" $SSH_USER@$SSH_HOST "cd ~/build/SmartFlanders; git reset --hard; rm package-lock.json; git pull; git checkout master; npm install; forever stopall; forever start index.js"
+ - run: ssh -o "StrictHostKeyChecking no" $SSH_USER@$SSH_HOST "~/deploy.sh"
workflows:
version: 2
diff --git a/.circleci/deploy.sh b/.circleci/deploy.sh
new file mode 100644
index 0000000..599ac3a
--- /dev/null
+++ b/.circleci/deploy.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# Go to master branch version
+cd ~/build/SmartFlanders
+git reset --hard
+rm package-lock.json
+git pull
+git checkout master
+
+# Install back end
+npm install
+forever stopall
+forever start index.js
+
+# Install front end
+cd /var/www/smartflanders.ilabt.imec.be
+rm *.html *.css *.js *.scss
+cp ~/build/SmartFlanders/frontend /var/www/smartflanders.ilabt.imec.be
+
diff --git a/.gitignore b/.gitignore
index ad46b30..7fef739 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,3 +59,6 @@ typings/
# next.js build output
.next
+
+# SASS compile file
+frontend/styles.css.map
diff --git a/controllers/openingHoursController.js b/controllers/openingHoursController.js
new file mode 100644
index 0000000..7332eac
--- /dev/null
+++ b/controllers/openingHoursController.js
@@ -0,0 +1,28 @@
+const validator = require('validator')
+const transformer = require('../helpers/transformer')
+
+let json = []
+
+exports.getOpeningHours = (params) => {
+
+ Object.keys(params.openinghours).forEach((element, index) => {
+ json.push({
+ "@type": "OpeningHoursSpecification",
+ "closes": Object.values(params.openinghours)[index][1],
+ "dayOfWeek": "http://schema.org/" + capitalizeFirstLetter(element),
+ "opens": Object.values(params.openinghours)[index][0]
+ }, {
+ "@type": "OpeningHoursSpecification",
+ "closes": Object.values(params.openinghours)[index][3],
+ "dayOfWeek": "http://schema.org/" + capitalizeFirstLetter(element),
+ "opens": Object.values(params.openinghours)[index][2]
+ })
+ });
+ return `
+ "openingHoursSpecification": ${JSON.stringify(json)}
+ `
+}
+
+function capitalizeFirstLetter(chars) {
+ return chars[0].toUpperCase() + chars.slice(1);
+}
\ No newline at end of file
diff --git a/controllers/transformerController.js b/controllers/transformerController.js
index 62ef761..54da1ac 100644
--- a/controllers/transformerController.js
+++ b/controllers/transformerController.js
@@ -7,7 +7,7 @@ const transformer = require('../helpers/transformer')
* Validates user input
* @param {Object} params
*/
-module.exports = async (params) => {
+exports.getAdres = async (params) => {
try {
if (!validator.isPostalCode(params.postcode, 'BE')) throw new Error("Postcode is niet correct");
if (!validator.isLength(params.street, {
@@ -18,10 +18,29 @@ module.exports = async (params) => {
min: 1,
max: 10000
})) throw new Error("Huisnummer is niet correct");
- let response = await transformer(params);
+ let response = await transformer.adresFetcher(params);
return response
} catch (error) {
console.log(error.name + ': ' + error.message);
throw new Error(error.message)
}
-}
\ No newline at end of file
+}
+
+exports.getGebouwEenheden = async (params) => {
+ try {
+ if(!validator.isInt(params.adresObjectId)) throw new Error ("Adres is geen nummer");
+ return await transformer.gebouwEenheidFetcher(params)
+ } catch (error) {
+ console.log(error.name + ': ' + error.message);
+ throw new Error(error.message)
+ }
+}
+
+exports.getGebouwId = async (params) => {
+ try {
+ if(!validator.isDataURI(params.gebouwEenheidId)) throw new Error ("gebouwEenheidId is geen URI");
+ } catch (error) {
+ console.log(error.name + ': ' + error.message);
+ throw new Error(error.message)
+ }
+}
diff --git a/files/catalog-example.json b/files/catalog-example.json
new file mode 100644
index 0000000..d9e1d59
--- /dev/null
+++ b/files/catalog-example.json
@@ -0,0 +1,39 @@
+{
+ "@context": {
+ "dcat": "https://www.w3.org/ns/dcat#",
+ "dcterms": "http://purl.org/dc/terms/",
+ "foaf": "http://xmlns.com/foaf/0.1/"
+ },
+ "@type": "dcat:Catalog",
+ "dcterms:license": [{
+ "@id": "https://creativecommons.org/publicdomain/zero/1.0/"
+ }],
+ "dcat:dataset": [{
+ "@type": "dcat:Dataset",
+ "dcat:keyword": "http://schema.org/Service",
+ "dcat:distribution": [{
+ "@type": "dcat:Distribution",
+ "dcat:accessUrl": "https://www.mechelen.be/huis-van-de-mechelaar",
+ "dcat:mediaType": "text/html"
+ }]
+ },
+ {
+ "@type": "dcat:Dataset",
+ "dcat:keyword": "http://purl.org/vocab/cpsv#PublicService",
+ "dcat:distribution": [{
+ "@type": "dcat:Distribution",
+ "dcat:accessUrl": "http://www.academiemechelen.be/",
+ "dcat:mediaType": "text/html"
+ }]
+ },
+ {
+ "@type": "dcat:Dataset",
+ "dcat:keyword": "http://data.vlaanderen.be/ns/gebouw#Gebouw",
+ "dcat:distribution": [{
+ "@type": "dcat:Distribution",
+ "dcat:accessUrl": "http://smartflanders.ilabt.imec.be/graph/gebouw-example.json",
+ "dcat:mediaType": "text/html"
+ }]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/files/gebouw-example.json b/files/gebouw-example.json
new file mode 100644
index 0000000..98e9a11
--- /dev/null
+++ b/files/gebouw-example.json
@@ -0,0 +1,26 @@
+{
+ "@context": {
+ "gebouwenRegister": "http://data.vlaanderen.be/id/gebouw/",
+ "adressenRegister": "https://data.vlaanderen.be/doc/adres",
+ "gebouw": "http://data.vlaanderen.be/ns/gebouw#",
+ "schema": "http://schema.org/",
+ "dcterms": "http://purl.org/dc/terms/",
+ "toevla": "http://semweb.mmlab.be/ns/wa#",
+ "locn": "http://www.w3.org/ns/locn#",
+ "geo": "http://www.opengis.net/ont/geosparql#",
+ "xsd": "http://www.w3.org/2001/XMLSchema#"
+ },
+ "@id": "http://data.vlaanderen.be/id/gebouw/123",
+ "@type": "gebouw:Gebouw",
+ "http://purl.org/dc/terms/description": "The entrance of the public library of Mechelen",
+ "toevla:accessibilityMeasurement": {
+ "toevla:accessibilityMeasurement_for": {
+ "dcterms:description": "The entrance",
+ "toevla:entranceDoorWidth": {
+ "@value": "70",
+ "@type": "xsd:Integer"
+ },
+ "toevla:entranceDoorWidthScore": "+"
+ }
+ }
+}
\ No newline at end of file
diff --git a/files/master-catalog.json b/files/master-catalog.json
new file mode 100644
index 0000000..eedaa7a
--- /dev/null
+++ b/files/master-catalog.json
@@ -0,0 +1,17 @@
+{
+ "@context": {
+ "dcat": "https://www.w3.org/ns/dcat#",
+ "dcterms": "http://purl.org/dc/terms/",
+ "foaf": "http://xmlns.com/foaf/0.1/"
+ },
+ "@type": "dcterms:Collection",
+ "dcterms:hasPart": [{
+ "foaf:page": "http://smartflanders.ilabt.imec.be/catalog-example.json",
+ "@type": "dcat:Catalog"
+ },
+ {
+ "foaf:page": "http://www.oostende.be/",
+ "@type": "dcat:Catalog"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/files/service-example.json b/files/service-example.json
new file mode 100644
index 0000000..1998ce9
--- /dev/null
+++ b/files/service-example.json
@@ -0,0 +1,69 @@
+[{
+ "@context": "http://schema.org/",
+ "@id": "https://stad.gent/id/products/123",
+ "@type": "Service",
+ "name": "Public toilet library",
+ "description": "The public toilet of the public library of Mechelen",
+ "http://purl.org/oslo/ns/localgov#productType": "http://productencatalogus.vlaanderen.be/fiche/158",
+ "telephone": "+32",
+ "email": "test@gmail.com",
+ "https://schema.org/hoursAvailable":
+ [
+ {
+ "@type": "OpeningHoursSpecification",
+ "dayOfWeek": "schema:Monday",
+ "opens": "09:00",
+ "closes": "11:00"
+ },
+ {
+ "@type": "OpeningHoursSpecification",
+ "dayOfWeek": "schema:Tuesday",
+ "opens": "09:00",
+ "closes": "16:00"
+ },
+ {
+ "@type": "OpeningHoursSpecification",
+ "validFrom": "2013-12-24",
+ "validThrough": "2014-01-02"
+ }
+ ]
+ },{
+ "@id": "https://stad.gent/id/products/123",
+ "@type": "http://purl.org/vocab/cpsv#PublicService",
+ "http://data.europa.eu/m8g/hasChannel": {
+ "https://schema.org/hoursAvailable":
+ [
+ {
+ "@type": "OpeningHoursSpecification",
+ "validFrom": "2013-12-24",
+ "validThrough": "2013-12-25",
+ "opens": "09:00",
+ "closes": "11:00"
+ },
+ {
+ "@type": "OpeningHoursSpecification",
+ "validFrom": "2013-05-24",
+ "validThrough": "2013-10-25",
+ "opens": "09:00",
+ "closes": "16:00"
+ },
+ {
+ "@type": "OpeningHoursSpecification",
+ "validFrom": "2013-12-24",
+ "validThrough": "2014-01-02"
+ }
+ ]
+ },
+ "http://purl.org/dc/terms/description": "The public toilet of the public library of Mechelen",
+ "http://www.w3.org/ns/locn#location": "http://data.vlaanderen.be/id/gebouw/123",
+ "toevla:accessibilityMeasurement": {
+ "toevla:accessibilityMeasurement_for": {
+ "dcterms:description": "The elevator",
+ "toevla:elevatorDoorWidth": {
+ "@value": "70",
+ "@type": "xsd:Integer"
+ },
+ "toevla:elevatorDoorScore": "+"
+ }
+ }
+ }]
\ No newline at end of file
diff --git a/frontend/form.html b/frontend/form.html
index 6114034..6c489e8 100644
--- a/frontend/form.html
+++ b/frontend/form.html
@@ -8,14 +8,23 @@
Gebouwenregister
-